[vtkusers] Add sphere to current slice (vtkImageReslice)

Enzo Matsumiya enzo.ferlin at micromar.com
Tue Feb 23 08:58:04 EST 2016


Hello David,

Thanks for your reply.

Although your answer really helped me on something I would eventually struggle, my problem seems to be deeper.

This is the position for 6 random clicks:

x: 147.573 y: 22.5072 z: 6.81678
x: 197.866 y: 83.5424 z: -2.80355e-05
x: 85.5616 y: 83.0541 z: 6.81678
x: 137.808 y: 116.257 z: -2.80355e-05
x: 87.0264 y: -15.5787 z: 6.81678
x: 103.628 y: 31.2963 z: -2.80355e-05

Clearly Z is wrong and I can't figure how to get it correctly (I'm using vtkPropPicker for now).

Rearranging my thoughts, now I think my previous problem was that the spheres were being added way too far from my volume.

Any help with that?


Thanks,

--
Enzo Ferlin Matsumiya
System Analyst

Skype: enzo.ferlin
Phone: +55 11 4057-5722
            +55 48 9130-2478

www.micromar.com <http://www.micromar.com/>




> On Feb 22, 2016, at 15:20, David Gobbi <david.gobbi at gmail.com> wrote:
> 
> 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 <mailto:enzo.ferlin at micromar.com>> wrote:
> 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 <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/20160223/72c8096f/attachment.html>


More information about the vtkusers mailing list