How to store a 3d deformation field array into an mhd image

I have a numpy array of size (160,512,512,3), standing for a 3D deformation field.
I am trying to save this array to an image (desired type is itk.Image[itk.Vector[itk.F,3],3]) by using itk.GetImageFromArray.
The code can run without errors. But after I checked the image that I got. I found the size was (512,512,3,3) even though the image took the correct amount of memery (about three times of the corresponding image with type itk.Image[[itk.F,3],3] ).
Can anyone help me to figure this out?
I am using itk 5.2.1

1 Like

Sorry to bother, the problem has been solved by using itk.image_from_array with ttype specified.

1 Like

You might want to share your code in case someone runs across this thread in the future.

1 Like