Skip to content

Commit

Permalink
Merge pull request #99 from mharms/feature/freesurfer_v6_latest
Browse files Browse the repository at this point in the history
Fix bug created for MR-FIX in interpreted matlab/octave while getting compiled mode working
  • Loading branch information
glasserm authored Mar 14, 2019
2 parents 0e41085 + fe8bdfb commit 124919c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
16 changes: 11 additions & 5 deletions ICAFIX/ReApplyFixMultiRunPipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,18 @@ main()
fi

log_Msg "RegString: ${RegString}"

# For interpreted modes, make sure that matlab/octave have access to the functions they need
# (e.g., read_avw, save_avw, ciftiopen, ciftisave)
# Several environment variables are set in FSL_FIXDIR/settings.sh, which is sourced below for interpreted modes

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

# Some defaults
local aggressive=0
Expand Down
13 changes: 9 additions & 4 deletions ICAFIX/ReApplyFixPipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,16 @@ main()

log_Msg "RegString: ${RegString}"

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

# Some defaults
local aggressive=0
Expand Down
20 changes: 14 additions & 6 deletions ICAFIX/hcp_fix_multi_run
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,18 @@ for fmri in $fmris ; do
## We will use the call_matlab.sh script available in ${FSL_FIXDIR}.
## But the arguments need to be customized depending on the matlab mode, because:
## (1) the -r argument does not support the use of compiled matlab, but is needed for interpreted matlab/octave
## to allow addition of 'addpath' as a command, so that functionhighpassandvariancenormalize.m can be found within matlab/octave
## (2) for compiled matlab, we need to use the -c and -b flags to specify the location of the MCR and the compiled binary
## (we cannot use the defaults in ${FSL_FIXDIR}/settings.sh here, since functionhighpassandvariancenormalize.m is an HCP
## specific script that is not part of the FIX distribution.
## to allow addition of 'addpath' as a command, so that functionhighpassandvariancenormalize.m can be found within matlab/octave.
## (2) for compiled matlab, we need to use the -c and -b flags to specify the location of the MCR and the compiled binary.
## (We cannot use the defaults in ${FSL_FIXDIR}/settings.sh here, since functionhighpassandvariancenormalize.m is an HCP
## specific script that is not part of the FIX distribution).

# For interpreted modes, make sure that matlab/octave has access to the functions it needs.
# normalise.m (needed by functionhighpassandvariancenormalize.m) is in '${HCPPIPEDIR}/global/matlab'
# Note that the call_matlab.sh script itself adds ${FSL_FIXDIR} (all the fix-related functions)
# and ${FSL_MATLAB_PATH} (e.g., read_avw.m, save_avw.m) to the matlab path.
# Note that the ciftiopen.m, ciftisave.m functions are added to the path through the ${FSL_FIX_WBC}
# environment variable within fix_3_clean.m itself.
ML_PATHS="addpath('${HCPPIPEDIR}/global/matlab'); addpath('${this_script_dir}/scripts');"

case ${FSL_FIX_MATLAB_MODE} in
0)
Expand All @@ -393,7 +401,7 @@ for fmri in $fmris ; do
1 | 2)
# Use interpreted MATLAB or Octave
# ${hp} needs to be passed in as a string, to handle the hp=pd* case
matlab_cmd="addpath('${this_script_dir}/scripts'); functionhighpassandvariancenormalize(${tr}, '${hp}', '${fmri}', '${Caret7_Command}');"
matlab_cmd="${ML_PATHS} functionhighpassandvariancenormalize(${tr}, '${hp}', '${fmri}', '${Caret7_Command}');"
log_Msg "Run interpreted MATLAB/Octave with command..."
log_Msg "${FSL_FIXDIR}/call_matlab.sh -r ${matlab_cmd}"
${FSL_FIXDIR}/call_matlab.sh -r "${matlab_cmd}" # Note: the semicolon within ${matlab_cmd} needs to be protected with quotation marks
Expand Down Expand Up @@ -561,7 +569,7 @@ case ${FSL_FIX_MATLAB_MODE} in
1 | 2)
# Use interpreted MATLAB or Octave
# ${hp} needs to be passed in as a string, to handle the hp=pd* case
matlab_cmd="addpath('${this_script_dir}/scripts'); functionhighpassandvariancenormalize(${tr}, ${AlreadyHP}, '${concatfmrihp}', '${Caret7_Command}');"
matlab_cmd="${ML_PATHS} functionhighpassandvariancenormalize(${tr}, ${AlreadyHP}, '${concatfmrihp}', '${Caret7_Command}');"
log_Msg "Run interpreted MATLAB/Octave with command..."
log_Msg "${FSL_FIXDIR}/call_matlab.sh -r ${matlab_cmd}"
${FSL_FIXDIR}/call_matlab.sh -r "${matlab_cmd}" # Note: the semicolon within ${matlab_cmd} needs to be protected with quotation marks
Expand Down
Empty file modified global/config/FreeSurferCSFRegLut.txt
100755 → 100644
Empty file.
Empty file modified global/config/FreeSurferCorticalLabelTableLut.txt
100755 → 100644
Empty file.
Empty file modified global/config/FreeSurferWMRegLut.txt
100755 → 100644
Empty file.

0 comments on commit 124919c

Please sign in to comment.