[vtkusers] OK so does ANYONE use the vtkImageTracerWidget?

Dean Inglis dean.inglis at sympatico.ca
Mon Nov 5 05:49:18 EST 2007


A couple of points on using vtkImageTracerWidget:

1) InitializeHandles requires that the vtkPoints be non-NULL
and that there be n>0 points
2) if you change the slice position, then you have to
tell the widget where you want to place points onto:
(e.g. from Examples/GUI/Tcl/ImageTracerwidget.tcl)
  itw ProjectToPlaneOn
  itw SetProjectionNormalToXAxes
  itw SetProjectionPosition $pos

If you just change the slice position using vtkImageActor
to view slices in a volume and not the slice
orientation, then SetProjectionPosition will update
the coordinates of all the handles of the widget.

Kent, as for your current problem:

>What isn't happening right now: If I switch to an untraced slice, I
>call InitializeHandles() with a zero length set of points, but this
>doesn't in fact get rid of the currently visualized trace.

I didn't design the tracer to work this way, but if you
want a work-around for now, just send in a vtkPoints
with one point with coords of the center of the current 
image slice.  This should show one handle signifying
to the user to start tracing.  e.g.:

vtkPoints* pt = vtkPoints::New();
pt->InsertNextPoint(0,0,0);
// set the widget to have one handle
widget->InitializeHandles(pt);
// this should force the first handle to lie at the center of
// the bounds of the image plane 
widget->PlaceWidget(myImageActor->GetBounds());
// if the slices are x-y planes
widget->SetProjectionPosition(myImageActor->GetBounds()[4]);


Another option would be to use the latest cvs 
vtkContourWidget since I recently
modified it to take a NULL vtkPolyData in to Initialize
the widget to its starting state. You can draw with either
straight line segments between placed handles or 
have it interpolate a higher order curve between them.
vtkCntourWidgte will not let you "trace" continuously though.

HTH,
Dean



More information about the vtkusers mailing list