SimpleITK wraps only TransformBaseTemplate<double>, so a float32 displacement field handed to DisplacementFieldTransform is converted to float64 and interleaved at that width before anything is resampled.
At the scale of registration fields this is the dominant cost of the operation. Measured on a 122-row region of a large field (SimpleITK 2.5.5): building the double-precision transform allocates 6.9 GiB and takes 5.0 s, which is 39% of everything that region costs end to end in our pipeline. The field itself is float32 on disk and float32 is plenty for the geometry.
sitk.Warp escapes because it is templated on the field's own pixel type, but it only covers the narrowest case: field grid == output grid, whole map, linear interpolation. Any composite or resampled-field use pays the float64 build.
ITK already instantiates DisplacementFieldTransform<float, N>. Exposing it (or a Resample overload accepting a sitkVectorFloat32 field directly) would halve the memory and remove the conversion for every consumer that resamples through stored fields. Happy to help test a PR if the wrapping approach is agreed on.
SimpleITK wraps only
TransformBaseTemplate<double>, so a float32 displacement field handed toDisplacementFieldTransformis converted to float64 and interleaved at that width before anything is resampled.At the scale of registration fields this is the dominant cost of the operation. Measured on a 122-row region of a large field (SimpleITK 2.5.5): building the double-precision transform allocates 6.9 GiB and takes 5.0 s, which is 39% of everything that region costs end to end in our pipeline. The field itself is float32 on disk and float32 is plenty for the geometry.
sitk.Warpescapes because it is templated on the field's own pixel type, but it only covers the narrowest case: field grid == output grid, whole map, linear interpolation. Any composite or resampled-field use pays the float64 build.ITK already instantiates
DisplacementFieldTransform<float, N>. Exposing it (or aResampleoverload accepting asitkVectorFloat32field directly) would halve the memory and remove the conversion for every consumer that resamples through stored fields. Happy to help test a PR if the wrapping approach is agreed on.