[vtkusers] Overlay slice on vtkResliceImageViewer and change slice when scrolling

David Gobbi david.gobbi at gmail.com
Thu Feb 22 13:28:38 EST 2018

On Thu, Feb 22, 2018 at 10:12 AM, ochampao <ochampao at hotmail.com> wrote:

> I have also tried using vtkImageResliceMapper and vtkImageSlice, but
> unfortunately I was not able to make it work.

The best example to work from is the following VTK test code:

It shows a grid on top of an image, but you could modify it to load two
images.  Also, the interactor style can be changed as follows, which
will allow you to slice though the volumes simultaneously by holding
"Ctrl" while dragging the mouse:

  vtkInteractorStyleImage *style = vtkInteractorStyleImage::New();

For overlay, there is also a class called vtkImageStack that makes
image overlay more robust (it takes care of Z-buffer issues):
Also see the overview of vtkImageSlice and vtkImageResliceMapper:

There is also some test code that shows vtkImageStack in a different
configuration, where it shows a set of orthoplanes in a 3D view:

Is this only possible by writing my own vtkImageInteractionCallback that
> wheel handle, for example, vtkCommand::MouseWheelBackwardEvent in order to
> change both slices at the same time?

If you use vtkImageResliceMapper, then probably the best option is to
customize vtkInteractorStyleImage e.g. via subclassing and then modify
its code to achieve exactly the kind of interaction you want.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180222/b9a34833/attachment.html>

More information about the vtkusers mailing list