def get_images(self) -> tuple: """ Returns a tuple of :class:`~dicom_parser.image.Image` instances ordered by instance number. Returns ------- tuple Image instance by instance number. """ images = [Image(dcm_path) for dcm_path in self.get_dcm_paths()] return tuple( sorted(images, key=lambda image: image.header.get("InstanceNumber")))
def setUpClass(cls): cls.image = Image(TEST_RSFMRI_IMAGE_PATH) cls.mosaic = Mosaic(cls.image._data, cls.image.header)
def test_is_mosaic_property(self): not_mosaic_image = Image(TEST_IMAGE_PATH) self.assertFalse(not_mosaic_image.is_mosaic) mosaic_image = Image(TEST_RSFMRI_IMAGE_PATH) self.assertTrue(mosaic_image.is_mosaic)
def test_initialization_without_pixel_data_raises_attribute_error(self): dataset = pydicom.dcmread(TEST_IMAGE_PATH, stop_before_pixels=True) with self.assertWarns(Warning): Image(dataset)
def test_initialization_with_filedataset(self): dataset = pydicom.dcmread(TEST_IMAGE_PATH) image = Image(dataset) self.assertIsInstance(image, Image) self.assertIsInstance(image.header, Header)
def test_initialization_with_pathlib_path(self): image = Image(Path(TEST_IMAGE_PATH)) self.assertIsInstance(image, Image) self.assertIsInstance(image.header, Header)
def setUpClass(cls): cls.image = Image(TEST_IMAGE_PATH) cls.rsfmri_image = Image(TEST_RSFMRI_IMAGE_PATH)