<div dir="ltr">Hi Fantasy,<div><br></div><div>VTK has "stencil" operations for extracting regions from vtkImageData.  For example:</div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToImageData" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToImageData</a><br></div><div><br></div><div>There are a few VTK test samples that show different ways to use stencils:</div><div><br></div><div><div>Imaging/Core/Testing/Cxx/TestStencilWithLasso.cxx</div><div>Imaging/Core/Testing/Cxx/TestStencilWithPolyDataContour.cxx</div><div>Imaging/Core/Testing/Cxx/TestStencilWithPolyDataSurface.cxx</div></div><div><br></div><div><div>Imaging/Core/Testing/Python/TestBlendStencil.py</div><div>Imaging/Core/Testing/Python/TestLassoStencil.py</div><div>Imaging/Core/Testing/Python/TestROIStencil.py</div><div>Imaging/Core/Testing/Python/TestStencilToImage.py</div><div>Imaging/Core/Testing/Python/TestStencilWithFunction.py</div><div>Imaging/Core/Testing/Python/TestStencilWithImage.py</div></div><div><br></div><div>Extraction of a polygonal region can be done with vtkLassoStencilSource</div><div>or with vtkPolyDataToImageStecil.</div><div><br></div><div>Cheers,</div><div> - David</div><div><br></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 26, 2016 at 2:22 PM, Chen, Lifan <span dir="ltr"><<a href="mailto:LCHEN41@mgh.harvard.edu" target="_blank">LCHEN41@mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:rgb(0,0,0);font-size:10pt">Hey all,
<div><br>
</div>
<div>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 (<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData</a>)<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData" style="font-size:10pt" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectPolyData</a></div>
<div>However, it doesn't work for vtkImageData. Is there any method to solve this problem?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Fantasy Chen</div>
</div>
<p></p>

<p>The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.</p></div></blockquote></div></div></div></div>