Manual registration (apply transform matrix)

Hi Leonardo,

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.

The code is not too pretty but it should do.

To resume you need:

  1. 2 vtkImageData (mine have the same spacing)
  2. vtkImageTranslateExtent to translate the extent of one image
  3. 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.
  4. 2 vtkImageCast to cast to float (signed int might be sufficient)
  5. vtkImageMathematics with operation subtract
  6. display the output of vtkImageMathematics

It would be nice to change the color map, but the grey one seems to do the job.

HTH

Edo