Section: Visualization Toolkit Filtering Classes
Instances may be used independently or within pipelines with a variety of architectures and update mechanisms. Pipelines are controlled by instances of vtkExecutive. Every vtkAlgorithm instance has an associated vtkExecutive when it is used in a pipeline. The executive is responsible for data flow.
To create an instance of class vtkAlgorithm, simply invoke its constructor as follows
obj = vtkAlgorithm
obj
is an instance of the vtkAlgorithm class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkAlgorithm = obj.NewInstance ()
vtkAlgorithm = obj.SafeDownCast (vtkObject o)
int = obj.HasExecutive ()
- Check whether this algorithm has an assigned executive. This
will NOT create a default executive.
vtkExecutive = obj.GetExecutive ()
- Get this algorithm's executive. If it has none, a default
executive will be created.
obj.SetExecutive (vtkExecutive executive)
- Set this algorithm's executive. This algorithm is removed from
any executive to which it has previously been assigned and then
assigned to the given executive.
int = obj.ModifyRequest (vtkInformation request, int when)
- This method gives the algorithm a chance to modify the contents of a
request before or after (specified in the when argument) it is
forwarded. The default implementation is empty. Returns 1 on success,
0 on failure. When can be either vtkExecutive::BeforeForward or
vtkExecutive::AfterForward.
vtkInformation = obj.GetInputPortInformation (int port)
- Get the information object associated with an input port. There
is one input port per kind of input to the algorithm. Each input
port tells executives what kind of data and downstream requests
this algorithm can handle for that input.
vtkInformation = obj.GetOutputPortInformation (int port)
- Get the information object associated with an output port. There
is one output port per output from the algorithm. Each output
port tells executives what kind of upstream requests this
algorithm can handle for that output.
vtkInformation = obj.GetInformation ()
- Set/Get the information object associated with this algorithm.
obj.SetInformation (vtkInformation )
- Set/Get the information object associated with this algorithm.
int = obj.GetNumberOfInputPorts ()
- Get the number of input ports used by the algorithm.
int = obj.GetNumberOfOutputPorts ()
- Get the number of output ports provided by the algorithm.
obj.Register (vtkObjectBase o)
- Participate in garbage collection.
obj.UnRegister (vtkObjectBase o)
- Participate in garbage collection.
obj.SetAbortExecute (int )
- Set/Get the AbortExecute flag for the process object. Process objects
may handle premature termination of execution in different ways.
int = obj.GetAbortExecute ()
- Set/Get the AbortExecute flag for the process object. Process objects
may handle premature termination of execution in different ways.
obj.AbortExecuteOn ()
- Set/Get the AbortExecute flag for the process object. Process objects
may handle premature termination of execution in different ways.
obj.AbortExecuteOff ()
- Set/Get the AbortExecute flag for the process object. Process objects
may handle premature termination of execution in different ways.
obj.SetProgress (double )
- Set/Get the execution progress of a process object.
double = obj.GetProgressMinValue ()
- Set/Get the execution progress of a process object.
double = obj.GetProgressMaxValue ()
- Set/Get the execution progress of a process object.
double = obj.GetProgress ()
- Set/Get the execution progress of a process object.
obj.UpdateProgress (double amount)
- Update the progress of the process object. If a ProgressMethod exists,
executes it. Then set the Progress ivar to amount. The parameter amount
should range between (0,1).
obj.SetProgressText (string ptext)
- Set the current text message associated with the progress state.
This may be used by a calling process/GUI.
Note: Because SetProgressText() is called from inside RequestData()
it does not modify the algorithm object. Algorithms are not
allowed to modify themselves from inside RequestData().
string = obj.GetProgressText ()
- Set the current text message associated with the progress state.
This may be used by a calling process/GUI.
Note: Because SetProgressText() is called from inside RequestData()
it does not modify the algorithm object. Algorithms are not
allowed to modify themselves from inside RequestData().
long = obj.GetErrorCode ()
- The error code contains a possible error that occured while
reading or writing the file.
obj.SetInputArrayToProcess (int idx, int port, int connection, int fieldAssociation, string name)
- Set the input data arrays that this algorithm will
process. Specifically the idx array that this algorithm will process
(starting from 0) is the array on port, connection with the specified
association and name or attribute type (such as SCALARS). The
fieldAssociation refers to which field in the data object the array is
stored. See vtkDataObject::FieldAssociations for detail.
obj.SetInputArrayToProcess (int idx, int port, int connection, int fieldAssociation, int fieldAttributeType)
- Set the input data arrays that this algorithm will
process. Specifically the idx array that this algorithm will process
(starting from 0) is the array on port, connection with the specified
association and name or attribute type (such as SCALARS). The
fieldAssociation refers to which field in the data object the array is
stored. See vtkDataObject::FieldAssociations for detail.
obj.SetInputArrayToProcess (int idx, vtkInformation info)
- Set the input data arrays that this algorithm will
process. Specifically the idx array that this algorithm will process
(starting from 0) is the array on port, connection with the specified
association and name or attribute type (such as SCALARS). The
fieldAssociation refers to which field in the data object the array is
stored. See vtkDataObject::FieldAssociations for detail.
obj.SetInputArrayToProcess (int idx, int port, int connection, string fieldAssociation, string attributeTypeorName)
- String based versions of SetInputArrayToProcess(). Because
fieldAssociation and fieldAttributeType are enums, they cannot be
easily accessed from scripting language. These methods provides an
easy and safe way of passing association and attribute type
information. Field association is one of the following:
@verbatim
vtkDataObject::FIELD_ASSOCIATION_POINTS
vtkDataObject::FIELD_ASSOCIATION_CELLS
vtkDataObject::FIELD_ASSOCIATION_NONE
vtkDataObject::FIELD_ASSOCIATION_POINTS_THEN_CELLS
@endverbatim
Attribute type is one of the following:
@verbatim
vtkDataSetAttributes::SCALARS
vtkDataSetAttributes::VECTORS
vtkDataSetAttributes::NORMALS
vtkDataSetAttributes::TCOORDS
vtkDataSetAttributes::TENSORS
@endverbatim
If the last argument is not an attribute type, it is assumed to
be an array name.
vtkInformation = obj.GetInputArrayInformation (int idx)
- Get the info object for the specified input array to this algorithm
obj.RemoveAllInputs ()
- Remove all the input data.
vtkDataObject = obj.GetOutputDataObject (int port)
- Get the data object that will contain the algorithm output for
the given port.
vtkDataObject = obj.GetInputDataObject (int port, int connection)
- Get the data object that will contain the algorithm input for the given
port and given connection.
obj.SetInputConnection (int port, vtkAlgorithmOutput input)
- Set the connection for the given input port index. Each input
port of a filter has a specific purpose. A port may have zero or
more connections and the required number is specified by each
filter. Setting the connection with this method removes all
other connections from the port. To add more than one connection
use AddInputConnection().
The input for the connection is the output port of another
filter, which is obtained with GetOutputPort(). Typical usage is
filter2->SetInputConnection(0, filter1->GetOutputPort(0)).
obj.SetInputConnection (vtkAlgorithmOutput input)
- Set the connection for the given input port index. Each input
port of a filter has a specific purpose. A port may have zero or
more connections and the required number is specified by each
filter. Setting the connection with this method removes all
other connections from the port. To add more than one connection
use AddInputConnection().
The input for the connection is the output port of another
filter, which is obtained with GetOutputPort(). Typical usage is
filter2->SetInputConnection(0, filter1->GetOutputPort(0)).
obj.AddInputConnection (int port, vtkAlgorithmOutput input)
- Add a connection to the given input port index. See
SetInputConnection() for details on input connections. This
method is the complement to RemoveInputConnection() in that it
adds only the connection specified without affecting other
connections. Typical usage is
filter2->AddInputConnection(0, filter1->GetOutputPort(0)).
obj.AddInputConnection (vtkAlgorithmOutput input)
- Add a connection to the given input port index. See
SetInputConnection() for details on input connections. This
method is the complement to RemoveInputConnection() in that it
adds only the connection specified without affecting other
connections. Typical usage is
filter2->AddInputConnection(0, filter1->GetOutputPort(0)).
obj.RemoveInputConnection (int port, vtkAlgorithmOutput input)
- Remove a connection from the given input port index. See
SetInputConnection() for details on input connection. This
method is the complement to AddInputConnection() in that it
removes only the connection specified without affecting other
connections. Typical usage is
filter2->RemoveInputConnection(0, filter1->GetOutputPort(0)).
vtkAlgorithmOutput = obj.GetOutputPort (int index)
- Get a proxy object corresponding to the given output port of this
algorithm. The proxy object can be passed to another algorithm's
SetInputConnection(), AddInputConnection(), and
RemoveInputConnection() methods to modify pipeline connectivity.
vtkAlgorithmOutput = obj.GetOutputPort ()
- Get the number of inputs currently connected to a port.
int = obj.GetNumberOfInputConnections (int port)
- Get the number of inputs currently connected to a port.
int = obj.GetTotalNumberOfInputConnections ()
- Get the total number of inputs for this algorithm
vtkAlgorithmOutput = obj.GetInputConnection (int port, int index)
- Get the algorithm output port connected to an input port.
obj.Update ()
- Bring this algorithm's outputs up-to-date.
obj.UpdateInformation ()
- Backward compatibility method to invoke UpdateInformation on executive.
obj.UpdateWholeExtent ()
- Bring this algorithm's outputs up-to-date.
obj.SetReleaseDataFlag (int )
- Turn release data flag on or off for all output ports.
int = obj.GetReleaseDataFlag ()
- Turn release data flag on or off for all output ports.
obj.ReleaseDataFlagOn ()
- Turn release data flag on or off for all output ports.
obj.ReleaseDataFlagOff ()
- Turn release data flag on or off for all output ports.
int = obj.UpdateExtentIsEmpty (vtkDataObject output)
- This detects when the UpdateExtent will generate no data
This condition is satisfied when the UpdateExtent has
zero volume (0,-1,...) or the UpdateNumberOfPieces is 0.
The source uses this call to determine whether to call Execute.
int = obj.UpdateExtentIsEmpty (vtkInformation pinfo, int extentType)
- This detects when the UpdateExtent will generate no data
This condition is satisfied when the UpdateExtent has
zero volume (0,-1,...) or the UpdateNumberOfPieces is 0.
The source uses this call to determine whether to call Execute.
double = obj.ComputePriority ()
- Returns the priority of the piece described by the current update
extent. The priority is a number between 0.0 and 1.0 with 0 meaning
skippable (REQUEST_DATA not needed) and 1.0 meaning important.