[vtkusers] How to select a polygon region in a vtkImageData

David Gobbi david.gobbi at gmail.com
Tue Jan 26 16:47:02 EST 2016


Hi Fantasy,

VTK has "stencil" operations for extracting regions from vtkImageData.  For
example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToImageData

There are a few VTK test samples that show different ways to use stencils:

Imaging/Core/Testing/Cxx/TestStencilWithLasso.cxx
Imaging/Core/Testing/Cxx/TestStencilWithPolyDataContour.cxx
Imaging/Core/Testing/Cxx/TestStencilWithPolyDataSurface.cxx

Imaging/Core/Testing/Python/TestBlendStencil.py
Imaging/Core/Testing/Python/TestLassoStencil.py
Imaging/Core/Testing/Python/TestROIStencil.py
Imaging/Core/Testing/Python/TestStencilToImage.py
Imaging/Core/Testing/Python/TestStencilWithFunction.py
Imaging/Core/Testing/Python/TestStencilWithImage.py

Extraction of a polygonal region can be done with vtkLassoStencilSource
or with vtkPolyDataToImageStecil.

Cheers,
 - David



On Tue, Jan 26, 2016 at 2:22 PM, Chen, Lifan <LCHEN41 at mgh.harvard.edu>
wrote:

> Hey all,
>
> I am working on a project that requires to manually extract a region from
> a 3D vtkImageData. I read the example on how to select a region in a
> vtkPolyData in VTK/Examples/Cxx/PolyData/SelectPolyData (
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData)
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData
> However, it doesn't work for vtkImageData. Is there any method to solve
> this problem?
>
> Thanks,
> Fantasy Chen
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160126/73b80d50/attachment.html>


More information about the vtkusers mailing list