diff --git a/Examples/Scripts/RunHippUnfoldHCP.sh b/Examples/Scripts/RunHippUnfoldHCP.sh new file mode 100755 index 000000000..cfbd871c1 --- /dev/null +++ b/Examples/Scripts/RunHippUnfoldHCP.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +get_batch_options() { + local arguments=("$@") + + command_line_specified_study_folder="" + command_line_specified_subject="" + command_line_specified_run_local="FALSE" + + local index=0 + local numArgs=${#arguments[@]} + local argument + + while [ ${index} -lt ${numArgs} ]; do + argument=${arguments[index]} + + case ${argument} in + --StudyFolder=*) + command_line_specified_study_folder=${argument#*=} + index=$(( index + 1 )) + ;; + --Subject=*) + command_line_specified_subject=${argument#*=} + index=$(( index + 1 )) + ;; + --runlocal) + command_line_specified_run_local="TRUE" + index=$(( index + 1 )) + ;; + *) + echo "" + echo "ERROR: Unrecognized Option: ${argument}" + echo "" + exit 1 + ;; + esac + done +} + +get_batch_options "$@" + +StudyFolder="${HOME}/projects/Pipelines_ExampleData" #Location of Subject folders (named by SubjectID) +Subjlist="100307 100610" #Space delimited list of subject IDs +EnvironmentScript="${HOME}/projects/Pipelines/Examples/Scripts/SetUpHCPPipeline.sh" #Pipeline environment script + +if [ -n "${command_line_specified_study_folder}" ]; then + StudyFolder="${command_line_specified_study_folder}" +fi + +if [ -n "${command_line_specified_subject}" ]; then + Subjlist="${command_line_specified_subject}" +fi + +#Set up pipeline environment variables and software +source "$EnvironmentScript" + +# Log the originating call +echo "$@" + +#NOTE: syntax for QUEUE has changed compared to earlier pipeline releases, +#DO NOT include "-q " at the beginning +#default to no queue, implying run local +QUEUE="" +#QUEUE="hcp_priority.q" + +########################################## INPUTS ########################################## + +#Scripts called by this script do assume they run on the outputs of the PostFreeSurfer Pipeline + +######################################### DO WORK ########################################## + +for Subject in $Subjlist ; do + echo $Subject + + if [[ "${command_line_specified_run_local}" == "TRUE" || "$QUEUE" == "" ]] ; then + echo "About to locally run ${HCPPIPEDIR}/HippUnfoldHCP/HippUnfoldHCP.sh" + queuing_command=("$HCPPIPEDIR"/global/scripts/captureoutput.sh) + else + echo "About to use fsl_sub to queue ${HCPPIPEDIR}/HippUnfoldHCP/HippUnfoldHCP.sh" + queuing_command=("$FSLDIR/bin/fsl_sub" -q "$QUEUE") + fi + + "${queuing_command[@]}" "$HCPPIPEDIR"/HippUnfoldHCP/HippUnfoldHCP.sh \ + --study-folder="$StudyFolder" \ + --subject="$Subject" \ + + # The following lines are used for interactive debugging to set the positional parameters: $1 $2 $3 ... + + echo "set -- --study-folder=$StudyFolder \ + --subject=$Subject" \ + + echo ". ${EnvironmentScript}" + +done diff --git a/Examples/Scripts/RunPostHippUnfoldHCP.sh b/Examples/Scripts/RunPostHippUnfoldHCP.sh new file mode 100755 index 000000000..b7134559a --- /dev/null +++ b/Examples/Scripts/RunPostHippUnfoldHCP.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +get_batch_options() { + local arguments=("$@") + + command_line_specified_study_folder="" + command_line_specified_subject="" + command_line_specified_run_local="FALSE" + + local index=0 + local numArgs=${#arguments[@]} + local argument + + while [ ${index} -lt ${numArgs} ]; do + argument=${arguments[index]} + + case ${argument} in + --StudyFolder=*) + command_line_specified_study_folder=${argument#*=} + index=$(( index + 1 )) + ;; + --Subject=*) + command_line_specified_subject=${argument#*=} + index=$(( index + 1 )) + ;; + --runlocal) + command_line_specified_run_local="TRUE" + index=$(( index + 1 )) + ;; + *) + echo "" + echo "ERROR: Unrecognized Option: ${argument}" + echo "" + exit 1 + ;; + esac + done +} + +get_batch_options "$@" + +StudyFolder="${HOME}/projects/Pipelines_ExampleData" #Location of Subject folders (named by SubjectID) +Subjlist="100307 100610" #Space delimited list of subject IDs +EnvironmentScript="${HOME}/projects/Pipelines/Examples/Scripts/SetUpHCPPipeline.sh" #Pipeline environment script + +if [ -n "${command_line_specified_study_folder}" ]; then + StudyFolder="${command_line_specified_study_folder}" +fi + +if [ -n "${command_line_specified_subject}" ]; then + Subjlist="${command_line_specified_subject}" +fi + +#Set up pipeline environment variables and software +source "$EnvironmentScript" + +# Log the originating call +echo "$@" + +#NOTE: syntax for QUEUE has changed compared to earlier pipeline releases, +#DO NOT include "-q " at the beginning +#default to no queue, implying run local +QUEUE="" +#QUEUE="hcp_priority.q" + +########################################## INPUTS ########################################## + +#Scripts called by this script do assume they run on the outputs of the PostFreeSurfer Pipeline + +######################################### DO WORK ########################################## + +for Subject in $Subjlist ; do + echo $Subject + + if [[ "${command_line_specified_run_local}" == "TRUE" || "$QUEUE" == "" ]] ; then + echo "About to locally run ${HCPPIPEDIR}/HippUnfoldHCP/PostHippUnfoldHCP.sh" + queuing_command=("$HCPPIPEDIR"/global/scripts/captureoutput.sh) + else + echo "About to use fsl_sub to queue ${HCPPIPEDIR}/HippUnfoldHCP/PostHippUnfoldHCP.sh" + queuing_command=("$FSLDIR/bin/fsl_sub" -q "$QUEUE") + fi + + "${queuing_command[@]}" "$HCPPIPEDIR"/HippUnfoldHCP/PostHippUnfoldHCP.sh \ + --study-folder="$StudyFolder" \ + --subject="$Subject" \ + + # The following lines are used for interactive debugging to set the positional parameters: $1 $2 $3 ... + + echo "set -- --study-folder=$StudyFolder \ + --subject=$Subject" \ + + echo ". ${EnvironmentScript}" + +done diff --git a/Examples/Scripts/SetUpHCPPipeline.sh b/Examples/Scripts/SetUpHCPPipeline.sh index 048444dbf..c59ab2646 100644 --- a/Examples/Scripts/SetUpHCPPipeline.sh +++ b/Examples/Scripts/SetUpHCPPipeline.sh @@ -26,6 +26,8 @@ export MATLAB_COMPILER_RUNTIME=/export/matlab/MCR/R2017b/v93 # If a suitable version of wb_command is on your $PATH, CARET7DIR can be blank export CARET7DIR= export HCPCIFTIRWDIR="$HCPPIPEDIR"/global/matlab/cifti-matlab +export HIPPUNFOLDPATH="${HOME}/pipeline_tools/HippUnfold/khanlab_hippunfold_latest.sif" +export HIPPUNFOLD_CACHE_DIR="${HOME}/.cache/hippunfold" ## Set up FSL (if not already done so in the running environment) ## Uncomment the following 2 lines (remove the leading #) and correct the FSLDIR setting for your setup diff --git a/HippUnfoldHCP/HippUnfoldHCP.sh b/HippUnfoldHCP/HippUnfoldHCP.sh new file mode 100755 index 000000000..68f5a5372 --- /dev/null +++ b/HippUnfoldHCP/HippUnfoldHCP.sh @@ -0,0 +1,101 @@ +#!/bin/bash +set -eu +pipedirguessed=0 +if [[ "${HCPPIPEDIR:-}" == "" ]] +then + # pipedirguessed=1 + #fix this if the script is more than one level below HCPPIPEDIR + export HCPPIPEDIR="$(dirname -- "$0")/.." +fi + +source "$HCPPIPEDIR/global/scripts/newopts.shlib" "$@" +source "$HCPPIPEDIR/global/scripts/debug.shlib" "$@" + + +opts_SetScriptDescription "Make some BIDS structures and run HippUnfold" + +opts_AddMandatory '--study-folder' 'StudyFolder' 'path' "folder containing all subjects" +opts_AddMandatory '--subject' 'Subject' 'subject ID' "" +opts_AddOptional '--hippunfold-dir' 'HippUnfoldDIR' 'path' "location of HippUnfold outputs" + +opts_ParseArguments "$@" + +if ((pipedirguessed)) +then + log_Err_Abort "HCPPIPEDIR is not set, you must first source your edited copy of Examples/Scripts/SetUpHCPPipeline.sh" +fi + +opts_ShowValues + +T1wFolder="$StudyFolder/$Subject/T1w" # input data + +if [ -z ${HippUnfoldDIR} ] ; then + HippUnfoldDIR="${T1wFolder}/HippUnfold" +fi + +#Couldn't get non-BIDS to work (wouldn't do anything) +#HippUnfoldT1wFolder="$HippUnfoldDIR/T1w" +#HippUnfoldT2wFolder="$HippUnfoldDIR/T2w" +#HippUnfoldT2wFolder="$HippUnfoldDIR/T1wT2w" + +HippUnfoldT1wFolder="$HippUnfoldDIR/T1w/sub-${Subject}/anat" +HippUnfoldT2wFolder="$HippUnfoldDIR/T2w/sub-${Subject}/anat" +HippUnfoldT1wT2wFolder="$HippUnfoldDIR/T1wT2w/sub-${Subject}/anat" + +HippUnfoldT1wFolderOut="$HippUnfoldDIR/T1w_hippunfold" +HippUnfoldT2wFolderOut="$HippUnfoldDIR/T2w_hippunfold" +HippUnfoldT1wT2wFolderOut="$HippUnfoldDIR/T1wT2w_hippunfold" + + +T1wImage="$T1wFolder/T1w_acpc_dc_restore.nii.gz" +T2wImage="$T1wFolder/T2w_acpc_dc_restore.nii.gz" + + +if [ ! -f "$T1wImage" ]; then + echo "Error: T1w image not found at $T1wImage" >&2 + exit 1 +fi + +if [ ! -f "$T2wImage" ]; then + echo "Error: T2w image not found at $T2wImage" >&2 + exit 1 +fi + + +mkdir -p "$HippUnfoldT1wFolder" "$HippUnfoldT2wFolder" "$HippUnfoldT1wT2wFolder" + +#Couldn't get non-BIDS to work (wouldn't do anything) +#cp "$T1wImage" "$HippUnfoldT1wFolder/${Subject}_T1w_acpc_dc_restore.nii.gz" +#cp "$T2wImage" "$HippUnfoldT1wFolder/${Subject}_T2w_acpc_dc_restore.nii.gz" +#cp "$T1wImage" "$HippUnfoldT2wFolder/${Subject}_T1w_acpc_dc_restore.nii.gz" +#cp "$T2wImage" "$HippUnfoldT2wFolder/${Subject}_T2w_acpc_dc_restore.nii.gz" +#cp "$T1wImage" "$HippUnfoldT1wT2wFolder/${Subject}_T1w_acpc_dc_restore.nii.gz" +#cp "$T2wImage" "$HippUnfoldT1wT2wFolder/${Subject}_T2w_acpc_dc_restore.nii.gz" + +cp "$T1wImage" "$HippUnfoldT1wFolder/sub-${Subject}_T1w.nii.gz" +cp "$T2wImage" "$HippUnfoldT1wFolder/sub-${Subject}_T2w.nii.gz" +cp "$T1wImage" "$HippUnfoldT2wFolder/sub-${Subject}_T1w.nii.gz" +cp "$T2wImage" "$HippUnfoldT2wFolder/sub-${Subject}_T2w.nii.gz" +cp "$T1wImage" "$HippUnfoldT1wT2wFolder/sub-${Subject}_T1w.nii.gz" +cp "$T2wImage" "$HippUnfoldT1wT2wFolder/sub-${Subject}_T2w.nii.gz" + + +log_Msg "Created folder structure under $HippUnfoldDIR and copied T1w and T2w images" +log_Msg "Starting HippUnfold pipeline for subject: $Subject" + +#Couldn't get non-BIDS to work (wouldn't do anything) #Seriously: don't put a $ here... +#apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT1wFolder $HippUnfoldT1wFolder participant --modality T1w --path-T1w $HippUnfoldT1wFolder/{Subject}_T1w_acpc_dc_restore.nii.gz --cores all --force-output --generate_myelin_map +#apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT2wFolder $HippUnfoldT2wFolder participant --modality T2w --path-T2w $HippUnfoldT2wFolder/{Subject}_T2w_acpc_dc_restore.nii.gz --cores all --force-output --generate_myelin_map +#apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT2wFolder $HippUnfoldT2wFolder participant --modality T2w --path-T2w $HippUnfoldT2wFolder/{Subject}_T2w_acpc_dc_restore.nii.gz --cores all --force-output --generate_myelin_map --force-nnunet-model T1T2w + +log_Msg "Running T1w HippUnfold for subject: $Subject" +apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT1wFolder $HippUnfoldT1wFolderOut participant --modality T1w --cores all --force-output --generate_myelin_map --output-density 0p5mm 1mm 2mm +log_Msg "T1w HippUnfold completed." +log_Msg "Running T2w HippUnfold for subject: $Subject" +apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT2wFolder $HippUnfoldT2wFolderOut participant --modality T2w --cores all --force-output --generate_myelin_map --output-density 0p5mm 1mm 2mm +log_Msg "T2w HippUnfold completed." +log_Msg "Running T1wT2w HippUnfold for subject: $Subject" +apptainer run --bind $StudyFolder -e $HIPPUNFOLDPATH $HippUnfoldT1wT2wFolder $HippUnfoldT1wT2wFolderOut participant --modality T1w --cores all --force-output --generate_myelin_map --output-density 0p5mm 1mm 2mm --force-nnunet-model T1T2w +log_Msg "T1wT2w HippUnfold completed." + +log_Msg "HippUnfold pipeline completed successfully for subject: $Subject" diff --git a/HippUnfoldHCP/PostHippUnfoldHCP.sh b/HippUnfoldHCP/PostHippUnfoldHCP.sh new file mode 100755 index 000000000..ff717021f --- /dev/null +++ b/HippUnfoldHCP/PostHippUnfoldHCP.sh @@ -0,0 +1,300 @@ +#!/bin/bash +set -eu +pipedirguessed=0 +if [[ "${HCPPIPEDIR:-}" == "" ]] +then + # pipedirguessed=1 + #fix this if the script is more than one level below HCPPIPEDIR + export HCPPIPEDIR="$(dirname -- "$0")/.." +fi + +source "$HCPPIPEDIR/global/scripts/newopts.shlib" "$@" +source "$HCPPIPEDIR/global/scripts/debug.shlib" "$@" + + +opts_SetScriptDescription "Make some BIDS structures and run HippUnfold" + +opts_AddMandatory '--study-folder' 'StudyFolder' 'path' "folder containing all subjects" +opts_AddMandatory '--subject' 'Subject' 'subject ID' "" +opts_AddOptional '--hippunfold-dir' 'PhysicalHippUnfoldDIR' 'path' "location of HippUnfold outputs" +opts_AddOptional '--atlas-hippunfold-dir' 'AtlasHippUnfoldDIR' 'path' "location of Atlas HippUnfold outputs" + +opts_ParseArguments "$@" + +if ((pipedirguessed)) +then + log_Err_Abort "HCPPIPEDIR is not set, you must first source your edited copy of Examples/Scripts/SetUpHCPPipeline.sh" +fi + +opts_ShowValues + +log_Msg "Starting PostHippUnfold pipeline for subject: $Subject" + +T1wFolder="$StudyFolder/$Subject/T1w" +AtlasFolder="$StudyFolder/$Subject/MNINonLinear" + +if [ -z ${PhysicalHippUnfoldDIR} ] ; then + PhysicalHippUnfoldDIR="${T1wFolder}/HippUnfold" +fi + +if [ -z ${AtlasHippUnfoldDIR} ] ; then + AtlasHippUnfoldDIR="${AtlasFolder}/HippUnfold" +fi + +function PostHippUnfold { +HippUnfoldFolderOut=${1} +PhysicalHippUnfoldFolder=${2} +AtlasHippUnfoldFolder=${3} +T1wFolder=${4} +AtlasFolder=${5} +Subject=${6} +Modality=${7} +Mesh=${8} + +if [ ${Modality} = "T1wT2w" ] ; then + Modality="T1w" + Flag="On" +else + Flag="Off" +fi + +function PALETTE { +File=${1} +Color=${2} +Type=${3} +wb_command=${4} +if [ ${Color} = "GRAY" ] ; then + command="-pos-percent 2 98 -palette-name Gray_Interp -disp-pos true -disp-neg true -disp-zero true" +elif [ ${Color} = "VIDEEN" ] ; then + command="-pos-percent 4 96 -interpolate true -palette-name videen_style -disp-pos true -disp-neg false -disp-zero false" +fi +if [ ${Type} = 'metric' ] ; then + ${wb_command} -metric-palette ${File} MODE_AUTO_SCALE_PERCENTAGE ${command} +elif [ ${Type} = 'cifti' ] ; then + ${wb_command} -cifti-palette ${File} MODE_AUTO_SCALE_PERCENTAGE ${File} ${command} +fi +} + +Structures="dentate hipp" +Surfaces="inner@INNER midthickness@MIDTHICKNESS outer@OUTER" +Scalars="curvature@GRAY@Curvature gyrification@GRAY@Gyrification surfarea@VIDEEN@SurfaceArea thickness@VIDEEN@Thickness myelin@VIDEEN@MyelinMap" +Labels="atlas-multihist7_subfields@HippocampalSubfields" + +for Structure in $Structures ; do + if [ ${Structure} = "dentate" ] ; then + Left="HIPPOCAMPUS_DENTATE_LEFT" + Right="HIPPOCAMPUS_DENTATE_RIGHT" + for Hemisphere in L R ; do + #No dentate thickness is computed by HippUnfold + ${CARET7DIR}/wb_command -surface-to-surface-3d-distance $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_inner.surf.gii $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_outer.surf.gii $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_thickness.shape.gii + done + elif [ ${Structure} = "hipp" ] ; then + Left="HIPPOCAMPUS_LEFT" + Right="HIPPOCAMPUS_RIGHT" + fi + for Hemisphere in L R ; do + if [ ${Hemisphere} = "L" ] ; then + if [ ${Structure} = "dentate" ] ; then + HemiStructure="HIPPOCAMPUS_DENTATE_LEFT" + elif [ ${Structure} = "hipp" ] ; then + HemiStructure="HIPPOCAMPUS_LEFT" + fi + elif [ ${Hemisphere} = "R" ] ; then + if [ ${Structure} = "dentate" ] ; then + HemiStructure="HIPPOCAMPUS_DENTATE_RIGHT" + elif [ ${Structure} = "hipp" ] ; then + HemiStructure="HIPPOCAMPUS_RIGHT" + fi + fi + + #Anatomical Surfaces + for Surface in $Surfaces ; do + SurfaceType=`echo $Surface | cut -d "@" -f 2` + Surface=`echo $Surface | cut -d "@" -f 1` + cp $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_${Surface}.surf.gii ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii + ${CARET7DIR}/wb_command -set-structure ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii ${HemiStructure} -surface-type ANATOMICAL -surface-secondary-type ${SurfaceType} + ${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${HemiStructure} ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii + ${CARET7DIR}/wb_command -surface-apply-warpfield ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii ${AtlasFolder}/xfms/standard2acpc_dc.nii.gz ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii -fnirt ${AtlasFolder}/T1w_restore.nii.gz + ${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${HemiStructure} ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Surface}.${Mesh}.surf.gii + done + + #Flat Surfaces + cp $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-unfold_den-${Mesh}_label-${Structure}_midthickness.surf.gii ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii + ${CARET7DIR}/wb_command -set-structure ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii ${HemiStructure} -surface-type FLAT + ${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${HemiStructure} ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii + cp ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii + ${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${HemiStructure} ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_flat.${Mesh}.surf.gii + + #GIFTI Metrics + #Don't add GIFTI to Specs + for Scalar in $Scalars ; do + Name=`echo $Scalar | cut -d "@" -f 3` + Color=`echo $Scalar | cut -d "@" -f 2` + Scalar=`echo $Scalar | cut -d "@" -f 1` + cp $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_${Scalar}.shape.gii ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii + ${CARET7DIR}/wb_command -set-structure ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii ${HemiStructure} + PALETTE ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii ${Color} metric ${CARET7DIR}/wb_command + ${CARET7DIR}/wb_command -set-map-names ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii -map 1 "${Subject}_${Name}" + if [ $Scalar = "surfarea" ] ; then + ${CARET7DIR}/wb_command -surface-vertex-areas ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_midthickness.${Mesh}.surf.gii ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii + else + cp ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Scalar}.${Mesh}.shape.gii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + fi + done + + #GIFTI Labels + #Don't add GIFTI to Specs + for Label in $Labels ; do + Name=`echo $Label | cut -d "@" -f 2` + Label=`echo $Label | cut -d "@" -f 1` + if [ ${Structure} = "hipp" ] ; then + if [ ${Hemisphere} = "L" ] ; then + Expression="Var" + elif [ ${Hemisphere} = "R" ] ; then + Expression="Var + 8" + fi + ${CARET7DIR}/wb_command -metric-math "${Expression}" ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.shape.gii -var Var $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_${Label}.label.gii + ${CARET7DIR}/wb_command -metric-label-import ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.shape.gii $HCPPIPEDIR/global/config/HippUnfoldLut.txt ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii + elif [ ${Structure} = "dentate" ] ; then + if [ ${Hemisphere} = "L" ] ; then + Expression="6" + elif [ ${Hemisphere} = "R" ] ; then + Expression="6 + 8" + fi + ${CARET7DIR}/wb_command -metric-math "${Expression}" ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.shape.gii -var Var $HippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-${Structure}_${Scalar}.shape.gii + ${CARET7DIR}/wb_command -metric-label-import ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.shape.gii $HCPPIPEDIR/global/config/HippUnfoldLut.txt ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii + fi + ${CARET7DIR}/wb_command -set-structure ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii ${HemiStructure} + ${CARET7DIR}/wb_command -set-map-names ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii -map 1 "${Subject}_${Name}" + cp ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii ${AtlasHippUnfoldFolder}/${Subject}.${Hemisphere}.${Structure}_${Label}.${Mesh}.label.gii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + done + + #NIFTI Hemispheric Labels + cp $HippUnfoldFolderOut/hippunfold/sub-${Subject}/anat/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_desc-subfields_atlas-multihist7_dseg.nii.gz ${PhysicalHippUnfoldFolder}/${Subject}.${Hemisphere}.HippocampalSubfields.nii.gz + done +done + +#CIFTI Scalars +for Scalar in $Scalars ; do + Name=`echo $Scalar | cut -d "@" -f 3` + Color=`echo $Scalar | cut -d "@" -f 2` + Scalar=`echo $Scalar | cut -d "@" -f 1` + ${CARET7DIR}/wb_command -cifti-create-dense-scalar ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii -metric HIPPOCAMPUS_LEFT ${PhysicalHippUnfoldFolder}/${Subject}.L.hipp_${Scalar}.${Mesh}.shape.gii -metric HIPPOCAMPUS_RIGHT ${PhysicalHippUnfoldFolder}/${Subject}.R.hipp_${Scalar}.${Mesh}.shape.gii -metric HIPPOCAMPUS_DENTATE_LEFT ${PhysicalHippUnfoldFolder}/${Subject}.L.dentate_${Scalar}.${Mesh}.shape.gii -metric HIPPOCAMPUS_DENTATE_RIGHT ${PhysicalHippUnfoldFolder}/${Subject}.R.dentate_${Scalar}.${Mesh}.shape.gii + PALETTE ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii ${Color} cifti ${CARET7DIR}/wb_command + ${CARET7DIR}/wb_command -set-map-names ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii -map 1 "${Subject}_${Name}" + ${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + cp ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii ${AtlasHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + ${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${AtlasHippUnfoldFolder}/${Subject}.hippocampus_${Scalar}.${Mesh}.dscalar.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? +done + + +#CIFTI Labels +for Label in $Labels ; do + Name=`echo $Label | cut -d "@" -f 2` + Label=`echo $Label | cut -d "@" -f 1` + ${CARET7DIR}/wb_command -cifti-create-label ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii -label HIPPOCAMPUS_LEFT ${PhysicalHippUnfoldFolder}/${Subject}.L.hipp_${Label}.${Mesh}.label.gii -label HIPPOCAMPUS_RIGHT ${PhysicalHippUnfoldFolder}/${Subject}.R.hipp_${Label}.${Mesh}.label.gii -label HIPPOCAMPUS_DENTATE_LEFT ${PhysicalHippUnfoldFolder}/${Subject}.L.dentate_${Label}.${Mesh}.label.gii -label HIPPOCAMPUS_DENTATE_RIGHT ${PhysicalHippUnfoldFolder}/${Subject}.R.dentate_${Label}.${Mesh}.label.gii + ${CARET7DIR}/wb_command -set-map-names ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii -map 1 "${Subject}_${Name}" + ${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + cp ${PhysicalHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii ${AtlasHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? + ${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${AtlasHippUnfoldFolder}/${Subject}.hippocampus_${Label}.${Mesh}.dlabel.nii #TODO: mv to have maps in AtlasFolder like Cerebral Cortex? +done + +#NIFTI Label Volumes +fslmaths ${PhysicalHippUnfoldFolder}/${Subject}.R.HippocampalSubfields.nii.gz -add 8 -mas ${PhysicalHippUnfoldFolder}/${Subject}.R.HippocampalSubfields.nii.gz -add ${PhysicalHippUnfoldFolder}/${Subject}.L.HippocampalSubfields.nii.gz ${PhysicalHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz +${CARET7DIR}/wb_command -volume-label-import ${PhysicalHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz $HCPPIPEDIR/global/config/HippUnfoldLut.txt ${PhysicalHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz +rm ${PhysicalHippUnfoldFolder}/${Subject}.L.HippocampalSubfields.nii.gz ${PhysicalHippUnfoldFolder}/${Subject}.R.HippocampalSubfields.nii.gz +${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${PhysicalHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz +${CARET7DIR}/wb_command -volume-resample ${PhysicalHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz ${AtlasFolder}/T1w_restore.nii.gz ENCLOSING_VOXEL ${AtlasHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz -warp ${AtlasFolder}/xfms/acpc_dc2standard.nii.gz -fnirt ${AtlasFolder}/T1w_restore.nii.gz +${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${AtlasHippUnfoldFolder}/${Subject}.HippocampalSubfields.nii.gz + +#NIFTI Input Volumes +${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${T1wFolder}/T1w_acpc_dc_restore.nii.gz +${CARET7DIR}/wb_command -add-to-spec-file ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${T1wFolder}/T2w_acpc_dc_restore.nii.gz +${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${AtlasFolder}/T1w_restore.nii.gz +${CARET7DIR}/wb_command -add-to-spec-file ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec INVALID ${AtlasFolder}/T2w_restore.nii.gz + +#TODO: Merge Native Meshes, anything with 0pt5mm meshes? +if [ $Mesh = "2mm" ] ; then + ${CARET7DIR}/wb_command -spec-file-merge ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${T1wFolder}/fsaverage_LR32k/${Subject}.MSMAll.32k_fs_LR.wb.spec ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.MSMAll.32k.wb_spec #TODO: Don't Hardcode Cortex + ${CARET7DIR}/wb_command -spec-file-merge ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${AtlasFolder}/fsaverage_LR32k/${Subject}.MSMAll.32k_fs_LR.wb.spec ${AtlasHippUnfoldFolder}/${Subject}.${Mesh}.MSMAll.32k.wb_spec #TODO: Don't Hardcode Cortex +elif [ $Mesh = "1mm" ] ; then + ${CARET7DIR}/wb_command -spec-file-merge ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.wb_spec ${AtlasFolder}/${Subject}.MSMAll.164k_fs_LR.wb.spec ${PhysicalHippUnfoldFolder}/${Subject}.${Mesh}.MSMAll.164k.wb_spec #TODO: Don't Hardcode Cortex +fi + +if [ ${Flag} = "On" ] ; then + Modality="T1wT2w" +fi + +} + +for Modality in T1w T2w T1wT2w ; do + for Mesh in 0p5mm 1mm 2mm ; do #TODO: Native meshes not yet available from HippUnfold: "Native" Folder Name "native" Mesh Name + + PhysicalHippUnfoldFolderOut="$PhysicalHippUnfoldDIR/${Modality}_hippunfold" + AtlasHippUnfoldolderOut="$AtlasHippUnfoldDIR/${Modality}_hippunfold" + + PhysicalHippUnfoldFolder="$PhysicalHippUnfoldFolderOut/$Mesh" + AtlasHippUnfoldFolder="$AtlasHippUnfoldolderOut/$Mesh" + + mkdir -p ${PhysicalHippUnfoldFolder} ${AtlasHippUnfoldFolder} + + log_Msg "Processing $Modality $Mesh" + PostHippUnfold $PhysicalHippUnfoldFolderOut $PhysicalHippUnfoldFolder $AtlasHippUnfoldFolder $T1wFolder $AtlasFolder $Subject $Modality $Mesh + done +done + +log_Msg "PostHippUnfold pipeline completed successfully for subject: $Subject" + + +#HippUnfold Outputs Used By HCP +#Scalars +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_curvature.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_gyrification.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_myelin.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_surfarea.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_thickness.shape.gii #Not created by default +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_curvature.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_gyrification.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_myelin.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_surfarea.shape.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_thickness.shape.gii + +#Surfaces +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_inner.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_midthickness.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_outer.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_inner.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_midthickness.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_outer.surf.gii + +#Flat Surfaces +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-unfold_den-${Mesh}_label-dentate_midthickness.surf.gii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-unfold_den-${Mesh}_label-hipp_midthickness.surf.gii + +#Labels +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-hipp_atlas-multihist7_subfields.label.gii + +#Specs +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_den-${Mesh}_label-dentate_surfaces.spec +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}den-${Mesh}_label-hipp_surfaces.spec +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}den-${Mesh}_label-dentate_surfaces.spec +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_surfaces.spec + +#CIFTIScalars (recreated by the script) +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-dentate_curvature.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-dentate_gyrification.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-dentate_myelin.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-dentate_surfarea.dscalar.nii #Not created by default +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-dentate_thickness.dscalar.nii #Not created by default +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_curvature.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_gyrification.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_myelin.dscalar.nii +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_surfarea.dscalar.nii #Not created by default +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_thickness.dscalar.nii + +#CIFTILabels (recreated by the script) +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/surf/sub-${Subject}_space-${Modality}_den-${Mesh}_label-hipp_atlas-multihist7_subfields.dlabel.nii + +#VolumeLabels +#$PhysicalHippUnfoldFolderOut/hippunfold/sub-${Subject}/anat/sub-${Subject}_hemi-${Hemisphere}_space-${Modality}_desc-subfields_atlas-multihist7_dseg.nii.gz + diff --git a/global/config/HippUnfoldLut.txt b/global/config/HippUnfoldLut.txt new file mode 100644 index 000000000..179393b15 --- /dev/null +++ b/global/config/HippUnfoldLut.txt @@ -0,0 +1,33 @@ +L_Subiculum +1 41 43 252 255 +L_CA1 +2 102 209 216 255 +L_CA2 +3 0 179 60 255 +L_CA3 +4 255 182 0 255 +L_CA4 +5 255 43 23 255 +L_DentateGyrus +6 245 236 0 255 +L_SLRM +7 119 54 155 255 +L_Cyst +8 255 255 255 255 +R_Subiculum +9 41 43 252 255 +R_CA1 +10 102 209 216 255 +R_CA2 +11 0 179 60 255 +R_CA3 +12 255 182 0 255 +R_CA4 +13 255 43 23 255 +R_DentateGyrus +14 245 236 0 255 +R_SLRM +15 119 54 155 255 +R_Cyst +16 255 255 255 255 + diff --git a/global/matlab/cifti-matlab/private/cifti_parse_xml.m b/global/matlab/cifti-matlab/private/cifti_parse_xml.m index 325b74b90..27d804e16 100644 --- a/global/matlab/cifti-matlab/private/cifti_parse_xml.m +++ b/global/matlab/cifti-matlab/private/cifti_parse_xml.m @@ -264,6 +264,8 @@ function mywarn(msg, filename) case 'CIFTI_STRUCTURE_DIENCEPHALON_VENTRAL_RIGHT'; outstr = 'DIENCEPHALON_VENTRAL_RIGHT'; case 'CIFTI_STRUCTURE_HIPPOCAMPUS_LEFT'; outstr = 'HIPPOCAMPUS_LEFT'; case 'CIFTI_STRUCTURE_HIPPOCAMPUS_RIGHT'; outstr = 'HIPPOCAMPUS_RIGHT'; + case 'CIFTI_STRUCTURE_HIPPOCAMPUS_DENTATE_LEFT'; outstr = 'HIPPOCAMPUS_DENTATE_LEFT'; + case 'CIFTI_STRUCTURE_HIPPOCAMPUS_DENTATE_RIGHT'; outstr = 'HIPPOCAMPUS_DENTATE_RIGHT'; case 'CIFTI_STRUCTURE_OTHER'; outstr = 'OTHER'; case 'CIFTI_STRUCTURE_OTHER_GREY_MATTER'; outstr = 'OTHER_GREY_MATTER'; case 'CIFTI_STRUCTURE_OTHER_WHITE_MATTER'; outstr = 'OTHER_WHITE_MATTER'; diff --git a/global/matlab/cifti-matlab/private/cifti_write_xml.m b/global/matlab/cifti-matlab/private/cifti_write_xml.m index 87524f2e4..46cb757e5 100644 --- a/global/matlab/cifti-matlab/private/cifti_write_xml.m +++ b/global/matlab/cifti-matlab/private/cifti_write_xml.m @@ -143,6 +143,8 @@ case 'DIENCEPHALON_VENTRAL_RIGHT'; outstr = 'CIFTI_STRUCTURE_DIENCEPHALON_VENTRAL_RIGHT'; case 'HIPPOCAMPUS_LEFT'; outstr = 'CIFTI_STRUCTURE_HIPPOCAMPUS_LEFT'; case 'HIPPOCAMPUS_RIGHT'; outstr = 'CIFTI_STRUCTURE_HIPPOCAMPUS_RIGHT'; + case 'HIPPOCAMPUS_DENTATE_LEFT'; outstr = 'CIFTI_STRUCTURE_HIPPOCAMPUS_DENTATE_LEFT'; + case 'HIPPOCAMPUS_DENTATE_RIGHT'; outstr = 'CIFTI_STRUCTURE_HIPPOCAMPUS_DENTATE_RIGHT'; case 'OTHER'; outstr = 'CIFTI_STRUCTURE_OTHER'; case 'OTHER_GREY_MATTER'; outstr = 'CIFTI_STRUCTURE_OTHER_GREY_MATTER'; case 'OTHER_WHITE_MATTER'; outstr = 'CIFTI_STRUCTURE_OTHER_WHITE_MATTER'; @@ -153,7 +155,7 @@ case 'THALAMUS_LEFT'; outstr = 'CIFTI_STRUCTURE_THALAMUS_LEFT'; case 'THALAMUS_RIGHT'; outstr = 'CIFTI_STRUCTURE_THALAMUS_RIGHT'; otherwise - error(['invalid structure name "' instr '"in cifti struct']); + error(['invalid structure name "' instr '" in cifti struct']); end end