# Filter points from Polydata

**URL:** https://discourse.vtk.org/t/filter-points-from-polydata/8109
**Category:** Web
**Created:** [March 22, 2022, 5:00pm UTC](https://discourse.vtk.org/t/filter-points-from-polydata/8109 "2022-03-22T17:00:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kevin\_Sweeney](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kevin_sweeney/32/3935_2.png) [@Kevin\_Sweeney](https://discourse.vtk.org/u/Kevin_Sweeney)
#### Post date: [March 22, 2022, 5:00pm UTC](https://discourse.vtk.org/t/filter-points-from-polydata/8109/1 "2022-03-22T17:00:39Z")

</div>

I have a `vtkPolyData` data object, which is used as input data to a `vtk.Rendering.Core.vtkGlyph3DMapper` to plot spheres. These `polydata` have scalars mapped to them which are used to colour the spheres.

I am trying to see how I can filter these `polydata` based on these scalars. So, for example, say all my `polydata` points have scalars in the range of 0-9. How can I not plot those data points which have a scalar value of 5?

Many thanks

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [March 22, 2022, 5:04pm UTC](https://discourse.vtk.org/t/filter-points-from-polydata/8109/2 "2022-03-22T17:04:23Z")

</div>

You can use `vtkThreshold`. The output of this filter is a `vtkUnstructuredGrid` (which works: you can put any cells from a `vtkPolyData` inside a `vtkUnstructuredGrid`).

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [March 22, 2022, 5:07pm UTC](https://discourse.vtk.org/t/filter-points-from-polydata/8109/3 "2022-03-22T17:07:30Z")

</div>

@Yohann_Bearzi this is for vtk.js. We do not have `vtkUnstructuredGrid` or `vtkThreshold`.

But the idea is correct. You just need to create your own filter that will act as a `vtkThreshold` by filtering the cells of your polydata. Basically you just want to list the points that fulfill your condition.

Such filter would be trivial to write in JS and build the corresponding pipeline in vtk.js.
