How do I inflate a mesh in vtk?

I displayed a mesh with vtk and I need to make the mesh looking more like it is inflated
The mesh has a lot of curves and I’m not able to get the result I expect.

Here’s what I tried so far:

the original mesh look like this:
enter image description here

If I use the setFeatureAngle of the vtk.vtkPolyDataNormals I get this:
enter image description here
If I use a vtk.vtkWarpVector I get this:enter image description here

What I would like to have is pushing the inner part of the mesh toward the outside.
like on this pitcure:enter image description here

Here’s the small example I have

import vtk

def main():
    filename = "sEEG/tseeg03_rT1_mid15022V.vtk"
    reader = vtk.vtkGenericDataObjectReader()
    reader.SetFileName(filename)
    reader.Update()
    if 0: #without inflate
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputData(reader.GetOutput())
    elif 0:
        # inflate the mesh with smoothing
        normals = vtk.vtkPolyDataNormals()
        normals.SetInputData(reader.GetOutput())
        normals.SetFeatureAngle(2)
        normals.SplittingOff()
        normals.NonManifoldTraversalOn()
        normals.UpdateInformation()
        normals.Update()
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputData(normals.GetOutput())
    elif 1:
        # inflate the mesh with warp
        normals = vtk.vtkPolyDataNormals()
        normals.SetInputData(reader.GetOutput())
        normals.SplittingOff()
        normals.UpdateInformation()
        normals.Update()
        warp =vtk.vtkWarpVector()
        warp.SetInputData(normals.GetOutput())
        warp.SetInputArrayToProcess(0, 0, 0,vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS, vtk.vtkDataSetAttributes.NORMALS)
        warp.SetScaleFactor(10)
        warp.Update()
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputData(warp.GetOutput())
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    ren = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    ren.AddActor(actor)
    iren.Initialize()
    renWin.Render()

    iren.Start()


if __name__ == '__main__':
    main()

Someone has an idea to get the feature I would like to have?

By inflated, do you mean scaling the surface up (e.g., by a isotropic scale on the actor actor.SetScale(scale)? Or are you trying to smooth the surface? Have you tried vtkWindowedSincPolyDataFilter?

by inflate, I means getting the surface more like a balloon where the valley and the mountain of the mesh will be at the same level. like the last figure I gave. I didn’t check vtkWindowedSincPolyDataFilter.

Yes, vtkWindowedSincPolyDataFilter seems to be a good candidate
image

elif 1:
    smoother = vtk.vtkWindowedSincPolyDataFilter()
    smoother.SetInputData(reader.GetOutput())
    smoother.SetNumberOfIterations(15)
    smoother.BoundarySmoothingOff()
    smoother.FeatureEdgeSmoothingOff()
    smoother.SetFeatureAngle(120.0)
    smoother.SetPassBand(.001)
    smoother.NonManifoldSmoothingOn()
    smoother.NormalizeCoordinatesOn()
    smoother.Update()
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputData(smoother.GetOutput())

I think I need to tune some parameter.

This is hard to do without introducing self-intersections. You could also try vtkSmoothPolyDataFilter in combination with isotropic scaling. vtkSmoothPolyDataFilter (unlike vtkWindowedSincPolyDataFilter) is a laplacian-based smoother and will slowly shrink the mesh towards its center over the course of many iterations. This may give you a more “ballon-like” appearance. Then scale it out to get you something close to its original size. But the level of deformation is going to be extreme.

Another (problematic) approach is to use some form of implicit modeling to generate a distance field, and then isocontour the result.

@ymmx2 FreeSurfer developers spent decades with developing their brain surface processing algorithms, including this inflated surface generation. I believe VTK can be used to reimplement many of these algorithms and the brain imaging community would benefit from having a modern, efficient, non-Matlab-based implementation, but you still need to start with studying their papers and source code to see what they ended up implementing and why. If the method is something trivial such as a convex hull and surface-to-surface distance then you can easily implement it using VTK filters. If the method depends on some more advanced brain-surface-geometry-specific processing algorithms then the probably the best would be to have a focused conversation with brain imaging experts (preferably including FreeSurfer developers) and VTK developers.