ramp-kits / autism

Data Challenge on Autism Spectrum Disorder detection
https://paris-saclay-cds.github.io/autism_challenge/
67 stars 43 forks source link

accounting for confounds in timeseries #15

Open salma1601 opened 6 years ago

salma1601 commented 6 years ago

It is said in the doc that "For each subject, we preliminary extracted signals using different brain parcellations and atlases and accounting for motion correction and confounds." but while going through the script preprocessing/extract_time_series.py it looks like the saved .csv files are obtained without confounds regression https://github.com/ramp-kits/autism/blob/master/preprocessing/extract_time_series.py#L233

Am I misunderstanding something ?

glemaitre commented 6 years ago

Thanks to point this out. This is a mistake on the website. We finally did not account for the confounds but instead provided the motions which can be corrected with nilearn.signal.clean.

glemaitre commented 6 years ago

Actually this is the notebook which is faulty. I am correcting this now.

salma1601 commented 6 years ago

Ok thanks. The thing is that I plotted many correlation matrices and they have relatively high anticorrelations, but from the script it looks as if only detrending has been achieved, so I am a little puzzled. Can you confirm that the images from which the signal is extracted have not undergone any time processing step ?

pattishih commented 6 years ago

Hey @salma1601, anticorrelations are still present in resting state data, even without confound regression. The question is, how much anticorrelation are you seeing? I wish I can play with the data myself, but I'm currently swamped with other stuff to do. :(

glemaitre commented 6 years ago

@salma1601 The only processing that have been done is spatial smoothing and detrending: here

salma1601 commented 6 years ago

OK thanks. Well I am seeing a lot of anticorrelations and lower correlations than "usual", which means playing with other public/private rsfMRI data before confounds removal. For instance on a subsample of 41 adult controls from only 2 sites for the challenge data this is the distribution of correlation coefficients

while I am used to more skewed distribution like this one (another datasets, control adults, same number of subjects, only detrending and spatial smoothing)

To illustrate, here are the average correlation matrices. The Challenge matrix looks like one with regressed confounds to me. But may be I am wrong, never mind...

pattishih commented 6 years ago

@salma1601 For your "other" sample of rsfMRI data, how are you obtaining your time series? Using the same cortical parcellation scheme?

salma1601 commented 6 years ago

I used the same function to extract detrended timeseries from the same atlas. Before that, my images have undergone standard spatial preprocessing steps, leading to normalized images in MNI. Note that I use the "other" subsample Just for illustration. I had the opportunity in the past to work on différent rsfMRI datasets and I never experienced such correlation patterns before confounds regression, this is why I am puzzled.

pattishih commented 6 years ago

@salma1601 yes, I agree that the distribution of correlations in this dataset looks a lot like something you would see after removing the global or white-matter signal. It's definitely puzzling. I did some digging and the detrend method is as expected (removes mean and linear trend).

jmarichez commented 6 years ago

@glemaitre you mention that you provided the motions which can be corrected with nilearn.signal.clean. Discovering this API I'm struggling with understanding how to use it with the motions file content and signals. I guess signals is the array returned by load_fmri, but I can't understand how to format motions content to make it work with the API. Could you please detail how to make usage of the nilearn.signal.clean API in this context?

glemaitre commented 6 years ago

This should be something like:

import numpy as np
import pandas as pd
from nilearn.signal import clean

path_motions_subject = './fmri/motions/subject_id/run_*/motions.txt'
confounds = np.loadtxt(path_motions)

path_fmri = './some_atlas/subject_id/run_*/subject_id_task-Rest_confounds.csv'
timeseries = pd.read_csv(path_fmri, header=None)

cleaned_timeseries = clean(timeseries, confounds=confounds)
jmarichez commented 6 years ago

Ok thanks