Reputation: 71
I tried to use itk to convert array to 3d image as .img. But itk didn't work. Even I use the demo code to convert a image to array and then convert the array back to image. It still showed a 2d image. How can I solve this problem?
import itk
image = itk.imread("input_filename.png")
array_view = itk.GetArrayViewFromImage(image)
array = itk.GetArrayFromImage(image)
image_view = itk.GetImageViewFromArray( np_array)
image = itk.GetImageFromArray( np_array)
itk.imwrite(image, "output_filename.png")
I want to save the array as .img. And it should be 3d image.
Upvotes: 0
Views: 510