nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
638 stars 294 forks source link

Question about linear trend regression #1899

Open arnaudleroy59 opened 4 years ago

arnaudleroy59 commented 4 years ago

Hi,

I wonder how I can generate linear trend (to make linear trend regression) after fMRIprep preprocessing. I get cosines, but not for all files. I would like to apply the same methodology for each participant.

Thank you for your help

Best regards

Arnaud

effigies commented 4 years ago

Assuming the same TR and number of volumes, cosine regressors are interchangeable.

arnaudleroy59 commented 4 years ago

Thank you. I don't really get it. I've got 60 subjects, but some without cosine files in the confounds_regressors.tsv files. What do you mean by "cosine regressors are interchangeable"?

effigies commented 4 years ago

I mean the regressors are calculated purely from the repetition time (1/sampling rate) and the number of samples, and not at all from the actual values in your data files. Thus, if you have a 1.5s TR and 400 volumes for any two files, the cosine_xx regressors will be identical.

You can also calculate them directly: https://github.com/nipy/nipype/blob/63e5ef25eeaf8717ef271cc3397b41c2e754c5ef/nipype/algorithms/confounds.py#L1489-L1522

That said, if cosine files are not available in the regressor files, that does seem like a bug. Did you get any errors?

arnaudleroy59 commented 4 years ago

It seems like a bug, but I don't get any error. Cosine_XX regressors are not exactly the same in my sample, although TR and number of volume is the same. Have you got any explanation?

effigies commented 4 years ago

Do you have different numbers of non-steady-state volumes detected in each run? That would be the other source of variation.

The reason we're producing cosine regressors is that we do high-pass filtering before running a/tCompCor, and these are all calculated on the series without non-steady-state volumes. So if you include CompCor regressors, you should also include cosine regressors.

If that doesn't vary, then there's something very wrong.

arnaudleroy59 commented 4 years ago

The numbers of non-steady-state is indeed slighly variating. How can I do then to perform my linear trend regression for all my subjects (I don't use CompCor regressors, as I perform ICA AROMA analysis).

effigies commented 4 years ago

If you're not going to exclude non-steady-state volumes, you can use cosine_* columns from a run that did not detect any. Note that, if you're using the ICA-AROMA regressors calculated by fMRIPrep, I believe that also truncates non-steady-state volumes, for the same reason that CompCor does.

If you would like to rerun fMRIPrep, you can declare the number of dummy scans with --dummy-scans N. (Note that --dummy-scans 0 currently auto-detects. That will be fixed in the next release.)