How to use the nimare.due.due function in NiMARE

To help you get started, we’ve selected a few NiMARE examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neurostuff / NiMARE / nimare / annotate / ontology / cogpo.py View on Github external
@due.dcite(references.COGNITIVE_PARADIGM_ONTOLOGY,
           description='Introduces the Cognitive Paradigm Ontology.')
@due.dcite(references.ATHENA, description='Introduces ATHENA classifiers.')
def extract_cogpo():
    """
    Predict Cognitive Paradigm Ontology [1]_ labels with ATHENA classifiers
    [2]_.

    Warnings
    --------
    This function is not yet implemented.

    References
    ----------
    .. [1] Turner, Jessica A., and Angela R. Laird. "The cognitive paradigm
        ontology: design and application." Neuroinformatics 10.1 (2012): 57-66.
        https://doi.org/10.1007/s12021-011-9126-x
github neurostuff / NiMARE / nimare / meta / cbma / utils.py View on Github external
@due.dcite(references.ALE_KERNEL,
           description='Introduces sample size-dependent kernels to ALE.')
def get_ale_kernel(img, n=None, fwhm=None):
    """
    Estimate 3D Gaussian and sigma (in voxels) for ALE kernel given
    sample size (n) or fwhm (in mm).
    """
    if n is not None and fwhm is not None:
        raise ValueError('Only one of n and fwhm may be specified')
    elif n is None and fwhm is None:
        raise ValueError('Either n or fwhm must be provided')
    elif n is not None:
        uncertain_templates = (5.7 / (2. * np.sqrt(2. / np.pi)) *
                               np.sqrt(8. * np.log(2.)))  # pylint: disable=no-member
        # Assuming 11.6 mm ED between matching points
        uncertain_subjects = (11.6 / (2 * np.sqrt(2 / np.pi)) *
                              np.sqrt(8 * np.log(2))) / np.sqrt(n)  # pylint: disable=no-member
github neurostuff / NiMARE / nimare / parcellate / mapbot.py View on Github external
"""
Meta-analytic parcellation based on text (MAPBOT).
"""
import numpy as np
import pandas as pd
from sklearn.decomposition import NMF
from scipy.spatial.distance import cdist
from nilearn.masking import apply_mask, unmask

from .base import Parcellator
from ..due import due
from .. import references


@due.dcite(references.MAPBOT, description='Introduces the MAPBOT algorithm.')
class MAPBOT(Parcellator):
    """
    Meta-analytic parcellation based on text (MAPBOT) [1]_.

    Parameters
    ----------
    tfidf_df : :obj:`pandas.DataFrame`
        A DataFrame with feature counts for the model. The index is 'id',
        used for identifying studies. Other columns are features (e.g.,
        unigrams and bigrams from Neurosynth), where each value is the number
        of times the feature is found in a given article.
    coordinates_df : :obj:`pandas.DataFrame`
        A DataFrame with a list of foci in the dataset. The index is 'id',
        used for identifying studies. Additional columns include 'i', 'j' and
        'k' (the matrix indices of the foci in standard space).
    mask : :obj:`str` or :obj:`nibabel.Nifti1.Nifti1Image`
github neurostuff / NiMARE / nimare / annotate / ontology / cogat.py View on Github external
import re
import logging

import numpy as np
import pandas as pd

from . import utils
from ...utils import uk_to_us
from ...due import due
from ... import references
from ...extract import download_cognitive_atlas

LGR = logging.getLogger(__name__)


@due.dcite(references.COGNITIVE_ATLAS, description='Introduces the Cognitive Atlas.')
class CogAtLemmatizer(object):
    """
    Replace synonyms and abbreviations with Cognitive Atlas [1]_ identifiers in
    text.

    Parameters
    ----------
    ontology_df : :obj:`pandas.DataFrame`, optional
        DataFrame with three columns (id, name, alias) and one row for each
        alias (e.g., synonym or abbreviation) for each term in the Cognitive
        Atlas. If None, loads ontology file from resources folder.

    Attributes
    ----------
    ontology_ : :obj:`pandas.DataFrame`
        Ontology in DataFrame form.
github neurostuff / NiMARE / nimare / meta / esma.py View on Github external
@due.dcite(references.STOUFFERS, description='Stouffers citation.')
def stouffers(z_maps, inference='ffx', null='theoretical', n_iters=None,
              two_sided=True):
    """
    Run a Stouffer's image-based meta-analysis on z-statistic maps.

    Parameters
    ----------
    z_maps : (n_contrasts, n_voxels) :obj:`numpy.ndarray`
        A 2D array of z-statistic maps in the same space, after masking.
    inference : {'ffx', 'rfx'}, optional
        Whether to use fixed-effects inference (default) or random-effects
        inference.
    null : {'theoretical', 'empirical'}, optional
        Whether to use a theoretical null T distribution or an empirically-
        derived null distribution determined via sign flipping. Empirical null
        is only possible if ``inference = 'rfx'``.
github neurostuff / NiMARE / nimare / workflows / ica.py View on Github external
@due.dcite(references.META_ICA2,
           description='Compares results of BrainMap metaICA with resting state ICA.')
def meta_ica_workflow():
    """
    Perform a meta-ICA analysis on a database.

    Warnings
    --------
    This method is not yet implemented.
    """
    pass
github neurostuff / NiMARE / nimare / stats.py View on Github external
@due.dcite(references.T2Z_TRANSFORM,
           description='Introduces T-to-Z transform.')
@due.dcite(references.T2Z_IMPLEMENTATION,
           description='Python implementation of T-to-Z transform.')
def t_to_z(t_values, dof):
    """
    From Vanessa Sochat's TtoZ package.
    """
    # Select just the nonzero voxels
    nonzero = t_values[t_values != 0]

    # We will store our results here
    z_values = np.zeros(len(nonzero))

    # Select values less than or == 0, and greater than zero
    c = np.zeros(len(nonzero))
    k1 = (nonzero <= c)
github neurostuff / NiMARE / nimare / annotate / topic / lda.py View on Github external
import subprocess

import numpy as np
import pandas as pd

from ..base import AnnotationModel
from ...due import due
from ... import references
from ...extract import download_mallet, utils

LGR = logging.getLogger(__name__)


@due.dcite(references.LDA, description='Introduces LDA.')
@due.dcite(references.MALLET, description='Citation for MALLET toolbox')
@due.dcite(references.LDAMODEL,
           description='First use of LDA for automated annotation of '
           'neuroimaging literature.')
class LDAModel(AnnotationModel):
    """
    Perform topic modeling using Latent Dirichlet Allocation [1]_ with the
    Java toolbox MALLET [2]_, as performed in [3]_.

    Parameters
    ----------
    text_df : :obj:`pandas.DataFrame`
        A pandas DataFrame with two columns ('id' and text_column) containing
        article text.
    text_column : :obj:`str`, optional
        Name of column in text_df that contains text. Default is 'abstract'.
    n_topics : :obj:`int`, optional
        Number of topics to generate. Default=50.
github neurostuff / NiMARE / nimare / decode / discrete.py View on Github external
@due.dcite(references.BRAINMAP_DECODING,
           description='Citation for BrainMap-style decoding.')
def brainmap_decode(coordinates, annotations, ids, ids2=None, features=None,
                    frequency_threshold=0.001, u=0.05, correction='fdr_bh'):
    """
    Perform image-to-text decoding for discrete image inputs (e.g., regions
    of interest, significant clusters) according to the BrainMap method [1]_.

    References
    ----------
    .. [1] Amft, Maren, et al. "Definition and characterization of an extended
        social-affective default network." Brain Structure and Function 220.2
        (2015): 1031-1049. https://doi.org/10.1007/s00429-013-0698-0
    """
    id_cols = ['id', 'study_id', 'contrast_id']
    dataset_ids = sorted(list(set(coordinates['id'].values)))
    if ids2 is None: