[vtkusers] Extract Polydata points with same scalar value

David E DeMarle dave.demarle at kitware.com
Fri Jun 29 07:49:32 EDT 2012


Try selection. Make the selection over points, by either values or
thresholds, and turn on the containing_cells flag.

For an example, see line 704 of this test:
http://vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Extraction/Testing/Cxx/TestExtraction.cxx

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Tue, Jun 26, 2012 at 6:15 PM, Sara Rolfe <smrolfe at u.washington.edu> wrote:
> Actually, I just realized that vtkThresholdPoints appears to have extracted
> the points and the connections were lost.  So when I run it though the
> vtkPolydataConnectivityFilter there is one region for each point in the
> polydata.  Could you let me know if there's a way to get vtkThresholdPoints
> to preserve connectivity, or if there's a better approach?
>
> I've also tried using the vtkPolydaytaConnectivity filter operating on the
> scalar data, but was only able to get it to return the largest region for
> each label.
>
> Thanks,
> Sara
>
>
> On Jun 26, 2012, at 2:16 PM, Sara Rolfe wrote:
>
> Hi Jochen,
>
> I was able to use vtkThresholdPoints to do exactly what I wanted.  Thanks
> for your help!
>
> Sara
>
> On Jun 26, 2012, at 1:52 AM, Jochen K. wrote:
>
> Hi Sara,
>
> you may try to separate your polydata by scalar values using a
> vtkThresholdPoints object:
>
> untested snippet:
>
>          //...
>          vtkSmartPointer<vtkThresholdPoints> threshold =
> vtkSmartPointer<vtkThresholdPoints>::New();
>          threshold.SetInput(contourPolydata);
>          threshold.SetInputArrayToProcess(
>             0,
>             0,
>             vtkDataObject::FIELD_ASSOCIATION_POINTS,
>             vtkDataSetAttributes::SCALARS,
>             "NameOfYourScalarArray");
>          threshold->ThresholdBetween(0, 1); // would give you the points
> labeled with 1
>          // you may have to experiment with the value range a bit
>          //threshold->ThresholdBetween(1, 2); // would give you the points
> labeled with 2
>
>          threshold->Update();
>
>          vtkSmartPointer<vtkPolyData> part =
> vtkSmartPointer<vtkPolyData>::New();
>          part->SetInputConnection(threshold->GetOutputConnection());
>          //...
>
>
> best regards
> Jochen
> ________________________________
> View this message in context: Re: Extract Polydata points with same scalar
> value
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list