Skip to content

Instantly share code, notes, and snippets.

@kastman
Last active April 29, 2016 21:41
Show Gist options
  • Save kastman/9b9e3689545d7dea1bc6 to your computer and use it in GitHub Desktop.
Save kastman/9b9e3689545d7dea1bc6 to your computer and use it in GitHub Desktop.
Simple FAL Freesurfer Runner using dcmstack and ArcGet
#!/usr/bin/env bash
load_freesurfer 5.3.0-centos4
export SUBJECTS_DIR=/ncf/jwb/studies/FallyMGH/Analyses/fsrecon_v1
export L1SINK=/ncf/jwb/studies/FallyMGH/Analyses/fmriNipype_v1/data/level1sink/
batch1=(FAL001 FAL002 FAL004 FAL009 FAL009 FAL010)
batch2=(FAL010 FAL013 FAL014 FAL020 FAL021 FAL024 FAL025 FAL026 FAL029)
for subj in "${batch2[@]}"; do
rawdir=RAW/${subj}
ArcGet.py -a cbscentral -r "MEMPRAGE RMS" -s ${subj}_MR1 --new-structure -o ${rawdir}
dcmstack ${rawdir} --file-ext '.IMA'
imgargs=''
for img in ${rawdir}/*.nii*; do
imgargs=$imgargs" -i ${img}"
done
recon-all $imgargs -subjid ${subj}
rm -r $rawdir
sbatch -p ncf -N 1 -n 1 --mem 4000 -t 2-0:00 -o ${subj}_fs -p --wrap "recon-all -all -subjid ${subj} -qcache"
done
rmdir RAW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment