[vtkusers] clip one vtkPolyData with another?

Alle Meije Wink alle_meije at yahoo.co.uk
Mon Jan 30 05:36:43 EST 2006


Just to add...

I tried the vtkInplicitDataSet solution but could not get it working. 
When I toggle SetInideOut, it shows either all or nothing at all of the 
clip planes.

Here's a snapshot of my code:

//////////////////////////////////////////////////
// preprocessing

// iso-surface: smooth
// volume data: anatomyReader
// vtkPoints points
// vtkFloatArray normals

//////////////////////////////////////////////////
// clipping the surface

vtkTriangleFilter triangulate
     triangulate SetInput [smooth GetOutput]

vtkPlanes clipplanes
   clipplanes SetPoints points
   clipplanes SetNormals normals

vtkClipPolyData clipper
   clipper SetInput [triangulate GetOutput]
   clipper SetClipFunction clipplanes

//////////////////////////////////////////////////
// generate the cut planes and clip them

vtkCutter cutter
   cutter SetInput [anatomyReader GetOutput]
   cutter SetCutFunction clipplanes

vtkImplicitDataSet implicitIso
   implicitIso SetDataSet [triangulate GetOutput]

vtkClipPolyData clippedCut
   clippedCut SetInput [cutter GetOutput]
   clippedCut SetClipFunction implicitIso

vtkClipPolyData thresholdCut
   thresholdCut SetInput [clippedCut GetOutput]

// continue with rendering
//////////////////////////////////////////////////

> Hi,
> 
> I am trying to combine showing the outer surface of an MRI brain (iso
> surface) with 3 planes that define a cut inside the brain (say the upper
> back right part has been cut out.
> 
> Defining the surface (with vtkMarchingCubes) was not a problem. the
> cutout (with vtkPlanes and vtkClipPolyData) went fine as well.
> 
> Then I drew the cut planes with vtkCutter (using the same planes as I
> did for clipping). The cutplanes first extended to the edge of the
> bounding box, obscuring most of the brain surface. I (sort of) solved
> this by putting another vtkClipPolyData after the vtkCutter, which
> removes the part of the cut plane outside the brain.
> 
> The cut after thresholding is very rough, though. Does anyone know
> whether it is possible to clip a vtkPolyData with *another* vtkPolyData?
> The (visually) best result would be to limit the cutplanes by the brain
> surface. I tried to use vtkClipPolyData, but this can only use a
> vtkImplicitFunction to clip, and not another vtkPolyData.
> 
> Is there a way to compute the intersection of two vtkPolyData
> structures? Or to convert a vtkPolyData into a vtkImplicitFunction?
> Perhaps this can be done in another, very elegant way???
> 
> Many thanks,
> Alle Meije Wink




More information about the vtkusers mailing list