FreeMat

- Main Page
- Related Pages

vtkSeedWidget

Section: Visualization Toolkit Widget Classes

# Usage

The vtkSeedWidget is used to placed multiple seed points in the scene. The seed points can be used for operations like connectivity, segmentation, and region growing.

To use this widget, specify an instance of vtkSeedWidget and a representation (a subclass of vtkSeedRepresentation). The widget is implemented using multiple instances of vtkHandleWidget which can be used to position the seed points (after they are initially placed). The representations for these handle widgets are provided by the vtkSeedRepresentation.

.SECTION Event Bindings By default, the widget responds to the following VTK events (i.e., it watches the vtkRenderWindowInteractor for these events):

       LeftButtonPressEvent - add a point or select a handle (i.e., seed)
       RightButtonPressEvent - finish adding the seeds
       MouseMoveEvent - move a handle (i.e., seed)
       LeftButtonReleaseEvent - release the selected handle (seed)

Note that the event bindings described above can be changed using this class's vtkWidgetEventTranslator. This class translates VTK events into the vtkSeedWidget's widget events:

       vtkWidgetEvent::AddPoint – add one point; depending on the state
                                   it may the first or second point added. Or,
                                   if near handle, select handle.
       vtkWidgetEvent::Completed – finished adding seeds.
       vtkWidgetEvent::Move – move the second point or handle depending on the state.
       vtkWidgetEvent::EndSelect – the handle manipulation process has completed.

This widget invokes the following VTK events on itself (which observers can listen for):

       vtkCommand::StartInteractionEvent (beginning to interact)
       vtkCommand::EndInteractionEvent (completing interaction)
       vtkCommand::InteractionEvent (moving after selecting something)
       vtkCommand::PlacePointEvent (after point is positioned;
                                    call data includes handle id (0,1))

To create an instance of class vtkSeedWidget, simply invoke its constructor as follows

      obj = vtkSeedWidget

# Methods

The class vtkSeedWidget has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkSeedWidget class.

- `string = obj.GetClassName ()` - Standard methods for a VTK class.
- `int = obj.IsA (string name)` - Standard methods for a VTK class.
- `vtkSeedWidget = obj.NewInstance ()` - Standard methods for a VTK class.
- `vtkSeedWidget = obj.SafeDownCast (vtkObject o)` - Standard methods for a VTK class.
- `obj.SetEnabled (int )` - The method for activiating and deactiviating this widget. This method must be overridden because it is a composite widget and does more than its superclasses' vtkAbstractWidget::SetEnabled() method.
- `obj.SetCurrentRenderer (vtkRenderer )` - Set the current renderer. This method also propagates to all the child handle widgets, if any exist
- `obj.SetInteractor (vtkRenderWindowInteractor )` - Set the interactor. This method also propagates to all the child handle widgets, if any exist
- `obj.SetRepresentation (vtkSeedRepresentation rep)` - Create the default widget representation if one is not set.
- `obj.CreateDefaultRepresentation ()` - Create the default widget representation if one is not set.
- `obj.SetProcessEvents (int )` - Methods to change the whether the widget responds to interaction. Overridden to pass the state to component widgets.
- `obj.CompleteInteraction ()` - Method to be called when the seed widget should stop responding to the place point interaction. The seed widget, when defined allows you place seeds by clicking on the render window. Use this method to indicate that you would like to stop placing seeds interactively. If you'd like the widget to stop responding to any user interaction simply disable event processing by the widget by calling widget->ProcessEventsOff()
- `obj.RestartInteraction ()` - Method to be called when the seed widget should start responding to the interaction.
- `vtkHandleWidget = obj.CreateNewHandle ()` - Use this method to programmatically create a new handle. In interactive mode, (when the widget is in the PlacingSeeds state) this method is automatically invoked. The method returns the handle created. A valid seed representation must exist for the widget to create a new handle.
- `obj.DeleteSeed (int n)` - Delete the nth seed.
- `vtkHandleWidget = obj.GetSeed (int n)` - Get the nth seed