VTK/VTK 6 Migration/Changes to vtkProcrustesAlignmentFilter

From KitwarePublic
< VTK
Jump to navigationJump to search

Changes to vtkProcrustesAlignmentFilter

In VTK 6, we changed or removed a few algorithms that previously produced variable number of outputs, which is not supported in VTK 6. Such algorithms need to produce vtkMultiBlockDataSet instead. As part of this change, we change vtkProcrustesAlignmentFilter to take a multi-block dataset as input and produce a multi-block dataset as output.

Example 1

Replace:

vtkProcrustesAlignmentFilter procrustes
    procrustes SetNumberOfInputs 3
    procrustes SetInput 0 [sphere GetOutput]
    procrustes SetInput 1 [transformer1 GetOutput]
    procrustes SetInput 2 [transformer2 GetOutput]
    [procrustes GetLandmarkTransform] SetModeToRigidBody

vtkPolyDataMapper map2a
    map2a SetInput [procrustes GetOutput 0]

with:

vtkMultiBlockDataGroupFilter group
    group AddInputConnection [sphere GetOutputPort]
    group AddInputConnection [transformer1 GetOutputPort]
    group AddInputConnection [transformer2 GetOutputPort]

vtkProcrustesAlignmentFilter procrustes
    procrustes SetInputConnection [group GetOutputPort]
    [procrustes GetLandmarkTransform] SetModeToRigidBody
    procrustes Update

vtkPolyDataMapper map2a
    map2a SetInputData [[procrustes GetOutput] GetBlock 0]

Note the use of [[procustes GetOutput] GetBlock 0]. It is also possible to create a pipeline that works on one block (or more) by using the composite data pipeline and vtkExtractBlock filter.