[vtkusers] vtkThreshold Problem

David Doria daviddoria at gmail.com
Tue Feb 1 08:02:02 EST 2011


On Tue, Feb 1, 2011 at 3:16 AM, Ambar C <ambarc at gmail.com> wrote:

> Hello,
>
> I'm trying to use the vtkThreshold class to perform thresholding
> operations on a data set. I want to extract each point that's a
> certain distance away from a given mesh. However, I'm finding it tough
> to figure out how to set the constraints that determine which points
> get included and which don't.
>
> The class docs make references to each point in the mesh having a
> 'scalar' value associated with it over which the thresholding happens.
> Despite searching for a while, I couldn't find what these scalars
> truly are, or how I could customize them to match the constraint
> definitions I'd need.
>
> Could someone explain the class usage? How are those scalars to be
> used? Follow up questions welcome.
>
> Best,
> Ambar
>
>
You would have to do the computation of the point-to-mesh distance for every
point and store it in an array. Then you associate that array with either
the PointData or CellData. Then you have to (quite awkwardly) tell the
vtkThreshold filter which array to perform the thresholding on. This line
sets it to operate on the 'index' array of the CellData:

  threshold->SetInputArrayToProcess(0, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "index");

See a full example here:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ThresholdingCells

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110201/6a7bb29d/attachment.htm>


More information about the vtkusers mailing list