Configure mkcontrast-sess: Difference between revisions
Line 54: | Line 54: | ||
./do_mkcontrast.sh FAM sm4 | ./do_mkcontrast.sh FAM sm4 | ||
=Possible Problems= | =Possible Problems= | ||
This should be a straightforward script to run, however this script relies on Matlab or Octave. I recently ran into the problem described [https://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg62907.html here]. The solution was to define a MATLAB variable. I modified my .bashrc file to include the following line, though you can also run it at the commandline just prior to running mkcontrast-sess: | This should be a straightforward script to run, however this script relies on Matlab or Octave. I recently ran into the <code>MATLAB: Undefined variable</code> problem described [https://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg62907.html here]. The solution was to define a MATLAB variable. I modified my .bashrc file to include the following line, though you can also run it at the commandline just prior to running mkcontrast-sess: | ||
MATLAB=`getmatlab` | MATLAB=`getmatlab` |
Revision as of 09:35, 14 October 2020
Contrasts are planned comparisons reflecting hypotheses that you want to test. They are linear combinations of conditions. In order to construct a contrast, you need to know the numeric ID associated with each condition; this is specified in your paradigm file.
Suppose, for example, your par-files for the LDT experiment were encoded with the following conditions:
1 nonword 2 low-frequency word 3 high-frequency word
Contrasts between conditions are vector weightings of each condition.
The key thing is that the activated and contrast weightings must sum to zero. Continuing with this example, to configure the words > nonwords contrast for the analysis specified by the previous call to mkanalysis-sess
, you would run the following command within your $SUBJECTS_DIR:
mkcontrast-sess -analysis LDT.sm6.lh -contrast words-v-nonwords -a 2 -a 3 -c 1
Pertinent to some of our borrowed data, we have the following conditions for the children's dyslexia study:
1 O+P+ 2 O+P- 3 O-P+ 4 O-P- 5 Null (Fixation) 6 Perceptual
Contrasts between all first four lexical conditions and the fixation condition (i.e., LEX-FIX) would be coded:
mkcontrast-sess -analysis booth500.sm6.lh -contrast LEX_v_FIX -a 1 -a 2 -a 3 -a 4 -c 5
Because this needs to be repeated for each surface/volume for which you wish to run an analysis, you might find it helpful to get a little practice automating this command with a shell script. Below is a little script I wrote that takes a couple parameters that correspond to how I generated the analysis directories when I ran mkanalysis-sess
, and uses them to run mkcontrast-sess for the lh, rh and mni305 data:
do_mkcontrast.sh
Here's an example script:
#!/bin/bash PARADIGM=$1 #the first parameter is the PAR-file name #e.g., when using FAM.par, I would pass "FAM" as the first parameter shift # the shift command moves all the parameters down the line # like a conveyor belt. Now the first parameter "falls off", and the former # 2nd parameter is now the first parameter SMOOTHING=$1 # my analysis folders also include the smoothing kernel in the name (e.g., FAM.sm4.lh) # so I will need to also use this information when running the command shift # finally, I will list all the hemispheres/volumes to loop through HEMIS=( lh rh mni ) ANROOT="${PARADIGM}" #base name for the analysis directories for hemi in "${HEMIS[@]}" do #in my .PAR files, familiar trials are coded "1" and unfamiliar are coded "2" mkcontrast-sess -analysis ${ANROOT}.${SMOOTHING}.${hemi} -contrast task -a 1 -a 2 mkcontrast-sess -analysis ${ANROOT}.${SMOOTHING}.${hemi} -contrast fam-v-unfam -a 1 -c 2 mkcontrast-sess -analysis ${ANROOT}.${SMOOTHING}.${hemi} -contrast fam-v-base -a 1 mkcontrast-sess -analysis ${ANROOT}.${SMOOTHING}.${hemi} -contrast unfam-v-base -a 2 done
After making this script executable with the chmod command:
chmod ugo+x do_mkcontrast.sh
I would run it thus:
./do_mkcontrast.sh FAM sm4
Possible Problems
This should be a straightforward script to run, however this script relies on Matlab or Octave. I recently ran into the MATLAB: Undefined variable
problem described here. The solution was to define a MATLAB variable. I modified my .bashrc file to include the following line, though you can also run it at the commandline just prior to running mkcontrast-sess:
MATLAB=`getmatlab`