Run coordinate-based meta-analyses on 21 pain studies

Collection of NIDM-Results packs downloaded from Neurovault collection 1425, uploaded by Dr. Camille Maumet.

Note

Creation of the Dataset from the NIDM-Results packs was done with custom code. The Results packs for collection 1425 are not completely NIDM-Results-compliant, so the nidmresults library could not be used to facilitate data extraction.

import os

from nilearn.plotting import plot_stat_map

import nimare
from nimare.tests.utils import get_test_data_path

Load Dataset

dset_file = os.path.join(get_test_data_path(), "nidm_pain_dset.json")
dset = nimare.dataset.Dataset(dset_file)

mask_img = dset.masker.mask_img

MKDA density analysis

mkda = nimare.meta.MKDADensity(kernel__r=10, null_method="approximate")
mkda.fit(dset)
corr = nimare.correct.FWECorrector(method="montecarlo", n_iters=10, n_cores=1)
cres = corr.transform(mkda.results)
plot_stat_map(
    cres.get_map("logp_level-voxel_corr-FWE_method-montecarlo"),
    cut_coords=[0, 0, -8],
    draw_cross=False,
    cmap="RdBu_r",
)
plot cbma

Out:

  0%|          | 0/10 [00:00<?, ?it/s]
 10%|#         | 1/10 [00:00<00:01,  4.64it/s]
 20%|##        | 2/10 [00:00<00:01,  4.68it/s]
 30%|###       | 3/10 [00:00<00:01,  4.66it/s]
 40%|####      | 4/10 [00:00<00:01,  4.71it/s]
 50%|#####     | 5/10 [00:01<00:01,  4.72it/s]
 60%|######    | 6/10 [00:01<00:00,  4.76it/s]
 70%|#######   | 7/10 [00:01<00:00,  4.76it/s]
 80%|########  | 8/10 [00:01<00:00,  4.77it/s]
 90%|######### | 9/10 [00:01<00:00,  4.77it/s]
100%|##########| 10/10 [00:02<00:00,  4.76it/s]
100%|##########| 10/10 [00:02<00:00,  4.74it/s]

<nilearn.plotting.displays.OrthoSlicer object at 0x7f44bfafb9d0>

MKDA Chi2 with FDR correction

mkda = nimare.meta.MKDAChi2(kernel__r=10)
dset1 = dset.slice(dset.ids)
dset2 = dset.slice(dset.ids)
mkda.fit(dset1, dset2)
corr = nimare.correct.FDRCorrector(method="bh", alpha=0.001)
cres = corr.transform(mkda.results)
plot_stat_map(
    cres.get_map("z_desc-consistency_level-voxel_corr-FDR_method-bh"),
    threshold=1.65,
    cut_coords=[0, 0, -8],
    draw_cross=False,
    cmap="RdBu_r",
)
plot cbma

Out:

/home/docs/checkouts/readthedocs.org/user_builds/nimare/checkouts/0.0.9rc1/nimare/meta/cbma/mkda.py:237: RuntimeWarning: invalid value encountered in true_divide
  pFgA = pAgF * pF / pA
/home/docs/checkouts/readthedocs.org/user_builds/nimare/checkouts/0.0.9rc1/nimare/meta/cbma/mkda.py:241: RuntimeWarning: invalid value encountered in true_divide
  pFgA_prior = pAgF * self.prior / pAgF_prior

<nilearn.plotting.displays.OrthoSlicer object at 0x7f44c41bfb10>

MKDA Chi2 with FWE correction

Since we’ve already fitted the Estimator, we can just apply a new Corrector to the estimator.

corr = nimare.correct.FWECorrector(method="montecarlo", n_iters=10, n_cores=1)
cres = corr.transform(mkda.results)
plot_stat_map(
    cres.get_map("z_desc-consistency_level-voxel_corr-FWE_method-montecarlo"),
    threshold=1.65,
    cut_coords=[0, 0, -8],
    draw_cross=False,
    cmap="RdBu_r",
)
plot cbma

Out:

  0%|          | 0/10 [00:00<?, ?it/s]
 10%|#         | 1/10 [00:00<00:02,  3.99it/s]
 20%|##        | 2/10 [00:00<00:02,  3.95it/s]
 30%|###       | 3/10 [00:00<00:01,  3.97it/s]
 40%|####      | 4/10 [00:01<00:01,  3.99it/s]
 50%|#####     | 5/10 [00:01<00:01,  3.99it/s]
 60%|######    | 6/10 [00:01<00:00,  4.01it/s]
 70%|#######   | 7/10 [00:01<00:00,  4.00it/s]
 80%|########  | 8/10 [00:02<00:00,  3.99it/s]
 90%|######### | 9/10 [00:02<00:00,  4.00it/s]
100%|##########| 10/10 [00:02<00:00,  3.98it/s]
100%|##########| 10/10 [00:02<00:00,  3.98it/s]
/home/docs/checkouts/readthedocs.org/user_builds/nimare/envs/0.0.9rc1/lib/python3.7/site-packages/nilearn/plotting/displays.py:880: UserWarning: empty mask
  get_mask_bounds(new_img_like(img, not_mask, affine))

<nilearn.plotting.displays.OrthoSlicer object at 0x7f44f1f36f90>

KDA

kda = nimare.meta.KDA(kernel__r=10, null_method="approximate")
kda.fit(dset)
corr = nimare.correct.FWECorrector(method="montecarlo", n_iters=10, n_cores=1)
cres = corr.transform(kda.results)
plot_stat_map(
    cres.get_map("logp_level-voxel_corr-FWE_method-montecarlo"),
    cut_coords=[0, 0, -8],
    draw_cross=False,
    cmap="RdBu_r",
)
plot cbma

Out:

  0%|          | 0/10 [00:00<?, ?it/s]
 10%|#         | 1/10 [00:00<00:02,  4.26it/s]
 20%|##        | 2/10 [00:00<00:01,  4.31it/s]
 30%|###       | 3/10 [00:00<00:01,  4.36it/s]
 40%|####      | 4/10 [00:00<00:01,  4.37it/s]
 50%|#####     | 5/10 [00:01<00:01,  4.36it/s]
 60%|######    | 6/10 [00:01<00:00,  4.37it/s]
 70%|#######   | 7/10 [00:01<00:00,  4.38it/s]
 80%|########  | 8/10 [00:01<00:00,  4.40it/s]
 90%|######### | 9/10 [00:02<00:00,  4.41it/s]
100%|##########| 10/10 [00:02<00:00,  4.43it/s]
100%|##########| 10/10 [00:02<00:00,  4.39it/s]

<nilearn.plotting.displays.OrthoSlicer object at 0x7f44f1f12350>

ALE

ale = nimare.meta.ALE(null_method="approximate")
ale.fit(dset)
corr = nimare.correct.FWECorrector(method="montecarlo", n_iters=10, n_cores=1)
cres = corr.transform(ale.results)
plot_stat_map(
    cres.get_map("logp_level-cluster_corr-FWE_method-montecarlo"),
    cut_coords=[0, 0, -8],
    draw_cross=False,
    cmap="RdBu_r",
)
plot cbma

Out:

  0%|          | 0/10 [00:00<?, ?it/s]
 10%|#         | 1/10 [00:00<00:02,  3.45it/s]
 20%|##        | 2/10 [00:00<00:02,  3.48it/s]
 30%|###       | 3/10 [00:00<00:02,  3.49it/s]
 40%|####      | 4/10 [00:01<00:01,  3.49it/s]
 50%|#####     | 5/10 [00:01<00:01,  3.49it/s]
 60%|######    | 6/10 [00:01<00:01,  3.49it/s]
 70%|#######   | 7/10 [00:02<00:00,  3.48it/s]
 80%|########  | 8/10 [00:02<00:00,  3.49it/s]
 90%|######### | 9/10 [00:02<00:00,  3.49it/s]
100%|##########| 10/10 [00:02<00:00,  3.51it/s]
100%|##########| 10/10 [00:02<00:00,  3.49it/s]

<nilearn.plotting.displays.OrthoSlicer object at 0x7f44f1a3e590>

Total running time of the script: ( 0 minutes 32.702 seconds)

Gallery generated by Sphinx-Gallery