[vtkusers] Trouble Applying Threshold filter to UnstructuredGrid
Mike Jackson
imikejackson at gmail.com
Mon Jun 2 11:45:07 EDT 2008
I have a vtkUnstructuredGrid with 5 sets of Scalars attached to the
point data. I would like to run a vtkThreshold filter on the grid
selecting only points from the grid that have a scalar value between
1.5 and 2.5. I only want to use the 3rd scalar array as the
determining factor.
So lets say that I named my scalars "Scalars 1", "Scalars 2"...
Here is what I have so far, which is not working.
vtkSmartPointer<vtkThreshold> thr = vtkSmartPointer<vtkThreshold>::New
();
vtkFieldData* fd = grid->GetFieldData();
int index = -1;
fd->GetArray("Scalars 3", index);
thr->SetInput(grid);
thr->ThresholdBetween( 1.5, 2.5 );
thr->AllScalarsOff();
thr->SetInputArrayToProcess(index, info);
thr->Update(); // Force the filter to run
vtkUnstructuredGrid* output = thr->GetOutput(0);
output->Register(NULL);
Note that I am using "info" variable which was retrieved from the
RequestData(.. ) arguments in the usual fashion, which I don't think
is correct.
Also, the index of the Scalars array comes back as "-1" which means
that my "Scalars 3" array could not be found. I know it is there. I
can print the vtkUnstructuredGrid and "see" the named array.
So I know this should be straight forward but I am just coming up empty.
Any help or hints would be appreciated.
--
Mike Jackson
imikejackson & gmail * com
More information about the vtkusers
mailing list