Applying Mask over Multiple fMRI Scans?

nilearn

#1

Hi,
I’m working on a project right now on the ADHD dataset from NiLearn. My goal right now is to apply a mask onto the scans in this dataset, and to run a Ward clustering on the resulting filtered scans.

I first used
dataset = datasets.fetch_adhd()
to get my data,

then
mask_img = compute_epi_mask(dataset.func[0])
to create a mask.

The examples on nilearn use the apply_mask method, but when I do this:
masked_dataset = apply_mask(dataset.func[:], mask_img),
it doesn’t return something that can be inputted into ward.fit(), where

ward = Parcellations(method='ward', n_parcels = 100,standardize=False,
                      smoothing_fwhm=2,memory='nilearn_cache',memory_level=1,verbose=1).

Can you please direct me to an example that illustrates the process for doing these types of procedures, or suggest changes I could make that would help? Thanks (and sorry if the formatting of this post is messed up; this is my first time here, and I’m not familiar with the conventions that are common here).