Adding new contrasts in FSL 1st level analysis without re-running model estimation

Dear experts,

I am using FSL for my task-fMRI dataset. I would like to add some new contrasts at single-run level. I wonder whether there is a way to do it without re-running the entire model estimation, which would takes an eternity.
I found an relatively thread on the fsl mailing list (2007) saying that there would be a “edit contrasts” button on the feat post-stats tab. However, I did not see it and suspect that that button does not exist in my fsl version (6.0.0).

Does anyone know whether there is a way to do it?

Thank you so much,
Yuan-hao

Dear Yuan-hao,

I am confronted with this very issue at the moment. I am thus wondering if you managed to figure it out, and if so, whether you could please advise me on this?

I have two new contrasts I want to generate at single-run level with all model estimates already generated previously.

Hoping you could help!

Regards
Anika

Hello you two,

I ran into the same problem today and was wondering if you managed to solve it?

I have more than a hundred bold runs with 680 volumes each. I forgot to add just one contrast on the first-level analysis and it would be frustrating to re-run the whole model, which on my computer takes like two full days, for something that should computationally be done in some minutes…

Thanks and best,

Tobias

If your design is the same for all subjects, you should be able to accomplish this by adjusting your design, then calling film_gls directly with the modified design files. This will re-run just the model fitting stage, and will not perform any pre-processing steps, and should run very quickly for a single subject.

I won’t describe the full process, but this will hopefully be enough for you to incorporate into your own custom script.

  1. Run Glm to start the GLM GUI, click the Load button, and load one of your existing design.fsf files.
  2. Adjust your design accordingly.
  3. Click the Save button, and save your design with a different name (e.g. adjusted_design.fsf)

Then in a terminal, you can call film_gls like so (adjusting all of the file paths accordingly):

film_gls                                   \
  --in=fmri.feat/filtered_func_data.nii.gz \
  --rn=fmri.feat/adjusted_stats            \
  --pd=fmri.feat/adjusted_design.mat       \
  --con=fmri.feat/adjusted_design.con      \
  --fcon=fmri.feat/adjusted_design.fts     \
  --thr=1 --sa --ms=5

This will re-run the model fitting, and save all outputs in a new directory fmri.feat/adjusted_stats/.

The exact command may differ for you - for example you will need to add additional flags if you have used voxelwise regressors, and you may need to use different values for the --thr and --ms options. You can check the FEAT report log page from one of your existing analyes for the exact film_gls command to use.

To use your re-generated results in a higher-level analysis, you will need to do some more scripting to replace the old results with the new ones. For a single subject (with results in fmri.feat) you should be able to do something like this (you may want to consider making a copy of your existing analyses in case something goes wrong):

cd ./fmri.feat

# Make a backup of the old stats results, and
# replace them with the re-generated ones.
mv stats old_stats
mv adjusted_stats stats

# Make a backup of the old FEAT design files
for desfile in design*; do
    mv ${desfile} old_${desfile}
done

# Replace the FEAT design files with the
# adjusted ones.
for desfile in adjusted_design*; do
    mv ${desfile} $(echo ${desfile} | sed 's/adjusted_//g')
done

I must confess that I haven’t actually tested this, but will do so in the next couple of days and will re-post if I encounter any issues.

1 Like