-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add IBMAWorkflow * set defaults as parameters in the child class * Update api.rst * Add example and report for IBMA * Update base.py * Add ridgeplot in IBMA workflow report * Add seaborn to dependencies * Add test for IBMA reports * Get selected ids fro estimator inputs * Update test_reports.py * Pin matplotlib min version * Add more info to IBMA summary * Update setup.cfg * Add relative coverage plot to IBMA reports * Remove resampling from example gallery * Set epsilon for thresholding * Update base.py * Update figures.py * Update figures.py * Trigger the RTD build again * Update figures.py * Handle transformations in Workflow
- Loading branch information
1 parent
a6c21d3
commit 63f0a7e
Showing
12 changed files
with
582 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
""" | ||
.. _ibma_workflow: | ||
==================================================== | ||
Run an image-based meta-analysis (IBMA) workflow | ||
==================================================== | ||
NiMARE provides a plethora of tools for performing meta-analyses on neuroimaging data. | ||
Sometimes it's difficult to know where to start, especially if you're new to meta-analysis. | ||
This tutorial will walk you through using a IBMA workflow function which puts together | ||
the fundamental steps of a IBMA meta-analysis. | ||
""" | ||
import os | ||
from pathlib import Path | ||
|
||
import matplotlib.pyplot as plt | ||
from nilearn.plotting import plot_stat_map | ||
|
||
from nimare.extract import download_nidm_pain | ||
|
||
############################################################################### | ||
# Download data | ||
# ----------------------------------------------------------------------------- | ||
|
||
dset_dir = download_nidm_pain() | ||
|
||
############################################################################### | ||
# Load Dataset | ||
# ----------------------------------------------------------------------------- | ||
from nimare.dataset import Dataset | ||
from nimare.utils import get_resource_path | ||
|
||
dset_file = os.path.join(get_resource_path(), "nidm_pain_dset.json") | ||
dset = Dataset(dset_file) | ||
dset.update_path(dset_dir) | ||
|
||
############################################################################### | ||
# Run IBMA Workflow | ||
# ----------------------------------------------------------------------------- | ||
# The fit method of a IBMA workflow class runs the following steps: | ||
# | ||
# 1. Runs a meta-analysis using the specified method (default: Stouffers) | ||
# 2. Applies a corrector to the meta-analysis results (default: FDRCorrector, indep) | ||
# 3. Generates cluster tables and runs diagnostics on the corrected results (default: Jackknife) | ||
# | ||
# All in one call! | ||
from nimare.workflows.ibma import IBMAWorkflow | ||
|
||
workflow = IBMAWorkflow() | ||
result = workflow.fit(dset) | ||
|
||
############################################################################### | ||
# Plot Results | ||
# ----------------------------------------------------------------------------- | ||
# The fit method of the IBMA workflow class returns a :class:`~nimare.results.MetaResult` object, | ||
# where you can access the corrected results of the meta-analysis and diagnostics tables. | ||
# | ||
# Corrected map: | ||
img = result.get_map("z_corr-FDR_method-indep") | ||
plot_stat_map( | ||
img, | ||
cut_coords=4, | ||
display_mode="z", | ||
threshold=1.65, # voxel_thresh p < .05, one-tailed | ||
cmap="RdBu_r", | ||
vmax=4, | ||
) | ||
plt.show() | ||
|
||
############################################################################### | ||
# Clusters table | ||
# `````````````````````````````````````````````````````````````````````````````` | ||
result.tables["z_corr-FDR_method-indep_tab-clust"] | ||
|
||
############################################################################### | ||
# Contribution table | ||
# `````````````````````````````````````````````````````````````````````````````` | ||
result.tables["z_corr-FDR_method-indep_diag-Jackknife_tab-counts_tail-positive"] | ||
|
||
############################################################################### | ||
# Report | ||
# ----------------------------------------------------------------------------- | ||
# Finally, a NiMARE report is generated from the MetaResult. | ||
from nimare.reports.base import run_reports | ||
|
||
# root_dir = Path(os.getcwd()).parents[1] / "docs" / "_build" | ||
# Use the previous root to run the documentation locally. | ||
root_dir = Path(os.getcwd()).parents[1] / "_readthedocs" | ||
html_dir = root_dir / "html" / "auto_examples" / "02_meta-analyses" / "12_plot_ibma_workflow" | ||
html_dir.mkdir(parents=True, exist_ok=True) | ||
|
||
run_reports(result, html_dir) | ||
|
||
#################################### | ||
# .. raw:: html | ||
# | ||
# <iframe src="./12_plot_ibma_workflow/report.html" style="border:none;" seamless="seamless"\ | ||
# width="100%" height="1000px"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.