BIDS stats model specification for MRI analyses

Dear BIDS experts,

I am actually working on a project, in which I try to convert BIDS compliant stats model json files to SPM readable batch scripts. Therefore, all parameters needed for definition of the model (and related contrasts) should be integrated within the json file. According to BIDS extension proposal (BEP002) on this topic, one way to include software-related parameters is in the section Nodes.Transformations.Instructions, where I would like to explicitely include all SPM input parameters which are needed to construct the design matrix. The json file should be comprehensible on its own without referring to other files (besides MRI images & related movement data). The main reason for this approach is, that the file naming and folder structure of the MRI data do not necessarily fulfill BIDS standards - requiring customized input to get or locate all necessary data/parameters. The intended stats model file acts as the connection between non-standardised MRI data and BIDS compliant statistical modelling specification.

During the creation of such a json file, some questions were coming to my mind concerning the BIDS conformity. For this reason, I would like to ask, if the following points are in accordance with BIDS stats model specifications:
(1) Explicit definition of parameters (like also including event onsets and durations) in the Transformations section of the json file;
(2) Existence of such json files on different levels (run, subject, dataset); [In my understanding every run or subject requires its own file, because their parameters differ and the Nodes must be organized hierarchically within the json file.]
(3) Storage of json files in e.g. derivatives/spm-stats/sub-0001/models (as opposed to the recommended location of models/ directory in the dataset root);

Thanks a lot in advance for any help!

hey @d-ni374

Have you checked bidspm?

Because this is literally what it does (assuming that you have a valid raw BIDS dataset and its derivative à la fmriprep)?

Although I appreciate the enthusiasm, I think that the scope of the bids stats model is clearly limited to BIDS datasets.

I think it’d be easier to stick your data in bids rather than bend the bids stats model to accomodate non bids data.

The transformation section is the least specified part of the model, so I think you have a lot of room to try things there.
I have tried to centralize information about pybids and bids-matlab handling of transformations here: GitHub - bids-standard/variable-transform

I would advise against this and really try to stick to a bids layout of your data to avoid having to do things like this, other you end up defeating the purpose of having your whole stats analysis in a single file.

Same as above.

Hello @Remi-Gau

Thank you for your response!

I actually did check bidspm (yet never utilised it), but since most of our datasets are not compliant with BIDS, I assumed that it would be more efficient to adapt to BIDS standards at the model level. However, I will check once more the possibility of converting the raw data & derivatives to BIDS.

I understand that the BIDS stats model shall be condensed in a single file, which contradicts the insertion of subject-specific data within the file. Still, I see possibilities to use the Transformations section as a workaround by referring to (standardised) input files without mentioning explicit data. In this way, it should be possible to keep the nodes structure intended by BIDS stats models specification also for non-compliant data.
Problems might arise, if an event does not appear at all in individual subjects, since SPM does not accept ‘empty’ events. I’ll have to check, how such a case is handled in bidspm.

Thanks again,

1 Like