Spatial smoothing

Hi Jose Luis,

This function applies a Gaussian smoothing (aka blurring) filter to the the source values:
http://imaging.mrc-cbu.cam.ac.uk/imaging/PrinciplesSmoothing

You can define a Gaussian curve by its Full Width at Half Maximum (FWHM):

The last parameter defines how we apply the Gaussian smoothing kernel to the surface. This kernel size is defined in millimeters.
At a given vertex, we replace the value with a weighted average of the neighboring values. The weight is defined by the distance between the vertex and its neighbor.

This distance between two vertices can be estimated in different ways:

  • using the Euclidean distance between the two points (distance in the volume) => it smooths the activity between two vertices that are not connected (for instance, the two sides of a sulcus).
  • trying to recalculate the distance following the surface, following the edges that connect the points (distance on the surface) => The path that is used in my implementation is not the shortest path, and it doesn't work so well in regions where the topology is a bit complicated.

If found out that the average of the two methods was giving robust and acceptable results.

Hope this helps.
Francois