# Metric Clustering and Smoothing Dialog

This dialog is used for both clustering and smoothing of metric data.

## Surface

Choose the surface that is used when clustering or smoothing metric column.

## Metric Column

Input - This is the metric column that will be modified.  You may select "All Columns" for smoothing in which case all columns will be smoothed.

Output - The output of the process will be stored in this column.  This may be an existing column or a new column.  If a new column is selected, be sure to enter its name on the right side of this line.  This control is disabled when the input is "All Columns" in which case the data is replaced.

## Clustering

### Cluster Minimum Size

Any Size - clusters of all sizes are retained.

Minimum Number of Nodes - only clusters with at least the specified number of nodes are retained.

Minimum Surface Area - only clusters with a surface area greater than or equal to the specified area are retained.

### Cluster Value Threshold

To be in a cluster, the node must have a value within the range of the Minimum and the Maximum.

## Smoothing Algorithms

Average Neighbors
- Smooths a metric by averaging the metric's value with the metrics from all of its neighbors.

Full Width Half Maximum - Smooths a metric to an estimated full width half maximum.

Gaussian - Smooths by applying a gaussian-like weighting to the neighboring nodes.  See the Gaussian Smoothing description below.  Note: Gaussian smoothing is MUCH SLOWER that the other smoothing algorithms.

Weighted Average Neighbors - Smooths a metric by averaging the metric's value with the metrics from all of its neighbors.  The distance of the neighbors is taken into account so that neighbors close by have greater influence than neighbors far away.

## Smoothing Parameters

Iterations - This is the number of iterations of smoothing.

Strength - Determines how the node and its neighbors are combined when a smoothing a node.  A value of 1.0 weights to only the neighbors affecting the output.  A value of 0.0 does not use any neighboring values, and, results in no smoothing.  Values between 0.0 and 1.0 blend the node's metric along with the metrics of the node's neighbors.

## Full Width Half Maximum Smoothing

Prior to each iteration of smoothing, the Full Width Half Maximum is estimated using formula 2 on page 1094 from the article Smoothing and cluster thresholding for cortical surface-based group analysis of fMRI data by Donald J. Hagler Jr., Ayse Pinar Saygin, and Martin I. Sereno; NeuroImage 33 (2006) 1093-1103.  If the estimated FWHM exceeds the desired FWHM entered by the user, smoothing ceases.  If the desired FWHM is not exceeded, another iteration of smoothing is performed.  The Iterations parameter is the maximum number of iterations of smoothing that will be performed even if the desired FWHM is not reached.  For each iteration of smoothing, the node's new value is the average of the node's previous value and its neighbors' values.

## Gaussian Smoothing

Gaussian smoothing applies a gaussian-like weighting to the node's neighbors.  Two gaussian functions are used with the formula  e-(x*x/2.0sigma*sigma).  For the first gaussian, X is the distance from the neighboring node to a plane tangent to the surface at the node being smoothed and sigma is Sigma Normal.  If the node is above the plane and greater than Normal Above Cutoff units from the plane, the neighboring node receives a weighting of zero.  If the node is below the plane and more than Normal Below Cutoff units from the plane, the node receives a weighting of zero.  For the second gaussian, X is the distance from the neighboring node to the normal vector and sigma is Sigma Tangent.  If the distance from the neighboring node to the normal vector is greater than Tangent Cutoff units, the node receives a weighting of zero.

Full Width Half Maximum is approximately (2.3548 * Sigma), see http://mathworld.wolfram.com/GaussianFunction.html.

Sigma Normal  Standard deviation for gaussian along the node's normal vector.

Sigma Tangent  Standard deviation for gaussian along plane tangent to the node.

Normal Above Cutoff  The cutoff distance in the direction of the node's normal vector. ("Above" a plane tangent to the node).

Normal Below Cutoff  The cutoff distance in direction opposite of the node's normal vector. ("Under" a plane tangent to the node).

Tangent Cutoff  Cutoff distance along a plane tangent to the node.

## Gaussian Spherical Surface

For gaussian smoothing, all nodes within a "neighbor depth" of 5 are used when determining the neighbors of a node.  This of it as your first, second,..., fifth cousins.  Or, think of it as five (six) degrees of separation from Kevin Bacon.  If a fiducial surface was used for determining the distance to a node's neighbors, the Euclidean (straight line) distance may be very short across a sulcus but the geodesic distance (distance traveled on the surface) may be very long.  Unfortunately, the geodesic distance calculation is too slow.  As an result, we have chosen to approximate the geodesic distance by using the distance between two nodes on a sphere.  If the distance between a node and its neighbors on the sphere is greater than the maximum of the three cutoff values (normal above, normal below, tangent), the neighboring node is ignored during gaussian smoothing.