FreeMat

- Main Page
- Related Pages

vtkContourRepresentation

Section: Visualization Toolkit Widget Classes

# Usage

The vtkContourRepresentation is a superclass for various types of representations for the vtkContourWidget.

.SECTION Managing contour points The classes vtkContourRepresentationNode, vtkContourRepresentationInternals, vtkContourRepresentationPoint manage the data structure used to represent nodes and points on a contour. A contour may contain several nodes and several more points. Nodes are usually the result of user clicked points on the contour. Additional points are created between nodes to generate a smooth curve using some Interpolator. See the method `SetLineInterpolator`.

  The data structure stores both the world and display positions for every point. (This may seem like a duplication.) The default behaviour of this class is to use the WorldPosition to do all the math. Typically a point is added at a given display position. Its corresponding world position is computed using the point placer and stored. Any query of the display position of a stored point is done via the Renderer, which computes the display position given a world position.

  So why maintain the display position ? Consider drawing a contour on a volume widget. You might want the contour to be located at a certain world position in the volume or you might want to be overlayed over the window like an Actor2D. The default behaviour of this class is to provide the former behaviour.

  To achieve the latter behaviour override the methods that return the display position (to return the set display position instead of computing it from the world positions) and the method `BuildLines()` to interpolate lines using their display positions intead of world positions.

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

      obj = vtkContourRepresentation

# Methods

The class vtkContourRepresentation 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 vtkContourRepresentation class.

- `string = obj.GetClassName ()` - Standard VTK methods.
- `int = obj.IsA (string name)` - Standard VTK methods.
- `vtkContourRepresentation = obj.NewInstance ()` - Standard VTK methods.
- `vtkContourRepresentation = obj.SafeDownCast (vtkObject o)` - Standard VTK methods.
- `int = obj.AddNodeAtWorldPosition (double x, double y, double z)` - Add a node at a specific world position. Returns 0 if the node could not be added, 1 otherwise.
- `int = obj.AddNodeAtWorldPosition (double worldPos[3])` - Add a node at a specific world position. Returns 0 if the node could not be added, 1 otherwise.
- `int = obj.AddNodeAtWorldPosition (double worldPos[3], double worldOrient[9])` - Add a node at a specific world position. Returns 0 if the node could not be added, 1 otherwise.
- `int = obj.AddNodeAtDisplayPosition (double displayPos[2])` - Add a node at a specific display position. This will be converted into a world position according to the current constraints of the point placer. Return 0 if a point could not be added, 1 otherwise.
- `int = obj.AddNodeAtDisplayPosition (int displayPos[2])` - Add a node at a specific display position. This will be converted into a world position according to the current constraints of the point placer. Return 0 if a point could not be added, 1 otherwise.
- `int = obj.AddNodeAtDisplayPosition (int X, int Y)` - Add a node at a specific display position. This will be converted into a world position according to the current constraints of the point placer. Return 0 if a point could not be added, 1 otherwise.
- `int = obj.ActivateNode (double displayPos[2])` - Given a display position, activate a node. The closest node within tolerance will be activated. If a node is activated, 1 will be returned, otherwise 0 will be returned.
- `int = obj.ActivateNode (int displayPos[2])` - Given a display position, activate a node. The closest node within tolerance will be activated. If a node is activated, 1 will be returned, otherwise 0 will be returned.
- `int = obj.ActivateNode (int X, int Y)` - Given a display position, activate a node. The closest node within tolerance will be activated. If a node is activated, 1 will be returned, otherwise 0 will be returned.
- `int = obj.SetActiveNodeToWorldPosition (double pos[3])`
- `int = obj.SetActiveNodeToWorldPosition (double pos[3], double orient[9])`
- `int = obj.SetActiveNodeToDisplayPosition (double pos[2])` - Move the active node based on a specified display position. The display position will be converted into a world position. If the new position is not valid or there is no active node, a 0 will be returned. Otherwise, on success a 1 will be returned.
- `int = obj.SetActiveNodeToDisplayPosition (int pos[2])` - Move the active node based on a specified display position. The display position will be converted into a world position. If the new position is not valid or there is no active node, a 0 will be returned. Otherwise, on success a 1 will be returned.
- `int = obj.SetActiveNodeToDisplayPosition (int X, int Y)` - Move the active node based on a specified display position. The display position will be converted into a world position. If the new position is not valid or there is no active node, a 0 will be returned. Otherwise, on success a 1 will be returned.
- `int = obj.ToggleActiveNodeSelected ()` - Set/Get whether the active or nth node is selected.
- `int = obj.GetActiveNodeSelected ()` - Set/Get whether the active or nth node is selected.
- `int = obj.GetNthNodeSelected (int )` - Set/Get whether the active or nth node is selected.
- `int = obj.SetNthNodeSelected (int )` - Set/Get whether the active or nth node is selected.
- `int = obj.GetActiveNodeWorldPosition (double pos[3])` - Get the world position of the active node. Will return 0 if there is no active node, or 1 otherwise.
- `int = obj.GetActiveNodeWorldOrientation (double orient[9])` - Get the world orientation of the active node. Will return 0 if there is no active node, or 1 otherwise.
- `int = obj.GetActiveNodeDisplayPosition (double pos[2])` - Get the display position of the active node. Will return 0 if there is no active node, or 1 otherwise.
- `int = obj.GetNumberOfNodes ()` - Get the number of nodes.
- `int = obj.GetNthNodeDisplayPosition (int n, double pos[2])` - Get the nth node's display position. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting).
- `int = obj.GetNthNodeWorldPosition (int n, double pos[3])` - Get the nth node's world position. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting).
- `int = obj.GetNthNodeWorldOrientation (int n, double orient[9])` - Get the nth node's world orientation. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting).
- `int = obj.SetNthNodeDisplayPosition (int n, int X, int Y)` - Set the nth node's display position. Display position will be converted into world position according to the constraints of the point placer. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting) or the world position is not valid.
- `int = obj.SetNthNodeDisplayPosition (int n, int pos[2])` - Set the nth node's display position. Display position will be converted into world position according to the constraints of the point placer. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting) or the world position is not valid.
- `int = obj.SetNthNodeDisplayPosition (int n, double pos[2])` - Set the nth node's display position. Display position will be converted into world position according to the constraints of the point placer. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting) or the world position is not valid.
- `int = obj.SetNthNodeWorldPosition (int n, double pos[3])` - Set the nth node's world position. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting) or the world position is not valid according to the point placer.
- `int = obj.SetNthNodeWorldPosition (int n, double pos[3], double orient[9])` - Set the nth node's world position. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting) or the world position is not valid according to the point placer.
- `int = obj.GetNthNodeSlope (int idx, double slope[3])` - Get the nth node's slope. Will return 1 on success, or 0 if there are not at least (n+1) nodes (0 based counting).
- `int = obj.GetNumberOfIntermediatePoints (int n)`
- `int = obj.GetIntermediatePointWorldPosition (int n, int idx, double point[3])` - Get the world position of the intermediate point at index idx between nodes n and (n+1) (or n and 0 if n is the last node and the loop is closed). Returns 1 on success or 0 if n or idx are out of range.
- `int = obj.AddIntermediatePointWorldPosition (int n, double point[3])` - Add an intermediate point between node n and n+1 (or n and 0 if n is the last node and the loop is closed). Returns 1 on success or 0 if n is out of range.
- `int = obj.DeleteLastNode ()` - Delete the last node. Returns 1 on success or 0 if there were not any nodes.
- `int = obj.DeleteActiveNode ()` - Delete the active node. Returns 1 on success or 0 if the active node did not indicate a valid node.
- `int = obj.DeleteNthNode (int n)` - Delete the nth node. Return 1 on success or 0 if n is out of range.
- `obj.ClearAllNodes ()` - Delete all nodes.
- `int = obj.AddNodeOnContour (int X, int Y)` - Given a specific X, Y pixel location, add a new node on the contour at this location.
- `obj.SetPixelTolerance (int )` - The tolerance to use when calculations are performed in display coordinates
- `int = obj.GetPixelToleranceMinValue ()` - The tolerance to use when calculations are performed in display coordinates
- `int = obj.GetPixelToleranceMaxValue ()` - The tolerance to use when calculations are performed in display coordinates
- `int = obj.GetPixelTolerance ()` - The tolerance to use when calculations are performed in display coordinates
- `obj.SetWorldTolerance (double )` - The tolerance to use when calculations are performed in world coordinates
- `double = obj.GetWorldToleranceMinValue ()` - The tolerance to use when calculations are performed in world coordinates
- `double = obj.GetWorldToleranceMaxValue ()` - The tolerance to use when calculations are performed in world coordinates
- `double = obj.GetWorldTolerance ()` - The tolerance to use when calculations are performed in world coordinates
- `int = obj.GetCurrentOperation ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `obj.SetCurrentOperation (int )` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `int = obj.GetCurrentOperationMinValue ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `int = obj.GetCurrentOperationMaxValue ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `obj.SetCurrentOperationToInactive ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `obj.SetCurrentOperationToTranslate ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `obj.SetCurrentOperationToShift ()` - Set / get the current operation. The widget is either inactive, or it is being translated.
- `obj.SetCurrentOperationToScale ()`
- `obj.SetPointPlacer (vtkPointPlacer )`
- `vtkPointPlacer = obj.GetPointPlacer ()`
- `obj.SetLineInterpolator (vtkContourLineInterpolator )` - Set / Get the Line Interpolator. The line interpolator is responsible for generating the line segments connecting nodes.
- `vtkContourLineInterpolator = obj.GetLineInterpolator ()` - Set / Get the Line Interpolator. The line interpolator is responsible for generating the line segments connecting nodes.
- `obj.BuildRepresentation ()` - These are methods that satisfy vtkWidgetRepresentation's API.
- `int = obj.ComputeInteractionState (int X, int Y, int modified)` - These are methods that satisfy vtkWidgetRepresentation's API.
- `obj.StartWidgetInteraction (double e[2])` - These are methods that satisfy vtkWidgetRepresentation's API.
- `obj.WidgetInteraction (double e[2])` - These are methods that satisfy vtkWidgetRepresentation's API.
- `obj.ReleaseGraphicsResources (vtkWindow w)` - Methods required by vtkProp superclass.
- `int = obj.RenderOverlay (vtkViewport viewport)` - Methods required by vtkProp superclass.
- `int = obj.RenderOpaqueGeometry (vtkViewport viewport)` - Methods required by vtkProp superclass.
- `int = obj.RenderTranslucentPolygonalGeometry (vtkViewport viewport)` - Methods required by vtkProp superclass.
- `int = obj.HasTranslucentPolygonalGeometry ()` - Methods required by vtkProp superclass.
- `obj.SetClosedLoop (int val)` - Set / Get the ClosedLoop value. This ivar indicates whether the contour forms a closed loop.
- `int = obj.GetClosedLoop ()` - Set / Get the ClosedLoop value. This ivar indicates whether the contour forms a closed loop.
- `obj.ClosedLoopOn ()` - Set / Get the ClosedLoop value. This ivar indicates whether the contour forms a closed loop.
- `obj.ClosedLoopOff ()` - Set / Get the ClosedLoop value. This ivar indicates whether the contour forms a closed loop.
- `obj.SetShowSelectedNodes (int )` - A flag to indicate whether to show the Selected nodes Default is to set it to false.
- `int = obj.GetShowSelectedNodes ()` - A flag to indicate whether to show the Selected nodes Default is to set it to false.
- `obj.ShowSelectedNodesOn ()` - A flag to indicate whether to show the Selected nodes Default is to set it to false.
- `obj.ShowSelectedNodesOff ()` - A flag to indicate whether to show the Selected nodes Default is to set it to false.
- `obj.GetNodePolyData (vtkPolyData poly)` - Get the nodes and not the intermediate points in this contour as a vtkPolyData.