diff --git a/gatetools/image_convert.py b/gatetools/image_convert.py index 1fa87c7..6eb70ce 100644 --- a/gatetools/image_convert.py +++ b/gatetools/image_convert.py @@ -203,7 +203,7 @@ def test_convert(self): y = np.arange(-12, 15, 1) z = np.arange(-13, 10, 1) xx, yy, zz = np.meshgrid(x, y, z) - image = itk.image_from_array(np.float32(xx)) + image = itk.GetImageFromArray(np.float32(xx)) convertedImage = image_convert(image, "unsigned char") itk.imwrite(convertedImage, "testConvert.mha") with open("testConvert.mha","rb") as fnew: diff --git a/gatetools/image_crop.py b/gatetools/image_crop.py index c61aa02..e61ab7d 100644 --- a/gatetools/image_crop.py +++ b/gatetools/image_crop.py @@ -143,24 +143,24 @@ def test_auto_crop(self): image.SetRegions(region) image.Allocate() image.FillBuffer(0) - npView = itk.array_from_image(image) + npView = itk.GetArrayFromImage(image) npView[10:52, 42:192, 124:147] =1 - image = itk.image_from_array(npView) + image = itk.GetImageFromArray(npView) autoCrop = image_auto_crop(image) autoCropSize = autoCrop.GetLargestPossibleRegion().GetSize() self.assertTrue(np.allclose(autoCropSize[0], 23)) self.assertTrue(np.allclose(autoCropSize[1], 150)) self.assertTrue(np.allclose(autoCropSize[2], 42)) - self.assertTrue(np.allclose(itk.array_from_image(autoCrop)[0, 0, 0], 1)) + self.assertTrue(np.allclose(itk.GetArrayFromImage(autoCrop)[0, 0, 0], 1)) def test_crop(self): x = np.arange(-10, 10, 0.1) y = np.arange(-12, 15, 0.1) z = np.arange(-13, 10, 0.1) xx, yy, zz = np.meshgrid(x, y, z) - image = itk.image_from_array(np.float32(xx)) + image = itk.GetImageFromArray(np.float32(xx)) croppedImage = image_crop_with_bb(image, gt.bounding_box(xyz=[10.0, 12.0, 0.0, 7.0, 6.0, 15.0])) croppedImageSize = croppedImage.GetLargestPossibleRegion().GetSize() self.assertTrue(np.allclose(croppedImageSize[0], 3)) self.assertTrue(np.allclose(croppedImageSize[1], 8)) self.assertTrue(np.allclose(croppedImageSize[2], 10)) - self.assertTrue(np.allclose(itk.array_from_image(croppedImage)[0, 0, 0], -10)) + self.assertTrue(np.allclose(itk.GetArrayFromImage(croppedImage)[0, 0, 0], -10))