MantisBT - VTK
View Issue Details
0002187VTK(No Category)public2005-08-24 21:492012-12-12 12:13
Simon Warfield 
David Gobbi 
normalmajoralways
closedfixed 
 
5.6.0 
0002187: vtkImageBlend sets input on port 1 instead of connection 1
vtkImageAlgorithm has an AddInput method and a SetInput method which are intended to add or set the input at a particular index.
  These methods in turn call vtkAlgorithm AddInputConnection and SetInputConnection, but translate the index into a port.
  
  The upshot of this is that an attempt to set the second input at index 1 on port 0 instead sets index 0 on port 1.
  vtkImageBlend uses port 1 exclusively for vtkImageStencil data and the result is a runtime failure with a type mismatch.

Basically the bug is that these are incompatible:
void vtkImageAlgorithm::SetInput(int index, vtkDataObject* input)

void vtkAlgorithm::SetInputConnection(int port, vtkAlgorithmOutput* input)


Also, the workaround of calling SetInputConnection directly is difficult to discern as the pipeline documentation is not completely clear.
Basically a sequence like the following is necessary:

vtkImageData *input1;
vtkImageData *input2;
vtkImageData *input3;

blend->SetStencil(stencil);
blend->AddInputConnection(0, input1->GetProducerPort());
blend->AddInputConnection(0, input2->GetProducerPort());

// THERE IS NO REMOVEINPUT - WOULD BE GOOD TO HAVE IT blend->RemoveInput( input1->GetProducerPort()); // UNDESIRABLE blend->SetInput(0, 0); // Removes all inputs ????
blend->RemoveInputConnection(0,input2->GetProducerPort()); // seems to do the job....
// Not immediately obvious that calling GetProducerPort() generates a vtkAlgorithmOutput *.


blend->AddInputConnection(0, input3->GetProducerPort());
No tags attached.
Issue History
2008-02-06 10:17Jeff BaumesAssigned To => Berk Geveci
2011-02-26 10:38David GobbiAssigned ToBerk Geveci => David Gobbi
2011-04-15 17:31David GobbiNote Added: 0026189
2011-04-15 17:31David GobbiStatustabled => @80@
2011-04-15 17:31David GobbiResolutionopen => fixed
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2012-12-12 12:13David GobbiStatuscustomer review => closed
2012-12-12 12:13David GobbiFixed in Version => 5.6.0

Notes
(0002959)
Brad King   
2005-08-25 08:57   
I've changed the version number for this bug to "Devel" because it is not a VTK 4.x problem.

Most of the problem here is in the documentation. I've committed the following changes to make this more clear:

/cvsroot/VTK/VTK/Filtering/vtkAlgorithm.h,v <-- vtkAlgorithm.h
new revision: 1.25; previous revision: 1.24
/cvsroot/VTK/VTK/Filtering/vtkDataObjectAlgorithm.h,v <-- vtkDataObjectAlgorithm.h
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/Filtering/vtkDataSetAlgorithm.h,v <-- vtkDataSetAlgorithm.h
new revision: 1.11; previous revision: 1.10
/cvsroot/VTK/VTK/Filtering/vtkGenericDataSetAlgorithm.h,v <-- vtkGenericDataSetAlgorithm.h
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/Filtering/vtkHierarchicalDataSetAlgorithm.h,v <-- vtkHierarchicalDataSetAlgorithm.h
new revision: 1.7; previous revision: 1.6
/cvsroot/VTK/VTK/Filtering/vtkImageAlgorithm.h,v <-- vtkImageAlgorithm.h
new revision: 1.14; previous revision: 1.13
/cvsroot/VTK/VTK/Filtering/vtkPiecewiseFunctionAlgorithm.h,v <-- vtkPiecewiseFunctionAlgorithm.h
new revision: 1.3; previous revision: 1.2
/cvsroot/VTK/VTK/Filtering/vtkPointSetAlgorithm.h,v <-- vtkPointSetAlgorithm.h
new revision: 1.6; previous revision: 1.5
/cvsroot/VTK/VTK/Filtering/vtkPolyDataAlgorithm.h,v <-- vtkPolyDataAlgorithm.h
new revision: 1.20; previous revision: 1.19
/cvsroot/VTK/VTK/Filtering/vtkRectilinearGridAlgorithm.h,v <-- vtkRectilinearGridAlgorithm.h
new revision: 1.5; previous revision: 1.4
/cvsroot/VTK/VTK/Filtering/vtkStructuredGridAlgorithm.h,v <-- vtkStructuredGridAlgorithm.h
new revision: 1.5; previous revision: 1.4
/cvsroot/VTK/VTK/Filtering/vtkUnstructuredGridAlgorithm.h,v <-- vtkUnstructuredGridAlgorithm.h
new revision: 1.6; previous revision: 1.5
(0002960)
Brad King   
2005-08-25 09:11   
I'm assigning this bug to Ken because he wrote vtkImageAlgorithm and converted vtkImageBlend to the new pipeline. The problem now is that vtkImageAlgorithm::SetInput transforms its index to a port number and states in its documentation that subclasses should not override it.

I think we should change the policy to say that subclasses may override it but only to change the mapping to something backward-compatible for that subclass. In this case we want vtkImageBlend::SetInput to translate its index to a connection index on port 0.
(0026189)
David Gobbi   
2011-04-15 17:31   
This bug was fixed on Wed Apr 5 18:43:32 2006 -0400
commit 3f2dc76e776810d85624ed27587c63748b9da490