def test_create_image_from_2d_dataset(self, dataset_2d): data_element = gdcm_handler.create_data_element(dataset_2d) image = gdcm_handler.create_image(dataset_2d, data_element) assert image.GetNumberOfDimensions() == 2 assert image.GetDimensions() == [dataset_2d.Rows, dataset_2d.Columns] assert image.GetPhotometricInterpretation().GetType() == \ gdcm.PhotometricInterpretation.GetPIType( dataset_2d.PhotometricInterpretation) assert image.GetTransferSyntax().GetString() == str.__str__( dataset_2d.file_meta.TransferSyntaxUID) pixel_format = image.GetPixelFormat() assert pixel_format.GetSamplesPerPixel() == dataset_2d.SamplesPerPixel assert pixel_format.GetBitsAllocated() == dataset_2d.BitsAllocated assert pixel_format.GetBitsStored() == dataset_2d.BitsStored assert pixel_format.GetHighBit() == dataset_2d.HighBit assert pixel_format.GetPixelRepresentation() ==\ dataset_2d.PixelRepresentation
def test_create_image_from_2d_dataset(self, dataset_2d): data_element = gdcm_handler.create_data_element(dataset_2d) image = gdcm_handler.create_image(dataset_2d, data_element) assert image.GetNumberOfDimensions() == 2 assert image.GetDimensions() == [dataset_2d.Rows, dataset_2d.Columns] assert image.GetPhotometricInterpretation().GetType() == \ gdcm.PhotometricInterpretation.GetPIType( dataset_2d.PhotometricInterpretation) assert image.GetTransferSyntax().GetString() == str.__str__( dataset_2d.file_meta.TransferSyntaxUID) pixel_format = image.GetPixelFormat() assert pixel_format.GetSamplesPerPixel() == dataset_2d.SamplesPerPixel assert pixel_format.GetBitsAllocated() == dataset_2d.BitsAllocated assert pixel_format.GetBitsStored() == dataset_2d.BitsStored assert pixel_format.GetHighBit() == dataset_2d.HighBit assert pixel_format.GetPixelRepresentation() ==\ dataset_2d.PixelRepresentation
def test_create_image_from_3d_dataset(self, dataset_3d): data_element = gdcm_handler.create_data_element(dataset_3d) image = gdcm_handler.create_image(dataset_3d, data_element) assert 3 == image.GetNumberOfDimensions() assert [ dataset_3d.Columns, dataset_3d.Rows, int(dataset_3d.NumberOfFrames) ] == image.GetDimensions() pi = gdcm.PhotometricInterpretation.GetPIType( dataset_3d.PhotometricInterpretation) assert pi == image.GetPhotometricInterpretation().GetType() uid = str.__str__(dataset_3d.file_meta.TransferSyntaxUID) assert uid == image.GetTransferSyntax().GetString() pixel_format = image.GetPixelFormat() assert dataset_3d.SamplesPerPixel == pixel_format.GetSamplesPerPixel() assert dataset_3d.BitsAllocated == pixel_format.GetBitsAllocated() assert dataset_3d.BitsStored == pixel_format.GetBitsStored() assert dataset_3d.HighBit == pixel_format.GetHighBit() px_repr = dataset_3d.PixelRepresentation assert px_repr == pixel_format.GetPixelRepresentation() planar = dataset_3d.PlanarConfiguration assert planar == image.GetPlanarConfiguration()