[vtkusers] Crop plane
Martijn Steenwijk
martijnsteenwijk at gmail.com
Tue Sep 27 10:20:02 EDT 2011
Dear all,
I have a dataset of a brain and it's brain mask (see attached image). I
derived the brain contour using a contour filter and would like to map the
brain (not skull and skin) on a specific plane. I used the following code to
generate the attached image:
Inputs: im and im_mask
---
contour = vtk.vtkContourFilter()
contour.SetInput(im_mask)
contour.SetValue(0,0.5)
contour.SetComputeNormals(0)
smooth = vtk.vtkSmoothPolyDataFilter()
smooth.SetInput(contour.GetOutput())
smooth.SetNumberOfIterations(10)
smooth.SetRelaxationFactor(0.5)
plane = vtk.vtkPlane()
plane.SetOrigin(im.GetCenter())
plane.SetNormal(1,0,-1)
cutter = vtk.vtkCutter()
cutter.SetInput(im)
cutter.SetCutFunction(plane)
cutter.Update()
cutter2 = vtk.vtkCutter()
cutter2.SetInput(smooth.GetOutput())
cutter2.SetCutFunction(plane)
cutter2.SetGenerateCutScalars(0)
cutter2.Update()
. where cutter displays the plane and cutter2 (cut of contour) displays the
red line.
Is there a way to crop this plane such that a flat plane (a vtkPolyData
object) arises which is bounded by the 'red line' and which can be used to
apply a vtkProbeFilter which 'probes' the 'im' dataset such that the values
of the original image are displayed on the cropped plane?
Thanks for sharing your thoughts,
With best regards,
Martijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110927/cff5f135/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.png
Type: image/png
Size: 108590 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110927/cff5f135/attachment.png>
More information about the vtkusers
mailing list