[vtkusers] clip one vtkPolyData with another?

David.Pont at ensisjv.com David.Pont at ensisjv.com
Mon Feb 20 14:34:30 EST 2006


Alle Meije Wink <alle_meije at yahoo.co.uk> wrote on 20/02/2006 03:38:28:

> Returning to an old subject...
>
> I started this thread last month when I tried to make a cut-plane in an
> MRI image that (i) shows the grey values inside, and (ii) follows the
> contours of the iso-surface that I created from the same data set.
>
> I now have 2 scripts:
> One script uses vtkCutter on the 3D data set. This makes it possible to
> show the cutplanes with grey values. However, the edges of the cut-plane
> are defined via grey value thresholding, resulting in a rough shape that
> does not follow the iso-value. (1st attachment, result
> http://www.wbic.cam.ac.uk/~amw71/SurfaceCut.png)
>

Did you try vtkImplicitSelectionLoop to clip the rough edges?

> Another script has nicer cut-planes, where vtkCutter uses the planes and
> the normals of the iso-surface (the clipcow way). The edges now look
> much better, but I haven't managed to display the grey values on the
> planes. I thought that this should be possible with vtkProbeFilter? I
> tried this for one plane, but the only thing that shows up (very
> vaguely) is a sort of inner contour (2nd attachment, result:
> http://www.wbic.cam.ac.uk/~amw71/SurfaceCut2.png).
>

Perhaps there are not enough points on the cut surface to get decent
resolution when probing? (render the cut plane in wireframe to see the
sampling density you are using). If this is the problem you could try one
of the subdivision filters eg vtkLinearSubdivisionFilter (2 or 3
iterations) to generate more points on the plane before probing.

> The volume that I use is
http://www.wbic.cam.ac.uk/~amw71/HeadTemplate.vtk.
>
> Would it be possible to combine the best of the two scripts? Any help on
> this would be very welcome!
>
> Best,
> Alle Meije Wink
>
> David.Pont at ensisjv.com wrote:
> > 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
>
>
> --
>
>   Brain Mapping Unit
>   Dept. of Psychiatry
>   University of Cambridge
>   Downing Site
>   Cambridge CB2 3EB
>
>   tel: (+44) (0)1223 764676
>   fax: (+44) (0)1223 336581
>
>   alle_meije at yahoo.co.uk
>
> [attachment "SurfaceInsideOld.tcl" deleted by David Pont/ANZSC/NZ]
> [attachment "SurfaceInside.tcl" deleted by David Pont/ANZSC/NZ]




More information about the vtkusers mailing list