Smoothening of a volumetric mesh created by SegmentMesher and changed by applying DVF


I face a problem that after transforming mesh created by SegmentMesher with transform obtained by elastix registration, mesh is heavily deformed and yielding weird outliers, see following image:

The registration looks fine. I tried applying DVFs on a segmentation and the output was fine as well.

Atop of that, when loading the points with python I found also an outlier that is not shown on the visualisation itself but is located at following position:
[852.7322, -1861.4615, 5814.2349] (far from the actual volume).

I was thinking that this could be fixed by some smoothing tools. Is there something that slicer can do about that? I found laplacian smoothing in surfacetoolbox but it unfortunately works only for surface volumes, not volumetric volumes.


To transform an image, you need the resampling transform (fixed to moving image), while to transform a mesh, you need the modeling transform (moving to fixed image, inverse of the resampling transform). Automatic image intensity based registration always computes the resampling transform. When you apply that to a mesh then Slicer automatically computes the modeling transform by inverting the resampling transform. However, if the resampling transform was very noisy or inconsistent (maps different regions into the same region) then the modeling transform computation is unstable.

Probably the simplest solution is to compute the modeling transform by image registration is to switch up the fixed and moving images. If you need to have a single transform that can be used for both images and meshes then you need to tune the registration parameters to get smooth, consistent transform as a result.

Dear Andras,

thank you for your help, I appreciate that.

If I am doing everything inside Slicer, the only thing that I need is to switch up the moving and fixed image in Elastix registration right?

What about the application of deformation fields, does the slicer know that we have modelling transform instead of resampling transform?

thanks again.


Slicer keeps track of the transform direction: it stores either a ToParent or FromParent transform. You can see that in Transforms module’s Information section.