I’m going to register a moving image to a fixed image and save the registered in a file.
I load the two images in two nodes, do the registration (Elastix), and then call the SetAndObserveTransformNodeID on moving image.
then I save the node, but it’s just the same dimensions as the original moving image. sample code:
and if I harden the transformation then the size of the saved node is something different than the original fixed and moving image. sample code:
logic = slicer.vtkSlicerTransformLogic()
I appreciate any points helping out.
Without hardening the transform, saving the moving image just saves the original (untransformed) version because all information about the transformation is in the transform, not the moving image’s volume node. When you harden the transform, it will modify the moving image, but the new image’s dimensions are probably determined by the extrema of the transformed moving image. The transform itself does not know anything about the dimensions or resolution of the fixed image. If what you want is a resampled version of the transformed moving image into the space and resolution of the fixed image volume, then you want to set the “Output volume” output of the Elastix module to something other than None. If you set the output volume to be the same volume node as the input moving volume, then the input moving volume will be overwritten with the registered and resampled version; if you select “Create new volume” then the input moving volume will not be modified and the registered and resampled version will be saved to a new image volume. Either way, this new volume will have the same geometry as the fixed volume, but with the registered contents from the moving volume.
You can also resample a transformed volume to have the same geometry as any other volume by hardening the transform and then using “Resample Scalar/Vector/DWI volume” module.