[vtkusers] clip one vtkPolyData with another?

David.Pont at ensisjv.com David.Pont at ensisjv.com
Wed Feb 1 15:09:15 EST 2006


Alle Meije Wink <alle_meije at yahoo.co.uk> wrote on 31/01/2006 21:59:14:

> Hi Dave,
>
> Do you mean create a vtkClipPolyData without specifying either a scalar
> threshold or an implicit function? I think what happens then is that
> vtkClipPolyData provides its own scalar threshold (by the looks of it).
>

You were on the right track, clipping with a scalar threshold is what I
meant.

> The result that I get now (also using a scalar threshold) is nearly
> right, in that it follows the boundary of the segmented brain. It is not
> completely right though -the cutp lanes go a little outside the brain-
> and the cut of the voxel data is much rougher than the iso-surface:
>

Is this due to processing of the isosurface after marching cubes? ie
smoothing etc? If so could you apply the same filters to the output of the
clipped cut surfaces?

> http://www.wbic.cam.ac.uk/~amw71/SurfaceCut.png
>
> That is why I thought that if you make a contour (either 3D by using the
> iso surface or 2D by creating a vtkContourFilter on the cut surfaces) it
> wolud be possible to use that for clipping. I tried by making just the
> contour(s) and got a completely empty result.
>
> Is it necessary to generate the normals of the contour first (this
> happens in the ClipCow example as well) to determine what is inside and
> what is outside? Otherwise it is probably something that is not possible
> with VTK...
>

Unfortunately it is not possible to clip with polydata in vtk. There is a
class named vtkImplicitSelectionLoop that might be worth a try. You would
cut the isosurface (as you suggested above) with your planes to obtain a
polyline. Use this with vtkImplicitSelectionLoop->SetLoop and then clip
your cut surfaces with this 'implicit function'. Actually the geometry
seems like it would be a bit awkward which may affect accuracy... and you
may need to use a stripper as in the ClipCow example? The advantage should
be that the clipper has the exact profile of the clipped brain surface to
clip the cut planes with.

  regards
     Dave P

> Thanks for your suggestions!
>
> Alle Meije
>
> >  Hi Alle,
> >    If I understand correctly you started with a volume (MRI data). In
this
> > case you might be able to clip your cut surfaces with vtkClipPolydata.
I
> > have never done this but according to the documentation: "If a
ClipFunction
> > is not specified, or GenerateClipScalars is off (the default), then the
> > input's scalar data will be used to clip the polydata."  Try using
> > vtkClipPolyData->SetValue to specify the same value used with marching
> > cubes? There is also vtkImplicitDataSet, use the volume as the input
data
> > set, then use this as the implicit function with vtkClipPolyData. The
> > obvious problem I can forsee in either case is that the volume scalar
data
> > may not be monotonic and clipping may occur at other positions within
the
> > volume..?
> >
> > For the more general problem of clipping polydata with polydata I have
also
> > seen the GTS library:
> >
> > http://gts.sourceforge.net/index.html
> >
> >   regards
> >     Dave P.
> >
> >>Hi Obada,
> >>
> >>Thanks for you suggestions. I had already read Steve's email, and based
> >>on that info I started with a 2d contour:
> >>
> >>1. make the cut planes with vtkCutter in the usual way
> >>    (this generates the cut planes, but they extend to the bounding
box)
> >>2. make a 2d contour in the cut planes
> >>    (this would generate a contour in exactly the same plane
> >>     so -hopefully?- avoiding the roundoff errors etc)
> >>3. clip the 2D cut surface with the 2D contour
> >>
> >>Same result...
> >>
> >>I tried using implicit functions from the iso-surface, the original
> >>data, all sorts of contours, etc. but to no avail.
> >>
> >>I do not really understand your suggestion at the end. Does that do the
> >>same thing as I tried with my 2D contour?
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new
> Yahoo! Security Centre. http://uk.security.yahoo.com




More information about the vtkusers mailing list