[vtk-developers] HOW DO YOU ... aggregate vtk Widget

Karthik Krishnan karthik.krishnan at kitware.com
Thu Apr 3 17:16:32 EDT 2008


Kent:

We do have a framework for "composite widgets". A few examples are
vtkParallelopipedWidget, vtkBiDimensionalWidget etc.
The bidim widget for isntance manages 4 handles internally as child
widgets to specify the end points.

The methods you want to be aware of are

1.   vtkAbstractWidget::SetParent( vtkAbstractWidget *parent )

    This will cause the children to listen to the parent for
interactions. They will not listen to the renderwindow interactor.
    This works well for you because you can decide exactly when to
invoke what event. For
    instance, you could listen to the Control-LeftButtonPressEvent and
depending upon certain conditions,
    invoke a LeftButtonPressEvent. This will cause fresh contour
points to be added only when Ctrl-Left is pressed
    and your conditions are met as opposed to left.

2.   vtkAbstratWidget::SetPriority( .. )

    Set the priority of the children slightly below that of the parent.

3. vtkEventCallbackCommand

Your parent can decide when to abort event processing, irrespective of
what the child says. In other words you can have something like
one click causing contour points to be added on more than one contour.


Hope this helps
--
karthik

On Thu, Apr 3, 2008 at 4:54 PM, kent williams <nkwmailinglists at gmail.com> wrote:
> I have an application that allow tracing of 3D features in volume
>  images -- in our specific case, anatomical features of the brain.
>
>  To do this I use multiple instances of vtkContourWidget.
>
>  vtkContourWidget wasn't really designed to be used this way, but it
>  behaves remarkably well.  My empirical observation of its behavior is
>  that for a give rendering window, if there are multiple instances in
>  the view, you can only add points to the currently open Contour.  If
>  all contours are closed, which contour catches interactions depends on
>  whose control points to which the mouse cursor.  So even if you add 10
>  contours you can add points to only one contour at a time.
>
>  In my initial work on the tracer, all the state information, event
>  handlers, etc are associated with my class that encapsulates the
>  viewer in which tracing occurs.
>
>  I want to separate all the multiple contour widget management into
>  it's own class, so that it can be instantied and used with any vtk
>  viewer.  My question is this:
>  The obvious 'vtk' way to do this would be to sublcass
>  vtkAbstractWidget, but this carries with it all sorts of baggage I
>  don't care for. What I want -- call it vtkMultiContourWidget has all
>  its constituent vtkContourWidget instances, so it doesn't need
>  everything that's in vtkAbstractWidget.   So where should this new
>  class fit in the VTK class hierarchy? Should I just derive it from
>  vtkObject and then do whatever internal management necessary myself,
>  or ...
>  _______________________________________________
>  vtk-developers mailing list
>  vtk-developers at vtk.org
>  http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list