[vtkusers] Question about contour widget

Karthik Krishnan karthik.krishnan at kitware.com
Tue Oct 12 05:33:19 EDT 2010


On Tue, Oct 12, 2010 at 10:33 AM, Jonathan Morra <jonmorra at gmail.com> wrote:

> I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour
> on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found
> the following question
> http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and
> created the following code as a result (in Java)
>
>         vtkContourWidget contourWidget = new vtkContourWidget();
>         contourWidget.SetInteractor(panel.getRenWin().getIren());
>         contourWidget.FollowCursorOn();
>
>         vtkOrientedGlyphContourRepresentation rep = new
> vtkOrientedGlyphContourRepresentation();
>         contourWidget.SetRepresentation(rep);
>
>         vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
>         placer.SetImageActor(panel.getImageViewer().GetImageActor());
>         rep.SetPointPlacer(placer);
>

What this point placer does is to constrain the contour to the plane defined
by the ImageActor. However, given that the same image actor is used for
multiple slices, when you change the slice, the position of the image actor
effectively changes and the contour updates itself to lie on the new plane.

What you need is to use a vtkBoundedPlanePointPlacer with the bounding
planes de-lienating the bounds of the image actor when the contour is
defined. That way it won't change when you change the slice.

Also to manage visibility of the contour (the contour will be visible for
all slices in front of the defined slice), you could subclass the contour
representation, insert a clipper that clips the polydata based on the
bounding planes, that way, visibility is implicitly managed by the
representation.

--
karthik

        contourWidget.EnabledOn();
>         contourWidget.ProcessEventsOn();
>
> When I do this and draw a contour and then scroll through the image planes
> the same contour appears on every plane.  Ideally I'd like a different
> contour on every plane.  If I don't use the vtkImageActorPointPlacer then
> the contour only appears on one plane but it's the same plane regardless of
> which plane is being viewed, which is also wrong.
>
> Any suggestions about how to do this correctly would be greatly
> appreciated.
>
> Thanks
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101012/f25498ad/attachment.htm>


More information about the vtkusers mailing list