#/bin/tcsh ######################################################### # super-recon # # This script will run all of the recon-all -all options # # Version 1.02 - Daniel Goldenholz # # # Examples: # super_recon all $SUBJECTS_DIR $SUBJECT /space/dicom/file1 /space/dicom/file2 my_email@wherever.nmr.com # super_recon 1 $SUBJECTS_DIR $SUBJECT /space/dicom/file1 /space/dicom/file2 # super_recon 2 $SUBJECTS_DIR $SUBJECT lh & # super_recon 2 $SUBJECTS_DIR $SUBJECT rh & # super_recon 3 $SUBJECTS_DIR $SUBJECT ######################################################## source /usr/local/freesurfer/nmr-std-env ###################################################### # EDIT THIS STUFF # ###################################################### setenv SUPER_RECON "`pwd`/$0" setenv SUPER_STEP $1 setenv SUBJECTS_DIR $2 setenv SUBJECT $3 setenv OPT1 $4 setenv OPT2 $5 setenv OPT3 $6 setenv DIR $SUBJECTS_DIR/$SUBJECT/scripts/ cd $SUBJECTS_DIR set nWaitsMax = 1000; set WaitSleep = 1m; switch ( $SUPER_STEP ) case "all": # This is the all case, where we run everything setenv MYMAIL $OPT3 $SUPER_RECON 1 $SUBJECTS_DIR $SUBJECT $OPT1 $OPT2 $SUPER_RECON 2 $SUBJECTS_DIR $SUBJECT lh & $SUPER_RECON 2 $SUBJECTS_DIR $SUBJECT rh & @ nWaits = 1; while(! -e $DIR/super_recon2lh.status && ! -e $DIR/super_recon2rh.status && $nWaits < $nWaitsMax) sleep $WaitSleep; @ nWaits = $nWaits + 1; end if( $nWaits == $nWaitsMax ) then echo "ERROR: timed out waiting for hemispheres to finish." exit 1 endif $SUPER_RECON 3 $SUBJECTS_DIR $SUBJECT echo "super-recon $SUBJECT finished without error at `date`" | \ mail -s "$SUBJECT DONE `date`" $MYMAIL breaksw case 1: # This is the whole head stage setenv invol1 $OPT1 setenv invol2 $OPT2 setenv LOG $DIR/recon-all.log setenv STAT $DIR/recon-all-status.log recon-all -s $SUBJECT -log $LOG -status $STAT -i $invol1 -i $invol2 recon-all -s $SUBJECT -log $LOG -status $STAT -motioncor recon-all -s $SUBJECT -log $LOG -status $STAT -nuintensitycor recon-all -s $SUBJECT -log $LOG -status $STAT -talairach recon-all -s $SUBJECT -log $LOG -status $STAT -normalization recon-all -s $SUBJECT -log $LOG -status $STAT -skullstrip recon-all -s $SUBJECT -log $LOG -status $STAT -gcareg recon-all -s $SUBJECT -log $LOG -status $STAT -canorm recon-all -s $SUBJECT -log $LOG -status $STAT -careg recon-all -s $SUBJECT -log $LOG -status $STAT -rmneck recon-all -s $SUBJECT -log $LOG -status $STAT -skull-lta recon-all -s $SUBJECT -log $LOG -status $STAT -calabel recon-all -s $SUBJECT -log $LOG -status $STAT -segstats recon-all -s $SUBJECT -log $LOG -status $STAT -normalization2 recon-all -s $SUBJECT -log $LOG -status $STAT -segmentation recon-all -s $SUBJECT -log $LOG -status $STAT -fill echo "Done. `date`" > $DIR/super_recon1.status breaksw case 2: # These are the hemisphere dependent stages setenv hemi $OPT1 setenv LOG $DIR/recon-all-${hemi}.log setenv STAT $DIR/recon-all-status-${hemi}.log recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -tessellate recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -smooth1 recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -inflate1 recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -qsphere recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -fix recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -finalsurfs recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -smooth2 recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -inflate2 recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -cortribbon recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -sphere recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -surfreg recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -contrasurfreg recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -avgcurv recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -cortparc recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -parcstats recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -cortparc2 recon-all -s $SUBJECT -log $LOG -status $STAT -hemi $hemi -parcstats2 echo "Done. `date`" > $DIR/super_recon2${hemi}.status breaksw case 3: # This stage is not hemisphere dependent setenv LOG $DIR/recon-all.log setenv STAT $DIR/recon-all-status.log recon-all -s $SUBJECT -log $LOG -status $STAT -aparc2aseg echo "Done. `date`" > $DIR/super_recon3.status breaksw default echo "Unrecognized input" endsw echo "super-recon is done dude! `date`"