Applying Mask over Multiple fMRI Scans?



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,

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, where

ward = Parcellations(method='ward', n_parcels = 100,standardize=False,

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).