[vtkusers] Geometric mask over vtkImageData

Jesús Spí­nola jspinola at gmail.com
Wed Jan 31 06:34:04 EST 2007


Hello,

I'm using vtkImageViewer2 and I want to apply a geometric mask to its input
data ( vtkImageData ). The mask could be a rectangle, a circle, a polygon or
a combination of any of the three shapes. The mask will be applied to all
the images on the vtkImageData stack.

Searching over the mailing list and the online documentation I found
vtkPolyDataToImageStencil can be the key class to get what I need but I'm
not familiar with the vtk*Stencil* classes and I need some help.

Which is the correct pipeline to achieve what I need? I guess it could be
the following, but I'm not quite sure

First set the input for vtkPolyDataToImageStencil, ( a vtkPolyData object
with the desired shape ). Then set the output port of
vtkPolyDataToImageStencil to the input connection of vtkImageStencilData.
Third, SetStencil and SetBackgroundInput to vtkImageStencil with the
vtkImageStencilData and vtkImageData respectively. And finally set the input
of vtkImageViewer2 with the output of the vtkImageStencil.

Is that ok or there's an easier way to do it?

Another question I have is regarding the coordinate space. My mask shapes
will be defined in pixel space, where I have to indicate this in the
pipeline?
The last question is, how I define the color of my mask?

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070131/a407ffec/attachment.htm>


More information about the vtkusers mailing list