Nipype second-level analysis with FSL interface

Dear experts,
Is there a way to set up a second-level analysis (say one-sample t-test with multiple subjects) in Nipype using FSL interfaces? As I see the documentation under interfaces.fsl.model, there is only one function for a second-level analysis (L2Model) with a very cursory explanation. You can assume that the first-level analysis cope directory exists for all subjects.


-Satoru Hayasaka

@sathayas - there is an example for fmriprep outputs, which @rastko can point to

more generally, here are a few more general nipype options:

these are based on our older openfmri structure, but the flavor of the workflows should be quite similar. the one is a bit more general purpose and has support for PALM.

Yep – here is an example Nipype workflow for BIDS-formatted fmriprep outputs that includes a second-level analysis (second_level_wf). This example features FLAMEO with family-wise and cluster based correction for multiple comparisons (two-tailed test). I’m also happy to answer any questions that you might have about it.

1 Like


There’s a lot going on there :slight_smile:
Is there a tutorial or walkthrough on how to run the workflow?
It seems to involve building a Docker container, then I assume folders would be aliased, similar to running fmriprep-docker, etc. My attempts so far have failed.

Would appreciate any help getting started.

macOS attempt from the command line

(base) ➜  ds003-post-fMRIPrep-analysis git:(master) docker build -f ./Dockerfile ./postfsl
Sending build context to Docker daemon  5.167kB
Step 1/24 : FROM ubuntu:xenial-20161213
 ---> 104bec311bcd
Step 2/24 : COPY .docker/neurodebian.gpg /usr/local/etc/neurodebian.gpg
COPY failed: stat /var/lib/docker/tmp/docker-builder142440907/.docker/neurodebian.gpg: no such file or directory

PyCharm seemed to recognize that the Dockerfile had meaning, so I tried running there:

Failed to import duecredit due to No module named 'duecredit'
Traceback (most recent call last):
  File "/src/", line 6, in <module>
    from templateflow.api import get as tpl_get, templates as get_tpl_list
  File "/usr/local/miniconda/lib/python3.7/site-packages/templateflow/", line 6, in <module>
    from .conf import TF_LAYOUT, TF_S3_ROOT, TF_USE_DATALAD
  File "/usr/local/miniconda/lib/python3.7/site-packages/templateflow/conf/", line 81, in <module>
    ignore=['.git', '.datalad', '.gitannex', '.gitattributes', 'scripts'])
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/", line 188, in __init__
TypeError: __init__() got an unexpected keyword argument 'ignore'

Edit: used pip3 from the command line to install duecredit, but the error persists.

Hi @rastko – I just looked at your ds003 example and noticed that it includes cosine_XX regressors in addition to high pass filtering of the design matrix and of the functional data. I wanted to check my understanding – I thought that the design matrix and functional data should not be high pass filtered if the cosine bases were included in the glm. If I have that right, is there a reason you are doing both here?