I have two volumes and the user needs to be able to transform (translate and/or rotate) one of them for manual registration. What is the right way to do it? I thought about playing with actor.setOrigin(…) , actor.setScale(…) or actor.setUserMatrix(…) but I’m not sure if that is the right way.
In a near future it should also be possible to load a transformation matrix generated by some other library (eg: Elastix).
Context
Those actors represent DICOM series (CT + PET with colormap) from different frame of references that need to be manual registered, these two series may be loaded in one or more viewports (axial, coronal, sagittal and/or oblique views) and moving the PET series should also update all other viewports that have those two series.
With simple translation I observe some CharEvent (j b n m instead of arrows) and shift one image with respect to the other by one pixel. I capture how many shifts in each direction and display the user the subtraction image.
vtkImageTranslateExtent to translate the extent of one image
2 vtkExtractVOI to extract the overlapping parts of the 2 images. In VTK 8 you didn’t need this step as it was done internally. In VTK 9 you need to find the overlap extent by yourself, my code is here and then extract the VOI.
2 vtkImageCast to cast to float (signed int might be sufficient)
vtkImageMathematics with operation subtract
display the output of vtkImageMathematics
It would be nice to change the color map, but the grey one seems to do the job.