[vtkusers] OK so does ANYONE use the vtkImageTracerWidget?
kent williams
nkwmailinglists at gmail.com
Mon Nov 5 16:15:32 EST 2007
I have the opposite issue with int/reinit of handles. I'd like to be
able to turn on all the handles for all the points once a curve is
closed ;-)
On 11/5/07, Mark Wyszomierski <markww at gmail.com> wrote:
> Dean,
>
> I worked with this a bit more, I have two questions if you have time:
>
> 1) Right now after the enclosure is drawn, I am storing all the points using:
>
> GetPath(vtkPolyData);
>
> When trying to restore the points of the enclosure later on, there
> doesn't seem to be any 'SetPath()' function, we have to use
> InitializeHandles(). The problem is that there may be hundreds of
> points that make up an enclosure, and now all of them will be turned
> into handles which can be really slow. For instance, if you just draw
> a free-hand enclosure, there's only one handle. I can't find a way to
> restore that enclosure with one handle but many non-handle points.
>
> 2) To initialize a 'NULL' enclosure, it looks like we need to push on
> at least two dummy points, otherwise the line connection code isn't
> generated. For now I'm doing:
>
> p->InsertNextPoint(0, 0, 0);
> p->InsertNextPoint(0, 0, 0);
>
> I checked the condition inside InitializeHandles() and it seems at
> least two handles are necessary (otherwise previous line geometry
> isn't reset).
>
> After you suggested SetProjectionPosition(), my example is working as
> expected, I will post it if anyone is still interested. The widget is
> great, just wondering if there's some way around #1 to speed it up a
> little,
>
> Thanks,
> Mark
>
>
>
> On 11/5/07, Dean Inglis <dean.inglis at sympatico.ca> wrote:
> > 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
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list