FSL feat using bash not running: script/temple error?

Hi! I am trying to use a bash script to run FEAT on some already preprocessed data. I am not sure if it is due to my script or due to the design template I made, I cannot get it up and running. Below is my script and the corresponding error message. If you believe it would be helpful to also check my design template please let me know and I can find a way to send you (I’m not allowed to upload files as a new user :slight_smile: ).

Hope someone may help/guide my troubleshoot. Thanks!


  1. Here’s my bash script:
    TASK=MID

sub=$1
run=$2
ppi=$3 # 0 for activation, otherwise name of the roi
sm=$4

MAINOUTPUT=${maindir}/derivatives/fsl_task-${TASK}/sub-${sub}
mkdir -p $MAINOUTPUT
DATA=${maindir}/derivatives/preprocessed/sub-${sub}/functional/mid_run${run}/smoothed_spm8/swarf_4D.nii
EVDIR=${maindir}/derivatives/fsl_task-MID/EVfiles/sub-${sub}_task-${TASK}_run-${run}

if [ “$ppi” == “0” ]; then
TYPE=act
OUTPUT=${MAINOUTPUT}/L1_task-${TASK}_model-01_type-${TYPE}_run-0${run}_sm-${sm}
else
TYPE=ppi
OUTPUT=${MAINOUTPUT}/L1_task-${TASK}_model-01_type-${TYPE}_seed-${ppi}_run-0${run}_sm-${sm}
fi

check for output and skip existing

if [ -e ${OUTPUT}.feat/cluster_mask_zstat1.nii.gz ]; then
exit
else
echo "missing: $OUTPUT " >> ${maindir}/re-runL1.log
rm -rf ${OUTPUT}.feat
fi

ITEMPLATE=${maindir}/derivatives/fsl_task-MID/templates/L1_task-MID_model-01_type-act.fsf
OTEMPLATE=${MAINOUTPUT}/L1_task-${TASK}_model-01_seed-${ppi}_run-0${run}_variant-${dtype}.fsf

if [ “$ppi” == “0” ]; then
sed -e ‘s@OUTPUT@’$OUTPUT’@g
-e ‘s@DATA@’$DATA’@g
-e ‘s@EVDIR@’$EVDIR’@g
-e ‘s@SMOOTH@’$sm’@g
<$ITEMPLATE> $OTEMPLATE
else
PHYS=${MAINOUTPUT}/ts_task-${TASK}_mask-${ppi}_run-0${run}.txt
MASK=${maindir}/derivatives/masks/${ppi}.nii
fslmeants -i $DATAPPI -o $PHYS -m $MASK
sed -e ‘s@OUTPUT@’$OUTPUT’@g
-e ‘s@DATA@’$DATA’@g
-e ‘s@EVDIR@’$EVDIR’@g
-e ‘s@PHYS@’$PHYS’@g
-e ‘s@SMOOTH@’$sm’@g
<$ITEMPLATE> $OTEMPLATE
fi

runs feat on output template

feat $OTEMPLATE

fix registration as per NeuroStars post:

Performing full glm analysis with fsl on the bold images preprocessed by fmriprep without re-registering the data to the MNI space

mkdir -p ${OUTPUT}.feat/reg
ln -s $FSLDIR/etc/flirtsch/ident.mat ${OUTPUT}.feat/reg/example_func2standard.mat
ln -s $FSLDIR/etc/flirtsch/ident.mat ${OUTPUT}.feat/reg/standard2example_func.mat
ln -s ${OUTPUT}.feat/mean_func.nii.gz ${OUTPUT}.feat/reg/standard.nii.gz

delete unused files

rm -rf ${OUTPUT}.feat/stats/res4d.nii.gz
rm -rf ${OUTPUT}.feat/stats/corrections.nii.gz
rm -rf ${OUTPUT}.feat/stats/threshac1.nii.gz

if [ ! “$ppi” == “0” ]; then
rm -rf ${OUTPUT}.feat/filtered_func_data.nii.gz
fi


  1. Here’s the error message:

child process exited abnormally
while executing
"fsl:exec “${FSLDIR}/bin/feat_model design” $fmri(featModelOpts) -N feat0_model -l logs "
(procedure “firstLevelMaster” line 43)
invoked from within
“firstLevelMaster $session”
invoked from within
"if { $done_something == 0 } {

if { ! $fmri(inmelodic) } {
   if { $fmri(level) == 1 } {
          for { set session 1 } { $session <= $fmri(mult..."
(file "/usr/lib/fsl/5.0/feat" line 387)

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

@kychat Did you manage to find a solution to this?
I preprocessed some data using nipype as well and am getting the same error message you got a year ago…

Thanks a lot in advance!

All the best and stay healthy^^