Problem with vtkLinearExtrusionFilter

Hi all,
I wanna create a 3D object from a surface. I’m using vtkLinearExtusionFilter to extrude a surface but when I do that see some holes on extrude output and some bad edges. see the pic below.
image
here is my code:

        normals = vtk.vtkPolyDataNormals()
        normals.SetInputData(polydata)
        normals.SetComputePointNormals(True)
        normals.SetComputeCellNormals(False)
        normals.SplittingOff()
        normals.NonManifoldTraversalOff()
        normals.FlipNormalsOff()
        normals.ConsistencyOff()
        normals.AutoOrientNormalsOff()
        normals.Update()

        extrude = vtk.vtkLinearExtrusionFilter()
        # extrude = vtk.vtkPLinearExtrusionFilter()
        # extrude.PieceInvariantOff ()
        extrude.SetInputData(normals.GetOutput())
        extrude.SetScaleFactor(3)
        extrude.SetExtrusionTypeToNormalExtrusion()
        extrude.Update()

as you see, I used vtkPlinearExtusionFilter too but there is the same problem.
how can I fix it?
best regards

1 Like

I don’t think there is an easy solution for this.

If you want to keep the original mesh then it is impossible to ensure for every mesh that extrusion in normal direction will not lead to self-intersections.

If you want to have a method that works everytime for every mesh then the only method that I’m aware of is to convert the mesh to an image (using polydata to image stencil filter), shrink the image (e.g., using morphological operators or distance map with thresholding), subtract the shrunk image from the original, then convert back to mesh using flying edges filter. Alternatively, you can use implicit modelling classes. If you have meshes of anatomical structures then these methods should workfine (they are acquired from relatively low-resolution images anyway). However, if you want to apply this to high-accuracy surfaces (e.g., created using CAD software) then if you want to keep the original point positions then you would need to use a very high resolution image, which may require a lot of memory and computation time.

Do you mean a meshed surface or a topological surface?
If the latter you can try using OpenCascade with VTK integration to produce a vtkPolyData of the extruded part.