[vtkusers] removing vtkAlgorithm-object from visualisation-pipeline

Jens G. jens-devel at gmx.de
Tue Apr 4 05:58:48 EDT 2006


Hi vtk-fans 

How can I get the input and output vtkAlgorithm-objects of a vtkAlgorithm-object ?
I try to write an easy function for removing vtkAlgorithm-objects from a visualisation-pipeline like the following. But inputObj and outputObj is always null. 

	Greetings
		Jens

////////////////////////////////////////////////////////////////
////	removing a vtkAlgorithm-obj form its
////    visualisation pipeline.
////////////////////////////////////////////////////////////////
bool removeAlgorithm( vtkAlgorithm* algo )
{
	vtkInformation* inputInfo = algo->GetInputPortInformation(0);
	vtkInformation* outputInfo = algo->GetOutputPortInformation(0);

	// get the input- and output-vtkAlgorithm of algo 
	vtkAlgorithm inputObj = vtkAlgorithm::SafeDownCast( 
                                            outputInfo->Get(
                                              vtkDataObject::DATA_OBJECT()));
	vtkAlgorithm outputObj = vtkAlgorithm::SafeDownCast( 
                                            inputInfo->Get(
                                              vtkDataObject::DATA_OBJECT()));

	// rechain the algorithms
	if(inputObj && outputObj) {
		inputObj->RemoveAllInputs();
		inputObj->SetInputConnection( outputObj->GetOutputPort() );
		alog->Delete();
		return true;
	}
	return false;
}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060404/dea1f292/attachment.htm>


More information about the vtkusers mailing list