User Tools

Site Tools


public:analysis_of_a_cco_experiment_with_voxbo

Analysis of a Continuous Carry-Over Experiment with VoxBo

Once you have loaded the data onto the CfN cluster, it must be preprocessed and analyzed. Here are some demonstration scripts which have been successfully used to analyze a continuous carry-over experiment.

See also arrangement_of_data_directory.

Preprocessing

This step takes the raw data files and produces an Anatomy directory, containing the anatomical images in various formats, and one directory per scan containing the 4D data files.

The recommended way to do this is to have a single prep script which applies to all subjects, and then a file for each subject which calls that master file, defining various parameters.

Here is the master VBP file:

## Core script for processing experiments

# Prep anatomy

runonce shellcommand "mkdir -p Anatomy"
runonce shellcommand "mkdir -p Anatomy/raw"
runonce shellcommand "mkdir -p Models"
runonce shellcommand "vb2tes $RawEPI Anatomy/Functional.tes"
runonce shellcommand "tes2cub Anatomy/Functional.tes Anatomy/Functional.cub"
runonce shellcommand "rm Anatomy/Functional.tes"
runonce shellcommand "vb2cub $MPRAGE1 Anatomy/Anatomical.cub"
runonce shellcommand "mv $MPRAGE1 Anatomy/raw/"
runonce shellcommand "mv $FirstLoc Anatomy/raw/"
runonce shellcommand "mv $RawEPI Anatomy/raw/"

# Align origins of functional and anatomical data

runonce shellcommand "setorigin -m Anatomy/Anatomical.cub Anatomy/Functional.cub"
runonce shellcommand "setorigin -m Anatomy/Functional.cub Anatomy/Anatomical.cub"
runonce shellcommand "resample Anatomy/Anatomical.cub Anatomy/Display.cub -ra Anatomy/Functional.cub"

# Perform normalization of anatomicals

runonce spm2_norm_calc $DIR/Anatomy/ $paramfile Anatomical.cub $refvol $xa $ya $za $bb_anat
runonce spm2_norm_apply3d $DIR/Anatomy $DIR/Anatomy/$paramfile $anat nAnatomical.cub $xa $ya $za $bb_anat
runonce spm2_norm_apply3d $DIR/Anatomy $DIR/Anatomy/$paramfile $func nFunctional.cub $xf $yf $zf $bb_func
runonce spm2_norm_apply3d $DIR/Anatomy $DIR/Anatomy/$paramfile $anat nDisplay.cub $xa $ya $zf $bb_disp

# Perform noise reduction, skull-stripping and inhomogeneity correction with FSL tools

runonce shellcommand "vb2img Anatomy/nAnatomical.cub Anatomy/nAnatomical.img[small]"
runonce shellcommand "/usr/local/fsl/bin/susan_smooth Anatomy/nAnatomical 23.3302 Anatomy/nAnatomical 3 3D 1 0"
runonce shellcommand "/usr/local/fsl/bin/bet Anatomy/nAnatomical Anatomy/nAnatomical_BET -f 0.5 -g 0 -o -m"
runonce shellcommand "merge3d Anatomy/nAnatomical.img Anatomy/nAnatomical_BET_mask.img -o Anatomy/nAnatomical_BET.img -m"
runonce shellcommand "/usr/local/fsl/bin/fast -t1 -c 3 -or -ob -od Anatomy/nAnatomical_BET_FAST Anatomy/nAnatomical_BET"
runonce shellcommand "merge3d Anatomy/nAnatomical.img Anatomy/nAnatomical_BET_FAST_bias.img -o Anatomy/nAnatomical.img -m"
runonce shellcommand "rm Anatomy/nAnatomical_BET_FAST_restore.hdr"
runonce shellcommand "rm Anatomy/nAnatomical_BET_FAST_restore.img"
runonce shellcommand "rm Anatomy/nAnatomical_BET_overlay.hdr"
runonce shellcommand "rm Anatomy/nAnatomical_BET_overlay.img"
runonce shellcommand "rm Anatomy/nAnatomical_BET.hdr"
runonce shellcommand "rm Anatomy/nAnatomical_BET.img"
runonce shellcommand "rm Anatomy/nAnatomical_BET_mask.hdr"
runonce shellcommand "rm Anatomy/nAnatomical_BET_mask.img"
runonce shellcommand "mv Anatomy/nAnatomical_BET_FAST_bias.img Anatomy/nAnatomical_bias.img"
runonce shellcommand "mv Anatomy/nAnatomical_BET_FAST_bias.hdr Anatomy/nAnatomical_bias.hdr"
runonce shellcommand "mv Anatomy/nAnatomical_BET_FAST_seg.hdr Anatomy/nAnatomical_seg.hdr"
runonce shellcommand "mv Anatomy/nAnatomical_BET_FAST_seg.img Anatomy/nAnatomical_seg.img"
runonce shellcommand "mv Anatomy/nAnatomical.hdr Anatomy/nAnatomical_fsl.hdr"
runonce shellcommand "mv Anatomy/nAnatomical.img Anatomy/nAnatomical_fsl.img"
runonce shellcommand "resample Anatomy/nAnatomical_fsl.img Anatomy/Anat_ISO_SAG_TAL.img[small] -xx -49 1 256 -yy -16 1 256 -zz -77 1 256"
runonce shellcommand "vborient Anatomy/Anat_ISO_SAG_TAL.img Anatomy/Anat_ISO_SAG_TAL.img[small] ASR -from RPI"

# make the data directory and raw subdirectory
# make the tes file from the raw
# mv the raw Siemens data to the raw subdirectory

shellcommand "mkdir $scan"
shellcommand "mkdir $scan/raw"
vb2tes $raw $scan/$scan.tes
shellcommand "mv $raw $scan/raw/"

# process the tes file

shellcommand "sliceacq -i $scan/$scan.tes -o $scan/$scan.tes -n"

# NOTE THAT THE FOLLOWING LINE MUST BE CHANGED TO CORRESPOND TO YOUR NUMBER OF TRs.
# Here we are dropping the first 5 TRs to account for the CCO overlap.

shellcommand "vb2tes $scan/$scan.tes $scan/$scan.tes -i 5-157"

realign $scan/$scan.tes $scan/$scan.tes 0.5 Anatomy/Functional.cub
shellcommand "setorigin -c Anatomy/Functional.cub $scan/$scan.tes
spm2_norm_apply4d $DIR/$scan $DIR/Anatomy/$paramfile $scan.tes $scan.tes $xf $yf $zf $bb_func
shellcommand "vbsmooth -vox $smooth $smooth $smooth -o $scan/s$scan.tes $scan/$scan.tes

# threshold and calculate global signal and power spectrum
threshold $scan/$scan.tes $scan/$scan.tes $thresh
calcgs $scan/$scan.tes
calcps $scan/$scan.tes

# same thing for smoothed
threshold $scan/s$scan.tes $scan/s$scan.tes $thresh
calcgs $scan/s$scan.tes
calcps $scan/s$scan.tes

######################
# Create the average power spectrum and one-over-f file
#####################

## NOTE THAT THE FOLLOWING LINE MUST BE CHANGED TO CORRESPOND TO YOUR NUMBER OF TRs.
# This number should correspond to the numbers you used above (157 - 5 + 1 == 153)
runonce shellcommand "vbfit 3000 153 *_*/*_PS.ref -o Models/OneOverF.ref"

Here is a subject file which calls the above:

script /ajet/ddrucker/experiments/dioctmoons/PrepScripts/VBPs/dioctmoons_prep.vbp
SEQUENCENAME RawPrep_A011609I
DIR /ajet/ddrucker/dioctmoons_data/subjects/A011609I

PRIORITY 3
globals FirstLoc=0001_localizer
globals MPRAGE1=0008_t1_mpr_AX_MPRAGE
globals RawEPI=0002_ep2d_pace
FILE scan=A011609I_01 raw=0003_ep2d_pace_159
FILE scan=A011609I_02 raw=0004_ep2d_pace_159
FILE scan=A011609I_03 raw=0005_ep2d_pace_159
FILE scan=A011609I_04 raw=0006_ep2d_pace_159
FILE scan=A011609I_05 raw=0007_ep2d_pace_159
LOGGING 2
globals thresh=200
globals smooth=3
globals xa=1
globals ya=1
globals za=1
globals xf=3
globals yf=3
globals zf=3
globals refvol=/usr/local/spm2/templates/T1.mnc
globals paramfile=params.mat
globals anat=Anatomical.cub
globals func=Functional.cub
globals "bb_anat=[-79,-112,-51;79,76,86]"
globals "bb_func=[-78,-111,-50;78,75,85]"
globals "bb_disp=[-79,-112,-50;79,76,85]"

This file is parsed with vbprep.

GDS script

Next, a GDS script generates your .G file:

gsession /ajet/ddrucker/dioctmoons_data/subjects/A011609I/Models/A011609I_adapts_GLM

scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_01/sA011609I_01.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_02/sA011609I_02.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_03/sA011609I_03.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_04/sA011609I_04.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_05/sA011609I_05.tes

TR 3000

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/main.ref
  cov-name main
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/rept.ref
  cov-name rept
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/new.ref
  cov-name new
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/adaptP.ref
  cov-name d1_diff
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/adaptQ.ref
  cov-name d2_diff
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

newcov single /ajet/ddrucker/experiments/dioctmoons/PrepScripts/REFs/adaptOrthoEuclid.ref
  cov-name adaptOrthoEuclid
  option convolve /pkg/VoxBo/elements/filters/Eigen1.ref 2000
end

# include the no-interest covs
include A011609I.nointerest

The following file is included by reference:

newcov global-signal
end
newcov scan-effect
end
newcov intercept
end
newcov spike "333,444,555"
end

This file is parsed with gds

GLM

Next, create the GLM.

lows 25
highs 1
orderg 765
pri 3
audit no
meannorm yes
driftcorrect yes

glm A011609I_adapts_GLM
noisemodel /ajet/ddrucker/dioctmoons_data/subjects/A011609I/Models/OneOverF.ref
gmatrix /ajet/ddrucker/dioctmoons_data/subjects/A011609I/Models/A011609I_adapts_GLM/A011609I_adapts_GLM.G
dirname /ajet/ddrucker/dioctmoons_data/subjects/A011609I/Models/A011609I_adapts_GLM
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_01/sA011609I_01.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_02/sA011609I_02.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_03/sA011609I_03.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_04/sA011609I_04.tes
scan /ajet/ddrucker/dioctmoons_data/subjects/A011609I/A011609I_05/sA011609I_05.tes
end

This file is parsed with vbmakeglm.

/var/www/html/aguirreg/html/wiki/data/pages/public/analysis_of_a_cco_experiment_with_voxbo.txt · Last modified: 2009/09/03 18:32 by aguirreg