vtk: how to smooth surface?

I have a surface (vtkPolyData), and it looks like:

The red color indicates some unsoomth mesh. Is it possible to smooth the unsmooth mesh?

The automatic and semi-automatic is accepted.

I have tried vtkWindowedSincPolyDataFilter, and it need many smooth iterations to remove the unsmooth part. On the one hand, the number of iteration is hard to decide, and on the other hand, the vtkWindowedSincPolyDataFilter with many iteration would finally affect the whole mesh. Is there any other solution?

Any suggestion is appreciated~~~

Here’s an idea, I’ve never tried it but maybe…

Use the filter vtkConstrainedSmoothingFilter. Set the constraint distances (using the constraint array “SmoothingConstraints” in the input point data) ==0.0 for each point, except for those points in those local regions you want to smooth. In those local regions, set a non-zero value consistent with the motion you are willing to accept etc.

The hard part will be to identify the points and the local neighborhood of points around the points that can be smoothed. In ParaView you can manually select a region of points etc.

Vessel smoothing often need to be combined with remeshing to make sure mesh integrity is maintained (there are no self-intersections or ill-shaped elements). You could do it by applying uniform remeshing after applying some smoothing and repeat this many times. But there is a simpler solution: since vessels are usually extracted from 3D images, you can simply smooth the labelmap image representation instead of the surface mesh. Morphological operators are usually sufficient but for very strong smoothing you may use Gaussian smoothing.

This is all available with a convenient user interface in 3D Slicer’s Segment Editor:

Slicer is all VTK-based and embeds Python, so if you need any additional pre/post processing then you can easily do that in Slicer, too.

1 Like

@lassoan The smoothing brush is interesting. What algorithm is used when the smoothing brush is applied?

Inside of the ball, the mask is smoothed. Am I right? But, how to smooth a binary mask?

The same choices are used for the smoothing brush as for global smoothing: Gaussian smoothing, morphological opening, morphological closing. They are all available in VTK.

You can find the source code here, feel free to copy anything into your application. However, I would strongly recommend to not reimplement the entire application, because you would need to copy-paste, integrate, maintain, test, document hundreds of more features like this. Instead, you can customize and extend the Slicer core application to have a medical application that does exactly what you need (the default generic user interface of the version you download from slicer.org is just for advanced users/engineers/researchers).