https://github.com/lennartverhagen/Pipelines
Tip revision: 545402bc5545cef1ecb6746519cbe14b096767f3 authored by Matt Glasser on 17 December 2013, 06:59:19 UTC
*Improve pial surface performance in FreeSurfer 5.3
*Improve pial surface performance in FreeSurfer 5.3
Tip revision: 545402b
GenericfMRISurfaceProcessingPipeline.sh
#!/bin/bash
set -e
# Requirements for this script
# installed versions of: FSL5.0.2 or higher , FreeSurfer (version 5 or higher) , gradunwarp (python code from MGH)
# environment: use SetUpHCPPipeline.sh (or individually set FSLDIR, FREESURFER_HOME, HCPPIPEDIR, PATH - for gradient_unwarp.py)
# make pipeline engine happy...
if [ $# -eq 1 ]
then
echo "Version unknown..."
exit 0
fi
########################################## PIPELINE OVERVIEW ##########################################
# TODO
########################################## OUTPUT DIRECTORIES ##########################################
# TODO
################################################ SUPPORT FUNCTIONS ##################################################
# function for parsing options
getopt1() {
sopt="$1"
shift 1
for fn in $@ ; do
if [ `echo $fn | grep -- "^${sopt}=" | wc -w` -gt 0 ] ; then
echo $fn | sed "s/^${sopt}=//"
return 0
fi
done
}
defaultopt() {
echo $1
}
################################################## OPTION PARSING #####################################################
# Just give usage if no arguments specified
if [ $# -eq 0 ] ; then Usage; exit 0; fi
# parse arguments
Path=`getopt1 "--path" $@` # "$1"
Subject=`getopt1 "--subject" $@` # "$2"
NameOffMRI=`getopt1 "--fmriname" $@` # "$6"
LowResMesh=`getopt1 "--lowresmesh" $@` # "$6"
FinalfMRIResolution=`getopt1 "--fmrires" $@` # "${14}"
SmoothingFWHM=`getopt1 "--smoothingFWHM" $@` # "${14}"
GrayordinatesResolution=`getopt1 "--grayordinatesres" $@` # "${14}"
RUN=`getopt1 "--printcom" $@` # use ="echo" for just printing everything and not running the commands (default is to run)
# Setup PATHS
PipelineScripts=${HCPPIPEDIR_fMRISurf}
GlobalScripts=${HCPPIPEDIR_Global}
GlobalBinaries=${HCPPIPEDIR_Bin}
#Naming Conventions
AtlasSpaceFolder="MNINonLinear"
T1wFolder="T1w"
NativeFolder="Native"
ResultsFolder="Results"
DownSampleFolder="fsaverage_LR${LowResMesh}k"
ROIFolder="ROIs"
OutputAtlasDenseTimeseries="${NameOffMRI}_Atlas"
AtlasSpaceFolder="$Path"/"$Subject"/"$AtlasSpaceFolder"
T1wFolder="$Path"/"$Subject"/"$T1wFolder"
ResultsFolder="$AtlasSpaceFolder"/"$ResultsFolder"/"$NameOffMRI"
ROIFolder="$AtlasSpaceFolder"/"$ROIFolder"
#Make fMRI Ribbon
#Noisy Voxel Outlier Exclusion
#Ribbon-based Volume to Surface mapping and resampling to standard surface
mkdir -p "$ResultsFolder"/RibbonVolumeToSurfaceMapping
"$PipelineScripts"/RibbonVolumeToSurfaceMapping.sh "$ResultsFolder"/RibbonVolumeToSurfaceMapping "$ResultsFolder"/"$NameOffMRI" "$Subject" "$AtlasSpaceFolder"/"$DownSampleFolder" "$LowResMesh" "$AtlasSpaceFolder"/"$NativeFolder" "$T1wFolder"/"$NativeFolder"
#Surface Smoothing
"$PipelineScripts"/SurfaceSmoothing.sh "$ResultsFolder"/"$NameOffMRI" "$Subject" "$AtlasSpaceFolder"/"$DownSampleFolder" "$LowResMesh" "$SmoothingFWHM"
#Subcortical Processing
"$PipelineScripts"/SubcorticalProcessing.sh "$AtlasSpaceFolder" "$ROIFolder" "$FinalfMRIResolution" "$ResultsFolder" "$NameOffMRI" "$SmoothingFWHM" "$GrayordinatesResolution"
#Generation of Dense Timeseries
"$PipelineScripts"/CreateDenseTimeseries.sh "$AtlasSpaceFolder"/"$DownSampleFolder" "$Subject" "$LowResMesh" "$ResultsFolder"/"$NameOffMRI" "$SmoothingFWHM" "$ROIFolder" "$ResultsFolder"/"$OutputAtlasDenseTimeseries" "$GrayordinatesResolution"