FS Course Laptop Commands

List of commands to try on course laptops to verify tutorial commands will work.

CHECK BEFORE RUNNING COMMANDS

Interaction with Individual Subject Data

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR

tkmedit good_output brainmask.mgz lh.white -aux T1.mgz -aux-surface rh.white -segmentation aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

tksurfer good_output lh inflated

Troubleshooting

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR

tkmedit topo_defect_before brainmask.mgz lh.white -aux wm.mgz -aux-surface rh.white

tksurfer pial_edits_before lh inflated

#EXTRA COMMANDS TO TRY
#tkmedit topo_defect_after brainmask.mgz \
#  lh.white -aux wm.mgz -aux-surface rh.white
#
#
#tkmedit wm1_edits_before brainmask.mgz \
#  lh.white -aux T1.mgz -aux-surface rh.white
#
#
#tksurfer wm1_edits_before lh inflated
#
#tkmedit pial_edits_before brainmask.mgz \
#  lh.white -aux T1.mgz -aux-surface rh.white
#
#
#tkmedit skullstrip1_before brainmask.mgz \
#  lh.white -aux T1.mgz -aux-surface rh.white
#
#
#tkmedit cp_before brainmask.mgz \
#  lh.white -aux T1.mgz -aux-surface rh.white
#
#
#tksurfer cp_before lh inflated &
#tksurfer cp_before rh inflated &
#
#tkmedit tal_before brainmask.mgz \
#  lh.white -aux T1.mgz -aux-surface rh.white
#
#
#tksurfer tal_before lh inflated

ROI Analysis

setenv SUBJECTS_DIR $TUTORIAL_DATA/group_analysis_tutorial
cd $SUBJECTS_DIR

tkmedit 004 orig.mgz -aux aparc+aseg.mgz -seg aparc+aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

tksurfer 004 lh inflated -annot aparc.annot

cat $FREESURFER_HOME/FreeSurferColorLUT.txt

cat 004/label/lh.BA45.label

#tkmedit 004 orig.mgz

#tksurfer 004 lh inflated

cd $SUBJECTS_DIR/004/stats
cat aseg.stats

cd $SUBJECTS_DIR/004/stats
cat lh.aparc.stats

setenv SUBJECTS_DIR $TUTORIAL_DATA/group_analysis_tutorial
cd $SUBJECTS_DIR

asegstats2table --subjects 004 021 040 067 080 092 \
  --segno 11 17 18 \
  --tablefile aseg.vol.table

cat $FREESURFER_HOME/FreeSurferColorLUT.txt

cat aseg.vol.table

#oocalc aseg.vol.table

#/Applications/OpenOffice.org.app/Contents/MacOS/scalc aseg.vol.table

asegstats2table \
  --subjects 004 021 040 067 080 092 \
  --segno 11 17 18 \
  --meas mean \
  --tablefile aseg.mean-intensity.table

cat $FREESURFER_HOME/FreeSurferColorLUT.txt

asegstats2table \
  --subjects 004 021 040 067 080 092 \
  --segno 3007 3021 3022 4022 \
  --stats wmparc.stats \
  --tablefile wmparc.vol.table

cat $FREESURFER_HOME/FreeSurferColorLUT.txt

aparcstats2table --hemi lh \
  --subjects 004 021 040 067 080 092 \
  --tablefile lh.aparc.area.table

aparcstats2table --hemi lh \
  --subjects 004 021 040 067 080 092 \
  --meas thickness \
  --parc aparc.a2009s \
  --tablefile lh.aparc.a2009.thickness.table

Longitudinal Tutorial

setenv SUBJECTS_DIR $TUTORIAL_DATA/long-tutorial
cd $SUBJECTS_DIR

freeview -v OAS2_0001/mri/norm.mgz \
         -f OAS2_0001/surf/lh.pial:edgecolor=red \
            OAS2_0001/surf/rh.pial:edgecolor=red \
            OAS2_0001/surf/lh.white:edgecolor=blue \
            OAS2_0001/surf/rh.white:edgecolor=blue

freeview -v OAS2_0001_MR1.long.OAS2_0001/mri/norm.mgz \
            OAS2_0001_MR2.long.OAS2_0001/mri/norm.mgz \
         -f OAS2_0001_MR1.long.OAS2_0001/surf/lh.pial:edgecolor=red \
            OAS2_0001_MR1.long.OAS2_0001/surf/lh.white:edgecolor=blue \
            OAS2_0001_MR2.long.OAS2_0001/surf/lh.pial:edgecolor=255,128,128 \
            OAS2_0001_MR2.long.OAS2_0001/surf/lh.white:edgecolor=lightblue

gedit qdec/long.qdec.table.dat

ooffice -calc qdec/long.qdec.table.dat

tksurfer OAS2_0001 lh pial -overlay $SUBJECTS_DIR/OAS2_0001/surf/lh.long.thickness-avg.fwhm15.mgh -timecourse $SUBJECTS_DIR/OAS2_0001/surf/lh.long.thickness-stack.mgh -aparc

tksurfer fsaverage lh pial -overlay $SUBJECTS_DIR/OAS2_0001/surf/lh.long.thickness-spc.fwhm15.fsaverage.mgh -aparc

long_qdec_table --qdec ./qdec/long.qdec.table.dat --cross --out ./qdec/cross.qdec.table.dat

qdec --table ./qdec/cross.qdec.table.dat

gedit qdec/.Qdecrc

tkmedit OAS2_0088 brainmask.mgz  -aux T1.mgz -surfs

#tkmedit OAS2_0088_MR1 brainmask.mgz  -aux T1.mgz -surfs
#tkmedit OAS2_0088_MR2 brainmask.mgz  -aux T1.mgz -surfs

#tkmedit OAS2_0088_MR1.long.OAS2_0004 brainmask.mgz  -aux T1.mgz -surfs
#tkmedit OAS2_0088_MR2.long.OAS2_0004 brainmask.mgz  -aux T1.mgz -surfs

tkmedit OAS2_0002_MR2 brainmask.mgz -aux brain.finalsurfs.mgz -surfs -segmentation aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

tkmedit OAS2_0002 brainmask.mgz -aux brain.finalsurfs.mgz -surfs -segmentation aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

tkmedit OAS2_0002_MR2.long.OAS2_0002 brainmask.mgz -aux brain.finalsurfs.mgz -surfs -segmentation aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

Multi-Modal Registration

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $TUTORIAL_DATA/multimodal/fmri/fbirn-101

tkregister2 --mov template.nii --s fbirn-anat-101.v4 --regheader --reg myregister.dat --surf

#  bbregister --mov template.nii --bold \
#    --s fbirn-anat-101.v4 \
#    --init-fsl --reg register.dat

cat register.dat

#tkregister2 --mov template.nii --reg register.dat --surf

Multi-Modal fMRI Individual

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $TUTORIAL_DATA/multimodal/fmri/fbirn-101

tkregister2 --mov template.nii --reg bb.register.dat --surf

tkmedit fbirn-anat-101.v4 orig.mgz -aux brain.mgz -seg aparc+aseg.mgz -overlay sig.nii -reg bb.register.dat -fthresh 2 -fmax 4

mri_vol2surf --mov sig.nii \
    --reg bb.register.dat \
    --projfrac 0.5 --interp nearest \
    --hemi lh --o lh.sig.mgh


mri_info lh.sig.mgh

#tksurfer fbirn-anat-101.v4 lh inflated -annot aparc \
#  -overlay lh.sig.mgh

mri_vol2vol --mov ces.nii \
    --reg bb.register.dat \
    --fstarg --interp nearest \
    --o ces.anat.bb.mgh

mri_info ces.anat.bb.mgh

mri_segstats \
   --seg $SUBJECTS_DIR/fbirn-anat-101.v4/mri/aparc+aseg.mgz \
   --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \
   --id 1021 --id 1022 --id 1030  --id 17 \
   --i ces.anat.bb.mgh --sum ces.bb.stats

mri_vol2vol --mov sig.nii \
    --reg bb.register.dat \
    --fstarg --interp nearest \
    --o sig.anat.bb.mgh

mri_segstats \
   --seg $SUBJECTS_DIR/fbirn-anat-101.v4/mri/aparc+aseg.mgz \
   --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \
   --id 1021 --id 1022 --id 1030  --id 17 \
   --i ces.anat.bb.mgh --sum ces.abs-masked.bb.stats \
   --mask sig.anat.bb.mgh --maskthresh 2 --masksign abs

mri_segstats \
   --seg $SUBJECTS_DIR/fbirn-anat-101.v4/mri/aparc+aseg.mgz \
   --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \
   --id 1021 --id 1022 --id 1030  --id 17 \
   --i ces.anat.bb.mgh --sum ces.pos-masked.bb.stats \
   --mask sig.anat.bb.mgh --maskthresh 2 --masksign pos

Multi-Modal fMRI Group

setenv SUBJECTS_DIR $TUTORIAL_DATA
cd $TUTORIAL_DATA/multimodal/fmri

tkregister2 --mov fbirn-101/template.nii --reg fbirn-101/bb.register.dat --surf

mris_preproc --target fsaverage --hemi lh \
  --iv  fbirn-101/ces.nii fbirn-101/bb.register.dat \
  --iv  fbirn-103/ces.nii fbirn-103/bb.register.dat \
  --iv  fbirn-104/ces.nii fbirn-104/bb.register.dat \
  --iv  fbirn-105/ces.nii fbirn-105/bb.register.dat \
  --iv  fbirn-106/ces.nii fbirn-106/bb.register.dat \
  --projfrac 0.5 \
  --out lh.ces.mgh

mri_info lh.ces.mgh

mri_surf2surf --hemi lh --s fsaverage --fwhm 5 --cortex\
  --sval lh.ces.mgh --tval lh.ces.sm05.mgh

mri_glmfit --y lh.ces.sm05.mgh --surf fsaverage lh \
  --osgm --glmdir lh.ces.sm05.osgm --cortex

tksurfer fsaverage lh inflated -annot aparc -ov lh.ces.sm05.osgm/osgm/sig.mgh

asegstats2table \
  --meas volume \
  --tablefile ces.pos-masked.vol.stats \
  --i fbirn-101/ces.pos-masked.bb.stats \
  fbirn-103/ces.pos-masked.bb.stats \
  fbirn-104/ces.pos-masked.bb.stats \
  fbirn-105/ces.pos-masked.bb.stats \
  fbirn-106/ces.pos-masked.bb.stats

asegstats2table \
  --meas mean \
  --tablefile ces.abs-masked.mean.stats \
  --i fbirn-101/ces.abs-masked.bb.stats \
  fbirn-103/ces.abs-masked.bb.stats \
  fbirn-104/ces.abs-masked.bb.stats \
  fbirn-105/ces.abs-masked.bb.stats \
  fbirn-106/ces.abs-masked.bb.stats

asegstats2table \
  --meas mean \
  --tablefile ces.pos-masked.mean.stats \
  --i fbirn-101/ces.pos-masked.bb.stats \
  fbirn-103/ces.pos-masked.bb.stats \
  fbirn-104/ces.pos-masked.bb.stats \
  fbirn-105/ces.pos-masked.bb.stats \
  fbirn-106/ces.pos-masked.bb.stats

Multi-Modal DTI Group

setenv SUBJECTS_DIR $TUTORIAL_DATA
cd $TUTORIAL_DATA/multimodal/dti

tkregister2 --mov lowb.nii --reg register.dat --surf

tkmedit M87102113.v4 orig.mgz -aux brain.mgz -seg wmparc.mgz -reg register.dat -overlay fa.nii -fthresh 0.2 -fmax 1

mri_vol2vol --mov fa.nii \
  --reg register.dat \
  --fstarg --interp nearest \
  --o fa.anat.mgh

mri_segstats \
  --seg $SUBJECTS_DIR/M87102113.v4/mri/wmparc.mgz \
  --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \
  --id 251 --id 3021 --id 3024 --id 3030 --id 12 --id 4 \
  --i fa.anat.mgh --sum fa.stats

#------------------------------
#Testing tksurfer, tkmedit and qdec
#------------------------------

cd $SUBJECTS_DIR

tkmedit good_output brainmask.mgz lh.white \
        -aux T1.mgz -aux-surface rh.white \
        -segmentation aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt

tksurfer good_output lh inflated

qdec 

Group Analysis

setenv SUBJECTS_DIR $TUTORIAL_DATA/group_analysis_tutorial
cd $SUBJECTS_DIR/glm


mris_preproc --fsgd gender_age.fsgd \
  --cache-in thickness.fwhm10.fsaverage \
  --target fsaverage --hemi lh \
  --out lh.gender_age.thickness.10.mgh


mri_glmfit \
  --y lh.gender_age.thickness.10.mgh \
  --fsgd gender_age.fsgd dods\
  --C lh-Avg-thickness-age-Cor.mtx \
  --surf fsaverage lh \
  --cortex \
  --glmdir lh.gender_age.glmdir


tksurfer fsaverage lh inflated -annot aparc.annot -fthresh 2 -overlay lh.gender_age.glmdir/lh-Avg-thickness-age-Cor/sig.mgh


mri_glmfit-sim \
  --glmdir lh.gender_age.glmdir \
  --sim mc-z 5 4 mc-z.negative \
  --sim-sign neg \
  --overwrite

cat lh.gender_age.glmdir/csd/mc-z.neg4.j001-lh-Avg-thickness-age-Cor.csd

cat lh.gender_age.glmdir/lh-Avg-thickness-age-Cor/mc-z.neg4.sig.cluster.summary

#tksurfer fsaverage lh inflated \
#  -annot lh.gender_age.glmdir/lh-Avg-thickness-age-Cor/mc-z.neg4.sig.ocn.annot \
#  -fthresh 2 -curv -gray

Group Analysis (QDEC)

setenv SUBJECTS_DIR $TUTORIAL_DATA/group_analysis_tutorial
cd $SUBJECTS_DIR

setenv SUBJECTS_DIR $TUTORIAL_DATA/group_analysis_tutorial
cd $SUBJECTS_DIR

#qdec &

cd $SUBJECTS_DIR
mris_anatomical_stats -l lh.supramarg.label \
  -t lh.thickness -b -f 004/stats/lh.supramarg.stats 004 lh

#tkmedit 004 brainmask.mgz -label lh.supramarg.label

FS FAST

cd $TUTORIAL_DATA/fsfast-functional
ls

cd $TUTORIAL_DATA/fsfast-functional/sess01.noproc
ls

setenv SUBJECTS_DIR $TUTORIAL_DATA/fsfast-tutorial.subjects

cat subjectname

ls $SUBJECTS_DIR

ls rest

ls bold

cd bold/001
ls

mri_info --dim f.nii.gz
mri_info --res f.nii.gz

tkmedit -f f.nii.gz -t f.nii.gz

cat workmem.par

cd $TUTORIAL_DATA/fsfast-functional
cat sessidlist

setenv SUBJECTS_DIR $TUTORIAL_DATA/fsfast-tutorial.subjects
cd $TUTORIAL_DATA/fsfast-functional
preproc-sess -s sess01 -fsd bold -stc up -surface fsaverage lhrh -mni305 -fwhm 5 -per-run 

plot-twf-sess -s sess01 -fsd bold -mc 

tkregister-sess -s sess01 -s sess02 -s sess03 -fsd bold -per-run -bbr-sum

tkregister-sess -s sess02 -fsd bold -per-run

cd $TUTORIAL_DATA/fsfast-functional/sess01/bold/001

tkmedit -f template.nii.gz -overlay masks/brain.nii.gz -fthresh 0.5

mri_info --dim fmcpr.up.sm5.mni305.2mm.nii.gz
mri_info --res fmcpr.up.sm5.mni305.2mm.nii.gz

mri_info --dim fmcpr.up.sm5.fsaverage.lh.nii.gz
mri_info --res fmcpr.up.sm5.fsaverage.lh.nii.gz

setenv SUBJECTS_DIR $TUTORIAL_DATA/fsfast-tutorial.subjects
cd $TUTORIAL_DATA/fsfast-functional

mkanalysis-sess \
  -fsd bold -stc up  -surface fsaverage lh -fwhm 5  \
  -event-related  -paradigm workmem.par -nconditions 5 \
  -spmhrf 0 -TR 2 -refeventdur 16 -nskip 4 -polyfit 2 \
  -analysis my-workmem.sm05.lh -force

ls my-workmem.sm05.lh

mkcontrast-sess -analysis my-workmem.sm05.lh -contrast encode-v-base -a 1

ls my-workmem.sm05.lh

mkanalysis-sess \
  -fsd bold -stc up  -surface fsaverage rh -fwhm 5  \
  -event-related  -paradigm workmem.par -nconditions 5 \
  -spmhrf 0 -TR 2 -refeventdur 16 -nskip 4 -polyfit 2 \
  -analysis my-workmem.sm05.rh -force

selxavg3-sess -s sess01 -analysis workmem.sm05.lh

ls $TUTORIAL_DATA/fsfast-functional/sess01/bold

tksurfer-sess -s sess01 \
  -analysis workmem.sm05.lh \
  -c encode-v-base \
  -c emot.dist-v-base \
  -c probe.avg-v-base \
  -c emot.dist-v-neut.dist

tksurfer-sess -s sess01 -analysis workmem.sm05.rh \
  -c encode-v-base \
  -c emot.dist-v-base \
  -c emot.dist-v-neut.dist \
  -c probe.avg-v-base

tkmedit-sess -s sess01 -analysis workmem.sm05.mni305 \
  -c encode-v-base \
  -c emot.dist-v-base \
  -c emot.dist-v-neut.dist \
  -c probe.avg-v-base

setenv SUBJECTS_DIR $TUTORIAL_DATA/fsfast-tutorial.subjects
cd $TUTORIAL_DATA/fsfast-functional

isxconcat-sess -sf sessidlist -analysis workmem.sm05.lh -contrast encode-v-base -o my-group

cd $TUTORIAL_DATA/fsfast-functional/my-group
ls

cd $TUTORIAL_DATA/fsfast-functional/my-group/workmem.sm05.lh
ls

mri_glmfit --y ces.nii.gz \
  --wls cesvar.nii.gz \
  --osgm \
  --surface fsaverage lh \
  --glmdir my-glm.wls \
  --nii.gz

tksurfer fsaverage lh inflated -aparc -overlay my-glm.wls/osgm/sig.nii.gz -fminmax 2 3

mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166

cat my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary

tksurfer fsaverage lh inflated \
  -overlay my-glm.wls/osgm/cache.th30.pos.sig.cluster.nii.gz \
  -annot ./my-glm.wls/osgm/cache.th30.pos.sig.ocn.annot -fminmax 1.3 3

cd $TUTORIAL_DATA/fsfast-functional/group/workmem.sm05.rh/encode-v-base
mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm \
  --surface fsaverage rh --glmdir my-glm.wls --nii.gz
mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166

cat my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary

cd $TUTORIAL_DATA/fsfast-functional/group/workmem.sm05.mni305/encode-v-base
ls

cd $TUTORIAL_DATA/fsfast-functional/group/workmem.sm05.mni305/encode-v-base
mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm  \
  --glmdir my-glm.wls --nii.gz
tkmedit fsaverage orig.mgz -aparc+aseg -overlay my-glm.wls/osgm/sig.nii.gz -fminmax 2 3

mri_glmfit-sim --glmdir my-glm.wls --grf 3 pos --cwpvalthresh .0166

cat my-glm.wls/osgm/grf.th3.pos.sig.cluster.summary

tkmedit fsaverage orig.mgz \
  -ov my-glm.wls/osgm/grf.th3.pos.sig.cluster.nii.gz \
  -seg ./my-glm.wls/osgm/grf.th3.pos.sig.ocn.anat.nii.gz  \
       ./my-glm.wls/osgm/grf.th3.pos.sig.ocn.lut \
  -fminmax 1.3 5

cd $TUTORIAL_DATA/fsfast-functional/group
cat workmem.sm05.lh/encode-v-base/my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary
cat workmem.sm05.rh/encode-v-base/my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary
cat workmem.sm05.mni305/encode-v-base/my-glm.wls/osgm/grf.th3.pos.sig.cluster.summary

vlrmerge --o encode.merged.nii.gz \
  --lh workmem.sm05.lh/encode-v-base/my-glm.wls/osgm/cache.th30.pos.sig.cluster.nii.gz \
  --rh workmem.sm05.rh/encode-v-base/my-glm.wls/osgm/cache.th30.pos.sig.cluster.nii.gz \
  --vol workmem.sm05.mni305/encode-v-base/my-glm.wls/osgm/grf.th3.pos.sig.cluster.nii.gz \
  --scm workmem.sm05.mni305/subcort.mask.nii.gz

tkmedit fsaverage orig.mgz -aparc+aseg -ov encode.merged.nii.gz -fminmax 1.3 5 -surfs

Diffusion Tutorial

setenv SUBJECTS_DIR $TUTORIAL_DATA/diffusion_recons
setenv TUTORIAL_DIR $TUTORIAL_DATA/diffusion_tutorial
set subj = Diff001

freeview -v $TUTORIAL_DIR/$subj/dtrecon/fa.nii $TUTORIAL_DIR/$subj/dtrecon/adc.nii

mri_vol2vol --mov $TUTORIAL_DIR/$subj/dtrecon/lowb.nii \
            --targ $SUBJECTS_DIR/$subj/mri/wmparc.mgz \
            --inv --interp nearest --o $SUBJECTS_DIR/$subj/mri/wmparc2diff.mgz \
            --reg $TUTORIAL_DIR/$subj/dtrecon/register.dat --no-save-reg

#freeview -v $TUTORIAL_DIR/$subj/dtrecon/fa.nii \
#            $SUBJECTS_DIR/$subj/mri/aparc+aseg2diff.mgz:colormap=lut

mri_mask $TUTORIAL_DIR/$subj/dtrecon/fa.nii \
         $SUBJECTS_DIR/$subj/mri/wmparc2diff.mgz \
         $TUTORIAL_DIR/$subj/dtrecon/fa-masked.mgz

#freeview -v $TUTORIAL_DIR/$subj/dtrecon/fa.nii \
#           $TUTORIAL_DIR/$subj/dtrecon/fa-masked.mgz

#freeview -v $FREESURFER_HOME/subjects/cvs_avg35/mri/norm.mgz \
#            $TUTORIAL_DIR/$subj/dtrecon/fa-masked.ANAT+CVS-to-avg35.mgz

mkdir $TUTORIAL_DIR/GLM
set inputfiles = ($TUTORIAL_DIR/Diff???/dtrecon/fa-masked.ANAT+CVS-to-avg35.mgz)
echo $inputfiles
mri_concat --i $inputfiles --o $TUTORIAL_DIR/GLM/GroupAnalysis.fa-masked.CVS-to-avg35.Input.mgz

mri_average $inputfiles $TUTORIAL_DIR/GLM/Average.fa-masked.CVS-to-avg35.Input.mgz

TRACULA Tutorial

setenv SUBJECTS_DIR $TUTORIAL_DATA/diffusion_recons
cd $TUTORIAL_DATA/diffusion_tutorial

gedit $TUTORIAL_DATA/diffusion_tutorial/scripts/dmrirc_single_subject

set dtroot = $TUTORIAL_DATA/diffusion_tutorial

set subjlist = (Diff001 Diff002 Diff003)

set runlist = (1)

set dcmroot = $TUTORIAL_DATA/diffusion_tutorial/

set dcmlist = (Diff001/orig/6-1.dcm \
               Diff002/orig/312000-6-1.dcm \
               Diff003/orig/781000-6-1.dcm)

#trac-all -prep -c $TUTORIAL_DATA/diffusion_tutorial/scripts/dmrirc_single_subject

#trac-all -bedp -c $TUTORIAL_DATA/diffusion_tutorial/scripts/dmrirc_single_subject

#trac-all -path -c $TUTORIAL_DATA/diffusion_tutorial/scripts/dmrirc_single_subject

#TRACULA OUTPUT

cd $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri
freeview $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/dtifit_FA.nii.gz

cd $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/mni/
freeview -v $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/mni/dtifit_FA.bbr.nii.gz

#freeview -v $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz \
            $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/mni/dtifit_FA.flt.nii.gz

freeview -v $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/dtifit_FA.nii.gz \
            $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.ilf_AS_avg32_mni_flt/path.pd.nii.gz:colormap=jet:isosurface=0,0:color='yellow' \
            $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/rh.ilf_AS_avg32_mni_flt/path.pd.nii.gz:colormap=jet:isosurface=0,0:color='yellow'

freeview -tv $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/merged_avg32_mni_flt.mgz \
         -v $TUTORIAL_DATA/diffusion_tutorial/Diff001/dmri/dtifit_FA.nii.gz

#TRACT STATS

cd $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.All.table

#gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.All.table

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.FA_Avg.table

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt

#gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.FA_Avg.table

#$TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
#gedit $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list

tractstats2table --load-pathstats-from-file $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.All.table

ls $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/*.All.table

tractstats2table --load-pathstats-from-file $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.FA_Avg.table

oocalc $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.All.table