# Sam ers and sam ersc

Return to Source Localization - SAM

## Description

The sam_ers and sam_ersc programs are closely related to the sam_4d and sam_4dc programs, and have some overlapping functionality. Like sam_4d and sam_4dc, sam_ers and sam_ersc will take the output of sam_wts (or sam_Nwts, roi_wts, or patch_wts) and produce a 3D+time NIFTI format image. The output units of the image are either moment (signal/noise) or power. In addition, sam_ersc can produce images of rank vector entropy or conditional rank vector entropy. sam_ers and sam_ersc will output an averaged timeseries, in the requested image metric, with the baseline subtracted (if requested). If two markers are given in the parameter file, the difference is computed.

Two versions of this program — sam_ers and sam_ersc are offered. sam_ers can compute averages of source moment or power, while sam_ersc can additionally compute averages of rank vector entropy. The “c” in sam_ersc denotes a “continuous” analysis, as will be explained, below.

sam_ers applies the beamformer coefficients to the filtered MEG data (using ImageBand) to compute the sensor time series for each trial (the start and end times relative to each named marker) — including a baseline segment specified by the keyword Baseline. If, the ImageMetric is power, the sensor-space Hilbert envelope (unsmoothed) is computed for each trial. The average is accumulated over all trials. The sensor averages of moment or power are than projected to source space using the SAM coefficients computed by sam_wts. The source-space output is resampled as specified by the keyword TimeStep, and smoothed using a boxcar integrator, as specified by TimeInt. The output 3D+time image is written to a NIFTI file.

sam_ersc reads and filters the MEG data according to the ImageBand keyword. The filtered data are then projected into source space for each voxel. The voxel (source) time series is computed over the entire dataset without respect to trials or markers. If power or rank vector entropy are selected as the ImageMetric, the voxel source time-series is transformed to that metric, using either Hilbert envelope, RVE, or conditional RVE. If power is selected, the Hilbert envelope is then lowpass filtered according to the SmoothBand keyword. The voxel time-series are subsequently parsed into trials and signal averaged, followed by baseline removal according to the Baseline keyword. The average is then resampled according to the TimeStep parameter. The averaged evoked response of source moment, power, RVE or conditional RVE are then written to a 3D+time NIFTI file.

Although sam_ers will run significantly faster than sam_ersc, sam_ersc is more accurate and is the recommended program of choice.

## Usage

sam_ers -r <dataset_name> -m <parameter_file_name> [options] sam_ersc -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 -a Designates that the output be the absolute value of the specified metric -h Show help

Required Parameters:

CovBand: Bandpass for the covariance matrices (and directory for weights files) ImageBand: Bandpass for the image ImageMetric: Can be MOMENT, POWER, or RVE TimeStep: designates the sampling interval for the output timeseries TimInt: designates the duration for the boxcar integration SmoothBand: designates the anti-aliasing lowpass filter 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_ers, 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_ersc computes the power continuously across the entire dataset, only the SUM or GLOBAL options are allowed for CovType.

Optional Parameters:

Baseline: if given, the computed metric averaged over the baseline will be subtracted from the timeseries SignSegment: Designates a time interval over which the moment should be positive 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.

## Output Files

The output from sam_ers and sam_ersc is a single 3D+time NIFTI format image. The image will be in either +orig (ortho) space are +tlrc (Talairach) space depending on the value of ImageFormat.