nimare.nimads.Studyset

class Studyset(source, target_space=None, mask=None, annotations=None)[source]

Bases: object

A collection of studies for meta-analysis.

Added in version 0.0.14.

This is the primary target for Estimators and Transformers in NiMARE.

Variables:
  • id (str) – A unique identifier for the Studyset.

  • name (str) – A human-readable name for the Studyset.

  • annotations (list of nimare.nimads.Annotation objects) – The Annotation objects associated with the Studyset.

  • studies (list of nimare.nimads.Study objects) – The Study objects comprising the Studyset.

Methods

combine_analyses()

Combine analyses in Studyset.

copy()

Create a copy of the Studyset.

from_nimads(filename)

Create a Studyset from a NIMADS JSON file.

get_analyses_by_annotations(key[, value])

Extract a list of Analyses with a given label/annotation.

get_analyses_by_coordinates(xyz[, r, n])

Extract a list of Analyses with at least one Point near the requested coordinates.

get_analyses_by_mask(img)

Extract a list of Analyses with at least one Point in the specified mask.

get_analyses_by_metadata(key[, value])

Extract a list of Analyses with a metadata field/value.

get_annotations(analyses)

Collect Annotations associated with specified Analyses.

get_images(analyses)

Collect image files associated with specified Analyses.

get_metadata(analyses)

Collect metadata associated with specified Analyses.

get_points(analyses)

Collect Points associated with specified Analyses.

get_texts(analyses)

Collect texts associated with specified Analyses.

load(filename)

Load a Studyset from a pickled file.

merge(right)

Merge a separate Studyset into the current one.

save(filename)

Write the Studyset to a pickled file.

slice(analyses)

Create a new Studyset with only requested Analyses.

to_dataset()

Convert the Studyset to a NiMARE Dataset.

to_dict()

Return a dictionary representation of the Studyset.

to_nimads(filename)

Write the Studyset to a NIMADS JSON file.

Properties

annotations

Return existing Annotations.

property annotations

Return existing Annotations.

combine_analyses()[source]

Combine analyses in Studyset.

copy()[source]

Create a copy of the Studyset.

classmethod from_nimads(filename)[source]

Create a Studyset from a NIMADS JSON file.

get_analyses_by_annotations(key, value=None)[source]

Extract a list of Analyses with a given label/annotation.

get_analyses_by_coordinates(xyz, r=None, n=None)[source]

Extract a list of Analyses with at least one Point near the requested coordinates.

Parameters:
  • xyz (array_like) – 1 x 3 array of coordinates in mm space to search from

  • r (float, optional) – Search radius in millimeters. Mutually exclusive with n.

  • n (int, optional) – Number of closest analyses to return. Mutually exclusive with r.

Returns:

A list of Analysis IDs with at least one point within the search criteria.

Return type:

list[str]

Notes

Either r or n must be provided, but not both.

get_analyses_by_mask(img)[source]

Extract a list of Analyses with at least one Point in the specified mask.

Parameters:

img (img_like) – Mask across which to search for coordinates.

Returns:

A list of Analysis IDs with at least one point in the mask.

Return type:

list[str]

get_analyses_by_metadata(key, value=None)[source]

Extract a list of Analyses with a metadata field/value.

get_annotations(analyses)[source]

Collect Annotations associated with specified Analyses.

get_images(analyses)[source]

Collect image files associated with specified Analyses.

get_metadata(analyses)[source]

Collect metadata associated with specified Analyses.

Parameters:

analyses (list of str) – List of Analysis IDs to get metadata for.

Returns:

Dictionary mapping Analysis IDs to their combined metadata (including study metadata).

Return type:

dict[str, dict]

get_points(analyses)[source]

Collect Points associated with specified Analyses.

get_texts(analyses)[source]

Collect texts associated with specified Analyses.

load(filename)[source]

Load a Studyset from a pickled file.

Parameters:

filename (str) – Path to the pickled file to load from.

Returns:

The loaded Studyset object.

Return type:

Studyset

merge(right)[source]

Merge a separate Studyset into the current one.

Parameters:

right (Studyset) – The other Studyset to merge with this one.

Returns:

A new Studyset containing merged studies from both input Studysets. For studies with the same ID, their analyses and metadata are combined, with data from self (left) taking precedence in case of conflicts.

Return type:

Studyset

save(filename)[source]

Write the Studyset to a pickled file.

Parameters:

filename (str) – Path where the pickled file should be saved.

slice(analyses)[source]

Create a new Studyset with only requested Analyses.

to_dataset()[source]

Convert the Studyset to a NiMARE Dataset.

to_dict()[source]

Return a dictionary representation of the Studyset.

to_nimads(filename)[source]

Write the Studyset to a NIMADS JSON file.

Examples using nimare.nimads.Studyset

Using NIMADS with NiMARE

Using NIMADS with NiMARE