|
Size: 4049
Comment:
|
Size: 5067
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 4: | Line 4: |
| Be sure to source FreeSurfer before trying to run any of the following scripts. | |
| Line 5: | Line 6: |
| Be sure to source FreeSurfer before trying to run any of the following scripts. | === subjects.csh === Use this script to set the 'SUBJECTS_DIR' and 'TUTORIAL_DIR' parameters, as well as assigning variouos subject data sub-sets (normal subjects, lesioned subjects, both groups). The 'TUTORIAL_DATA' parameter should the file path of where the tutorial data is being stored. |
| Line 7: | Line 9: |
| subjects.csh | {{{ #!/bin/tcsh -ef |
| Line 9: | Line 12: |
| DiffPreproc.csh | setenv SUBJECTS_DIR $TUTORIAL_DATA/diffusion_recon setenv TUTORIAL_DIR $TUTORIAL_DATA/diffusion_tutorial |
| Line 11: | Line 15: |
| Output: dwi.nii, dwi.mghdti.bvecs, dwi.mghdti.bvals, dwi-ec.nii, lowb.nii, bvecs.dat, bvals.dat, eigvec[123].nii, eigvals.nii, tensor.nii, dwirvar.nii, ivc.nii, adc.nii, radialdiff.nii, vr.nii, ra.nii, fa.nii. | |
| Line 13: | Line 16: |
| ---- {{{#!/bin/tcsh –ef source $SUBJECTS_DIR/scripts/subjects.csh |
set SUBJECTS = (Diff001 Diff002 Diff003 Diff004 Diff005 Diff006 Diff007 Diff008 Diff009 Diff010) set LESION_SUBJECTS = (LDiff006 LDiff007 LDiff008 LDiff009 LDiff010) set SUBJECTS_AND_LESION_SUBJECTS = (Diff001 Diff002 Diff003 Diff004 Diff005 LDiff006 LDiff007 LDiff008 LDiff009 LDiff010) }}} |
| Line 17: | Line 21: |
| === DiffPreproc.csh === Output: dwi.nii, dwi.mghdti.bvecs, dwi.mghdti.bvals, dwi-ec.nii, lowb.nii, bvecs.dat, bvals.dat, eigvec[123].nii, eigvals.nii, tensor.nii, dwirvar.nii, ivc.nii, adc.nii, radialdiff.nii, vr.nii, ra.nii, fa.nii, fa-tal.nii, register.dat. {{{ #!/bin/tcsh –ef # source subjects.csh # Run dt_recon on all subjects |
|
| Line 19: | Line 34: |
| set outdir = $SUBJECTS_DIR/$subj/LZDiff <-----!!*****!! | set outdir = $TUTORIAL_DIR/$subj/dtrecon |
| Line 21: | Line 36: |
| set dicomfile = $SUBEJCTS_DIR/$subj/orig/*-1.dcm | set dicomfile = $TUTORIAL_DIR/$subj/orig/*-1.dcm |
| Line 27: | Line 42: |
| ---- | |
| Line 38: | Line 52: |
| ---- {{{#!/bin/tcsh -ef source $SUBJECTS_DIR/scripts/subjects.csh |
{{{ #!/bin/tcsh -ef # |
| Line 42: | Line 56: |
| source subjects.csh # Loop through each subject |
|
| Line 44: | Line 61: |
| set outdir = $SUBJECTS_DIR/$subj/LZDiff <-----!!*****!! | set outdir = $TUTORIAL_DIR/$subj/dtrecon |
| Line 46: | Line 63: |
| # For each subject's wmparc and aparc+aseg volumes do... | |
| Line 57: | Line 75: |
| ---- | |
| Line 68: | Line 85: |
| ---- {{{#!/bin/tcsh -ef source $SUBJECTS_DIR/scripts/subjects.csh |
{{{ #!/bin/tcsh -ef # |
| Line 72: | Line 89: |
| source subjects.csh # Loop through each subject |
|
| Line 74: | Line 94: |
| set outdir = $SUBJECTS_DIR/$subj/LZDiff <-----!!*****!! | set outdir = $TUTORIAL_DIR/$subj/dtrecon |
| Line 76: | Line 96: |
| # Use wmparc2diff.mgz.... | |
| Line 85: | Line 106: |
| ---- | |
| Line 96: | Line 116: |
| ---- {{{#!/bin/tcsh -ef source $SUBJECTS_DIR/scripts/subjects.csh |
{{{ #!/bin/tcsh -ef # source subjects.csh |
| Line 101: | Line 123: |
| set template = /autofs/cluster/con_001/users/lilla/CVS_atlas/buckner35rerun/avg35rerun/mri/norm.mgz <-----!!*****!! | set template = $FREESURFER_HOME/subjects/cvs_avg35/mri/norm.mgz |
| Line 103: | Line 125: |
| # Loop through each subject | |
| Line 105: | Line 128: |
| set outdir = $SUBJECTS_DIR/$subj/LZDiff <-----!!*****!! | set outdir = $TUTORIAL_DIR/$subj/dtrecon |
| Line 108: | Line 131: |
| foreach vol (fa adc ivc) | # Uncomment '(fa adc ivc)' and remove '(fa)' to run all three volumes through... foreach vol (fa) # (fa adc ivc) |
| Line 111: | Line 135: |
| set outvol = ${vol:r}.ANAT+CVS-to-avg35.v2v.mgz | set outvol = ${vol:r}.ANAT+CVS-to-avg35.mgz |
| Line 113: | Line 137: |
| set cmd = ( mri_vol2vol --targ $template --m3z $morph --noDefM3zPath --reg $outdir/register.dat --mov $vol\ | set cmd = (mri_vol2vol --targ $template --m3z $morph --noDefM3zPath --reg $outdir/register.dat --mov $vol\ |
| Line 121: | Line 145: |
| ---- | |
| Line 132: | Line 155: |
| ---- | |
| Line 134: | Line 156: |
| set outdir = $SUBJECTS_DIR/diffusion_tutorial/GLM set type = CVS-to-avg35 # alternatively could be TAL-to-avg35 or MNI-to-avg35 set prefix = fa-masked #alternatively could be adc-masked or ivc-masked set inputfiles = ($outdir/../*/LZDiff/${prefix}.ANAT+${type}.v2v.mgz) <-----!!*****!! |
#!/bin/tcsh -ef |
| Line 139: | Line 158: |
| set cmd = (mri_concat --i $inputfiles --o $outdir/GroupAnalysis.{$prefix}.${type}.Input.mgz) | source subjects.csh set outdir = $TUTORIAL_DIR/GLM mkdir -p $outdir # Assembling input for group analysis set type = CVS-to-avg35 # alternatively could be 'TAL-to-avg35' or 'MNI-to-avg35' set prefix = fa-masked #alternatively could be adc-masked or ivc-masked set inputfiles = () foreach subj ($SUBJECTS) set inputfiles=($inputfiles $TUTORIAL_DIR/$subj/dtrecon/${prefix}.ANAT+${type}.mgz) end set cmd = (mri_concat --i $inputfiles --o $outdir/GroupAnalysis.${prefix}.${type}.Input.mgz) |
| Line 143: | Line 176: |
| # Create average of the input images for visualization | |
| Line 147: | Line 181: |
| set cmd = ( mri_glmfit --y $outdir/GroupAnalysis.{$prefix}.${type}.Input.mgz --fsgd group_analysis.fsgd\ | set cmd = (mri_glmfit --y $outdir/GroupAnalysis.{$prefix}.${type}.Input.mgz --fsgd group_analysis.fsgd\ |
| Line 152: | Line 186: |
| ---- |
Return to Diffusion |
Be sure to source FreeSurfer before trying to run any of the following scripts.
subjects.csh
Use this script to set the 'SUBJECTS_DIR' and 'TUTORIAL_DIR' parameters, as well as assigning variouos subject data sub-sets (normal subjects, lesioned subjects, both groups). The 'TUTORIAL_DATA' parameter should the file path of where the tutorial data is being stored.
setenv SUBJECTS_DIR $TUTORIAL_DATA/diffusion_recon setenv TUTORIAL_DIR $TUTORIAL_DATA/diffusion_tutorial set SUBJECTS = (Diff001 Diff002 Diff003 Diff004 Diff005 Diff006 Diff007 Diff008 Diff009 Diff010) set LESION_SUBJECTS = (LDiff006 LDiff007 LDiff008 LDiff009 LDiff010) set SUBJECTS_AND_LESION_SUBJECTS = (Diff001 Diff002 Diff003 Diff004 Diff005 LDiff006 LDiff007 LDiff008 LDiff009 LDiff010)
DiffPreproc.csh
Output: dwi.nii, dwi.mghdti.bvecs, dwi.mghdti.bvals, dwi-ec.nii, lowb.nii, bvecs.dat, bvals.dat, eigvec[123].nii, eigvals.nii, tensor.nii, dwirvar.nii, ivc.nii, adc.nii, radialdiff.nii, vr.nii, ra.nii, fa.nii, fa-tal.nii, register.dat.
#!/bin/tcsh –ef # source subjects.csh # Run dt_recon on all subjects foreach subj ($SUBJECTS) echo $subj set outdir = $TUTORIAL_DIR/$subj/dtrecon mkdir -p $outdir set dicomfile = $TUTORIAL_DIR/$subj/orig/*-1.dcm set cmd = (dt_recon --i $dicomfile --s $subj --o $outdir) echo $cmd eval $cmd end
Return to Diffusion |
AlignAnat2Diff.csh
Outputs: wmparc2diff.mgz, aparc+aseg2diff.mgz
#!/bin/tcsh -ef
#
source subjects.csh
# Loop through each subject
foreach subj ($SUBJECTS)
echo $subj
set outdir = $TUTORIAL_DIR/$subj/dtrecon
# For each subject's wmparc and aparc+aseg volumes do...
foreach vol (wmparc aparc+aseg)
set vol = $SUBJECTS_DIR/$subj/mri/$vol.mgz
set vol2diff = ${vol:r}2diff.mgz
set cmd = (mri_vol2vol --mov $outdir/lowb.nii --targ $vol --inv --interp nearest\
--o $vol2diff --reg $outdir/register.dat --no-save-reg)
echo $cmd
eval $cmd
end
endReturn to Diffusion |
DiffMasking.csh
Outputs: fa-masked.mgz, adc-masked.mgz, ivc-masked.mgz
#!/bin/tcsh -ef
#
source subjects.csh
# Loop through each subject
foreach subj ($SUBJECTS)
echo $subj
set outdir = $TUTORIAL_DIR/$subj/dtrecon
# Use wmparc2diff.mgz....
foreach vol (fa adc ivc)
set cmd = (mri_mask $outdir/$vol.nii $SUBJECTS_DIR/$subj/mri/wmparc2diff.mgz\
$outdir/${vol}-masked.mgz)
echo $cmd
eval $cmd
end
endReturn to Diffusion |
AlignAnatCVSToAvg.csh
Outputs: fa.ANAT+CVS-to-avg35.v2v.mgz, adc.ANAT+CVS-to-avg35.v2v.mgz, ivc.ANAT+CVS-to-avg35.v2v.mgz
#!/bin/tcsh -ef
#
source subjects.csh
set interp = trilin
set template = $FREESURFER_HOME/subjects/cvs_avg35/mri/norm.mgz
# Loop through each subject
foreach subj ($SUBJECTS)
echo $subj
set outdir = $TUTORIAL_DIR/$subj/dtrecon
set morph = $SUBJECTS_DIR/$subj/cvs/fullCVSmorph-to-avg35template.m3z <-----!!*****!!
# Uncomment '(fa adc ivc)' and remove '(fa)' to run all three volumes through...
foreach vol (fa) # (fa adc ivc)
set vol = $outdir/${vol}-masked.mgz # any volume in diffusion space (i.e. fa.nii or adc.nii)
echo $vol
set outvol = ${vol:r}.ANAT+CVS-to-avg35.mgz
echo $outvol
set cmd = (mri_vol2vol --targ $template --m3z $morph --noDefM3zPath --reg $outdir/register.dat --mov $vol\
--o $outvol --interp $interp --no-save-reg )
echo $cmd
eval $cmd
end
endReturn to Diffusion |
GroupAnalysis.csh
Outputs: gender_age.fa-masked.CVS-to-avg35.glmdir, dof.dat, mri_glmfit.log, y.fsgd, X.mat, contrast/Xg.dat, contrast/rstd.mgz, contrast/rvar.mgz, contrast/beta.mgz, contrast/fwhm.dat, contrast/sar1.mgz, contrast/mask.mgz
#!/bin/tcsh -ef
source subjects.csh
set outdir = $TUTORIAL_DIR/GLM
mkdir -p $outdir
# Assembling input for group analysis
set type = CVS-to-avg35 # alternatively could be 'TAL-to-avg35' or 'MNI-to-avg35'
set prefix = fa-masked #alternatively could be adc-masked or ivc-masked
set inputfiles = ()
foreach subj ($SUBJECTS)
set inputfiles=($inputfiles $TUTORIAL_DIR/$subj/dtrecon/${prefix}.ANAT+${type}.mgz)
end
set cmd = (mri_concat --i $inputfiles --o $outdir/GroupAnalysis.${prefix}.${type}.Input.mgz)
echo $cmd
eval $cmd
# Create average of the input images for visualization
set cmd = (mri_average $inputfiles $outdir/Average.{$prefix}.${type}.Input.mgz)
echo $cmd
eval $cmd
set cmd = (mri_glmfit --y $outdir/GroupAnalysis.{$prefix}.${type}.Input.mgz --fsgd group_analysis.fsgd\
dods --C contrast.mtx --glmdir $outdir/gender_age.{$prefix}.${type}.glmdir --mgz)
echo $cmd
eval $cmd