Skip to content

Commit

Permalink
Log all FIX parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mharms committed Nov 9, 2019
1 parent 503dc8a commit 6ca4875
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 45 deletions.
50 changes: 33 additions & 17 deletions ICAFIX/hcp_fix
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ fi

#############################################################

### Support Functions

# Function to return whether FIX version is "NEW" (i.e., 1.06.12 or later).
# Need at least that fix version for proper handling of the
# do_motion_regression=FALSE condition (when highpass>=0)

# NOTE:
# Don't echo anything in this function other than the last echo
# that outputs the return value

#
determine_old_or_new_fix()
{
# Default to "OLD", and change to "NEW" only if version is 1.06.12 or later
Expand Down Expand Up @@ -120,6 +122,21 @@ determine_old_or_new_fix()
echo ${old_or_new}
}

function interpret_as_bool()
{
case $(echo "$1" | tr '[:upper:]' '[:lower:]') in
(true | yes | 1)
echo TRUE
;;
(false | no | none | 0)
echo FALSE
;;
(*)
log_Err_Abort "error: '$1' is not valid for this argument, please use TRUE or FALSE"
;;
esac
}

#############################################################

# Set global variables
Expand Down Expand Up @@ -170,6 +187,10 @@ log_Msg "FSL_FIX_MATLAB_MODE: ${FSL_FIX_MATLAB_MODE}"

#############################################################

## ---------------------------------------------------------------------------
## Parse and check parameters
## ---------------------------------------------------------------------------

fmri=$1
cd `dirname $fmri`
fmri=`basename $fmri` # After this, $fmri no longer includes the leading directory components
Expand All @@ -180,21 +201,6 @@ fi

hp=$2

function interpret_as_bool()
{
case $(echo "$1" | tr '[:upper:]' '[:lower:]') in
(true | yes | 1)
echo TRUE
;;
(false | no | none | 0)
echo FALSE
;;
(*)
log_Err_Abort "error: '$1' is not valid for this argument, please use TRUE or FALSE"
;;
esac
}

doMotionRegression=$(interpret_as_bool "$3")
# do_motion_regression=FALSE combined with hp filtering doesn't work properly with single-run FIX,
# for fix versions earlier than 1.06.12, so don't allow that mode of operation if the fix version
Expand Down Expand Up @@ -224,13 +230,23 @@ if [ -z "${FixThresh}" ]; then
FixThresh=10
fi

## ---------------------------------------------------------------------------
## Report parameters
## ---------------------------------------------------------------------------

log_Msg "fMRI Name: ${fmri}"
log_Msg "highpass: ${hp}"
log_Msg "doMotionRegression: ${doMotionRegression}"
log_Msg "TrainingData: ${TrainingData}"
log_Msg "FixThresh: ${FixThresh}"
log_Msg "DeleteIntermediates: ${DeleteIntermediates}"

## ---------------------------------------------------------------------------
## Preparation (highpass)
## ---------------------------------------------------------------------------

tr=`$FSLDIR/bin/fslval $fmri pixdim4`
log_Msg "tr: ${tr}"
log_Msg "processing FMRI file ${fmri} with highpass ${hp}"

fmrihp=${fmri}_hp${hp}
if (( hp > 0 )); then
Expand Down
72 changes: 44 additions & 28 deletions ICAFIX/hcp_fix_multi_run
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ FSL_FIX_WBC=${Caret7_Command} # Used by fix_3_clean in interpreted matlab/octav

#############################################################

#
### Support Functions

# NOTE:
# Don't echo anything in this function other than the last echo
# that outputs the return value
Expand Down Expand Up @@ -247,18 +248,40 @@ demeanMovementRegressors() {
echo "${AllOut}" > ${Out}
}

fsl_version_get fsl_ver
log_Msg "FSL version: ${fsl_ver}"
function interpret_as_bool()
{
case $(echo "$1" | tr '[:upper:]' '[:lower:]') in
(true | yes | 1)
echo TRUE
;;
(false | no | none | 0)
echo FALSE
;;
(*)
log_Err_Abort "error: '$1' is not valid for this argument, please use TRUE or FALSE"
;;
esac
}

old_or_new_version=$(determine_old_or_new_fsl ${fsl_ver})
#############################################################

## ---------------------------------------------------------------------------
## Check whether FSL version is recent enough
## ---------------------------------------------------------------------------

old_or_new_version=$(determine_old_or_new_fsl ${fsl_ver})
if [ "${old_or_new_version}" == "OLD" ] ; then
log_Err_Abort "FSL version 6.0.1 or greater is required."
fi

## ---------------------------------------------------------------------------
## Parse and check parameters
## ---------------------------------------------------------------------------

fmris=`echo ${1} | sed 's/@/ /g'` # replaces the @ that combines the filenames with ' '

hp=$2
if [[ "${hp}" == "0" ]]; then
log_Msg "hp=0 corresponds to a linear detrend"
pdFlag=TRUE
fi
if [[ "${hp}" == pd* ]]; then
Expand All @@ -277,27 +300,7 @@ if [[ $(echo "${hpNum} < 0" | bc) == "1" ]]; then #Logic of this script does no
log_Err_Abort "highpass value must not be negative"
fi

log_Msg "hp: ${hp}"

fmris=`echo ${1} | sed 's/@/ /g'` # replaces the @ that combines the filenames with ' '
log_Msg "fmris: ${fmris}"
ConcatName="${3}"
log_Msg "ConcatName: ${ConcatName}"

function interpret_as_bool()
{
case $(echo "$1" | tr '[:upper:]' '[:lower:]') in
(true | yes | 1)
echo TRUE
;;
(false | no | none | 0)
echo FALSE
;;
(*)
log_Err_Abort "error: '$1' is not valid for this argument, please use TRUE or FALSE"
;;
esac
}

doMotionRegression=$(interpret_as_bool "$4")

Expand All @@ -316,10 +319,23 @@ if [ -z "${FixThresh}" ]; then
FixThresh=10
fi

DIR=`pwd`
log_Msg "PWD : $DIR"
## ---------------------------------------------------------------------------
## Report parameters
## ---------------------------------------------------------------------------

#echo $fmris | tr ' ' '\n' #separates paths separated by ' '
log_Msg "fMRI Names: ${fmris}"
log_Msg "highpass: ${hp}"
if [[ "${hp}" == "0" ]]; then
log_Msg "hp=0 corresponds to a linear detrend"
fi
log_Msg "ConcatName: ${ConcatName}"
log_Msg "doMotionRegression: ${doMotionRegression}"
log_Msg "TrainingData: ${TrainingData}"
log_Msg "FixThresh: ${FixThresh}"
log_Msg "DeleteIntermediates: ${DeleteIntermediates}"

DIR=`pwd`
log_Msg "PWD: $DIR"

## ---------------------------------------------------------------------------
## Preparation (highpass) on the individual runs
Expand Down

0 comments on commit 6ca4875

Please sign in to comment.