nimare.extract.fetch_neurosynth

fetch_neurosynth(data_dir=None, version='7', overwrite=False, return_type='studyset', target='mni152_2mm', **kwargs)[source]

Download the latest data files from NeuroSynth.

Changed in version 0.0.10:

  • Use new format for Neurosynth and NeuroQuery files.

  • Change “path” parameter to “data_dir”.

Added in version 0.0.4.

Parameters:
  • data_dir (pathlib.Path or str, optional) – Path where data should be downloaded. By default, files are downloaded in home directory. A subfolder, named neurosynth, will be created in data_dir, which is where the files will be located.

  • version (str or list, optional) – The version to fetch. The default is “7” (Neurosynth’s latest version).

  • overwrite (bool, optional) – Whether to overwrite existing files or not. Default is False.

  • return_type ({"studyset", "dataset", "files"}, optional) – Type of object to return after downloading. The default is "studyset". Use "dataset" for the legacy Dataset return type or "files" to return the downloaded file manifest without conversion.

  • target ({'mni152_2mm', 'ale_2mm'}, optional) – Target template space used when constructing Dataset or Studyset outputs. Ignored when return_type="files".

  • kwargs (dict, optional) – Keyword arguments to select relevant feature files. Valid kwargs include: source, vocab, type. Each kwarg may be a string or a list of strings. For most Neurosynth term-based workflows, including the decoding examples in NiMARE, use source="abstract" and vocab="terms". If no kwargs are provided, all feature files for the specified database version will be downloaded, including multiple annotation sets.

Returns:

outputs – List of downloaded databases, returned as Studysets, Datasets, or file-manifest dictionaries depending on return_type.

Return type:

list

Notes

This function was adapted from neurosynth.base.dataset.download().

The source, vocab, and type keyword arguments are selectors for annotation files:

  • source identifies which text source the annotations came from. For Neurosynth, the available source is currently "abstract".

  • vocab identifies the annotation vocabulary. "terms" selects term-level tf-idf features, while "LDA50", "LDA100", "LDA200", and "LDA400" select topic-model features for versions 6 and 7.

  • type identifies the feature representation. "tfidf" is used for term annotations, while "weight" is used for LDA topics.

Only combinations present in NiMARE’s database manifest are valid. For Neurosynth, the supported combinations are:

source

vocab

type

abstract

terms

tfidf

abstract

LDA50

weight

abstract

LDA100

weight

abstract

LDA200

weight

abstract

LDA400

weight

Versions 3, 4, and 5 only provide abstract + terms + tfidf. The LDA vocabularies are only available for versions 6 and 7.

Examples

Fetch the abstract-derived term annotations used by most Neurosynth decoding workflows:

fetch_neurosynth(version="7", source="abstract", vocab="terms")

Warning

return_type="dataset" is deprecated and will be removed in a future release. Prefer the default return_type="studyset".

Warning

Starting in version 0.0.10, this function operates on the new Neurosynth/NeuroQuery file format. Old code using this function will not work with the new version.

Examples using nimare.extract.fetch_neurosynth

Neurosynth and NeuroQuery

Neurosynth and NeuroQuery