I’m wondering if the smoothing algorithm can dilate (red) rather than shrink (blue).
The code above does not affect any segmentations that you already created. You can change all the existing nodes as well (e.g., add a function that is called each time a node is added to the the scene and change the smoothing) but instead of solving the underlying problem you would just replace it with a different issue.
The windowed since smoothing filter performs low-pass filtering, so it does not dilate or shrink the surface. However, if the voxels are to large and not not cube-shaped (the resolution of thr image is too coarse and a isotropic) then the filter may fail to reproduce the original continuous surface.
If there is any significant change in the overall shape of the segments due to the 3D reconstruction (isosurface extraction + smoothing) then most likely the resolution of the segmentation is not sufficient to represent that fine level of detail.
To solve this, you can resample the segmentation to have finer resolution (and probaly you also want the resolution to be isotropic). You can also experiment with slightly decreasing the smoothing factor to see if you can preserve all the details while removing the surface artifacts. Finally, you may also try the new surface nets based surface reconstruction that is available in the latest Slicer Preview Releases.
This does the trick. Thank you very much for this insight.
I’ve resampled a cropped portion of ‘Panoramix-cropped’ to 0.3 x 0.3 x 0.3 mm spacing and segmented again. The default surface smoothing factor of 0.5 is quite consistent with the slice view outline as shown below.
As for surface net, a visual change is observed in the form of a shrinking of the segment in the 3D view with the ‘Faster’ option only. The ‘Fast’ option didn’t seem to do anything. Are these two independent surface smoothing techniques? Or is the ‘Faster’ option the real one, requiring the ‘Fast’ option to be on?
@ruili I fear you should re-segment everything again
Fast
option uses the same windowed sinc smoothing filter (same as with the default flying edges surface extraction method). Faster
option uses a different algorithm that performs smoothing during surface extraction, which is faster but less accurate. You can ask for more details in the topic where the feature was announced.
It might not be necessary to redo the complete segmentation. You can change the segmentation geometry and apply slight smoothing (e.g., using joint smoothing) and see if the result is satisfactory. It may not be optimal because some details may be lost that could have been present if the segmentation were performed at finer resolution from the beginning.