Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostFreeSurfer related pull request #135

Merged
merged 23 commits into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cc5ab4a
FreeSurfer2CaretConvertAndRegisterNonlinear.sh related changes
sivcek Sep 27, 2019
4119999
`FreeSurfer2CaretConvertAndRegisterNonlinear_1res.sh related changes
sivcek Sep 27, 2019
598cbc2
PostFreeSurferPipeline_1res.sh
sivcek Sep 27, 2019
4fc5c23
PostFreeSurferPipeline.sh related changes
sivcek Sep 27, 2019
5a56f68
Adjusted MPP compliance checking.
sivcek Oct 2, 2019
92716a2
Added verbose_echo.
sivcek Oct 2, 2019
f85aac0
Avoided skipping CreateMyelinMaps.sh and added checks for what can no…
sivcek Oct 3, 2019
503868d
Corrected variable reporting.
sivcek Oct 7, 2019
077793d
Simplified T2w conditional execution and added it to adding CIFTI Map…
sivcek Oct 7, 2019
53a9b87
Moved -mpp-mode parameter reading and reporting.
sivcek Oct 8, 2019
40fb987
Simplified T2w related checks code placement.
sivcek Oct 8, 2019
14d154b
Changed parameter reading and defaults setting position.
sivcek Oct 8, 2019
274b2a4
Split conceptually # Create T1w/T2w maps using if/fi statements.
sivcek Oct 8, 2019
39498c8
Simplified code.
sivcek Oct 8, 2019
58e0d72
Implemented new naming convention and added warring when using FS for…
sivcek Oct 9, 2019
ee14852
Changed environment var reporting and fixed log_Warn.
sivcek Oct 10, 2019
adb0706
Simplified lists in CreateMyelin maps further.
sivcek Oct 10, 2019
33165d4
Fixed STRINGList and reporting with spaces.
sivcek Oct 11, 2019
b8e66cd
Changed the warning.
sivcek Oct 11, 2019
634ecbd
Changed default from FS to MSMSulc
sivcek Oct 12, 2019
845fd46
In both scripts.
sivcek Oct 12, 2019
9785189
Using variable to report script started / finished in verbose_echo.
sivcek Oct 12, 2019
d2e9c8a
In both scripts.
sivcek Oct 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 51 additions & 9 deletions PostFreeSurfer/PostFreeSurferPipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ set -e
script_name=$(basename "${0}")

if [ -z "${HCPPIPEDIR}" ]; then
echo "${script_name}: ABORTING: HCPPIPEDIR environment variable must be set"
exit 1
echo "${script_name}: ABORTING: HCPPIPEDIR environment variable must be set"
exit 1
else
echo "${script_name}: HCPPIPEDIR: ${HCPPIPEDIR}"
echo "${script_name}: HCPPIPEDIR: ${HCPPIPEDIR}"
fi

if [ -z "${HCPPIPEDIR_PostFS}" ]; then
echo "${script_name}: ABORTING: HCPPIPEDIR_PostFS environment variable must be set"
exit 1
echo "${script_name}: ABORTING: HCPPIPEDIR_PostFS environment variable must be set"
exit 1
else
echo "${script_name}: HCPPIPEDIR_PostFS: ${HCPPIPEDIR_PostFS}"
echo "${script_name}: HCPPIPEDIR_PostFS: ${HCPPIPEDIR_PostFS}"
fi

########################################## PIPELINE OVERVIEW ##########################################
Expand All @@ -37,8 +37,8 @@ fi
# Load Function Libraries
# --------------------------------------------------------------------------------

source $HCPPIPEDIR/global/scripts/log.shlib # Logging related functions
source $HCPPIPEDIR/global/scripts/opts.shlib # Command line option functions
source ${HCPPIPEDIR}/global/scripts/log.shlib # Logging related functions
source ${HCPPIPEDIR}/global/scripts/opts.shlib # Command line option functions

########################################## SUPPORT FUNCTIONS ##########################################

Expand Down Expand Up @@ -90,6 +90,24 @@ InflateExtraScale=`opts_DefaultOpt $InflateExtraScale 1`

PipelineScripts=${HCPPIPEDIR_PostFS}

verbose_red_echo "---> Starting Post FreeSurfer Pipeline"
verbose_echo " "
verbose_echo " Using parameters ..."
verbose_echo " --path: ${StudyFolder}"
verbose_echo " --subject: ${Subject}"
verbose_echo " --surfatlasdir: ${SurfaceAtlasDIR}"
verbose_echo " --grayordinatesdir: ${GrayordinatesSpaceDIR}"
verbose_echo " --grayordinatesres: ${GrayordinatesResolutions}"
verbose_echo " --hiresmesh: ${HighResMesh}"
verbose_echo " --lowresmesh: ${LowResMeshes}"
verbose_echo " --subcortgraylabels: ${SubcorticalGrayLabels}"
verbose_echo " --freesurferlabels: ${FreeSurferLabels}"
verbose_echo " --refmyelinmaps: ${ReferenceMyelinMaps}"
verbose_echo " --mcsigma: ${CorrectionSigma}"
verbose_echo " --regname: ${RegName}"
verbose_echo " --PipelineScripts: ${PipelineScripts}"
sivcek marked this conversation as resolved.
Show resolved Hide resolved
verbose_echo " "

#Naming Conventions
# Do NOT include spaces in any of these names
T1wImage="T1w_acpc_dc"
Expand Down Expand Up @@ -141,6 +159,27 @@ FreeSurferFolder="$T1wFolder"/"$FreeSurferFolder"
AtlasTransform="$AtlasSpaceFolder"/xfms/"$AtlasTransform"
InverseAtlasTransform="$AtlasSpaceFolder"/xfms/"$InverseAtlasTransform"


# ------------------------------------------------------------------------------
# Compliance check
# ------------------------------------------------------------------------------

MPPMode=`opts_GetOpt1 "--mpp-mode" $@`
MPPMode=`opts_DefaultOpt $MPPMode "HCPStyleData"`
Compliance="HCPStyleData"
ComplianceMsg=""
sivcek marked this conversation as resolved.
Show resolved Hide resolved

# -- T2w image

if [ `${FSLDIR}/bin/imtest ${T2wFolder}/T2w` -eq 0 ]; then
ComplianceMsg+=" T2w image not present"
Compliance="LegacyStyleData"
T2wRestoreImage="NONE"
fi

check_mpp_compliance "${MPPMode}" "${Compliance}" "${ComplianceMsg}"


#Conversion of FreeSurfer Volumes and Surfaces to NIFTI and GIFTI and Create Caret Files and Registration
log_Msg "Conversion of FreeSurfer Volumes and Surfaces to NIFTI and GIFTI and Create Caret Files and Registration"
log_Msg "RegName: ${RegName}"
Expand Down Expand Up @@ -184,7 +223,6 @@ argList+="$T1wRestoreImage " # ${7} Called T1wImage in CreateRibbon.s
argList+="$FreeSurferLabels " # ${8}
"$PipelineScripts"/CreateRibbon.sh ${argList}


#Myelin Mapping
log_Msg "Myelin Mapping"
log_Msg "RegName: ${RegName}"
Expand Down Expand Up @@ -230,4 +268,8 @@ argList+="$CorrectionSigma "
argList+="$RegName " # ${39}
"$PipelineScripts"/CreateMyelinMaps.sh ${argList}

verbose_green_echo "---> Finished Post FreeSurfer Pipeline"
sivcek marked this conversation as resolved.
Show resolved Hide resolved
verbose_echo " "

log_Msg "Completed"

59 changes: 51 additions & 8 deletions PostFreeSurfer/PostFreeSurferPipeline_1res.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ set -e
script_name=$(basename "${0}")

if [ -z "${HCPPIPEDIR}" ]; then
echo "${script_name}: ABORTING: HCPPIPEDIR environment variable must be set"
exit 1
echo "${script_name}: ABORTING: HCPPIPEDIR environment variable must be set"
exit 1
else
echo "${script_name}: HCPPIPEDIR: ${HCPPIPEDIR}"
echo "${script_name}: HCPPIPEDIR: ${HCPPIPEDIR}"
fi

if [ -z "${HCPPIPEDIR_PostFS}" ]; then
echo "${script_name}: ABORTING: HCPPIPEDIR_PostFS environment variable must be set"
exit 1
echo "${script_name}: ABORTING: HCPPIPEDIR_PostFS environment variable must be set"
exit 1
else
echo "${script_name}: HCPPIPEDIR_PostFS: ${HCPPIPEDIR_PostFS}"
echo "${script_name}: HCPPIPEDIR_PostFS: ${HCPPIPEDIR_PostFS}"
fi

########################################## PIPELINE OVERVIEW ##########################################
Expand All @@ -37,8 +37,8 @@ fi
# Load Function Libraries
# --------------------------------------------------------------------------------

source $HCPPIPEDIR/global/scripts/log.shlib # Logging related functions
source $HCPPIPEDIR/global/scripts/opts.shlib # Command line option functions
source ${HCPPIPEDIR}/global/scripts/log.shlib # Logging related functions
source ${HCPPIPEDIR}/global/scripts/opts.shlib # Command line option functions

########################################## SUPPORT FUNCTIONS ##########################################

Expand Down Expand Up @@ -89,6 +89,24 @@ InflateExtraScale=`opts_DefaultOpt $InflateExtraScale 1`

PipelineScripts=${HCPPIPEDIR_PostFS}

verbose_red_echo "---> Starting Post FreeSurfer Pipeline 1res"
verbose_echo " "
verbose_echo " Using parameters ..."
verbose_echo " --path: ${StudyFolder}"
verbose_echo " --subject: ${Subject}"
verbose_echo " --surfatlasdir: ${SurfaceAtlasDIR}"
verbose_echo " --grayordinatesdir: ${GrayordinatesSpaceDIR}"
verbose_echo " --grayordinatesres: ${GrayordinatesResolutions}"
verbose_echo " --hiresmesh: ${HighResMesh}"
verbose_echo " --lowresmesh: ${LowResMeshes}"
verbose_echo " --subcortgraylabels: ${SubcorticalGrayLabels}"
verbose_echo " --freesurferlabels: ${FreeSurferLabels}"
verbose_echo " --refmyelinmaps: ${ReferenceMyelinMaps}"
verbose_echo " --mcsigma: ${CorrectionSigma}"
verbose_echo " --regname: ${RegName}"
verbose_echo " --PipelineScripts: ${PipelineScripts}"
verbose_echo " "

#Naming Conventions
# Do NOT include spaces in any of these names
T1wImage="T1w_acpc_dc"
Expand Down Expand Up @@ -140,6 +158,28 @@ FreeSurferFolder="$T1wFolder"/"$FreeSurferFolder"
AtlasTransform="$AtlasSpaceFolder"/xfms/"$AtlasTransform"
InverseAtlasTransform="$AtlasSpaceFolder"/xfms/"$InverseAtlasTransform"


# ------------------------------------------------------------------------------
# Compliance check
# ------------------------------------------------------------------------------

MPPMode=`opts_GetOpt1 "--mpp-mode" $@`
MPPMode=`opts_DefaultOpt $MPPMode "HCPStyleData"`
Compliance="HCPStyleData"
ComplianceMsg=""

# -- T2w image

if [ `${FSLDIR}/bin/imtest ${T2wFolder}/T2w` -eq 0 ]; then
ComplianceMsg+=" T2w image not present"
Compliance="LegacyStyleData"
T2wRestoreImage="NONE"
fi

check_mpp_compliance "${MPPMode}" "${Compliance}" "${ComplianceMsg}"



#Conversion of FreeSurfer Volumes and Surfaces to NIFTI and GIFTI and Create Caret Files and Registration
log_Msg "Conversion of FreeSurfer Volumes and Surfaces to NIFTI and GIFTI and Create Caret Files and Registration"
log_Msg "RegName: ${RegName}"
Expand Down Expand Up @@ -215,4 +255,7 @@ argList+="$CorrectionSigma "
argList+="$RegName " # ${39}
"$PipelineScripts"/CreateMyelinMaps_1res.sh ${argList}

verbose_green_echo "---> Finished Post FreeSurfer Pipeline 1res"
verbose_echo " "

log_Msg "Completed"
Loading