neurostuff / NiMARE

Coordinate- and image-based meta-analysis in Python
https://nimare.readthedocs.io
MIT License
179 stars 58 forks source link

IBMA - Statistical map doesn't fit with the template #584

Closed gnbattist closed 3 years ago

gnbattist commented 3 years ago

Summary

Hi everyone,

I'm trying to run an IBMA meta-analysis and, when I run my script, I observe that the statical map doesn't fit with the MNI template on the upper and lower region.

Anyone know where does it come from? Figure 2021-10-20 122752

My script:

from nimare.io import convert_neurovault_to_dataset

# The specific collections I would like to download group level
# statistical maps from

##Collection_ids with direct images in the collection 
#collection_ids = (48858, 48859, 48860, 48861, 48862, 48863, 48864, 48865, 48866, 48867, 48868, 48869, 453291, 64897, 64898, 64899, 64900, 65068, 65066, 65067, 306480, 306481, 306482, 306483, 306484, 306485, 306486, 306487, 306488)
## collection_ids with only collection link 
collection_ids = (2525, 3935, 3952, 6150)

# A mapping between what I want the contrast(s) to be
# named in the dataset and what their respective group
# statistical maps are named on neurovault
contrasts = {
    "dyad synchrony": (
        "Auditory|"
        "Cerebellum|"
        "DMN1|"
        "DMN2|"
        "FPNL|"
        "FPNR|"
        "Limbic|"
        "Salience|"
        "Somatosensory|"
        "VentralStream|"
        "Visual1|"
        "Visual2|"
        "Visual3|"
        "General ISC|"
        "HC vs LC ISC|"
        "General ISPS|"
        "HC vs LC ISPS|"
        "children's brain self-family contrast negatively correlated with the relationship quality|"
        "children's brain self-family contrast negatively correlated with the perceptual similarity (ffa rsa value)|"
        "Parents' response to feedback, no errors|"
        "Adolescents' response to feedback, no errors|"
        "Parent vs adolescent response to feedback, no errors|"
        "Parents' response to adolescent error feedback|"
        "Adolescents' response to parent error feedback|"
        "Parent vs adolescent response to dyadic error feedback|"
        "Parents' response to adolescent error feedback vs Parents' response to feedback, no errors|"
        "Adolescents' response to parent error feedback vs Adolescents' response to feedback, no errors|"
        "Parent vs adolescent response to dyadic error feedback vs feedback, no errors"
    )
}

# Convert how the statistical maps on neurovault are represented
# in a NiMARE dataset.
map_type_conversion = {"Z map": "z", "T map": "t"}

dset = convert_neurovault_to_dataset(
    collection_ids,
    contrasts,
    img_dir="/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta",
    map_type_conversion=None,
)

from nimare.transforms import ImageTransformer

# Not all studies have Z maps!
#print(dset.images["z"])

z_transformer = ImageTransformer(target="z")
dset = z_transformer.transform(dset)

# All studies now have Z maps!
#print(dset.images["z"])

from nilearn.plotting import plot_stat_map

from nimare.meta.ibma import Fishers

meta = Fishers()

meta_res = meta.fit(dset)

plot_stat_map(meta_res.get_map("z"), threshold=0.0001)
# The result may look questionable, but this code provides
# a template on how to use neurovault in your meta analysis.

Terminal output:

INFO:nimare.extract.utils:Dataset found in /Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony

WARNING:nimare.io:Multiple sample sizes were found for neurovault collection: 6150for contrast: dyad synchrony, sample sizes: {25, 27, 52}, selecting modal sample size: 25
INFO:nimare.utils:Shared path detected: '/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony/'
INFO:nimare.utils:Shared path detected: '/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony/'
WARNING:nimare.base:Masking out 30559 additional voxels. The updated masker is available in the Estimator.masker attribute.
/Users/ginodiez/opt/anaconda3/lib/python3.8/site-packages/nilearn/_utils/niimg.py:61: UserWarning: Non-finite values detected. These values will be replaced with zeros.
  warn(

Best, Gino

tsalo commented 3 years ago

NiMARE's image-based meta-analyses use an aggressive masking procedure based on the coverage of each input map. Any voxel with a zero or NaN in any of the input maps will be masked out. My guess is that at least one of your inputs is missing voxels in the upper and lower parts of the brain.

I'm less sure about what could be causing the odd grid in the midline though... perhaps it's a resampling issue. NiMARE resamples maps with different dimensions into the resolution and space of the template. It may be worth checking the individual maps being used in the IBMA to be sure that they all look good.

tsalo commented 3 years ago

@gnodix do you have any further questions about the template coverage of the IBMA?

tsalo commented 3 years ago

I'm going to close this now. @gnodix if you need to follow up, please feel free to add a comment in this issue.