[vtkusers] best way to clip vtkImageData using vtkPloyData

David Gobbi david.gobbi at gmail.com
Wed Jul 14 18:31:13 EDT 2010


Hi Prathamesh,

You should use either vtkClipVolume or vtkImageStencil, based on what
you want as an output. The vtkClipVolume filter will output an
unstructured grid, i.e. it will produce a geometric data set
consisting of voxel cells (each voxel cell will be a little cube with
eight points at its corners).  If you want the output to be an actual
image, with the background set to black or to transparent, then you
should use vtkImageStencil.

In either case, the best place to start is vtkImplicitLoop, which
takes a contour and produces an "implicit function", which in
VTK-speak, is a function used to define the inside vs. the outside of
a selection area.  Then the vtkImplicitLoop can be used as an input to
vtkImplicitFunctionToImageStencil.  The output of
vtkImplicitFunctionToImageStencil can then be used as an input to e.g.
vtkImageBlend (for pasting a cut-out image onto another image),
vtkImageStencil (for blacking out the non-selected region of the
image), or vtkImageAccumulate (for computing the average value,
standard deviation, or the histogram of the image area inside the
stencil).

   David




On Wed, Jul 14, 2010 at 4:13 PM, Prathamesh Kulkarni
<prathameshmkulkarni at gmail.com> wrote:
>
> Hello all,
>
> I want to extract a sub-image from vtkImageData given a closed set of points
> forming any arbitrary shape (may be a vtkPolyData).
>
> I have been looking at vtk classes like vtkClipVolume, vtkExtractVOI,
> vtkImageStencil. I am no able to understand which way should be preferred
> over which to do my task. Also, I am not able to figure out the exact
> pipeline structure for these clipping methods.
>
> Could someone please throw some light on this?
>
> Thanks,
> Prathamesh
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list