Data retrieved from NiftiLabelsMaskers and NiftiMaskers are different

so I tried to get raw data, but it differs from what I can get via the direct method

masker = NiftiLabelsMasker(
    labels_img=atlas_data.harvard_atlas[1], standardize=False,
time_series = masker.fit_transform(
    data, confounds=confounds, sample_mask=confounds_mask)


from nilearn.maskers import NiftiMasker
nifti_masker = NiftiMasker(
sigs = nifti_masker.fit_transform(

yields different results when I compare the averaged signal of masker data to the data gotten from labelsmasker

Ok, figured this out. The NiftiMasker was upsampling the data image to the mask image

NiftiLabelsMasker, however, performs downsampling (to data) by default.

So the two maskers, if naively used, give different results…

1 Like

Hi @DasDominus, indeed the NiftiMasker module does have different default behavior for resampling than the NiftiLabelsMasker and NiftiMapsMasker modules. This definitely needs to be better documented. We have a couple of issues already open about this such as in and Guide for resource requirements when using masker objects · Issue #3398 · nilearn/nilearn · GitHub. We welcome users to open pull requests if you are interested!

Thx to both.
But I don’t see any good reason for this discrepancy in behavior. I’d rather have a homogeneous resampling behavior across maskers.

@bthirion I was wondering if there was a reason behind this as the use cases for the NiftiMasker are different from the Labels and Maps maskers but it is not very clear to me. If indeed this behavior can be homogeneous then we should open an issue to fix this.

Can you open an issue to have the discussion with other devs there ? Thx

Linking opened issue here: Differences in default resampling behavior in maskers module · Issue #3413 · nilearn/nilearn · GitHub