nimare.dataset
.Dataset¶
-
class
Dataset
(source, target='mni152_2mm', mask=None)[source]¶ Storage container for a coordinate- and/or image-based meta-analytic dataset/database.
Parameters: - source (
str
) – JSON file containing dictionary with database information or the dict() object - target (
str
) – Desired coordinate space for coordinates. Names follow NIDM convention. - mask (str, Nifti1Image, or any nilearn Masker) – Mask(er) to use. If None, uses the target space image, with all non-zero voxels included in the mask.
Methods
get
(self, dict_)Retrieve files and/or metadata from the current Dataset. get_images
(self[, ids, imtype])Get images of a certain type for a subset of studies in the dataset. get_labels
(self[, ids])Extract list of labels for which studies in Dataset have annotations. get_metadata
(self[, ids, field])Get metadata from Dataset. get_params
(self[, deep])Get parameters for this estimator. get_studies_by_coordinate
(self, xyz[, r])Extract list of studies with at least one focus within radius r of requested coordinates. get_studies_by_label
(self[, labels, …])Extract list of studies with a given label. get_studies_by_mask
(self, mask)Extract list of studies with at least one coordinate in mask. get_texts
(self[, ids, text_type])Extract list of texts of a given type for selected IDs. load
(filename[, compressed])Load a pickled class instance from file. save
(self, filename[, compress])Pickle the class instance to the provided file. set_params
(self, \*\*params)Set the parameters of this estimator. slice
(self, ids)Return a reduced dataset with only requested IDs. update_path
(self, new_path)Update paths to images. -
get
(self, dict_)[source]¶ Retrieve files and/or metadata from the current Dataset.
Parameters: dict ( dict
) – Dictionary specifying images or metadata to collectReturns: results – A dictionary of lists of requested data. Return type: dict
-
get_images
(self, ids=None, imtype='z')[source]¶ Get images of a certain type for a subset of studies in the dataset.
Parameters: Returns: images – List of images of requested type for selected IDs.
Return type:
-
get_labels
(self, ids=None)[source]¶ Extract list of labels for which studies in Dataset have annotations.
Parameters: ids (list, optional) – A list of IDs in the Dataset for which to find labels. Default is None, in which case all labels are returned. Returns: labels – List of labels for which there are annotations in the Dataset. Return type: list
-
get_metadata
(self, ids=None, field='sample_sizes')[source]¶ Get metadata from Dataset.
Parameters: Returns: metadata – List of values of requested type for selected IDs.
Return type:
-
get_params
(self, deep=True)[source]¶ Get parameters for this estimator.
Parameters: deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns: params – Parameter names mapped to their values. Return type: mapping of string to any
-
get_studies_by_coordinate
(self, xyz, r=20)[source]¶ Extract list of studies with at least one focus within radius r of requested coordinates.
Parameters: - xyz ((X x 3) array_like) – List of coordinates against which to find studies.
- r (float, optional) – Radius (in mm) within which to find studies. Default is 20mm.
Returns: found_ids – A list of IDs from the Dataset with at least one focus within radius r of requested coordinates.
Return type:
-
get_studies_by_label
(self, labels=None, label_threshold=0.5)[source]¶ Extract list of studies with a given label.
Parameters: Returns: found_ids – A list of IDs from the Dataset found by the search criteria.
Return type:
-
get_studies_by_mask
(self, mask)[source]¶ Extract list of studies with at least one coordinate in mask.
Parameters: mask (img_like) – Mask across which to search for coordinates. Returns: found_ids – A list of IDs from the Dataset with at least one focus in the mask. Return type: list
-
get_texts
(self, ids=None, text_type='abstract')[source]¶ Extract list of texts of a given type for selected IDs.
Parameters: Returns: texts – List of texts of requested type for selected IDs.
Return type:
-
classmethod
load
(filename, compressed=True)[source]¶ Load a pickled class instance from file.
Parameters: Returns: obj – Loaded class object.
Return type: class object
-
save
(self, filename, compress=True)[source]¶ Pickle the class instance to the provided file.
Parameters:
-
set_params
(self, **params)[source]¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.Returns: Return type: self
-
slice
(self, ids)[source]¶ Return a reduced dataset with only requested IDs.
Parameters: ids (array_like) – List of study IDs to include in new dataset Returns: new_dset – Redcued Dataset containing only requested studies. Return type: nimare.dataset.Dataset
- source (