# Sam 3d and sam 3dc

Return to Source Localization - SAM

## Description

The sam_3d and sam_3dc programs versatile. They can be used whenever a single 3d image of power (or rank vector entropy, RVE) is desired. This can be relative to a marker, or across a continuous dataset. Note that because this routine calculates power, activity is not assumed to be phase locked to the marker of interest. This program assumes that beamformer coefficients have been estimated using sam_wts. Weight files from roi_wts, patch_wts, or sam_Nwts can also be used, although the result will not be an image in the traditional sense.

Two versions of this program — sam_3d and sam_3dc are offered. They differ in the order in which the functions of power or RVE are computed and parsed. The “c” denotes a “continuous” analysis over all samples, as will be explained.

sam_3d first applies the beamformer coefficients to the filtered MEG data (using ImageBand) to compute the source time series for each marked trial (the start and end times relative to each named marker). Next, the metric function (either power or entropy) is computed for each trial. The statistical mean and variance for each voxel, over all trials, is saved and written to their respective image files.

By contrast, sam_3dc applies the beamformer weights to the filtered MEG data over the entire time series — without respect to epochs or markers. The metric function (either power or entropy) is then computed continuously over the entire time series. The resulting metric time series for every voxel is then parsed into trials and the mean and variance accumulated over all trials for each marker and then written to their respective image files.

The problem that arises for sam_3d is that the functions of power and especially RVE are biased by their being computed over short segments of each trial. Short time segments add uncertainties to these measures. To reduce this bias, sam_3dc computes power and entropy over the entire dataset time series, for every voxel. This makes sam_3d faster than sam_3dc. However, it is always preferable to use sam_3dc.

## Usage

sam_3d -r <dataset_name> -m <parameter_file_name> [options] sam_3dc -r <dataset_name> -m <parameter_file_name> [options]

The -r flag designates the dataset name (with or without the .ds suffix), and -m designates the parameter file name.

Other options:

-v Verbose mode, without this flag sam_wts works silently except for error messages -Z Normalize the SAM weights by the projected noise. -h Show help

Required Parameters:

CovBand: Bandpass for the covariance matrices (and directory for weights files) ImageBand: Bandpass for the image ImageMetric: Can be either POWER or RVE NumMarkers: Number of markers used in the analysis MarkerN: Marker specification details CovType: Which covariance/weights are used for the image

It is important to note that when using sam_3d, GLOBAL, SUM, or ALL can be chosen for CovType. However, use of the ALL beamformer weights may introduce unwanted bias because they are derived from the covariance of short data segments. Because sam_3dc computes the power continuously across the entire dataset, only the SUM or GLOBAL options are allowed for CovType.

Optional Parameters:

ImageFormat: Designates whether the weights are in +orig or +tlrc space ImageDirectory: Directory where the output images are written, default is the SAM directory PrefixLength: Number of characters in the MEG dataset name used for naming MRI files.

Unlike previous SAM analyses, sam_3d and sam_3dc do not compute statistical comparisons among markers. The statistics such as pseudo-T, pseudo-F, T, F, or Mann-Whitney U, may be computed from the mean and variance images using the appropriate AFNI routines.

## Output Files

For each named marker, sam_3d and sam_3dc will compute two nifti images representing the mean and variance.