[vtkusers] 答复: 答复: How to select a polygon region in a vtkImageData

Chen, Lifan LCHEN41 at mgh.harvard.edu
Wed Jan 27 16:22:45 EST 2016


I mean the size in in three dimensions of the output of the stencil is still the same as the input, for example, if the original size of the image data is 512x512x312, the output of the stencil is still 512x512x312. However, I only need the region that has been extracted from the original image data. Is there any method to minimize the size of the output to the extracted region?

Fantasy
________________________________
发件人: David Gobbi [david.gobbi at gmail.com]
发送时间: 2016年1月27日 14:39
收件人: Chen, Lifan
抄送: vtkusers at vtk.org
主题: Re: 答复: [vtkusers] How to select a polygon region in a vtkImageData

Hi Fantasy,

I don't know what you mean by "dimension index".

When you display in the 3D viewer, make sure the window/level are set correctly in the viewer.  The outside of the region is given a value of zero, but zero can show as gray depending on how the window/level is set.

 - David


On Wed, Jan 27, 2016 at 12:22 PM, Chen, Lifan <LCHEN41 at mgh.harvard.edu<mailto:LCHEN41 at mgh.harvard.edu>> wrote:
Hey David,

I use stencil and it works well, however, the dimension index of the output of stencil remain unchanged which I supposed to change according to the size of region I choose and there is a gray part around the region I choose when displaying in the 3-D viewer. Do you what is the problem?

Thanks,
Fantasy
________________________________
发件人: David Gobbi [david.gobbi at gmail.com<mailto:david.gobbi at gmail.com>]
发送时间: 2016年1月26日 16:47
收件人: Chen, Lifan
抄送: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
主题: Re: [vtkusers] How to select a polygon region in a vtkImageData

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<mailto: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/20160127/5a168c15/attachment.html>


More information about the vtkusers mailing list