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:
- 2
vtkImageData
(mine have the same spacing) 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.
HTH
Edo