https://github.com/VisionandCognition/NHP-Freesurfer
Tip revision: 8d4b89337b865fb194e196cf1b2af4967e14d607 authored by Chris Klink on 23 June 2020, 10:55:45 UTC
Surface cuts and flatmaps can now be made with Freeview
Surface cuts and flatmaps can now be made with Freeview
Tip revision: 8d4b893
average_multiple_t1.sh
#!/bin/bash
set -e # exit if a command fails
# assumes first argument is a folder with multiple T1's
in_fld=$1
startpath=pwd;
subj=${PWD##*/} # get monkey name from the folder we're in
cd ${in_fld} # go to the specified folder
mkdir -p output
# define a preprocessing routing
preprocess_indiv () {
mri_convert -i ${1} -o rs_${1} --sphinx -vs 0.5 0.5 0.5
fslreorient2std rs_${1} rs_${1}
mri_nu_correct.mni --i rs_${1} --o ./output/ro_${1} --distance 24
rm rs_${1}
}
# do the preprocessing
for f in *.nii.gz; do
preprocess_indiv $f &
done
wait # wait for individual files preprocessing
# initiate the averaging command
cmd=mri_motion_correct.fsl -o ../${subj}.nii.gz
# add the preprocessed files
for f in ro_*.nii.gz; do
cmd=${cmd}' -i './output/${f}
done
eval ${cmd} # evaluate the averaging command
cd $startpath