NIMH MEG Core Facility

National Institute of Mental Health, Bethesda, Maryland

Main

MEG Analysis

Valid XHTML 1.0!

Valid CSS!

view · edit · attach · print

« samslide | Software | SAMcov »

SAMerf

SAMerf is adapted from CTF code to generate source images of event-related responses. Traditional SAM creates a source image from the summed power in time windows around multiple similar events. For this reason the image will contain activity not phase locked to the event. SAMerf attenuates non-phase locked activity by averaging virtual channels at each voxel location and creating a source image based on the average. This allows the user to image standard evoked responses such as the SEF or the N100m. A control window is required from either baseline or another event. The resulting image will show the log base 10 of the ratio between mean power in the active and control windows.

SAMerf works by first running single-state SAM over the time windows of interest. Average virtual channels are then calculated and the mean power determined for the specified active and control windows. The active and control windows should be contained in the original window given to the single-state SAM procedure. Although not necessary, it is recommended that the active and control windows be the same size.

Download and Installation

Download SAMerf.tgz. Version 1.1 10/25/05

Usage

SAMerf should be run in a script as in the following example:

#! /bin/bash

# This does SAMerf for a dataset.  Usage:
# doit ds lo hi window

function doit() {

	cp ../windows/$4 $1/SAM/$4
	SAMFcov -r $1 -f "$2 $3" -m $4 -v
	KENsrcZ2 -r $1 -c ${4},${2}-${3}Hz -W 0.0 -x "-10 12" -y "-8 8" -z "-2 14" -s 0.75 -v 3
	SAMerf -r $1 -w ${4},${2}-${3}Hz -m odd -t "0.1 0.2" -c std -b "0.1 0.2" -f "$2 $3" -v
}

#--------------------------------------------------

doit dataset.ds 1 30 oddstd

the window file 'oddstd' looks something like this:

2
odd 0.0 0.3
std 0.0 0.3

This script is designed to determine the difference between responses to odd and standard tones in a window from 100 to 200ms and in a frequency band from 1 to 30Hz. The window file can contain windows of the same size or larger. If you wish to only use one stimulus type and a baseline window the SAMerf command would look something like this:

 SAMerf -r $1 -w ${4},${2}-${3}Hz -m odd -t "0.1 0.2" -c odd -b "-0.1 0.0" -f "$2 $3" -v

and the window file would look something like this:

1
odd -0.1 0.1

SAMerf can also be run in 'sliding window' fashion. In this case SAMFcov and KENsrcZ2 are run first on a large time window, and then SAMerf is run multiple times on segments of the window to create a time series of mean activation for each voxel. An example script is shown below.

function doit1() {

	cp ../windows/clicks/$4 $1/SAM/$4
	SAMFcov -r $1 -f "$2 $3" -m $4 -v
	KENsrcZ2 -r $1 -c ${4},${2}-${3}Hz -W 0.0 -x "-10 12" -y "-8 8" \
	    -z "-2 14" -s 0.75 -v 3
}

function doit2() {

	SAMerf -r $1 -w ${4},${2}-${3}Hz -m firstclick -t "$5 $6" \
	    -c firstclick -b "-0.250 -.200" -f "$2 $3" -v
        b=`printf '%03d' $7`
        cp $1/SAM/${4},${2}-${3}Hz,firstclick,ERR.svl $1/SAM/b${b}.svl
}

#--------------------------------------------------

ds="$1"
doit1 $ds 25 50 firstclickwindow
k=1
for i in `seq -.200 .025 1.400`; do
  j=$(echo "$i + .050" | bc)
  echo $i $j $k
  doit2 $ds 25 50 firstclickwindow $i $j $k 
  k=`expr $k + 1`
done

Here doit1 performs conventional SAM on a −250ms to 1450ms time window around the marker firstclick. The function doit2 is called multiple times from the for loop to perform SAMerf on 50ms windows, which are slid ahead 25ms each iteration. The window from −250 to −200ms serves as a control. The results are saved in the SAM directory within the subject's data directory as files named b001.svl, b002.svl, etc.

To combine the results into a 3d+Time dataset you will need to use the AFNI 3dTcat and 3drefit commands like so:

3dTcat -prefix CRslide b001.svl b002.svl b003.svl ...
3drefit -TR 0.025 -Torg -.175 CRslide+orig

The SAMFcov and KENsrcZ2 programs are included in the download.

You'll need to add the -M flag to the localSpheres command, to generate a MultiSpheres file.

 
view · edit · attach · print · history · recent changes
Page last modified on November 09, 2009, at 03:44 PM
 
Department of Health and Human Services image and link First Gov image and link