1

on using the vtkThresholdPoints to threshold a mesh it returns back just the points. I need to get back the mesh with its surface again, not just the points. those are the output points I need to get the thresholded mesh with the surface.

this is my code:

threshold = vtkThresholdPoints()
 threshold.SetInputData(polydata)
 threshold.ThresholdByUpper(threshold_value)
 threshold.Update()
 polydata = threshold.Update()

Then I added the surface reconstruction filter to construct the surface again, but it gives a total different red shape.

  surface = vtkSurfaceReconstructionFilter()
  surface.SetInputData(polydata)

  cf = vtkContourFilter()
  cf.SetInputConnection(surface.GetOutputPort())
  cf.Update()
  cf.GetOutput()

this is the output, which is not the input mesh I used or the expected output. enter image description here

HadyKh
  • 43
  • 7

1 Answers1

1

vtkThresholdPoints only "extracts points whose scalar value satisfies threshold criterion" (from the doc). So no way to get any surface defined.

You should use the vtkClipDataSet filter instead. You can clip by a scalar instead of a geometric implicit function. See the lens_clip in this example

Nico Vuaille
  • 2,310
  • 1
  • 6
  • 14
  • Thank you for your answer. The output of this filter is an unstructured grid, and what I am looking for is to get a vtkPolyData. any help with that too? – HadyKh Mar 07 '23 at 09:53
  • 1
    Then you have the `vtkGeometryFilter` (https://vtk.org/doc/nightly/html/classvtkGeometryFilter.html#details) to convert to surface. – Nico Vuaille Mar 08 '23 at 12:47
  • Thank you for providing that. I tried to do that in the following order vtkClipDataSet followed by vtkGeometryFilter. but the render window seems to be empty. can you help with that? without any errors appear. you can look at my code in here: https://github.com/HadyKh/VTK-Examples/blob/main/clip.py – HadyKh Mar 10 '23 at 13:57
  • 1
    Not sure what happen in your code, feel free to open a question in order to provide more details – Nico Vuaille Mar 13 '23 at 08:54