How to get dataset with data structure like in nilearn.dataset.fetch_adhd

Hi! I would like to ask how you got datast structure like in adhd200_sample from nilearn.datasets. That would help me very much to perform some academic tasks on this code:

#Using a filter to extract the regions time series
from nilearn import input_data
masker = input_data.NiftiMapsMasker(components_img, smoothing_fwhm=6,
standardize=False, detrend=True,
t_r=2.5, low_pass=0.1,

#Computing the regions signals and extracting the phenotypic information of interest
subjects = []
adhds = []
sites = []
labels = []
for func_file, confound_file, phenotypic in zip(
adhd_data.func, adhd_data.confounds, adhd_data.phenotypic):
time_series = masker.fit_transform(func_file, confounds=confound_file)
is_adhd = phenotypic[‘adhd’]
if is_adhd == 1:

This code needs the regressors files which I can not find in other fMRI dataset structures like full ADHD-200


1 Like

Hi @milanziuziakowski

Sorry for the delay !

In case you’re still having trouble here: Some amount of data preprocessing is usually required to generate regressor files. For example, if you look at fMRIPrep processed datasets, you should be able to pull from the generated derivatives folder both _desc-regressors_timeseries.tsv and _desc-preproc_bold.nii.gz files.

In general, you’ll want to make sure that you’re sub-selecting confounds from the generated timeseries.tsv file, since quite a few of these are included by default. One example sub-selection is in the nilearn.datasets.fetch_development_fmri function, but there’s a more general package simexp/load_confounds that might be useful !



1 Like