API

nimare.meta: Meta-analytic algorithms

For more information about the components of coordinate-based meta-analysis in NiMARE, see Coordinate-based meta-analysis in NiMARE.

Coordinate-, image-, and effect-size-based meta-analysis estimators.

meta.ibma

Image-based meta-analysis estimators.

meta.cbma.ale

CBMA methods from the activation likelihood estimation (ALE) family.

meta.cbma.mkda

CBMA methods from the multilevel kernel density analysis (MKDA) family.

meta.cbma.base

CBMA methods from the ALE and MKDA families.

meta.kernel

Kernel transformers for CBMA algorithms.

meta.cbmr

Coordinate-based meta-regression methods.

nimare.results: Meta-analytic results

Tools for managing meta-analytic results.

results.MetaResult(estimator[, corrector, ...])

Base class for meta-analytic results.

results.DroppedInput(key)

Stand-in for an input image array dropped by MetaResult.save().

nimare.correct: Multiple comparisons correction

Multiple comparisons correction methods.

correct.FWECorrector([method, n_iters, n_cores])

Perform family-wise error rate correction on a meta-analysis.

correct.FDRCorrector([method, alpha])

Perform false discovery rate correction on a meta-analysis.

nimare.diagnostics: Diagnostics

Methods for diagnosing problems in meta-analytic datasets or analyses.

diagnostics.FocusFilter([mask])

Remove coordinates outside of the collection mask.

diagnostics.Jackknife([target_image, ...])

Run a jackknife analysis on a meta-analysis result.

diagnostics.FocusCounter([target_image, ...])

Run a focus-count analysis on a coordinate-based meta-analysis result.

diagnostics.ResampledStability([...])

Estimate voxelwise stability of thresholded results under dataset resampling.

nimare.annotate: Automated annotation

Automated annotation tools.

annotate.cogat

Automated annotation of Cognitive Atlas labels.

annotate.gclda

Topic modeling with generalized correspondence latent Dirichlet allocation.

annotate.lda

Topic modeling with latent Dirichlet allocation.

annotate.text

Text extraction tools.

annotate.utils

Utility functions for ontology tools.

nimare.decode: Functional characterization analysis

For more information about functional characterization analysis, see Meta-analytic functional decoding.

Functional decoding tools.

decode.discrete

Methods for decoding subsets of voxels or experiments into text.

decode.continuous

Methods for decoding unthresholded brain maps into text.

decode.encode

Methods for encoding text into brain maps.

decode.base

Base classes for the decode module.

nimare.io: Tools for ingesting data in other formats

Input/Output operations.

io.convert_neurosynth_to_dict(...[, ...])

Convert Neurosynth/NeuroQuery database files to a dictionary.

io.convert_neurosynth_to_json(...[, ...])

Convert Neurosynth/NeuroQuery dataset text file to a NiMARE json file.

io.convert_neurosynth_to_dataset(...[, ...])

Convert Neurosynth/NeuroQuery database files into NiMARE Dataset.

io.fetch_neurostore_studyset(studyset_id[, ...])

Download a Neurostore studyset and optional annotation as a NiMARE Studyset.

io.convert_nimads_to_dataset(studyset[, ...])

Convert nimads studyset to a dataset.

io.convert_nimads_to_sleuth(studyset, output_dir)

Convert a NIMADS Studyset to Sleuth text file(s).

io.convert_dataset_to_nimads_dict(dataset, *)

Convert a NiMARE Dataset to a NIMADS Studyset dictionary.

io.convert_dataset_to_studyset(dataset, *[, ...])

Convert a NiMARE Dataset into a nimads.Studyset object.

io.convert_sleuth_to_dict(text_file)

Convert Sleuth text file to a dictionary.

io.convert_sleuth_to_json(text_file, out_file)

Convert Sleuth output text file into json.

io.convert_sleuth_to_dataset(text_file[, target])

Convert Sleuth output text file into NiMARE Dataset.

io.convert_sleuth_to_studyset(text_file[, ...])

Convert Sleuth output text file into a NiMARE Studyset.

io.convert_neurovault_to_dataset(...[, ...])

Convert a group of NeuroVault collections into a NiMARE Dataset.

nimare.studyset: NeuroImaging Meta-Analysis Data Structure

The NIMADS Studyset is the primary collection type for all NiMARE workflows. nimare.nimads re-exports this module under the historical import path and adds nothing of its own.

Columnar studyset: an immutable store, views over it, and typed blocks.

A NIMADS studyset is a fixed-depth forest – every point, image and condition names exactly one parent analysis, and every analysis exactly one study – so it is a set of columnar tables joined by CSR offset arrays, not a graph.

The layering, which the module boundaries enforce:

store, columns

the data. Immutable, numpy only. Knows nothing about selections, algorithms, pandas or files.

layout

the rules that keep parent links and offsets consistent.

view

a selection: (store, analysis index, point mask) plus execution context.

requirements, blocks

what an algorithm declares it needs, and the shapes it gets back.

edit

copy-on-write growth: store -> store.

io

NIMADS and parquet, in and out.

nested

read-only Study/Analysis/Point/Image accessors over the columns. A walk is confined to the view it started from, so it reports what that view’s frames and blocks report.

Data flows store -> view -> block and never back.

This is the canonical public surface. nimare.nimads re-exports it under the historical import path and adds nothing of its own.

studyset.Studyset(source[, target, mask, ...])

A collection of studies for meta-analysis.

studyset.StudysetStore(id, name, study_key, ...)

Immutable columnar representation of a studyset.

studyset.View(store[, index, point_mask, ...])

A selection of analyses over one immutable store.

studyset.Context([space, masker, basepath])

Execution setup: not data, so it lives on the view.

studyset.Study(view, row)

One study.

studyset.Analysis(view, row)

One analysis (a contrast).

studyset.Image(view, row)

One statistic map.

studyset.Point(view, row)

One focus, reported in the space its studyset is being read in.

studyset.AnnotationSet(id, name, columns, ...)

One annotation: identity, declared types, and columns over the analyses.

studyset.ColumnStore(n_rows, dense, sparse)

Columns aligned to one level's row index, dense or sparse.

studyset.Coordinates([space, name])

Foci, grouped by analysis, in space.

studyset.Images(imtype[, policy, name])

One statistic map per analysis, of type imtype.

studyset.Labels([annotation, name])

The annotation matrix.

studyset.Texts([field, name])

Documents from a text field.

studyset.PerAnalysis(field[, reduce, name])

One number per analysis, from metadata at either level.

studyset.CoordinateBlock(xyz, offsets, ...)

Foci grouped by analysis.

studyset.ImageBlock(refs, analysis_pos, ...)

One row per image, with its parent analysis and study alongside.

studyset.LabelBlock(values, labels, rows, ...)

The annotation matrix, column-major.

studyset.TextBlock(text, rows, field)

Documents, with the document index already integral.

studyset.Comparison(group1, group2)

A pairwise input: two views that provably share one store.

studyset.normalize_collection(collection)

Return a Studyset for whatever was passed in.

studyset.check_invariants(store)

Return a list of invariant violations.

studyset.from_nimads(source, *[, ...])

Build a store from a NIMADS studyset document.

studyset.from_parquet(directory, *[, ...])

Build a store from a parquet studyset release directory.

studyset.write_nimads(store, path[, ...])

Write the studyset as NIMADS JSON.

studyset.write_parquet(store, directory)

Write the studyset as a parquet release directory.

studyset.convert_neurostore_json_to_parquet(...)

Convert a NeuroStore release JSON export into parquet tables.

nimare.dataset: Legacy Dataset IO

Warning

Dataset is deprecated and will be removed in NiMARE 1.0.0. Constructing one, or passing one to any algorithm, raises a FutureWarning. Use Studyset instead – see from_dataset() and the nimare.io.convert_*_to_studyset functions for the migration paths.

Classes for representing datasets of images and/or coordinates.

Deprecated since version 0.21.0: Dataset is deprecated and will be removed in NiMARE 1.0.0. Use Studyset instead. Constructing a Dataset, or passing one to any NiMARE algorithm, raises a FutureWarning; silence them with::

warnings.filterwarnings(“ignore”, message=”.*nimare.dataset.Dataset is deprecated”)

dataset.Dataset(source[, target, mask])

Storage container for a coordinate- and/or image-based meta-analytic dataset/database.

nimare.transforms: Data transforms

Miscellaneous spatial and statistical transforms.

transforms.ImageTransformer(target[, overwrite])

A class to create new images from existing ones within a collection.

transforms.ImagesToCoordinates([...])

Transformer from images to coordinates.

transforms.StandardizeField(fields)

Standardize metadata fields.

transforms.threshold_image(image, threshold)

Threshold an array or Niimg-like object and zero voxels that fail the criterion.

transforms.transform_images(images_df, ...)

Generate images of a given type from other image types and write out to files.

transforms.resolve_transforms(target, ...)

Determine and apply the appropriate transforms to a target image type from available data.

transforms.sample_sizes_to_dof(sample_sizes)

Calculate degrees of freedom from a list of sample sizes using a simple heuristic.

transforms.sample_sizes_to_sample_size(...)

Calculate appropriate sample size from a list of sample sizes using a simple heuristic.

transforms.sd_to_varcope(sd, sample_size)

Convert standard deviation to sampling variance.

transforms.se_to_varcope(se)

Convert standard error values to sampling variance.

transforms.samplevar_dataset_to_varcope(...)

Convert "sample variance of the dataset" to "sampling variance".

transforms.t_and_varcope_to_beta(t, varcope)

Convert t-statistic to parameter estimate using sampling variance.

transforms.t_and_beta_to_varcope(t, beta)

Convert t-statistic to sampling variance using parameter estimate.

transforms.t_to_d(t_values, sample_sizes)

Convert t-statistics to Cohen's d.

transforms.d_to_g(d, N[, return_variance])

Convert Cohen's d to Hedges' g.

transforms.p_to_z(p[, tail])

Convert p-values to (unsigned) z-values.

transforms.nlogp_to_z(nlogp[, tail])

Convert nlogp, the natural logarithm of a p-value, to (unsigned) z-values.

transforms.t_to_z(t_values, dof)

Convert t-statistics to z-statistics.

transforms.z_to_t(z_values, dof)

Convert z-statistics to t-statistics.

transforms.z_to_p(z[, tail])

Convert z-values to p-values.

transforms.z_to_nlogp(z[, tail])

Convert z-values to nlogp, the natural logarithm of the p-value.

transforms.t_to_nlogp(t_values, dof[, tail])

Convert t-statistics to nlogp, the natural logarithm of the p-value.

transforms.chi2_to_nlogp(chi2_values, dof)

Convert chi-squared statistics to nlogp, the natural logarithm of the p-value.

nimare.extract: Dataset and model fetching

For more information about fetching data from the internet, see Fetching resources from the internet.

Dataset and trained model downloading functions.

extract.fetch_neuroquery([data_dir, ...])

Download the latest data files from NeuroQuery.

extract.fetch_neurosynth([data_dir, ...])

Download the latest data files from NeuroSynth.

extract.download_nidm_pain([data_dir, overwrite])

Download NIDM Results for 21 pain studies from NeuroVault for tests.

extract.download_cognitive_atlas([data_dir, ...])

Download Cognitive Atlas ontology and extract IDs and relationships.

extract.download_abstracts(dataset, email)

Download the abstracts for a list of PubMed IDs.

extract.utils.get_data_dirs([data_dir])

Return the directories in which NiMARE looks for data.

nimare.stats: Statistical functions

Various statistical helper functions.

stats.one_way(data, n)

One-way chi-square test of independence.

stats.two_way_counts(selected, unselected, ...)

Two-way chi-square test from paired study-count vectors.

stats.two_way(cells)

Two-way chi-square test of independence.

stats.pearson(x, y)

Correlate row vector x with each row vector in 2D array y, quickly.

stats.null_to_p(test_value, null_array[, ...])

Return p-value for test value(s) against null array.

stats.nullhist_to_p(test_values, ...)

Return one-sided p-value for test value against null histogram.

stats.nlogp_bonferroni(nlogp)

Perform Bonferroni correction on nlogp values.

stats.nlogp_fdr(nlogp[, method])

Perform FDR correction on nlogp values.

nimare.generate: Data generation functions

Utilities for generating data for testing.

generate.create_coordinate_dataset([foci, ...])

Generate coordinate based dataset for meta analysis.

generate.create_coordinate_studyset([foci, ...])

Generate a coordinate-based Studyset for meta-analysis.

generate.create_neurovault_dataset([...])

Download images from NeuroVault and use them to create a dataset.

generate.create_neurovault_studyset([...])

Download images from NeuroVault and use them to create a Studyset.

nimare.utils: Utility functions and submodules

Utility functions for NiMARE.

utils.get_template([space, mask])

Load template file.

utils.get_masker(mask[, memory, memory_level])

Get an initialized, fitted nilearn Masker instance from passed argument.

utils.get_resource_path()

Return the path to general resources, terminated with separator.

utils.vox2mm(ijk, affine)

Convert matrix subscripts to coordinates.

utils.mm2vox(xyz, affine)

Convert coordinates to matrix subscripts.

utils.tal2mni(coords)

Convert coordinates from Talairach space to MNI space.

utils.mni2tal(coords)

Convert coordinates from MNI space Talairach space.

utils.unique_rows(ar[, return_counts])

Remove repeated rows from a 2D array.

nimare.workflows: Common workflows

Common meta-analytic workflows.

workflows.macm_workflow(dataset_file, mask_file)

Perform MACM with ALE algorithm.

workflows.cbma.CBMAWorkflow([estimator, ...])

Compose a coordinate-based meta-analysis workflow.

workflows.cbma.ContrastWorkflow([...])

Compose a masked contrast workflow for pairwise CBMA analyses.

workflows.cbma.PairwiseCBMAWorkflow([...])

Base class for pairwise coordinate-based meta-analysis workflow methods.

workflows.ibma.IBMAWorkflow([estimator, ...])

Compose a coordinate-based meta-analysis workflow.

workflows.misc.conjunction_analysis(imgs)

Perform a conjunction analysis.

nimare.reports: NiMARE report

Reports module.

reports.run_reports(results, out_dir)

Run the reports.

nimare.base: Base classes

Base classes for NiMARE.

base.NiMAREBase()

Base class for NiMARE.

estimator.Estimator([memory, memory_level, ...])

Estimators take in collections and return fitted result objects.