[vtkusers] Add sphere to current slice (vtkImageReslice)

David Gobbi david.gobbi at gmail.com
Mon Feb 22 13:20:35 EST 2016

Hi Enzo,

As a general solution, you can add a callback for the renderer's
StartEvent.  The renderer emits this event immediately before it renders
the scene, so a StartEvent callback can be used to compute the distance of
each sphere from the slice plane, and can then call VisibilityOn() for all
sphere actors that are close to the slice, and VisibilityOff() for all
actors that are far from the slice.

I've found the StartEvent to be incredibly useful for manipulating
annotations like spheres, arrows, text, and whatnot.

 - David

On Mon, Feb 22, 2016 at 10:32 AM, Enzo Ferlin <enzo.ferlin at micromar.com>

> Hello,
> I'm trying to add a sphere to the current slice of a rendered DICOM volume.
> Basically, I'm using this code:
> http://web.mit.edu/16.225/dv/VTK/Examples/ImageProcessing/Cxx/ImageSlicing.cxx
> The only difference being that I use
> MouseWheelForwardEvent/MouseWheelBackwardEvent to reslice and I intercept
> left button press on my custom interactor (vtkInteractorStyleImage) to add
> a sphere on that position.
> The sphere is added in the correct position (as an addition, I can already
> measure the correct distance (mm) between 2 added spheres).
> My problem is that when I scroll to go back/forward another slice, these
> spheres stays in front of the volume.
> I want those spheres appear only when I pass through that particular slice
> that they were added.
> How could I accomplish that?
> Thank in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160222/be516a9c/attachment.html>

More information about the vtkusers mailing list