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

Stand Alone MSMSulc.sh script #290

Merged
merged 23 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef0b056
Create MSMSulc.sh
nagedem Apr 9, 2024
2d61793
removed if conditional, adjusted indentations, removed redundant rota…
nagedem Apr 10, 2024
b82f64c
Update global/scripts/MSMSulc.sh
nagedem Apr 11, 2024
c3a1bc6
removed rotated sphere generation from MSMSulc.sh, run MSMSulc.sh in …
nagedem Apr 22, 2024
bba2029
updated MSMSulc.sh
nagedem Apr 23, 2024
2b89908
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem Apr 23, 2024
06928b9
Update MSMSulc.sh
nagedem Apr 26, 2024
5ea18ff
Update MSMSulc.sh
nagedem Apr 26, 2024
90f15fc
Update global/scripts/MSMSulc.sh
nagedem Apr 26, 2024
ce31759
Update global/scripts/MSMSulc.sh
nagedem Apr 26, 2024
ade44da
Update global/scripts/MSMSulc.sh
nagedem Apr 26, 2024
77af7bb
Update global/scripts/MSMSulc.sh
nagedem Apr 26, 2024
0d42906
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem Apr 26, 2024
ee781b8
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem Apr 26, 2024
240e677
Update MSMSulc.sh
nagedem Apr 26, 2024
4fe260a
Merge branch 'master' of https://github.com/nagedem/HCPpipelines
nagedem Apr 26, 2024
9dbc84d
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem Apr 26, 2024
0093d35
set B for both hemispheres
nagedem Apr 29, 2024
9b1bad6
Update MSMSulc.sh
nagedem Apr 29, 2024
d570be3
Update MSMSulc.sh
nagedem Apr 29, 2024
70c3cce
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem Apr 29, 2024
170e44b
Update MSMSulc.sh
nagedem Apr 30, 2024
afbff24
Update FreeSurfer2CaretConvertAndRegisterNonlinear.sh
nagedem May 3, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -412,46 +412,22 @@ for Hemisphere in L R ; do
${CARET7DIR}/wb_command -metric-math "ln(var) / ln (2)" "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainR_FS.native.shape.gii -var var "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainR_FS.native.shape.gii
rm "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".Strain_FS.native.shape.gii

#Calculate Affine Transform and Apply
${CARET7DIR}/wb_command -surface-affine-regression "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.reg.reg_LR.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/rotate.${Hemisphere}.mat
${CARET7DIR}/wb_command -surface-apply-affine "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/rotate.${Hemisphere}.mat "$AtlasSpaceFolder"/"$NativeFolder"/${Hemisphere}.sphere_rot.surf.gii
${CARET7DIR}/wb_command -surface-modify-sphere "$AtlasSpaceFolder"/"$NativeFolder"/${Hemisphere}.sphere_rot.surf.gii 100 "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.rot.native.surf.gii

rm -f "$AtlasSpaceFolder"/"$NativeFolder"/${Hemisphere}.sphere_rot.surf.gii rotate.${Hemisphere}.mat

#If desired, run MSMSulc folding-based registration to FS_LR initialized with FS affine
if [ ${RegName} = "MSMSulc" ] ; then
#Calculate Affine Transform and Apply
if [ ! -e "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc ] ; then
mkdir "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc
coalsont marked this conversation as resolved.
Show resolved Hide resolved
fi
${CARET7DIR}/wb_command -surface-affine-regression "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.reg.reg_LR.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.mat
${CARET7DIR}/wb_command -surface-apply-affine "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.mat "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere_rot.surf.gii
${CARET7DIR}/wb_command -surface-modify-sphere "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere_rot.surf.gii 100 "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere_rot.surf.gii
cp "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere_rot.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.rot.native.surf.gii
DIR=$(pwd)
cd "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc
#Register using FreeSurfer Sulc Folding Map Using MSM Algorithm Configured for Reduced Distortion
#${MSMBINDIR}/msm --version
#${MSMBINDIR}/msm --levels=4 --conf=${MSMCONFIGDIR}/allparameterssulcDRconf --inmesh="$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.rot.native.surf.gii --trans="$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.rot.native.surf.gii --refmesh="$AtlasSpaceFolder"/"$Subject"."$Hemisphere".sphere."$HighResMesh"k_fs_LR.surf.gii --indata="$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sulc.native.shape.gii --refdata="$AtlasSpaceFolder"/${Subject}.${Hemisphere}.refsulc."$HighResMesh"k_fs_LR.shape.gii --out="$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}. --verbose
${MSMBINDIR}/msm --conf=${MSMCONFIGDIR}/MSMSulcStrainFinalconf --inmesh="$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.rot.native.surf.gii --refmesh="$AtlasSpaceFolder"/"$Subject"."$Hemisphere".sphere."$HighResMesh"k_fs_LR.surf.gii --indata="$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sulc.native.shape.gii --refdata="$AtlasSpaceFolder"/${Subject}.${Hemisphere}.refsulc."$HighResMesh"k_fs_LR.shape.gii --out="$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}. --verbose
cp ${MSMCONFIGDIR}/MSMSulcStrainFinalconf "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.logdir/conf
cd $DIR
#cp "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.HIGHRES_transformed.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.surf.gii
cp "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere.reg.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.surf.gii
${CARET7DIR}/wb_command -set-structure "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.surf.gii ${Structure}

#Make MSMSulc Registration Areal Distortion Maps
${CARET7DIR}/wb_command -surface-vertex-areas "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.shape.gii
${CARET7DIR}/wb_command -surface-vertex-areas "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.shape.gii
${CARET7DIR}/wb_command -metric-math "ln(spherereg / sphere) / ln(2)" "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_MSMSulc.native.shape.gii -var sphere "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.shape.gii -var spherereg "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.shape.gii
rm "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.shape.gii "$AtlasSpaceFolder"/"$NativeFolder"/${Subject}.${Hemisphere}.sphere.MSMSulc.native.shape.gii
${CARET7DIR}/wb_command -set-map-names "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_MSMSulc.native.shape.gii -map 1 "$Subject"_"$Hemisphere"_Areal_Distortion_MSMSulc
${CARET7DIR}/wb_command -metric-palette "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_MSMSulc.native.shape.gii MODE_AUTO_SCALE -palette-name ROY-BIG-BL -thresholding THRESHOLD_TYPE_NORMAL THRESHOLD_TEST_SHOW_OUTSIDE -1 1

${CARET7DIR}/wb_command -surface-distortion "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.MSMSulc.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".EdgeDistortion_MSMSulc.native.shape.gii -edge-method

${CARET7DIR}/wb_command -surface-distortion "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.MSMSulc.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".Strain_MSMSulc.native.shape.gii -local-affine-method
${CARET7DIR}/wb_command -metric-merge "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainJ_MSMSulc.native.shape.gii -metric "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".Strain_MSMSulc.native.shape.gii -column 1
${CARET7DIR}/wb_command -metric-merge "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainR_MSMSulc.native.shape.gii -metric "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".Strain_MSMSulc.native.shape.gii -column 2
${CARET7DIR}/wb_command -metric-math "ln(var) / ln (2)" "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainJ_MSMSulc.native.shape.gii -var var "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainJ_MSMSulc.native.shape.gii
${CARET7DIR}/wb_command -metric-math "ln(var) / ln (2)" "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainR_MSMSulc.native.shape.gii -var var "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".StrainR_MSMSulc.native.shape.gii
rm "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".Strain_MSMSulc.native.shape.gii

RegSphere="${AtlasSpaceFolder}/${NativeFolder}/${Subject}.${Hemisphere}.sphere.MSMSulc.native.surf.gii"
mkdir -p "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc

coalsont marked this conversation as resolved.
Show resolved Hide resolved
cp "$AtlasSpaceFolder"/"$NativeFolder"/"$Subject"."$Hemisphere".sphere.rot.native.surf.gii "$AtlasSpaceFolder"/"$NativeFolder"/MSMSulc/${Hemisphere}.sphere_rot.surf.gii

$HCPPIPEDIR/global/scripts/MSMSulc.sh --subject-dir="$StudyFolder" --subject="$Subject" --regname="$RegName" --hemi "$Hemisphere"

RegSphere="${AtlasSpaceFolder}/${NativeFolder}/${Subject}.${Hemisphere}.sphere."$RegName".native.surf.gii"
else
RegSphere="${AtlasSpaceFolder}/${NativeFolder}/${Subject}.${Hemisphere}.sphere.reg.reg_LR.native.surf.gii"
fi
Expand Down
124 changes: 124 additions & 0 deletions global/scripts/MSMSulc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/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" "$@"

#description of script/command
opts_SetScriptDescription "Run MSMSulc registration and save distortion outputs"

opts_AddMandatory '--subject-dir' 'SubjectDir' 'path' "folder containing all subjects"
opts_AddMandatory '--subject' 'Subject' 'subject ID' "subject-id"
opts_AddMandatory '--regname' 'RegName' 'my reg' "set a new registration name"
opts_AddOptional '--msm-conf' 'ConfFile' 'conf file' "provide the name of the configuration file, default MSMSulcStrainFinalconf" "$MSMCONFIGDIR"/MSMSulcStrainFinalconf
opts_AddOptional '--hemi' 'Hemi' 'hemisphere' "provide hemisphere for registration, L=Left, R=Right, default B=Both" "B"
opts_AddOptional '--refmesh' 'RefMesh' 'ref mesh' "provide alternate standard sphere, default 164k_fs_LR, use .HEMISPHERE. instead of .L. or .R."
opts_AddOptional '--refdata' 'RefData' 'ref data' "provide alternate reference data, use .HEMISPHERE. instead of .L. or .R."

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

#display the parsed/default values
opts_ShowValues

#set paths
SurfaceTemplateFolder="$HCPPIPEDIR"/global/templates/standard_mesh_atlases
NonlinearFolder="$SubjectDir"/"$Subject"/MNINonLinear
NativeFolder="$NonlinearFolder"/Native

#if user provided --refmesh but not --refdata, scream
if [[ "$RefMesh" != "" && "$RefData" == "" ]]
then
log_Err_Abort "Non-default standard sphere provided, but no non-default reference data"
fi

if [[ "$RefMesh" == "" ]]
then
RefMesh="$SurfaceTemplateFolder"/fsaverage.HEMISPHERE_LR.spherical_std.164k_fs_LR.surf.gii
fi

if [[ "$RefData" == "" ]]
then
RefData="$SurfaceTemplateFolder"/HEMISPHERE.refsulc.164k_fs_LR.shape.gii
fi

#Make MSMSulc Directory
mkdir -p "$NativeFolder"/"$RegName"

#Loop through left and right hemispheres
if [[ "$Hemi" == *B* ]]
then
Hemi="L R"
fi

for Hemisphere in $Hemi ; do

if [[ "$Hemisphere" == "L" ]] ; then
Structure="CORTEX_LEFT"
elif [[ "$Hemisphere" == "R" ]] ; then
Structure="CORTEX_RIGHT"
else
log_Err_Abort "unrecognized hemisphere identifier '$Hemisphere', use L, R, or B for both"
fi

#convert relative to absolute for correctness after cd, restrict HEMISPHERE replacement to filename only
RefMeshFile=$(basename -- "$RefMesh")
ReferenceMesh="$(cd "$(dirname -- "$RefMesh")"; pwd)/${RefMeshFile/HEMISPHERE/$Hemisphere}"
RefDataFile=$(basename -- "$RefData")
ReferenceData="$(cd "$(dirname -- "$RefData")"; pwd)/${RefDataFile/HEMISPHERE/$Hemisphere}"
(
cd "$NativeFolder"/"$RegName"

#Register using FreeSurfer Sulc Folding Map Using MSM Algorithm Configured for Reduced Distortion
"$MSMBINDIR"/msm --conf="$ConfFile" --inmesh="$NativeFolder"/"$Subject"."$Hemisphere".sphere.rot.native.surf.gii --refmesh="$ReferenceMesh" --indata="$NativeFolder"/"$Subject"."$Hemisphere".sulc.native.shape.gii --refdata="$ReferenceData" --out="$NativeFolder"/"$RegName"/"$Hemisphere". --verbose
)

cp "$ConfFile" "$NativeFolder"/"$RegName"/"$Hemisphere".logdir/conf
cp "$NativeFolder"/"$RegName"/"$Hemisphere".sphere.reg.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".sphere."$RegName".native.surf.gii

wb_command -set-structure "$NativeFolder"/"$Subject"."$Hemisphere".sphere."$RegName".native.surf.gii "$Structure"

wb_command -surface-distortion "$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".sphere."$RegName".native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_"$RegName".native.shape.gii
wb_command -set-map-names "$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_"$RegName".native.shape.gii -map 1 "$Subject"_"$Hemisphere"_Areal_Distortion_"$RegName"
wb_command -metric-palette "$NativeFolder"/"$Subject"."$Hemisphere".ArealDistortion_"$RegName".native.shape.gii MODE_AUTO_SCALE -palette-name ROY-BIG-BL -thresholding THRESHOLD_TYPE_NORMAL THRESHOLD_TEST_SHOW_OUTSIDE -1 1

wb_command -surface-distortion "$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".sphere."$RegName".native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".EdgeDistortion_"$RegName".native.shape.gii -edge-method
wb_command -surface-distortion "$NativeFolder"/"$Subject"."$Hemisphere".sphere.native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".sphere."$RegName".native.surf.gii "$NativeFolder"/"$Subject"."$Hemisphere".Strain_"$RegName".native.shape.gii -local-affine-method -log2

wb_command -metric-merge "$NativeFolder"/"$Subject"."$Hemisphere".StrainJ_"$RegName".native.shape.gii -metric "$NativeFolder"/"$Subject"."$Hemisphere".Strain_"$RegName".native.shape.gii -column 1
wb_command -metric-merge "$NativeFolder"/"$Subject"."$Hemisphere".StrainR_"$RegName".native.shape.gii -metric "$NativeFolder"/"$Subject"."$Hemisphere".Strain_"$RegName".native.shape.gii -column 2

rm "$NativeFolder"/"$Subject"."$Hemisphere".Strain_"$RegName".native.shape.gii
done

if [[ "$Hemi" == *L* && "$Hemi" == *R* ]] ; then
coalsont marked this conversation as resolved.
Show resolved Hide resolved
#Create CIFTI Files
wb_command -cifti-create-dense-scalar "$NativeFolder"/"$Subject".ArealDistortion_"$RegName".native.dscalar.nii -left-metric "$NativeFolder"/"$Subject".L.ArealDistortion_"$RegName".native.shape.gii -right-metric "$NativeFolder"/"$Subject".R.ArealDistortion_"$RegName".native.shape.gii
wb_command -set-map-names "$NativeFolder"/"$Subject".ArealDistortion_"$RegName".native.dscalar.nii -map 1 "$Subject"_ArealDistortion_"$RegName"
wb_command -cifti-palette "$NativeFolder"/"$Subject".ArealDistortion_"$RegName".native.dscalar.nii MODE_USER_SCALE "$NativeFolder"/"$Subject".ArealDistortion_"$RegName".native.dscalar.nii -pos-user 0 1 -neg-user 0 -1 -interpolate true -palette-name ROY-BIG-BL -disp-pos true -disp-neg true -disp-zero false

wb_command -cifti-create-dense-scalar "$NativeFolder"/"$Subject".EdgeDistortion_"$RegName".native.dscalar.nii -left-metric "$NativeFolder"/"$Subject".L.EdgeDistortion_"$RegName".native.shape.gii -right-metric "$NativeFolder"/"$Subject".R.EdgeDistortion_"$RegName".native.shape.gii
wb_command -set-map-names "$NativeFolder"/"$Subject".EdgeDistortion_"$RegName".native.dscalar.nii -map 1 "$Subject"_EdgeDistortion_"$RegName"
wb_command -cifti-palette "$NativeFolder"/"$Subject".EdgeDistortion_"$RegName".native.dscalar.nii MODE_USER_SCALE "$NativeFolder"/"$Subject".EdgeDistortion_"$RegName".native.dscalar.nii -pos-user 0 1 -neg-user 0 -1 -interpolate true -palette-name ROY-BIG-BL -disp-pos true -disp-neg true -disp-zero false

wb_command -cifti-create-dense-scalar "$NativeFolder"/"$Subject".StrainJ_"$RegName".native.dscalar.nii -left-metric "$NativeFolder"/"$Subject".L.StrainJ_"$RegName".native.shape.gii -right-metric "$NativeFolder"/"$Subject".R.StrainJ_"$RegName".native.shape.gii
wb_command -set-map-names "$NativeFolder"/"$Subject".StrainJ_"$RegName".native.dscalar.nii -map 1 "$Subject"_StrainJ_"$RegName"
wb_command -cifti-palette "$NativeFolder"/"$Subject".StrainJ_"$RegName".native.dscalar.nii MODE_USER_SCALE "$NativeFolder"/"$Subject".StrainJ_"$RegName".native.dscalar.nii -pos-user 0 1 -neg-user 0 -1 -interpolate true -palette-name ROY-BIG-BL -disp-pos true -disp-neg true -disp-zero false

wb_command -cifti-create-dense-scalar "$NativeFolder"/"$Subject".StrainR_"$RegName".native.dscalar.nii -left-metric "$NativeFolder"/"$Subject".L.StrainR_"$RegName".native.shape.gii -right-metric "$NativeFolder"/"$Subject".R.StrainR_"$RegName".native.shape.gii
wb_command -set-map-names "$NativeFolder"/"$Subject".StrainR_"$RegName".native.dscalar.nii -map 1 "$Subject"_StrainR_"$RegName"
wb_command -cifti-palette "$NativeFolder"/"$Subject".StrainR_"$RegName".native.dscalar.nii MODE_USER_SCALE "$NativeFolder"/"$Subject".StrainR_"$RegName".native.dscalar.nii -pos-user 0 1 -neg-user 0 -1 -interpolate true -palette-name ROY-BIG-BL -disp-pos true -disp-neg true -disp-zero false
fi