and the dimensions are still correct, but after creating a displacement field the type info changes to itk::Image<unsigned char, 2u> rather than itk::VectorImage<double, 3u>
This is a feature not a bug. When you provide the displacement image to the displacement transform it is “consumed” by the transform (the transform owns the memory now and the image has zero size). Please see the doxygen documentation for the SetDisplacementField method. This is a design choice that minimizes the large memory footprint associated with displacement fields (transform/image).
I am totally cool with it being a feature. 95% of the time the issue is between chair and keyboard. Thank you for the reply. What is the proper way to do this then?
I think I want to create the inverse transform.
and when I do this following the above.
I get a solution using dis_trans, but the scaling appears to be compressing the stack of images rather than expanding them.
when I try the inverse inv_trans I get the following error
Traceback (most recent call last):
File "build_volume.py", line 392, in <module>
main()
File "build_volume.py", line 184, in main
im_trans = resampler.Execute(im_vol)
File "/Users/sansomk/anaconda3/envs/reg/lib/python3.7/site-packages/SimpleITK/SimpleITK.py", line 59356, in Execute
return _SimpleITK.ResampleImageFilter_Execute(self, *args)
RuntimeError: Exception thrown in SimpleITK ResampleImageFilter_Execute: Code/BasicFilters/src/sitkResampleImageFilter.cxx:210:
sitk::ERROR: Unexpected error converting transform! Possible miss matching dimensions!