Skip to content

Commit 124919c

Browse files
authored
Merge pull request #99 from mharms/feature/freesurfer_v6_latest
Fix bug created for MR-FIX in interpreted matlab/octave while getting compiled mode working
2 parents 0e41085 + fe8bdfb commit 124919c

File tree

6 files changed

+34
-15
lines changed

6 files changed

+34
-15
lines changed

ICAFIX/ReApplyFixMultiRunPipeline.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,18 @@ main()
449449
fi
450450

451451
log_Msg "RegString: ${RegString}"
452-
453-
# For interpreted modes, make sure that matlab/octave have access to the functions they need
454-
# (e.g., read_avw, save_avw, ciftiopen, ciftisave)
455-
# Several environment variables are set in FSL_FIXDIR/settings.sh, which is sourced below for interpreted modes
452+
453+
# For interpreted modes, make sure that matlab/octave has access to the functions it needs.
454+
# normalise.m (needed by functionhighpassandvariancenormalize.m) is in '${HCPPIPEDIR}/global/matlab'
455+
# Since we are NOT using the ${FSL_FIXDIR}/call_matlab.sh script to invoke matlab (unlike 'hcp_fix_multi_run')
456+
# we need to explicitly add ${FSL_FIXDIR} (all the fix-related functions)
457+
# and ${FSL_MATLAB_PATH} (e.g., read_avw.m, save_avw.m) to the matlab path as well.
458+
# Several additional necessary environment variables (e.g., ${FSL_FIX_CIFTIRW} and ${FSL_FIX_WBC})
459+
# are set in FSL_FIXDIR/settings.sh, which is sourced below for interpreted modes.
460+
# Note that the ciftiopen.m, ciftisave.m functions are added to the path through the ${FSL_FIX_WBC}
461+
# environment variable within fix_3_clean.m itself.
456462
export FSL_MATLAB_PATH="${FSLDIR}/etc/matlab"
457-
local ML_PATHS="addpath('${FSL_MATLAB_PATH}'); addpath('${FSL_FIXDIR}'); addpath('${this_script_dir}/scripts');"
463+
local ML_PATHS="addpath('${FSL_FIXDIR}'); addpath('${FSL_MATLAB_PATH}'); addpath('${HCPPIPEDIR}/global/matlab'); addpath('${this_script_dir}/scripts');"
458464

459465
# Some defaults
460466
local aggressive=0

ICAFIX/ReApplyFixPipeline.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,16 @@ main()
349349

350350
log_Msg "RegString: ${RegString}"
351351

352-
# For interpreted modes, make sure that fix_3_clean has access to the functions it needs
353-
# (e.g., read_avw, save_avw, ciftiopen, ciftisave)
354-
# Several environment variables are set in FSL_FIXDIR/settings.sh, which is sourced below for interpreted modes
352+
# For interpreted modes, make sure that matlab/octave has access to the functions it needs.
353+
# Since we are NOT using the ${FSL_FIXDIR}/call_matlab.sh script to invoke matlab (unlike 'hcp_fix')
354+
# we need to explicitly add ${FSL_FIXDIR} (all the fix-related functions)
355+
# and ${FSL_MATLAB_PATH} (e.g., read_avw.m, save_avw.m) to the matlab path.
356+
# Several additional necessary environment variables (e.g., ${FSL_FIX_CIFTIRW} and ${FSL_FIX_WBC})
357+
# are set in FSL_FIXDIR/settings.sh, which is sourced below for interpreted modes.
358+
# Note that the ciftiopen.m, ciftisave.m functions are added to the path through the ${FSL_FIX_WBC}
359+
# environment variable within fix_3_clean.m itself.
355360
export FSL_MATLAB_PATH="${FSLDIR}/etc/matlab"
356-
local ML_PATHS="addpath('${FSL_MATLAB_PATH}'); addpath('${FSL_FIXDIR}');"
361+
local ML_PATHS="addpath('${FSL_FIXDIR}'); addpath('${FSL_MATLAB_PATH}');"
357362

358363
# Some defaults
359364
local aggressive=0

ICAFIX/hcp_fix_multi_run

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,18 @@ for fmri in $fmris ; do
369369
## We will use the call_matlab.sh script available in ${FSL_FIXDIR}.
370370
## But the arguments need to be customized depending on the matlab mode, because:
371371
## (1) the -r argument does not support the use of compiled matlab, but is needed for interpreted matlab/octave
372-
## to allow addition of 'addpath' as a command, so that functionhighpassandvariancenormalize.m can be found within matlab/octave
373-
## (2) for compiled matlab, we need to use the -c and -b flags to specify the location of the MCR and the compiled binary
374-
## (we cannot use the defaults in ${FSL_FIXDIR}/settings.sh here, since functionhighpassandvariancenormalize.m is an HCP
375-
## specific script that is not part of the FIX distribution.
372+
## to allow addition of 'addpath' as a command, so that functionhighpassandvariancenormalize.m can be found within matlab/octave.
373+
## (2) for compiled matlab, we need to use the -c and -b flags to specify the location of the MCR and the compiled binary.
374+
## (We cannot use the defaults in ${FSL_FIXDIR}/settings.sh here, since functionhighpassandvariancenormalize.m is an HCP
375+
## specific script that is not part of the FIX distribution).
376+
377+
# For interpreted modes, make sure that matlab/octave has access to the functions it needs.
378+
# normalise.m (needed by functionhighpassandvariancenormalize.m) is in '${HCPPIPEDIR}/global/matlab'
379+
# Note that the call_matlab.sh script itself adds ${FSL_FIXDIR} (all the fix-related functions)
380+
# and ${FSL_MATLAB_PATH} (e.g., read_avw.m, save_avw.m) to the matlab path.
381+
# Note that the ciftiopen.m, ciftisave.m functions are added to the path through the ${FSL_FIX_WBC}
382+
# environment variable within fix_3_clean.m itself.
383+
ML_PATHS="addpath('${HCPPIPEDIR}/global/matlab'); addpath('${this_script_dir}/scripts');"
376384

377385
case ${FSL_FIX_MATLAB_MODE} in
378386
0)
@@ -393,7 +401,7 @@ for fmri in $fmris ; do
393401
1 | 2)
394402
# Use interpreted MATLAB or Octave
395403
# ${hp} needs to be passed in as a string, to handle the hp=pd* case
396-
matlab_cmd="addpath('${this_script_dir}/scripts'); functionhighpassandvariancenormalize(${tr}, '${hp}', '${fmri}', '${Caret7_Command}');"
404+
matlab_cmd="${ML_PATHS} functionhighpassandvariancenormalize(${tr}, '${hp}', '${fmri}', '${Caret7_Command}');"
397405
log_Msg "Run interpreted MATLAB/Octave with command..."
398406
log_Msg "${FSL_FIXDIR}/call_matlab.sh -r ${matlab_cmd}"
399407
${FSL_FIXDIR}/call_matlab.sh -r "${matlab_cmd}" # Note: the semicolon within ${matlab_cmd} needs to be protected with quotation marks
@@ -561,7 +569,7 @@ case ${FSL_FIX_MATLAB_MODE} in
561569
1 | 2)
562570
# Use interpreted MATLAB or Octave
563571
# ${hp} needs to be passed in as a string, to handle the hp=pd* case
564-
matlab_cmd="addpath('${this_script_dir}/scripts'); functionhighpassandvariancenormalize(${tr}, ${AlreadyHP}, '${concatfmrihp}', '${Caret7_Command}');"
572+
matlab_cmd="${ML_PATHS} functionhighpassandvariancenormalize(${tr}, ${AlreadyHP}, '${concatfmrihp}', '${Caret7_Command}');"
565573
log_Msg "Run interpreted MATLAB/Octave with command..."
566574
log_Msg "${FSL_FIXDIR}/call_matlab.sh -r ${matlab_cmd}"
567575
${FSL_FIXDIR}/call_matlab.sh -r "${matlab_cmd}" # Note: the semicolon within ${matlab_cmd} needs to be protected with quotation marks

global/config/FreeSurferCSFRegLut.txt

100755100644
File mode changed.

global/config/FreeSurferCorticalLabelTableLut.txt

100755100644
File mode changed.

global/config/FreeSurferWMRegLut.txt

100755100644
File mode changed.

0 commit comments

Comments
 (0)