[vtkusers] vtkThreshold

David Thompson dcthomp at sandia.gov
Tue Feb 8 14:25:19 EST 2011


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