9.1.1. Data Grabbers

DataGrabbers for datasets’ data description.

enum junifer.datagrabber.AOMICSpace(value)

Accepted spaces for AOMIC.

Member Type:

str

Valid values are as follows:

Native = <AOMICSpace.Native: 'native'>
MNI152NLin2009cAsym = <AOMICSpace.MNI152NLin2009cAsym: 'MNI152NLin2009cAsym'>
enum junifer.datagrabber.AOMICTask(value)

Accepted tasks for AOMIC.

Member Type:

str

Valid values are as follows:

RestingState = <AOMICTask.RestingState: 'restingstate'>
Anticipation = <AOMICTask.Anticipation: 'anticipation'>
EmoMatching = <AOMICTask.EmoMatching: 'emomatching'>
Faces = <AOMICTask.Faces: 'faces'>
Gstroop = <AOMICTask.Gstroop: 'gstroop'>
WorkingMemory = <AOMICTask.WorkingMemory: 'workingmemory'>
StopSignal = <AOMICTask.StopSignal: 'stopsignal'>
pydantic model junifer.datagrabber.BaseDataGrabber

Abstract base class for data fetcher.

For every datagrabber, one needs to provide a concrete implementation of this abstract class.

Parameters:
typesDataType or list of variants

The data type(s) to grab.

datadirpathlib.Path

The path where the data is or will be stored.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "BaseDataGrabber",
   "description": "Abstract base class for data fetcher.\n\nFor every datagrabber, one needs to provide a concrete\nimplementation of this abstract class.\n\nParameters\n----------\ntypes : :enum:`.DataType` or list of variants\n    The data type(s) to grab.\ndatadir : pathlib.Path\n    The path where the data is or will be stored.",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataType"
            },
            {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "type": "array"
            }
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      }
   },
   "$defs": {
      "DataType": {
         "description": "Accepted data type.",
         "enum": [
            "T1w",
            "T2w",
            "BOLD",
            "Warp",
            "VBM_GM",
            "VBM_WM",
            "VBM_CSF",
            "fALFF",
            "GCOR",
            "LCOR",
            "DWI",
            "FreeSurfer"
         ],
         "title": "DataType",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "types",
      "datadir"
   ]
}

Config:
  • extra: str = forbid

  • use_enum_values: bool = True

Fields:
  • datadir (pathlib.Path)

  • types (junifer.datagrabber.base.DataType | list[junifer.datagrabber.base.DataType])

field datadir: Path [Required]
field types: Annotated[DataType | list[DataType], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] [Required]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

filter(selection)

Filter elements to be grabbed.

Parameters:
selectionElements

The list of partial or complete element selectors to filter using, with the same number of values.

Yields:
object

An element that can be indexed by the DataGrabber.

Raises:
ValueError

If the selectors have different numbers of values.

abstractmethod get_element_keys()

Get element keys.

For each item in the element tuple passed to __getitem__(), this method returns the corresponding key(s).

Returns:
list of str

The element keys.

abstractmethod get_elements()

Get elements.

Returns:
list

List of elements that can be grabbed. The elements can be strings or tuples of strings to index the DataGrabber.

abstractmethod get_item(**element)

Get the specified item from the dataset.

Parameters:
elementdict

The element to be indexed.

Returns:
dict

Dictionary of paths for each type of data required for the specified element.

get_type_element_keys(data_type)

Get the element keys that the data of a data type depends on.

The element keys (see get_element_keys()) are the keys that the data types to grab depend on.

Parameters:
data_typestr

The data type.

Returns:
list of str

The element keys, all of them unless a subclass knows which ones the data type depends on (e.g., only the subject for data that is the same for all the tasks of a subject).

get_types()

Get types.

Returns:
list of str

The data type(s) to grab.

model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

select_elements(selection)

Select the elements to grab.

All the selectors must have the same number of values (a single value counts as a tuple of one value), so they are either all complete elements or all partial selectors:

  • Complete elements have a value for each element key, in the order of get_element_keys(), e.g., ("sub-01", "rest") for the keys ["subject", "task"]. They are the elements to grab, so the elements of the dataset are not needed (they are not searched for). Repeated elements are only returned once.

  • Partial selectors have fewer values, e.g., "sub-01" or ("sub-01",). They select the elements of the dataset that match them, i.e., that have all their values for any key (see filter()). The elements of the dataset are searched for once, and each element is returned once, even if several selectors match it: with ["sub-01", "rest"], the element ("sub-01", "rest") matches both selectors and is returned once, together with the other tasks of sub-01 and the rest task of the other subjects.

Parameters:
selectionElements

The list of partial or complete element selectors.

Returns:
list of tuple

The selected elements, without duplicates.

Raises:
ValueError

If the selectors have different numbers of values.

RuntimeError

If a partial selector does not match any element.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

Subclasses can override to provide validation.

property fulldir: Path

Get complete data directory path.

Returns:
pathlib.Path

Complete path to the data directory. Can be overridden by subclasses.

enum junifer.datagrabber.ConfoundsFormat(value)

Accepted confounds format.

Member Type:

str

Valid values are as follows:

FMRIPrep = <ConfoundsFormat.FMRIPrep: 'fmriprep'>
AdHoc = <ConfoundsFormat.AdHoc: 'adhoc'>
pydantic model junifer.datagrabber.DMCC13Benchmark

Concrete implementation for datalad-based data fetching of DMCC13.

Parameters:
types{“BOLD”, “T1w”, “VBM_CSF”, “VBM_GM”, “VBM_WM”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

sessions{“ses-wave1bas”, “ses-wave1pro”, “ses-wave1rea”} or list of the options, optional

DMCC sessions. By default, all available sessions are selected.

tasks{“Rest”, “Axcpt”, “Cuedts”, “Stern”, “Stroop”} or list of the options, optional

DMCC tasks. By default, all available tasks are selected.

phase_encodings{“AP”, “PA”} or list of the options, optional

DMCC phase encoding directions. By default, all available phase encodings are selected.

runs{“1”, “2”} or list of the options, optional

DMCC runs. By default, all available runs are selected.

native_t1wbool, optional

Whether to use T1w in native space (default False).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DMCC13Benchmark",
   "description": "Concrete implementation for datalad-based data fetching of DMCC13.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"VBM_CSF\", \"VBM_GM\", \"VBM_WM\", \"Warp\"} or             list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\nsessions : {\"ses-wave1bas\", \"ses-wave1pro\", \"ses-wave1rea\"} or                list of the options, optional\n    DMCC sessions.\n    By default, all available sessions are selected.\ntasks : {\"Rest\", \"Axcpt\", \"Cuedts\", \"Stern\", \"Stroop\"} or             list of the options, optional\n    DMCC tasks.\n    By default, all available tasks are selected.\nphase_encodings : {\"AP\", \"PA\"} or list of the options, optional\n    DMCC phase encoding directions.\n    By default, all available phase encodings are selected.\nruns : {\"1\", \"2\"} or list of the options, optional\n    DMCC runs.\n    By default, all available runs are selected.\nnative_t1w : bool, optional\n    Whether to use T1w in native space (default False).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "VBM_CSF",
                  "VBM_GM",
                  "VBM_WM",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "VBM_CSF",
                     "VBM_GM",
                     "VBM_WM",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz",
                  "space": "MNI152NLin2009cAsym"
               },
               "pattern": "derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz",
               "space": "MNI152NLin2009cAsym"
            },
            "T1w": {
               "mask": {
                  "pattern": "derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz",
                  "space": "MNI152NLin2009cAsym"
               },
               "pattern": "derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz",
               "space": "MNI152NLin2009cAsym"
            },
            "VBM_CSF": {
               "pattern": "derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz",
               "space": "MNI152NLin2009cAsym"
            },
            "VBM_GM": {
               "pattern": "derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz",
               "space": "MNI152NLin2009cAsym"
            },
            "VBM_WM": {
               "pattern": "derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz",
               "space": "MNI152NLin2009cAsym"
            }
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject",
            "session",
            "task",
            "phase_encoding",
            "run"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "$ref": "#/$defs/ConfoundsFormat",
         "default": "fmriprep"
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/OpenNeuroDatasets/ds003452.git",
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      },
      "sessions": {
         "anyOf": [
            {
               "enum": [
                  "ses-wave1bas",
                  "ses-wave1pro",
                  "ses-wave1rea"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "ses-wave1bas",
                     "ses-wave1pro",
                     "ses-wave1rea"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "ses-wave1bas",
            "ses-wave1pro",
            "ses-wave1rea"
         ],
         "title": "Sessions"
      },
      "tasks": {
         "anyOf": [
            {
               "enum": [
                  "Rest",
                  "Axcpt",
                  "Cuedts",
                  "Stern",
                  "Stroop"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "Rest",
                     "Axcpt",
                     "Cuedts",
                     "Stern",
                     "Stroop"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "Rest",
            "Axcpt",
            "Cuedts",
            "Stern",
            "Stroop"
         ],
         "title": "Tasks"
      },
      "phase_encodings": {
         "anyOf": [
            {
               "enum": [
                  "AP",
                  "PA"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "AP",
                     "PA"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "AP",
            "PA"
         ],
         "title": "Phase Encodings"
      },
      "runs": {
         "anyOf": [
            {
               "enum": [
                  "1",
                  "2"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "1",
                     "2"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "1",
            "2"
         ],
         "title": "Runs"
      },
      "native_t1w": {
         "default": false,
         "title": "Native T1W",
         "type": "boolean"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • confounds_format (junifer.datagrabber.pattern.ConfoundsFormat)

  • native_t1w (bool)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • phase_encodings (Annotated[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCPhaseEncoding.AP, junifer.datagrabber.dmcc13_benchmark.DMCCPhaseEncoding.PA] | list[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCPhaseEncoding.AP, junifer.datagrabber.dmcc13_benchmark.DMCCPhaseEncoding.PA]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • replacements (list[str])

  • runs (Annotated[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCRun.One, junifer.datagrabber.dmcc13_benchmark.DMCCRun.Two] | list[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCRun.One, junifer.datagrabber.dmcc13_benchmark.DMCCRun.Two]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • sessions (Annotated[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Bas, junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Pro, junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Rea] | list[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Bas, junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Pro, junifer.datagrabber.dmcc13_benchmark.DMCCSession.Wave1Rea]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • tasks (Annotated[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCTask.Rest, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Axcpt, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Cuedts, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Stern, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Stroop] | list[Literal[junifer.datagrabber.dmcc13_benchmark.DMCCTask.Rest, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Axcpt, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Cuedts, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Stern, junifer.datagrabber.dmcc13_benchmark.DMCCTask.Stroop]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • uri (pydantic.networks.AnyUrl)

Validators:

field confounds_format: ConfoundsFormat = <ConfoundsFormat.FMRIPrep: 'fmriprep'>
field native_t1w: bool = False
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'pattern': 'derivatives/fmriprep-1.3.2/{subject}/{session}/func/{subject}_{session}_task-{task}_acq-mb4{phase_encoding}_run-{run}_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'T1w': {'mask': {'pattern': 'derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'pattern': 'derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'VBM_CSF': {'pattern': 'derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'VBM_GM': {'pattern': 'derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz', 'space': 'MNI152NLin2009cAsym'}, 'VBM_WM': {'pattern': 'derivatives/fmriprep-1.3.2/{subject}/anat/{subject}_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz', 'space': 'MNI152NLin2009cAsym'}}
field phase_encodings: Annotated[Literal[DMCCPhaseEncoding.AP, DMCCPhaseEncoding.PA] | list[Literal[DMCCPhaseEncoding.AP, DMCCPhaseEncoding.PA]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [DMCCPhaseEncoding.AP, DMCCPhaseEncoding.PA]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field replacements: list[str] = ['subject', 'session', 'task', 'phase_encoding', 'run']
field runs: Annotated[Literal[DMCCRun.One, DMCCRun.Two] | list[Literal[DMCCRun.One, DMCCRun.Two]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [DMCCRun.One, DMCCRun.Two]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field sessions: Annotated[Literal[DMCCSession.Wave1Bas, DMCCSession.Wave1Pro, DMCCSession.Wave1Rea] | list[Literal[DMCCSession.Wave1Bas, DMCCSession.Wave1Pro, DMCCSession.Wave1Rea]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [DMCCSession.Wave1Bas, DMCCSession.Wave1Pro, DMCCSession.Wave1Rea]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field tasks: Annotated[Literal[DMCCTask.Rest, DMCCTask.Axcpt, DMCCTask.Cuedts, DMCCTask.Stern, DMCCTask.Stroop] | list[Literal[DMCCTask.Rest, DMCCTask.Axcpt, DMCCTask.Cuedts, DMCCTask.Stern, DMCCTask.Stroop]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [DMCCTask.Rest, DMCCTask.Axcpt, DMCCTask.Cuedts, DMCCTask.Stern, DMCCTask.Stroop]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.VBM_CSF: 'VBM_CSF'>, <DataType.VBM_GM: 'VBM_GM'>, <DataType.VBM_WM: 'VBM_WM'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl = AnyUrl('https://github.com/OpenNeuroDatasets/ds003452.git')
model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

enum junifer.datagrabber.DMCCPhaseEncoding(value)

Accepted DMCC phase encoding directions.

Member Type:

str

Valid values are as follows:

AP = <DMCCPhaseEncoding.AP: 'AP'>
PA = <DMCCPhaseEncoding.PA: 'PA'>
enum junifer.datagrabber.DMCCRun(value)

Accepted DMCC runs.

Member Type:

str

Valid values are as follows:

One = <DMCCRun.One: '1'>
Two = <DMCCRun.Two: '2'>
enum junifer.datagrabber.DMCCSession(value)

Accepted DMCC sessions.

Member Type:

str

Valid values are as follows:

Wave1Bas = <DMCCSession.Wave1Bas: 'ses-wave1bas'>
Wave1Pro = <DMCCSession.Wave1Pro: 'ses-wave1pro'>
Wave1Rea = <DMCCSession.Wave1Rea: 'ses-wave1rea'>
enum junifer.datagrabber.DMCCTask(value)

Accepted DMCC tasks.

Member Type:

str

Valid values are as follows:

Rest = <DMCCTask.Rest: 'Rest'>
Axcpt = <DMCCTask.Axcpt: 'Axcpt'>
Cuedts = <DMCCTask.Cuedts: 'Cuedts'>
Stern = <DMCCTask.Stern: 'Stern'>
Stroop = <DMCCTask.Stroop: 'Stroop'>
enum junifer.datagrabber.DataType(value)

Accepted data type.

Member Type:

str

Valid values are as follows:

T1w = <DataType.T1w: 'T1w'>
T2w = <DataType.T2w: 'T2w'>
BOLD = <DataType.BOLD: 'BOLD'>
Warp = <DataType.Warp: 'Warp'>
VBM_GM = <DataType.VBM_GM: 'VBM_GM'>
VBM_WM = <DataType.VBM_WM: 'VBM_WM'>
VBM_CSF = <DataType.VBM_CSF: 'VBM_CSF'>
FALFF = <DataType.FALFF: 'fALFF'>
GCOR = <DataType.GCOR: 'GCOR'>
LCOR = <DataType.LCOR: 'LCOR'>
DWI = <DataType.DWI: 'DWI'>
FreeSurfer = <DataType.FreeSurfer: 'FreeSurfer'>
class junifer.datagrabber.DataTypeManager

Class for managing data types.

Overridden to make the class singleton.

clear()

Not implemented.

popitem()

Not implemented.

setdefault(key, value=None)

Not implemented.

class junifer.datagrabber.DataTypeSchema

Data type schema.

pydantic model junifer.datagrabber.DataladAOMICID1000

Concrete implementation for datalad-based data fetching of AOMIC ID1000.

Parameters:
types{“BOLD”, “T1w”, “VBM_CSF”, “VBM_GM”, “VBM_WM”, “DWI”, “FreeSurfer”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

space{“native”, “MNI152NLin2009cAsym”}, optional

AOMIC space (default AOMICSpace.MNI152NLin2009cAsym).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DataladAOMICID1000",
   "description": "Concrete implementation for datalad-based data fetching of AOMIC ID1000.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"VBM_CSF\", \"VBM_GM\", \"VBM_WM\", \"DWI\",             \"FreeSurfer\", \"Warp\"} or list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\nspace : {\"native\", \"MNI152NLin2009cAsym\"}, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "VBM_CSF",
                  "VBM_GM",
                  "VBM_WM",
                  "DWI",
                  "FreeSurfer",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "VBM_CSF",
                     "VBM_GM",
                     "VBM_WM",
                     "DWI",
                     "FreeSurfer",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}desc-preproc_bold.nii.gz",
               "reference": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}boldref.nii.gz"
               }
            },
            "T1w": {
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz"
            },
            "VBM_CSF": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz"
            },
            "VBM_GM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz"
            },
            "VBM_WM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz"
            },
            "DWI": {
               "pattern": "derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz"
            },
            "FreeSurfer": {
               "aseg": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]"
               },
               "lh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]"
               },
               "lh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]"
               },
               "norm": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]"
               },
               "pattern": "derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]",
               "rh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]"
               },
               "rh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]"
               }
            },
            "Warp": [
               {
                  "dst": "native",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5",
                  "src": "MNI152NLin2009cAsym",
                  "warper": "ants"
               },
               {
                  "dst": "MNI152NLin2009cAsym",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5",
                  "src": "native",
                  "warper": "ants"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "$ref": "#/$defs/ConfoundsFormat",
         "default": "fmriprep"
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/OpenNeuroDatasets/ds003097.git",
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      },
      "space": {
         "$ref": "#/$defs/AOMICSpace",
         "default": "MNI152NLin2009cAsym"
      }
   },
   "$defs": {
      "AOMICSpace": {
         "description": "Accepted spaces for AOMIC.",
         "enum": [
            "native",
            "MNI152NLin2009cAsym"
         ],
         "title": "AOMICSpace",
         "type": "string"
      },
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • confounds_format (junifer.datagrabber.pattern.ConfoundsFormat)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • replacements (list[str])

  • space (junifer.datagrabber.aomic._types.AOMICSpace)

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • uri (pydantic.networks.AnyUrl)

Validators:

field confounds_format: ConfoundsFormat = <ConfoundsFormat.FMRIPrep: 'fmriprep'>
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}desc-preproc_bold.nii.gz', 'reference': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-moviewatching_{sp_func_desc}boldref.nii.gz'}}, 'DWI': {'pattern': 'derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz'}, 'FreeSurfer': {'aseg': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]'}, 'lh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]'}, 'lh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]'}, 'norm': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]'}, 'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]', 'rh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]'}, 'rh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]'}}, 'T1w': {'mask': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz'}, 'VBM_CSF': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz'}, 'VBM_GM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz'}, 'VBM_WM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz'}, 'Warp': [{'dst': 'native', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5', 'src': 'MNI152NLin2009cAsym', 'warper': 'ants'}, {'dst': 'MNI152NLin2009cAsym', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5', 'src': 'native', 'warper': 'ants'}]}
field replacements: list[str] = ['subject']
field space: AOMICSpace = AOMICSpace.MNI152NLin2009cAsym
field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.VBM_CSF: 'VBM_CSF'>, <DataType.VBM_GM: 'VBM_GM'>, <DataType.VBM_WM: 'VBM_WM'>, <DataType.DWI: 'DWI'>, <DataType.FreeSurfer: 'FreeSurfer'>, <DataType.Warp: 'Warp'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl = AnyUrl('https://github.com/OpenNeuroDatasets/ds003097.git')
model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

pydantic model junifer.datagrabber.DataladAOMICPIOP1

Concrete implementation for pattern-based data fetching of AOMIC PIOP1.

Parameters:
types{“BOLD”, “T1w”, “VBM_CSF”, “VBM_GM”, “VBM_WM”, “DWI”, “FreeSurfer”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

tasks{“restingstate”, “anticipation”, “emomatching”, “faces”, “gstroop”, “workingmemory”} or list of the options, optional

AOMIC PIOP1 task sessions. By default, all available task sessions are selected.

space{“native”, “MNI152NLin2009cAsym”}, optional

AOMIC space (default AOMICSpace.MNI152NLin2009cAsym).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DataladAOMICPIOP1",
   "description": "Concrete implementation for pattern-based data fetching of AOMIC PIOP1.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"VBM_CSF\", \"VBM_GM\", \"VBM_WM\", \"DWI\",             \"FreeSurfer\", \"Warp\"} or list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\ntasks : {\"restingstate\", \"anticipation\", \"emomatching\", \"faces\",             \"gstroop\", \"workingmemory\"} or list of the options, optional\n    AOMIC PIOP1 task sessions.\n    By default, all available task sessions are selected.\nspace : {\"native\", \"MNI152NLin2009cAsym\"}, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "VBM_CSF",
                  "VBM_GM",
                  "VBM_WM",
                  "DWI",
                  "FreeSurfer",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "VBM_CSF",
                     "VBM_GM",
                     "VBM_WM",
                     "DWI",
                     "FreeSurfer",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}desc-preproc_bold.nii.gz",
               "reference": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}boldref.nii.gz"
               }
            },
            "T1w": {
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz"
            },
            "VBM_CSF": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz"
            },
            "VBM_GM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz"
            },
            "VBM_WM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz"
            },
            "DWI": {
               "pattern": "derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz"
            },
            "FreeSurfer": {
               "aseg": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]"
               },
               "lh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]"
               },
               "lh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]"
               },
               "norm": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]"
               },
               "pattern": "derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]",
               "rh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]"
               },
               "rh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]"
               }
            },
            "Warp": [
               {
                  "dst": "native",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5",
                  "src": "MNI152NLin2009cAsym",
                  "warper": "ants"
               },
               {
                  "dst": "MNI152NLin2009cAsym",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5",
                  "src": "native",
                  "warper": "ants"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject",
            "task"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "$ref": "#/$defs/ConfoundsFormat",
         "default": "fmriprep"
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/OpenNeuroDatasets/ds002785",
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      },
      "tasks": {
         "anyOf": [
            {
               "enum": [
                  "restingstate",
                  "anticipation",
                  "emomatching",
                  "faces",
                  "gstroop",
                  "workingmemory"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "restingstate",
                     "anticipation",
                     "emomatching",
                     "faces",
                     "gstroop",
                     "workingmemory"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "restingstate",
            "anticipation",
            "emomatching",
            "faces",
            "gstroop",
            "workingmemory"
         ],
         "title": "Tasks"
      },
      "space": {
         "$ref": "#/$defs/AOMICSpace",
         "default": "MNI152NLin2009cAsym"
      }
   },
   "$defs": {
      "AOMICSpace": {
         "description": "Accepted spaces for AOMIC.",
         "enum": [
            "native",
            "MNI152NLin2009cAsym"
         ],
         "title": "AOMICSpace",
         "type": "string"
      },
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • confounds_format (junifer.datagrabber.pattern.ConfoundsFormat)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • replacements (list[str])

  • space (junifer.datagrabber.aomic._types.AOMICSpace)

  • tasks (Annotated[Literal[junifer.datagrabber.aomic._types.AOMICTask.RestingState, junifer.datagrabber.aomic._types.AOMICTask.Anticipation, junifer.datagrabber.aomic._types.AOMICTask.EmoMatching, junifer.datagrabber.aomic._types.AOMICTask.Faces, junifer.datagrabber.aomic._types.AOMICTask.Gstroop, junifer.datagrabber.aomic._types.AOMICTask.WorkingMemory] | list[Literal[junifer.datagrabber.aomic._types.AOMICTask.RestingState, junifer.datagrabber.aomic._types.AOMICTask.Anticipation, junifer.datagrabber.aomic._types.AOMICTask.EmoMatching, junifer.datagrabber.aomic._types.AOMICTask.Faces, junifer.datagrabber.aomic._types.AOMICTask.Gstroop, junifer.datagrabber.aomic._types.AOMICTask.WorkingMemory]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • uri (pydantic.networks.AnyUrl)

Validators:

field confounds_format: ConfoundsFormat = <ConfoundsFormat.FMRIPrep: 'fmriprep'>
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}desc-preproc_bold.nii.gz', 'reference': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-*_{sp_func_desc}boldref.nii.gz'}}, 'DWI': {'pattern': 'derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz'}, 'FreeSurfer': {'aseg': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]'}, 'lh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]'}, 'lh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]'}, 'norm': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]'}, 'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]', 'rh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]'}, 'rh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]'}}, 'T1w': {'mask': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz'}, 'VBM_CSF': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz'}, 'VBM_GM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz'}, 'VBM_WM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz'}, 'Warp': [{'dst': 'native', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5', 'src': 'MNI152NLin2009cAsym', 'warper': 'ants'}, {'dst': 'MNI152NLin2009cAsym', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5', 'src': 'native', 'warper': 'ants'}]}
field replacements: list[str] = ['subject', 'task']
field space: AOMICSpace = AOMICSpace.MNI152NLin2009cAsym
field tasks: Annotated[Literal[AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory] | list[Literal[AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.VBM_CSF: 'VBM_CSF'>, <DataType.VBM_GM: 'VBM_GM'>, <DataType.VBM_WM: 'VBM_WM'>, <DataType.DWI: 'DWI'>, <DataType.FreeSurfer: 'FreeSurfer'>, <DataType.Warp: 'Warp'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl = AnyUrl('https://github.com/OpenNeuroDatasets/ds002785')
model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

pydantic model junifer.datagrabber.DataladAOMICPIOP2

Concrete implementation for pattern-based data fetching of AOMIC PIOP2.

Parameters:
types{“BOLD”, “T1w”, “VBM_CSF”, “VBM_GM”, “VBM_WM”, “DWI”, “FreeSurfer”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

tasks{“restingstate”, “stopsignal”, “workingmemory”, “emomatching”} or list of the options, optional

AOMIC PIOP2 task sessions. By default, all available task sessions are selected.

space{“native”, “MNI152NLin2009cAsym”}, optional

AOMIC space (default AOMICSpace.MNI152NLin2009cAsym).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DataladAOMICPIOP2",
   "description": "Concrete implementation for pattern-based data fetching of AOMIC PIOP2.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"VBM_CSF\", \"VBM_GM\", \"VBM_WM\", \"DWI\",             \"FreeSurfer\", \"Warp\"} or list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\ntasks : {\"restingstate\", \"stopsignal\", \"workingmemory\", \"emomatching\"} or             list of the options, optional\n    AOMIC PIOP2 task sessions.\n    By default, all available task sessions are selected.\nspace : {\"native\", \"MNI152NLin2009cAsym\"}, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "VBM_CSF",
                  "VBM_GM",
                  "VBM_WM",
                  "DWI",
                  "FreeSurfer",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "VBM_CSF",
                     "VBM_GM",
                     "VBM_WM",
                     "DWI",
                     "FreeSurfer",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}desc-preproc_bold.nii.gz",
               "reference": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}boldref.nii.gz"
               }
            },
            "T1w": {
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz"
            },
            "VBM_CSF": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz"
            },
            "VBM_GM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz"
            },
            "VBM_WM": {
               "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz"
            },
            "DWI": {
               "pattern": "derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz"
            },
            "FreeSurfer": {
               "aseg": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]"
               },
               "lh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]"
               },
               "lh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]"
               },
               "norm": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]"
               },
               "pattern": "derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]",
               "rh_pial": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]"
               },
               "rh_white": {
                  "pattern": "derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]"
               }
            },
            "Warp": [
               {
                  "dst": "native",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5",
                  "src": "MNI152NLin2009cAsym",
                  "warper": "ants"
               },
               {
                  "dst": "MNI152NLin2009cAsym",
                  "pattern": "derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5",
                  "src": "native",
                  "warper": "ants"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject",
            "task"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "$ref": "#/$defs/ConfoundsFormat",
         "default": "fmriprep"
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/OpenNeuroDatasets/ds002790",
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      },
      "tasks": {
         "anyOf": [
            {
               "enum": [
                  "restingstate",
                  "stopsignal",
                  "emomatching",
                  "workingmemory"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "restingstate",
                     "stopsignal",
                     "emomatching",
                     "workingmemory"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "restingstate",
            "stopsignal",
            "emomatching",
            "workingmemory"
         ],
         "title": "Tasks"
      },
      "space": {
         "$ref": "#/$defs/AOMICSpace",
         "default": "MNI152NLin2009cAsym"
      }
   },
   "$defs": {
      "AOMICSpace": {
         "description": "Accepted spaces for AOMIC.",
         "enum": [
            "native",
            "MNI152NLin2009cAsym"
         ],
         "title": "AOMICSpace",
         "type": "string"
      },
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • confounds_format (junifer.datagrabber.pattern.ConfoundsFormat)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • replacements (list[str])

  • space (junifer.datagrabber.aomic._types.AOMICSpace)

  • tasks (Annotated[Literal[junifer.datagrabber.aomic._types.AOMICTask.RestingState, junifer.datagrabber.aomic._types.AOMICTask.StopSignal, junifer.datagrabber.aomic._types.AOMICTask.EmoMatching, junifer.datagrabber.aomic._types.AOMICTask.WorkingMemory] | list[Literal[junifer.datagrabber.aomic._types.AOMICTask.RestingState, junifer.datagrabber.aomic._types.AOMICTask.StopSignal, junifer.datagrabber.aomic._types.AOMICTask.EmoMatching, junifer.datagrabber.aomic._types.AOMICTask.WorkingMemory]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.VBM_CSF, junifer.datagrabber.base.DataType.VBM_GM, junifer.datagrabber.base.DataType.VBM_WM, junifer.datagrabber.base.DataType.DWI, junifer.datagrabber.base.DataType.FreeSurfer, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • uri (pydantic.networks.AnyUrl)

Validators:

field confounds_format: ConfoundsFormat = <ConfoundsFormat.FMRIPrep: 'fmriprep'>
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}desc-preproc_bold.nii.gz', 'reference': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_acq-seq_{sp_func_desc}boldref.nii.gz'}}, 'DWI': {'pattern': 'derivatives/dwipreproc/{subject}/dwi/{subject}_desc-preproc_dwi.nii.gz'}, 'FreeSurfer': {'aseg': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]'}, 'lh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]'}, 'lh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]'}, 'norm': {'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]'}, 'pattern': 'derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]', 'rh_pial': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]'}, 'rh_white': {'pattern': 'derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]'}}, 'T1w': {'mask': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}desc-preproc_T1w.nii.gz'}, 'VBM_CSF': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-CSF_probseg.nii.gz'}, 'VBM_GM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-GM_probseg.nii.gz'}, 'VBM_WM': {'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_{sp_anat_desc}label-WM_probseg.nii.gz'}, 'Warp': [{'dst': 'native', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5', 'src': 'MNI152NLin2009cAsym', 'warper': 'ants'}, {'dst': 'MNI152NLin2009cAsym', 'pattern': 'derivatives/fmriprep/{subject}/anat/{subject}_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5', 'src': 'native', 'warper': 'ants'}]}
field replacements: list[str] = ['subject', 'task']
field space: AOMICSpace = AOMICSpace.MNI152NLin2009cAsym
field tasks: Annotated[Literal[AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.EmoMatching, AOMICTask.WorkingMemory] | list[Literal[AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.EmoMatching, AOMICTask.WorkingMemory]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.EmoMatching, AOMICTask.WorkingMemory]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.VBM_CSF: 'VBM_CSF'>, <DataType.VBM_GM: 'VBM_GM'>, <DataType.VBM_WM: 'VBM_WM'>, <DataType.DWI: 'DWI'>, <DataType.FreeSurfer: 'FreeSurfer'>, <DataType.Warp: 'Warp'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl = AnyUrl('https://github.com/OpenNeuroDatasets/ds002790')
model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

pydantic model junifer.datagrabber.DataladDataGrabber

Abstract base class for datalad-based data fetching.

Defines a DataGrabber that gets data from a datalad sibling.

Parameters:
uripydantic.AnyUrl

URI of the datalad sibling.

rootdirpathlib.Path, optional

The path within the datalad dataset to the root directory (default Path(“.”)).

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

Methods

install:

Installs (clones) the datalad dataset into the datadir. This method is called automatically when the datagrabber is used within a context.

remove:

Removes the datalad dataset from the datadir. This method is called automatically when the datagrabber is used within a context.

See also

BaseDataGrabber

Abstract base class for DataGrabber.

PatternDataGrabber

Concrete implementation for pattern-based data fetching.

PatternDataladDataGrabber

Concrete implementation for pattern and datalad based data fetching.

Notes

This class is intended to be used as a superclass of a subclass with multiple inheritance.

If the datadir is specified and has the stem prefix as "datalad" and the stem suffix as "juniferauto", it will be automatically deleted after use.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DataladDataGrabber",
   "description": "Abstract base class for datalad-based data fetching.\n\nDefines a DataGrabber that gets data from a datalad sibling.\n\nParameters\n----------\nuri : pydantic.AnyUrl\n    URI of the datalad sibling.\nrootdir : pathlib.Path, optional\n    The path within the datalad dataset to the root directory\n    (default Path(\".\")).\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\n\nMethods\n-------\ninstall:\n    Installs (clones) the datalad dataset into the ``datadir``. This method\n    is called automatically when the datagrabber is used within a context.\nremove:\n    Removes the datalad dataset from the ``datadir``. This method is called\n    automatically when the datagrabber is used within a context.\n\nSee Also\n--------\nBaseDataGrabber:\n    Abstract base class for DataGrabber.\nPatternDataGrabber:\n    Concrete implementation for pattern-based data fetching.\nPatternDataladDataGrabber:\n    Concrete implementation for pattern and datalad based data fetching.\n\nNotes\n-----\nThis class is intended to be used as a superclass of a subclass\nwith multiple inheritance.\n\nIf the ``datadir`` is specified and has the stem prefix as ``\"datalad\"``\nand the stem suffix as ``\"juniferauto\"``, it will be automatically\ndeleted after use.",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataType"
            },
            {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "type": "array"
            }
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "uri": {
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      }
   },
   "$defs": {
      "DataType": {
         "description": "Accepted data type.",
         "enum": [
            "T1w",
            "T2w",
            "BOLD",
            "Warp",
            "VBM_GM",
            "VBM_WM",
            "VBM_CSF",
            "fALFF",
            "GCOR",
            "LCOR",
            "DWI",
            "FreeSurfer"
         ],
         "title": "DataType",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "types",
      "uri"
   ]
}

Config:
  • extra: str = forbid

  • use_enum_values: bool = True

Fields:
  • datadir (pathlib.Path)

  • datalad_commit_id (str | None)

  • datalad_dirty (bool)

  • datalad_id (str | None)

  • rootdir (pathlib.Path)

  • uri (pydantic.networks.AnyUrl)

Validators:
  • disable_tag » datalad_dirty

  • warn_existing_datalad_autodir » datadir

field datadir: Path [Optional]
Validated by:
  • warn_existing_datalad_autodir

field datalad_commit_id: str | None = None
field datalad_dirty: bool = False
Validated by:
  • disable_tag

field datalad_id: str | None = None
field rootdir: Path = PosixPath('.')
field uri: AnyUrl [Required]
validator disable_tag  »  datalad_dirty

Disable setting datalad_dirty directly.

validator warn_existing_datalad_autodir  »  datadir

Warn if existing datalad autodir exists.

cleanup()

Cleanup the datalad dataset.

install()

Installs the datalad dataset.

Raises:
ValueError

If the dataset is already installed but with a different ID.

datalad.support.exceptions.IncompleteResultsError

If there is a datalad-related problem while cloning dataset.

model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

property fulldir: Path

Get complete data directory path.

Returns:
pathlib.Path

Complete path to the data directory.

pydantic model junifer.datagrabber.DataladHCP1200

Concrete implementation for datalad-based data fetching of HCP1200.

Parameters:
types{“BOLD”, “T1w”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

tasks{“REST1”, “REST2”, “SOCIAL”, “WM”, “RELATIONAL”, “EMOTION”, “LANGUAGE”, “GAMBLING”, “MOTOR”} or list of the options, optional

HCP task sessions. By default, all available task sessions are selected.

phase_encodings{“LR”, “RL”} or list of the options, optional

HCP phase encoding directions. By default, all are used.

ica_fixbool, optional

Whether to retrieve data that was processed with ICA+FIX. Only HCP1200Task.REST1 and HCP1200Task.REST2 tasks are available with ICA+FIX (default False).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DataladHCP1200",
   "description": "Concrete implementation for datalad-based data fetching of HCP1200.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"Warp\"} or list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\ntasks : {\"REST1\", \"REST2\", \"SOCIAL\", \"WM\", \"RELATIONAL\", \"EMOTION\",             \"LANGUAGE\", \"GAMBLING\", \"MOTOR\"} or list of the options, optional\n    HCP task sessions.\n    By default, all available task sessions are selected.\nphase_encodings : {\"LR\", \"RL\"} or list of the options, optional\n    HCP phase encoding directions.\n    By default, all are used.\nica_fix : bool, optional\n    Whether to retrieve data that was processed with ICA+FIX.\n    Only ``HCP1200Task.REST1`` and ``HCP1200Task.REST2`` tasks\n    are available with ICA+FIX\n    (default False).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "Warp"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "pattern": "{subject}/MNINonLinear/Results/?fMRI_{task}_{phase_encoding}/?fMRI_{task}_{phase_encoding}{suffix}.nii.gz",
               "space": "MNI152NLin6Asym"
            },
            "T1w": {
               "pattern": "{subject}/T1w/T1w_acpc_dc_restore.nii.gz",
               "space": "native"
            },
            "Warp": [
               {
                  "dst": "native",
                  "pattern": "{subject}/MNINonLinear/xfms/standard2acpc_dc.nii.gz",
                  "src": "MNI152NLin6Asym",
                  "warper": "fsl"
               },
               {
                  "dst": "MNI152NLin6Asym",
                  "pattern": "{subject}/MNINonLinear/xfms/acpc_dc2standard.nii.gz",
                  "src": "native",
                  "warper": "fsl"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject",
            "task",
            "phase_encoding"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "anyOf": [
            {
               "$ref": "#/$defs/ConfoundsFormat"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "tasks": {
         "anyOf": [
            {
               "enum": [
                  "REST1",
                  "REST2",
                  "SOCIAL",
                  "WM",
                  "RELATIONAL",
                  "EMOTION",
                  "LANGUAGE",
                  "GAMBLING",
                  "MOTOR"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "REST1",
                     "REST2",
                     "SOCIAL",
                     "WM",
                     "RELATIONAL",
                     "EMOTION",
                     "LANGUAGE",
                     "GAMBLING",
                     "MOTOR"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "title": "Tasks"
      },
      "phase_encodings": {
         "anyOf": [
            {
               "enum": [
                  "RL",
                  "LR"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "RL",
                     "LR"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "RL",
            "LR"
         ],
         "title": "Phase Encodings"
      },
      "ica_fix": {
         "default": false,
         "title": "Ica Fix",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/datalad-datasets/human-connectome-project-openaccess.git",
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": "HCP1200",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

  • use_enum_values: bool = True

Fields:
  • rootdir (pathlib.Path)

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • uri (pydantic.networks.AnyUrl)

Validators:

field rootdir: Path = PosixPath('HCP1200')
field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.Warp: 'Warp'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl = AnyUrl('https://github.com/datalad-datasets/human-connectome-project-openaccess.git')
get_elements()

Implement fetching list of elements in the dataset.

The subjects are sub-datasets, whose files are only there once they are installed, so the files are not searched: the elements are all the subjects (the directories of the dataset) with the tasks and phase encodings to grab, even if some of them have no data.

Returns:
list

The list of elements that can be grabbed in the dataset.

model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

property skip_file_check: bool

Skip file check existence.

pydantic model junifer.datagrabber.HCP1200

Concrete implementation for pattern-based data fetching of HCP1200.

Parameters:
types{“BOLD”, “T1w”, “Warp”} or list of the options, optional

The data type(s) to grab.

datadirpathlib.Path

The path where the data is stored.

tasks{“REST1”, “REST2”, “SOCIAL”, “WM”, “RELATIONAL”, “EMOTION”, “LANGUAGE”, “GAMBLING”, “MOTOR”} or list of the options, optional

HCP task sessions. By default, all available task sessions are selected.

phase_encodings{“LR”, “RL”} or list of the options, optional

HCP phase encoding directions. By default, all are used.

ica_fixbool, optional

Whether to retrieve data that was processed with ICA+FIX. Only HCP1200Task.REST1 and HCP1200Task.REST2 tasks are available with ICA+FIX (default False).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "HCP1200",
   "description": "Concrete implementation for pattern-based data fetching of HCP1200.\n\nParameters\n----------\ntypes : {\"BOLD\", \"T1w\", \"Warp\"} or list of the options, optional\n    The data type(s) to grab.\ndatadir : pathlib.Path\n    The path where the data is stored.\ntasks : {\"REST1\", \"REST2\", \"SOCIAL\", \"WM\", \"RELATIONAL\", \"EMOTION\",             \"LANGUAGE\", \"GAMBLING\", \"MOTOR\"} or list of the options, optional\n    HCP task sessions.\n    By default, all available task sessions are selected.\nphase_encodings : {\"LR\", \"RL\"} or list of the options, optional\n    HCP phase encoding directions.\n    By default, all are used.\nica_fix : bool, optional\n    Whether to retrieve data that was processed with ICA+FIX.\n    Only ``HCP1200Task.REST1`` and ``HCP1200Task.REST2`` tasks\n    are available with ICA+FIX\n    (default False).",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "enum": [
                  "BOLD",
                  "T1w",
                  "Warp"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "BOLD",
                     "T1w",
                     "Warp"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "BOLD",
            "T1w",
            "Warp"
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "pattern": "{subject}/MNINonLinear/Results/?fMRI_{task}_{phase_encoding}/?fMRI_{task}_{phase_encoding}{suffix}.nii.gz",
               "space": "MNI152NLin6Asym"
            },
            "T1w": {
               "pattern": "{subject}/T1w/T1w_acpc_dc_restore.nii.gz",
               "space": "native"
            },
            "Warp": [
               {
                  "dst": "native",
                  "pattern": "{subject}/MNINonLinear/xfms/standard2acpc_dc.nii.gz",
                  "src": "MNI152NLin6Asym",
                  "warper": "fsl"
               },
               {
                  "dst": "MNI152NLin6Asym",
                  "pattern": "{subject}/MNINonLinear/xfms/acpc_dc2standard.nii.gz",
                  "src": "native",
                  "warper": "fsl"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "default": [
            "subject",
            "task",
            "phase_encoding"
         ],
         "items": {
            "type": "string"
         },
         "title": "Replacements",
         "type": "array"
      },
      "confounds_format": {
         "anyOf": [
            {
               "$ref": "#/$defs/ConfoundsFormat"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "tasks": {
         "anyOf": [
            {
               "enum": [
                  "REST1",
                  "REST2",
                  "SOCIAL",
                  "WM",
                  "RELATIONAL",
                  "EMOTION",
                  "LANGUAGE",
                  "GAMBLING",
                  "MOTOR"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "REST1",
                     "REST2",
                     "SOCIAL",
                     "WM",
                     "RELATIONAL",
                     "EMOTION",
                     "LANGUAGE",
                     "GAMBLING",
                     "MOTOR"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "title": "Tasks"
      },
      "phase_encodings": {
         "anyOf": [
            {
               "enum": [
                  "RL",
                  "LR"
               ],
               "type": "string"
            },
            {
               "items": {
                  "enum": [
                     "RL",
                     "LR"
                  ],
                  "type": "string"
               },
               "type": "array"
            }
         ],
         "default": [
            "RL",
            "LR"
         ],
         "title": "Phase Encodings"
      },
      "ica_fix": {
         "default": false,
         "title": "Ica Fix",
         "type": "boolean"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "datadir"
   ]
}

Config:
  • extra: str = forbid

  • use_enum_values: bool = True

Fields:
  • ica_fix (bool)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • phase_encodings (Annotated[Literal[junifer.datagrabber.hcp1200.hcp1200.HCP1200PhaseEncoding.RL, junifer.datagrabber.hcp1200.hcp1200.HCP1200PhaseEncoding.LR] | list[Literal[junifer.datagrabber.hcp1200.hcp1200.HCP1200PhaseEncoding.RL, junifer.datagrabber.hcp1200.hcp1200.HCP1200PhaseEncoding.LR]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • replacements (list[str])

  • tasks (Annotated[Literal[junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.REST1, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.REST2, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.SOCIAL, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.WM, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.RELATIONAL, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.EMOTION, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.LANGUAGE, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.GAMBLING, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.MOTOR] | list[Literal[junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.REST1, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.REST2, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.SOCIAL, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.WM, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.RELATIONAL, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.EMOTION, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.LANGUAGE, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.GAMBLING, junifer.datagrabber.hcp1200.hcp1200.HCP1200Task.MOTOR]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

  • types (Annotated[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp] | list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp]], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

field ica_fix: bool = False
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] = {'BOLD': {'pattern': '{subject}/MNINonLinear/Results/?fMRI_{task}_{phase_encoding}/?fMRI_{task}_{phase_encoding}{suffix}.nii.gz', 'space': 'MNI152NLin6Asym'}, 'T1w': {'pattern': '{subject}/T1w/T1w_acpc_dc_restore.nii.gz', 'space': 'native'}, 'Warp': [{'dst': 'native', 'pattern': '{subject}/MNINonLinear/xfms/standard2acpc_dc.nii.gz', 'src': 'MNI152NLin6Asym', 'warper': 'fsl'}, {'dst': 'MNI152NLin6Asym', 'pattern': '{subject}/MNINonLinear/xfms/acpc_dc2standard.nii.gz', 'src': 'native', 'warper': 'fsl'}]}
field phase_encodings: Annotated[Literal[HCP1200PhaseEncoding.RL, HCP1200PhaseEncoding.LR] | list[Literal[HCP1200PhaseEncoding.RL, HCP1200PhaseEncoding.LR]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [HCP1200PhaseEncoding.RL, HCP1200PhaseEncoding.LR]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field replacements: list[str] = ['subject', 'task', 'phase_encoding']
field tasks: Annotated[Literal[HCP1200Task.REST1, HCP1200Task.REST2, HCP1200Task.SOCIAL, HCP1200Task.WM, HCP1200Task.RELATIONAL, HCP1200Task.EMOTION, HCP1200Task.LANGUAGE, HCP1200Task.GAMBLING, HCP1200Task.MOTOR] | list[Literal[HCP1200Task.REST1, HCP1200Task.REST2, HCP1200Task.SOCIAL, HCP1200Task.WM, HCP1200Task.RELATIONAL, HCP1200Task.EMOTION, HCP1200Task.LANGUAGE, HCP1200Task.GAMBLING, HCP1200Task.MOTOR]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [HCP1200Task.REST1, HCP1200Task.REST2, HCP1200Task.SOCIAL, HCP1200Task.WM, HCP1200Task.RELATIONAL, HCP1200Task.EMOTION, HCP1200Task.LANGUAGE, HCP1200Task.GAMBLING, HCP1200Task.MOTOR]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field types: Annotated[Literal[DataType.BOLD, DataType.T1w, DataType.Warp] | list[Literal[DataType.BOLD, DataType.T1w, DataType.Warp]], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.Warp: 'Warp'>]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

validate_datagrabber_params()

Run extra logical validation for datagrabber.

enum junifer.datagrabber.HCP1200PhaseEncoding(value)

Accepted HCP1200 phase encoding directions.

Member Type:

str

Valid values are as follows:

LR = <HCP1200PhaseEncoding.LR: 'LR'>
RL = <HCP1200PhaseEncoding.RL: 'RL'>
enum junifer.datagrabber.HCP1200Task(value)

Accepted HCP1200 tasks.

Member Type:

str

Valid values are as follows:

REST1 = <HCP1200Task.REST1: 'REST1'>
REST2 = <HCP1200Task.REST2: 'REST2'>
SOCIAL = <HCP1200Task.SOCIAL: 'SOCIAL'>
WM = <HCP1200Task.WM: 'WM'>
RELATIONAL = <HCP1200Task.RELATIONAL: 'RELATIONAL'>
EMOTION = <HCP1200Task.EMOTION: 'EMOTION'>
LANGUAGE = <HCP1200Task.LANGUAGE: 'LANGUAGE'>
GAMBLING = <HCP1200Task.GAMBLING: 'GAMBLING'>
MOTOR = <HCP1200Task.MOTOR: 'MOTOR'>
pydantic model junifer.datagrabber.MultipleDataGrabber

Concrete implementation for multi sourced data fetching.

Implements a DataGrabber which can be used to fetch data from multiple DataGrabbers, e.g., from different datasets:

  • Each data type is grabbed by one DataGrabber (set with their types), except for the DataGrabbers that only grab the nested data types of a data type (without its main file, e.g., only the confounds of BOLD), which replace the nested data types of the other one.

  • The element keys are the ones of the first DataGrabber, followed by the other keys of the other DataGrabbers, which can have different keys (e.g., subject and task for BOLD, and only subject for VBM_GM). The keys with the same name must have the same values in all the DataGrabbers.

  • The elements are the ones available in all the DataGrabbers, joined on their common keys, and each DataGrabber grabs an element with its keys.

Parameters:
datagrabberslist of DataGrabber-like objects

The DataGrabbers to use for fetching data.

**kwargs

Keyword arguments passed to superclass.

Raises:
RuntimeError

If more than one DataGrabber grabs the main file of a data type or the same nested data type without the main file.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "MultipleDataGrabber",
   "description": "Concrete implementation for multi sourced data fetching.\n\nImplements a DataGrabber which can be used to fetch data from multiple\nDataGrabbers, e.g., from different datasets:\n\n* Each data type is grabbed by one DataGrabber (set with their ``types``),\n  except for the DataGrabbers that only grab the nested data types of a\n  data type (without its main file, e.g., only the ``confounds`` of\n  ``BOLD``), which replace the nested data types of the other one.\n* The element keys are the ones of the first DataGrabber, followed by the\n  other keys of the other DataGrabbers, which can have different keys\n  (e.g., ``subject`` and ``task`` for ``BOLD``, and only ``subject`` for\n  ``VBM_GM``). The keys with the same name must have the same values in\n  all the DataGrabbers.\n* The elements are the ones available in all the DataGrabbers, joined on\n  their common keys, and each DataGrabber grabs an element with its keys.\n\nParameters\n----------\ndatagrabbers : list of DataGrabber-like objects\n    The DataGrabbers to use for fetching data.\n**kwargs\n    Keyword arguments passed to superclass.\n\nRaises\n------\nRuntimeError\n    If more than one DataGrabber grabs the main file of a data type or\n    the same nested data type without the main file.",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataType"
            },
            {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "type": "array"
            }
         ],
         "default": [],
         "title": "Types"
      },
      "datadir": {
         "default": ".",
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "datagrabbers": {
         "items": {
            "anyOf": [
               {},
               {
                  "$ref": "#/$defs/PatternDataGrabber"
               },
               {
                  "$ref": "#/$defs/PatternDataladDataGrabber"
               }
            ]
         },
         "title": "Datagrabbers",
         "type": "array"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      },
      "DataType": {
         "description": "Accepted data type.",
         "enum": [
            "T1w",
            "T2w",
            "BOLD",
            "Warp",
            "VBM_GM",
            "VBM_WM",
            "VBM_CSF",
            "fALFF",
            "GCOR",
            "LCOR",
            "DWI",
            "FreeSurfer"
         ],
         "title": "DataType",
         "type": "string"
      },
      "PatternDataGrabber": {
         "additionalProperties": false,
         "description": "Concrete implementation for pattern-based data fetching.\n\nImplements a DataGrabber that understands patterns to grab data.\n\nParameters\n----------\ntypes : :enum:`.DataType` or list of variants\n    The data type(s) to grab.\ndatadir : pathlib.Path\n    The path where the data is stored.\npatterns : ``DataGrabberPatterns``\n    The datagrabber patterns. Check :class:`.DataTypeSchema` for the         schema.\nreplacements : list of str or dict\n    All possible replacements in ``patterns.<data_type>.pattern``. As a\n    dictionary, the keys are the replacements and the values are the lists\n    of values to grab (or None to grab all of them), e.g.,\n    ``{\"subject\": None, \"task\": [\"rest\", \"movie\"]}`` to grab all the\n    subjects and only these tasks.\nconfounds_format : :enum:`.ConfoundsFormat` or None, optional\n    The format of the confounds for the dataset (default None).\npartial_pattern_ok : bool, optional\n    Whether to raise error if partial pattern for a data type is found.\n    This allows to bypass mandatory key check and issue a warning\n    instead of raising error. This allows one to have a DataGrabber\n    with data types without the corresponding mandatory keys and is\n    powerful when used with :class:`.MultipleDataGrabber`\n    (default True).\n\nAttributes\n----------\nskip_file_check",
         "properties": {
            "types": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  },
                  {
                     "items": {
                        "$ref": "#/$defs/DataType"
                     },
                     "type": "array"
                  }
               ],
               "title": "Types"
            },
            "datadir": {
               "format": "path",
               "title": "Datadir",
               "type": "string"
            },
            "patterns": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "additionalProperties": {
                                    "type": "string"
                                 },
                                 "type": "object"
                              },
                              {
                                 "type": "string"
                              }
                           ]
                        },
                        "type": "object"
                     },
                     {
                        "additionalProperties": {
                           "type": "string"
                        },
                        "type": "object"
                     },
                     {
                        "items": {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Patterns",
               "type": "object"
            },
            "replacements": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "additionalProperties": {
                        "anyOf": [
                           {
                              "items": {
                                 "type": "string"
                              },
                              "type": "array"
                           },
                           {
                              "type": "null"
                           }
                        ]
                     },
                     "type": "object"
                  }
               ],
               "title": "Replacements"
            },
            "confounds_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ConfoundsFormat"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "partial_pattern_ok": {
               "default": false,
               "title": "Partial Pattern Ok",
               "type": "boolean"
            }
         },
         "required": [
            "types",
            "datadir",
            "patterns",
            "replacements"
         ],
         "title": "PatternDataGrabber",
         "type": "object"
      },
      "PatternDataladDataGrabber": {
         "additionalProperties": true,
         "description": "Concrete implementation for pattern and datalad based data fetching.\n\nImplements a DataGrabber that gets data from a datalad sibling,\ninterpreting patterns.\n\nParameters\n----------\nuri : pydantic.AnyUrl\n    URI of the datalad sibling.\ntypes : enum:`.DataType` or list of variants\n    The data type(s) to grab.\npatterns : ``DataGrabberPatterns``\n    The datagrabber patterns. Check :class:`DataTypeSchema` for the schema.\nreplacements : list of str\n    All possible replacements in ``patterns.<data_type>.pattern``.\nrootdir : pathlib.Path, optional\n    The path within the datalad dataset to the root directory\n    (default Path(\".\")).\nconfounds_format : :enum:`.ConfoundsFormat` or None, optional\n    The format of the confounds for the dataset (default None).\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\n\n\nSee Also\n--------\nDataladDataGrabber:\n    Abstract base class for datalad-based data fetching.\nPatternDataGrabber:\n    Concrete implementation for pattern-based data fetching.",
         "properties": {
            "types": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  },
                  {
                     "items": {
                        "$ref": "#/$defs/DataType"
                     },
                     "type": "array"
                  }
               ],
               "title": "Types"
            },
            "datadir": {
               "format": "path",
               "title": "Datadir",
               "type": "string"
            },
            "patterns": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "additionalProperties": {
                                    "type": "string"
                                 },
                                 "type": "object"
                              },
                              {
                                 "type": "string"
                              }
                           ]
                        },
                        "type": "object"
                     },
                     {
                        "additionalProperties": {
                           "type": "string"
                        },
                        "type": "object"
                     },
                     {
                        "items": {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Patterns",
               "type": "object"
            },
            "replacements": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "additionalProperties": {
                        "anyOf": [
                           {
                              "items": {
                                 "type": "string"
                              },
                              "type": "array"
                           },
                           {
                              "type": "null"
                           }
                        ]
                     },
                     "type": "object"
                  }
               ],
               "title": "Replacements"
            },
            "confounds_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ConfoundsFormat"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "partial_pattern_ok": {
               "default": false,
               "title": "Partial Pattern Ok",
               "type": "boolean"
            },
            "uri": {
               "format": "uri",
               "minLength": 1,
               "title": "Uri",
               "type": "string"
            },
            "rootdir": {
               "default": ".",
               "format": "path",
               "title": "Rootdir",
               "type": "string"
            },
            "datalad_dirty": {
               "default": false,
               "title": "Datalad Dirty",
               "type": "boolean"
            },
            "datalad_commit_id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Datalad Commit Id"
            },
            "datalad_id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Datalad Id"
            }
         },
         "required": [
            "types",
            "patterns",
            "replacements",
            "uri"
         ],
         "title": "PatternDataladDataGrabber",
         "type": "object"
      }
   },
   "additionalProperties": true,
   "required": [
      "datagrabbers"
   ]
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • datadir (pathlib.Path)

  • datagrabbers (list[type[BaseDataGrabber] | junifer.datagrabber.pattern.PatternDataGrabber | junifer.datagrabber.pattern_datalad.PatternDataladDataGrabber])

  • types (Annotated[junifer.datagrabber.base.DataType | list[junifer.datagrabber.base.DataType], pydantic.functional_validators.BeforeValidator(func=junifer.utils.helpers.ensure_list, json_schema_input_type=PydanticUndefined)])

field datadir: Path = PosixPath('.')
field datagrabbers: list[type[BaseDataGrabber] | PatternDataGrabber | PatternDataladDataGrabber] [Required]
field types: Annotated[DataType | list[DataType], BeforeValidator(func=ensure_list, json_schema_input_type=PydanticUndefined)] = []
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

get_element_keys()

Get element keys.

For each item in the element tuple passed to __getitem__(), this method returns the corresponding key(s): the keys of the first DataGrabber, followed by the other keys of the other DataGrabbers.

Returns:
list of str

The element keys.

get_elements()

Get elements.

The elements of the DataGrabbers are joined on their common keys, as the elements of the data types of a PatternDataGrabber, so the elements are the ones available in all the DataGrabbers.

Returns:
list

List of elements that can be grabbed. The elements can be strings, tuples or any object that will be then used as a key to index the the DataGrabber. The element should be present in all of the related DataGrabbers.

get_item(**_)

Get the specified item from the dataset.

Parameters:
elementdict

The element to be indexed.

Returns:
dict

Dictionary of paths for each type of data required for the specified element.

Notes

This function is not implemented for this class as it is useless.

get_type_element_keys(data_type)

Get the element keys that the data of a data type depends on.

Parameters:
data_typestr

The data type.

Returns:
list of str

The element keys that the data of the data type depends on in all the DataGrabbers grabbing it (e.g., the one grabbing the main file and the one grabbing only its nested data types).

get_types()

Get types.

Returns:
list of str

The types of data to be grabbed.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

class junifer.datagrabber.OptionalTypeSchema

Optional type schema.

pydantic model junifer.datagrabber.PatternDataGrabber

Concrete implementation for pattern-based data fetching.

Implements a DataGrabber that understands patterns to grab data.

Parameters:
typesDataType or list of variants

The data type(s) to grab.

datadirpathlib.Path

The path where the data is stored.

patternsDataGrabberPatterns

The datagrabber patterns. Check DataTypeSchema for the schema.

replacementslist of str or dict

All possible replacements in patterns.<data_type>.pattern. As a dictionary, the keys are the replacements and the values are the lists of values to grab (or None to grab all of them), e.g., {"subject": None, "task": ["rest", "movie"]} to grab all the subjects and only these tasks.

confounds_formatConfoundsFormat or None, optional

The format of the confounds for the dataset (default None).

partial_pattern_okbool, optional

Whether to raise error if partial pattern for a data type is found. This allows to bypass mandatory key check and issue a warning instead of raising error. This allows one to have a DataGrabber with data types without the corresponding mandatory keys and is powerful when used with MultipleDataGrabber (default True).

Attributes:
skip_file_check

Skip file check existence.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "PatternDataGrabber",
   "description": "Concrete implementation for pattern-based data fetching.\n\nImplements a DataGrabber that understands patterns to grab data.\n\nParameters\n----------\ntypes : :enum:`.DataType` or list of variants\n    The data type(s) to grab.\ndatadir : pathlib.Path\n    The path where the data is stored.\npatterns : ``DataGrabberPatterns``\n    The datagrabber patterns. Check :class:`.DataTypeSchema` for the         schema.\nreplacements : list of str or dict\n    All possible replacements in ``patterns.<data_type>.pattern``. As a\n    dictionary, the keys are the replacements and the values are the lists\n    of values to grab (or None to grab all of them), e.g.,\n    ``{\"subject\": None, \"task\": [\"rest\", \"movie\"]}`` to grab all the\n    subjects and only these tasks.\nconfounds_format : :enum:`.ConfoundsFormat` or None, optional\n    The format of the confounds for the dataset (default None).\npartial_pattern_ok : bool, optional\n    Whether to raise error if partial pattern for a data type is found.\n    This allows to bypass mandatory key check and issue a warning\n    instead of raising error. This allows one to have a DataGrabber\n    with data types without the corresponding mandatory keys and is\n    powerful when used with :class:`.MultipleDataGrabber`\n    (default True).\n\nAttributes\n----------\nskip_file_check",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataType"
            },
            {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "type": "array"
            }
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "items": {
                           "type": "string"
                        },
                        "type": "array"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "type": "object"
            }
         ],
         "title": "Replacements"
      },
      "confounds_format": {
         "anyOf": [
            {
               "$ref": "#/$defs/ConfoundsFormat"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      },
      "DataType": {
         "description": "Accepted data type.",
         "enum": [
            "T1w",
            "T2w",
            "BOLD",
            "Warp",
            "VBM_GM",
            "VBM_WM",
            "VBM_CSF",
            "fALFF",
            "GCOR",
            "LCOR",
            "DWI",
            "FreeSurfer"
         ],
         "title": "DataType",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "types",
      "datadir",
      "patterns",
      "replacements"
   ]
}

Config:
  • extra: str = forbid

  • use_enum_values: bool = True

Fields:
  • confounds_format (junifer.datagrabber.pattern.ConfoundsFormat | None)

  • partial_pattern_ok (bool)

  • patterns (dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]])

  • replacements (list[str] | dict[str, list[str] | None])

field confounds_format: ConfoundsFormat | None = None
field partial_pattern_ok: bool = False
field patterns: dict[str, dict[str, dict[str, str] | str] | dict[str, str] | list[dict[str, str]]] [Required]
field replacements: list[str] | dict[str, list[str] | None] [Required]
get_element_keys()

Get element keys.

For each item in the “element” tuple, this functions returns the corresponding key: the replacements in the patterns of the data types to grab (see get_type_element_keys()), e.g., without task if only anatomical data types are grabbed.

Returns:
list of str

The element keys, in the order of replacements.

get_elements()

Implement fetching list of elements in the dataset.

It will use regex to search for “replacements” in the “patterns” and join the results for each type on their common replacements i.e., build a list of elements that have all the required types.

Returns:
list

The list of elements that can be grabbed in the dataset.

get_item(**element)

Get the specified item from the dataset.

This method constructs a real path to the requested item’s data, by replacing the patterns with actual values passed via **element.

Parameters:
elementdict

The element to be indexed. The keys must be the same as the replacements.

Returns:
dict

Dictionary of dictionaries for each type of data required for the specified element.

get_replacement_values()

Get the values of the replacements to grab.

The values are given by replacements (as a dictionary) or by the fields of the replacements (see _REPLACEMENT_FIELDS).

Returns:
dict

The lists of values of the replacements to grab, by replacement. The replacements without values (to grab all of them) are not included.

get_type_element_keys(data_type)

Get the element keys that the data of a data type depends on.

Parameters:
data_typestr

The data type.

Returns:
list of str

The replacements in the patterns of the data type (including the nested ones), in the order of replacements.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

property skip_file_check: bool

Skip file check existence.

pydantic model junifer.datagrabber.PatternDataladDataGrabber

Concrete implementation for pattern and datalad based data fetching.

Implements a DataGrabber that gets data from a datalad sibling, interpreting patterns.

Parameters:
uripydantic.AnyUrl

URI of the datalad sibling.

typesenum:.DataType or list of variants

The data type(s) to grab.

patternsDataGrabberPatterns

The datagrabber patterns. Check DataTypeSchema for the schema.

replacementslist of str

All possible replacements in patterns.<data_type>.pattern.

rootdirpathlib.Path, optional

The path within the datalad dataset to the root directory (default Path(“.”)).

confounds_formatConfoundsFormat or None, optional

The format of the confounds for the dataset (default None).

datadirpathlib.Path, optional

That path where the datalad dataset will be cloned. If not specified, the datalad dataset will be cloned into a temporary directory.

See also

DataladDataGrabber

Abstract base class for datalad-based data fetching.

PatternDataGrabber

Concrete implementation for pattern-based data fetching.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "PatternDataladDataGrabber",
   "description": "Concrete implementation for pattern and datalad based data fetching.\n\nImplements a DataGrabber that gets data from a datalad sibling,\ninterpreting patterns.\n\nParameters\n----------\nuri : pydantic.AnyUrl\n    URI of the datalad sibling.\ntypes : enum:`.DataType` or list of variants\n    The data type(s) to grab.\npatterns : ``DataGrabberPatterns``\n    The datagrabber patterns. Check :class:`DataTypeSchema` for the schema.\nreplacements : list of str\n    All possible replacements in ``patterns.<data_type>.pattern``.\nrootdir : pathlib.Path, optional\n    The path within the datalad dataset to the root directory\n    (default Path(\".\")).\nconfounds_format : :enum:`.ConfoundsFormat` or None, optional\n    The format of the confounds for the dataset (default None).\ndatadir : pathlib.Path, optional\n    That path where the datalad dataset will be cloned.\n    If not specified, the datalad dataset will be cloned into a temporary\n    directory.\n\n\nSee Also\n--------\nDataladDataGrabber:\n    Abstract base class for datalad-based data fetching.\nPatternDataGrabber:\n    Concrete implementation for pattern-based data fetching.",
   "type": "object",
   "properties": {
      "types": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataType"
            },
            {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "type": "array"
            }
         ],
         "title": "Types"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "items": {
                           "type": "string"
                        },
                        "type": "array"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "type": "object"
            }
         ],
         "title": "Replacements"
      },
      "confounds_format": {
         "anyOf": [
            {
               "$ref": "#/$defs/ConfoundsFormat"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "partial_pattern_ok": {
         "default": false,
         "title": "Partial Pattern Ok",
         "type": "boolean"
      },
      "uri": {
         "format": "uri",
         "minLength": 1,
         "title": "Uri",
         "type": "string"
      },
      "rootdir": {
         "default": ".",
         "format": "path",
         "title": "Rootdir",
         "type": "string"
      },
      "datalad_dirty": {
         "default": false,
         "title": "Datalad Dirty",
         "type": "boolean"
      },
      "datalad_commit_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Commit Id"
      },
      "datalad_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Datalad Id"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      },
      "DataType": {
         "description": "Accepted data type.",
         "enum": [
            "T1w",
            "T2w",
            "BOLD",
            "Warp",
            "VBM_GM",
            "VBM_WM",
            "VBM_CSF",
            "fALFF",
            "GCOR",
            "LCOR",
            "DWI",
            "FreeSurfer"
         ],
         "title": "DataType",
         "type": "string"
      }
   },
   "additionalProperties": true,
   "required": [
      "types",
      "patterns",
      "replacements",
      "uri"
   ]
}

Config:
  • extra: str = allow

  • use_enum_values: bool = True

Fields:
  • datadir (pathlib.Path)

  • datalad_commit_id (str | None)

  • datalad_dirty (bool)

  • datalad_id (str | None)

  • rootdir (pathlib.Path)

  • types (Annotated[DataType | list[DataType], BeforeValidator(ensure_list)])

  • uri (pydantic.networks.AnyUrl)

Validators:
  • disable_tag » datalad_dirty

  • warn_existing_datalad_autodir » datadir

field datadir: Path [Optional]
Validated by:
  • warn_existing_datalad_autodir

field datalad_commit_id: str | None = None
field datalad_dirty: bool = False
Validated by:
  • disable_tag

field datalad_id: str | None = None
field rootdir: Path = PosixPath('.')
field types: Annotated[DataType | list[DataType], BeforeValidator(ensure_list)] [Required]
Constraints:
  • func = <function ensure_list at 0x712131602660>

  • json_schema_input_type = PydanticUndefined

field uri: AnyUrl [Required]
install()

Install the datalad dataset and check the patterns.

The elements are found by searching the files of the patterns, but the files of a sub-dataset are only there once the sub-dataset is installed, so the patterns cannot search the files of the sub-datasets (e.g., with one sub-dataset per subject).

Raises:
RuntimeError

If a pattern searches the files of a sub-dataset.

model_post_init(context)

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

validate_datagrabber_params()

Run extra logical validation for datagrabber.

class junifer.datagrabber.PatternValidationMixin

Mixin class for pattern validation.

validate_patterns(types, replacements, patterns, partial_pattern_ok=False)

Validate the patterns.

Parameters:
typeslist of DataType

The data type(s) to check patterns of.

replacementslist of str

The replacements to be replaced in the patterns.

patternsDataGrabberPatterns

The patterns to validate.

partial_pattern_okbool, optional

Whether to raise error if partial pattern for a data type is found. If False, a warning is issued instead of raising an error (default False).

Raises:
ValueError

If length of types and patterns are different or if patterns is missing entries from types or if unknown data type is found in patterns or if data type pattern key contains ‘*’ as value.

junifer.datagrabber.register_confounds_format(name, alias)

Register custom confounds format.

Parameters:
namestr

The confounds format name to be referred.

aliasstr

The confounds format alias for string representation.

junifer.datagrabber.register_data_type(name, schema)

Register custom data type.

Parameters:
namestr

The data type name.

schemaDataTypeSchema

The data type schema.