[vtkusers] vtkThreshold
Robbie Banks
robbie.banks at gmail.com
Tue Feb 8 15:00:53 EST 2011
Sorry. Probably a little unclear, as it may be the way we store data.
>From an FE grid. Elemental data stored as celldata and nodal as point data,
so two different sets of scalar values.
Also, in order to be able to turn on and off materials, we've assigned each
material as its own unstructured grid. As such, each material has its own
grid, mapper and actor. So I just have to loop across the grids.
The 2D stuff is always displayed as polydata, so easier to filter.
We have to cast back to the dataset for 3D to make sure we get a full list
of points/cells that are correct for the threshold count.
My reading of the filter was that vtkThreshold took raw vtkDatasets, while
vtkThresholdPoints took polydata as an input.
Robbie
-----Original Message-----
From: David Thompson [mailto:dcthomp at sandia.gov]
Sent: Tuesday, February 08, 2011 11:25 AM
To: Robbie Banks
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] vtkThreshold
Hi Robbie,
> Yep, thanks for your input. I did a little digging and the first
> example
> will work perfectly for 2D datasets.
I don't understand why things would be different for 2D vs 3D
datasets. Either you want the n-dimensional volume ratio (in which
case you must sum the volume (3D) or surface area (2D) of the input
and output meshes) or you want the ratio of cell counts that satisfy
the criterion compared to the total (in which case GetNumberOfCells()
should be all you need).
> I think I can use the vtkThresholdPoints for the 2D stuff, as it
> will work
> of the polygonal output from the unstructured grids quicker.
Unless your meshes satisfy some special criteria, I don't see how
thresholding vertices will help you get information about the area of
polygons that satisfy a threshold on some scalar.
David
> As you say, for the 3D stuff I'll have to use the vtkThreshold
> filter and
> examine the volume of each of the grids and sum them, then run each
> grid
> through the filter to get the number of points or cells within the
> filter
> range.
>
> Thanks
> Robbie
>
> -----Original Message-----
> From: David Thompson [mailto:dcthomp at sandia.gov]
> Sent: Tuesday, February 08, 2011 10:47 AM
> To: Robbie Banks
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] vtkThreshold
>
>> I'm wondering how I can use the vtkThreshold filter to return the
>> number of cells in the structure above a certain scalar value.
>> The threshold filter seems to do this, but I can't see where the
>> number of scalars could be returned from.
>
> This:
> vtkThreshold* thresh;
> double cellCountRatio = thresh->GetInput()->GetNumberOfCells() /
> (double) thresh->GetOutput()->GetNumberOfCells();
> doesn't work?
>
>> I have an unstructured grid and I want to see how many of the cells
>> are above a certain scalar value, so that I can determine the
>> volumetric percentage of grid that is above the threshold?
>
> If you want the volume ratio, then you must compute the volume of the
> input and output datasets. You might be able to use the vtkMeshQuality
> filter to do this (but it will only compute volume of tetrahedra and
> hexahedra, so you would have to tetrahedralize other cells before
> passing the mesh to this filter).
>
> You might also ask that the vtkIntegrateAttributes be moved from
> ParaView to VTK.
>
> David
>
>
More information about the vtkusers
mailing list