dicom2stl icon indicating copy to clipboard operation
dicom2stl copied to clipboard

Program stuck at decimation step

Open Shaokun-X opened this issue 3 years ago • 1 comments

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

Shaokun-X avatar Feb 05 '21 16:02 Shaokun-X

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.

dave3d avatar Feb 05 '21 17:02 dave3d