[vtkusers] Questions about implementing an enhanced VTK tracing facility.

kent williams nkwmailinglists at gmail.com
Wed Oct 31 10:16:37 EDT 2007


I've been assigned the task of writing a new brain anatomy tracer. The
goal of this program is to allow a user to manually trace a feature of
brain anatomy in 3 Dimensions.

I've done a quick prototype of this application using the
vtkViewImage2DWithTracer widget, part of the vtkINRIA3D library (
http://www-sop.inria.fr/asclepios/software/vtkINRIA3D/index.php ).
The work done as part of the vtinria3d project adds a lot of value to
VTK and KWWidgets applications, but I need to integrate different
behaviors into them. I'm writing to ask for suggestions of the best
way to go about doing this.

My goal is a tracer that can be used to generate a three-dimensional
profile.  This would differ from vtkViewImage2DWithTracer in these
ways:

1. Instead of managing one outline, I need to allow one or more
outlines per image slice.  Internally this would be represented by a
Map of sets of one or more outline (vtkPoints objects), indexed by the
slice number.

2. When the user changes slices, only those outlines associated with
the current slice are displayed.

3. Outlines should be visible, but not editable, when not in outline
creation/edit mode.

I know some of what is necessary for implementation:

1. Associate the map of outline sets with the viewer.
2. When the user change slices, change the points associated with the
vtkImageTracerWidget.
3. Add actors to display the outlines not currently being created or edited.

I'm new to VTK, so I'm don't completely understand all the interaction
between the various VTK objects that control display and interaction
of the outlines, and how to manipulate them.  But a more immediate
question is this:

What is the best way to radically modify the behavior of existing vtk
composite objects like vtkViewImage2DWithTracer?  I can use the
existing class, and maintain my outlines data structure outside of the
class, but it seems like there are ways I'll need to change the
internals to get the behavior I need.  vtkViewImage2DWithTracer
doesn't lend itself to subclassing, as none of the member functions
I'd want to change are virtual.

An even bigger challenge is to change the behavior of
vtkImageTracerWidget. I thinks some of the event bindings are not
optimal.

1. The left mouse button always returns the tracer to the ground state
-- any existing trace is destroyed and you have to start over.  Since
the left mouse click is the single most common user mouse action, the
result I've seen when people try to use the tracer is that they do a
trace, and then click somewhere else in the viewport, and their trace
goes away.

2. There are two trace modes -- free draw and rubber-band outline.
You can edit a rubber band profile by moving vertices, adding vertices
or deleting vertices, but a free draw outline can't be edited, just
redone.

Again vtkImageTracerWidget isn't particularly configurable without
modification, and doesn't lend itself to subclassing.  The quickest
way to move forward with this project would be to copy the
vtkViewImage2DWithTracer and vtkImageTracerWidget classes and modify
them directly, but this doesn't seem optimal from a software
development standpoint, as I end up with divergent classes that don't
leverage the existing class hierarchies.

The most useful example of properly done tracing is in applications
like Photoshop or The Gimp: You can draw an outline defining a
selection, and add to or subtract from it after the initial tracing is
done. Ideally the tracer would behave very close to the way Photoshop
selection behaves, though I don't think I have the time or patience to
implement everything Photoshop does.



More information about the vtkusers mailing list