I want to use vtkExtractVectorComponents to do some computation with the components of a vector field, this works fine as long as the vector field is the first array in the data set.
When I have more arrays, the first one is picked,I tried the vtkExtractVectorComponents method SetInputArrayToProcess but hat had no effect (I think it should, am I doing something wrong?), so I thought I use vtkPassSelectArrays to only pass through the one array I want to work on, but that does not work either.
Specifically, I now have a vtkImageData object with two vector fields (vel, vel_input_1), when I use the ParaView GUI (setting const char *InputArray accordingly) to select vel with the code
vtkNew<vtkPassSelectedArrays> pass;
pass->SetInputData(input);
auto sel = pass->GetPointDataArraySelection();
sel->EnableArray(InputArray);
pass->Update();
and use
pass->GetOutput()->Print(std::cout);
I get the following output:
vtkImageData (0x28ce046a0)
Debug: Off
Modified Time: 1087182
Reference Count: 1
Registered Events: (none)
Information: 0x6000113edd40
Data Released: False
Global Release Data: Off
UpdateTime: 1087183
Field Data:
Debug: Off
Modified Time: 1087182
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 8388608
Number Of Cells: 8241919
Cell Data:
Debug: Off
Modified Time: 1087181
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x6000026e23a0)
Event: 33
EventName: ModifiedEvent
Command: 0x6000054d5180
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Point Data:
Debug: Off
Modified Time: 1087179
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x6000026e22e0)
Event: 33
EventName: ModifiedEvent
Command: 0x6000054d5180
Priority: 0
Tag: 1
Number Of Arrays: 1
Array 0 name = vel
Number Of Components: 3
Number Of Tuples: 8388608
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors:
Debug: Off
Modified Time: 455836
Reference Count: 7
Registered Events: (none)
Name: vel
Data type: float
Size: 25165824
MaxId: 25165823
NumberOfComponents: 3
Information: 0x600009de0d80
Debug: Off
Modified Time: 455992
Reference Count: 1
Registered Events: (none)
PER_COMPONENT: vtkInformationVector(0x600009de0de0)
L2_NORM_FINITE_RANGE: 1 3.01879
PER_FINITE_COMPONENT: vtkInformationVector(0x600009de0f60)
L2_NORM_RANGE: 1 3.01879
Name: vel
Number Of Components: 3
Number Of Tuples: 8388608
Size: 25165824
MaxId: 25165823
LookupTable: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Bounds:
Xmin,Xmax: (-2, 2)
Ymin,Ymax: (-2, 2)
Zmin,Zmax: (0, 6.28319)
Compute Time: 1087196
Spacing: (0.0314961, 0.0314961, 0.0122959)
Origin: (-2, -2, 0)
Direction: (1, 0, 0, 0, 1, 0, 0, 0, 1)
Dimensions: (128, 128, 512)
Increments: (0, 0, 0)
Extent: (0, 127, 0, 127, 0, 511)
This is the expected result, I have one point data vector array vel. However, when I change the InputArray in the GUI to vel_input_1 I get the following output:
vtkImageData (0x165d11230)
Debug: Off
Modified Time: 1215971
Reference Count: 1
Registered Events: (none)
Information: 0x6000113ed680
Data Released: False
Global Release Data: Off
UpdateTime: 1215972
Field Data:
Debug: Off
Modified Time: 1215971
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 8388608
Number Of Cells: 8241919
Cell Data:
Debug: Off
Modified Time: 1215970
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x6000020e7d20)
Event: 33
EventName: ModifiedEvent
Command: 0x60000573d900
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Point Data:
Debug: Off
Modified Time: 1215968
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x6000020e77b0)
Event: 33
EventName: ModifiedEvent
Command: 0x60000573d900
Priority: 0
Tag: 1
Number Of Arrays: 1
Array 0 name = vel_input_1
Number Of Components: 3
Number Of Tuples: 8388608
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Bounds:
Xmin,Xmax: (-2, 2)
Ymin,Ymax: (-2, 2)
Zmin,Zmax: (0, 6.28319)
Compute Time: 1215985
Spacing: (0.0314961, 0.0314961, 0.0122959)
Origin: (-2, -2, 0)
Direction: (1, 0, 0, 0, 1, 0, 0, 0, 1)
Dimensions: (128, 128, 512)
Increments: (0, 0, 0)
Extent: (0, 127, 0, 127, 0, 511)
I still have one point data array with the correct name, but the vector data is missing. Consequently, the vtkExtractVectorComponents class throws the following error:
vtkExtractVectorComponents (0x600000cf5fb0): No vector data to extract!
How do I get the vector data to be passed through as well? Or can I make vtkExtractVectorComponents work on a different array than the first?
Thank you!
Thomas