dicom2stl
dicom2stl copied to clipboard
Program stuck at decimation step
The program stuck at line 174 in vtkutils.py
:
def reduceMesh(mymesh, reductionFactor):
"""Reduce the number of triangles in a mesh using VTK's QuadricDecimation
filter."""
try:
t = time.perf_counter()
deci = vtk.vtkQuadricDecimation()
deci.SetTargetReduction(reductionFactor)
if vtk.vtkVersion.GetVTKMajorVersion() >= 6:
deci.SetInputData(mymesh)
else:
deci.SetInput(mymesh)
deci.Update()
# ......
I checked the official documentation, in the given example it uses vtk.vtkDecimatePro()
instead of vtk.vtkQuadricDecimation()
, and this fixes the problem.
My environment:
OS: Windows 10
CPU: AMD
VTK: 9.0.2 installed via pip
Python: 3.8.3
Interesting. I never had any problem with the quadric decimation filter. It probably depends on the particular data set. I could make it an option, which algorithm to use.
I always preferred the quadric decimation because I though it was a cool algorithm, and my friend wrote the VTK class.