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:
typeslist of DataType

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 : list of :enum:`.DataType`\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": {
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "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"
      }
   },
   "required": [
      "types",
      "datadir"
   ]
}

Config:
  • use_enum_values: bool = True

Fields:
  • datadir (pathlib.Path)

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

field datadir: Path [Required]
field types: list[DataType] [Required]
filter(selection)

Filter elements to be grabbed.

Parameters:
selectionElements

The list of partial or complete element selectors to filter using.

Yields:
object

An element that can be indexed by the DataGrabber.

abstract 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.

abstract 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.

abstract 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_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.

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:
typeslist of {DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.Warp}, 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.

sessionslist of DMCCSession, optional

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

taskslist of DMCCTask, optional

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

phase_encodingslist of DMCCPhaseEncoding, optional

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

runslist of DMCCRun, 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 : list of {``DataType.BOLD``, ``DataType.T1w``,             ``DataType.VBM_CSF``, ``DataType.VBM_GM``, ``DataType.VBM_WM``,             ``DataType.Warp``}, 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 : list of :enum:`.DMCCSession`, optional\n    DMCC sessions.\n    By default, all available sessions are selected.\ntasks : list of :enum:`.DMCCTask`, optional\n    DMCC tasks.\n    By default, all available tasks are selected.\nphase_encodings : list of :enum:`.DMCCPhaseEncoding`, optional\n    DMCC phase encoding directions.\n    By default, all available phase encodings are selected.\nruns : list of :enum:`.DMCCRun`, 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": {
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "VBM_CSF",
               "VBM_GM",
               "VBM_WM",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "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",
         "maxLength": 2083,
         "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": {
         "default": [
            "ses-wave1bas",
            "ses-wave1pro",
            "ses-wave1rea"
         ],
         "items": {
            "$ref": "#/$defs/DMCCSession"
         },
         "title": "Sessions",
         "type": "array"
      },
      "tasks": {
         "default": [
            "Rest",
            "Axcpt",
            "Cuedts",
            "Stern",
            "Stroop"
         ],
         "items": {
            "$ref": "#/$defs/DMCCTask"
         },
         "title": "Tasks",
         "type": "array"
      },
      "phase_encodings": {
         "default": [
            "AP",
            "PA"
         ],
         "items": {
            "$ref": "#/$defs/DMCCPhaseEncoding"
         },
         "title": "Phase Encodings",
         "type": "array"
      },
      "runs": {
         "default": [
            "1",
            "2"
         ],
         "items": {
            "$ref": "#/$defs/DMCCRun"
         },
         "title": "Runs",
         "type": "array"
      },
      "native_t1w": {
         "default": false,
         "title": "Native T1W",
         "type": "boolean"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      },
      "DMCCPhaseEncoding": {
         "description": "Accepted DMCC phase encoding directions.",
         "enum": [
            "AP",
            "PA"
         ],
         "title": "DMCCPhaseEncoding",
         "type": "string"
      },
      "DMCCRun": {
         "description": "Accepted DMCC runs.",
         "enum": [
            "1",
            "2"
         ],
         "title": "DMCCRun",
         "type": "string"
      },
      "DMCCSession": {
         "description": "Accepted DMCC sessions.",
         "enum": [
            "ses-wave1bas",
            "ses-wave1pro",
            "ses-wave1rea"
         ],
         "title": "DMCCSession",
         "type": "string"
      },
      "DMCCTask": {
         "description": "Accepted DMCC tasks.",
         "enum": [
            "Rest",
            "Axcpt",
            "Cuedts",
            "Stern",
            "Stroop"
         ],
         "title": "DMCCTask",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • use_enum_values: bool = True

  • extra: str = allow

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

  • native_t1w (bool)

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

  • phase_encodings (list[junifer.datagrabber.dmcc13_benchmark.DMCCPhaseEncoding])

  • replacements (list[str])

  • runs (list[junifer.datagrabber.dmcc13_benchmark.DMCCRun])

  • sessions (list[junifer.datagrabber.dmcc13_benchmark.DMCCSession])

  • tasks (list[junifer.datagrabber.dmcc13_benchmark.DMCCTask])

  • types (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]])

  • uri (pydantic.networks.HttpUrl)

Validators:

field confounds_format: ConfoundsFormat = ConfoundsFormat.FMRIPrep
field native_t1w: bool = False
field patterns: dict[str, dict[str, str | dict[str, str] | list[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: list[DMCCPhaseEncoding] = [DMCCPhaseEncoding.AP, DMCCPhaseEncoding.PA]
field replacements: list[str] = ['subject', 'session', 'task', 'phase_encoding', 'run']
field runs: list[DMCCRun] = [DMCCRun.One, DMCCRun.Two]
field sessions: list[DMCCSession] = [DMCCSession.Wave1Bas, DMCCSession.Wave1Pro, DMCCSession.Wave1Rea]
field tasks: list[DMCCTask] = [DMCCTask.Rest, DMCCTask.Axcpt, DMCCTask.Cuedts, DMCCTask.Stern, DMCCTask.Stroop]
field types: list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.Warp]] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.VBM_CSF: 'VBM_CSF'>, <DataType.VBM_GM: 'VBM_GM'>, <DataType.VBM_WM: 'VBM_WM'>]
field uri: HttpUrl = HttpUrl('https://github.com/OpenNeuroDatasets/ds003452.git')
get_elements()

Implement fetching list of subjects in the dataset.

Returns:
list of str

The list of subjects in the dataset.

get_item(subject, session, task, phase_encoding, run)

Get the specified item from the dataset.

Parameters:
subjectstr

The subject ID.

session{“ses-wave1bas”, “ses-wave1pro”, “ses-wave1rea”}

The session to get.

task{“Rest”, “Axcpt”, “Cuedts”, “Stern”, “Stroop”}

The task to get.

phase_encoding{“AP”, “PA”}

The phase encoding to get.

run{“1”, “2”}

The run to get.

Returns:
outdict

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

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:
typeslist of {DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp}, 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.

spaceAOMICSpace, 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 : list of {``DataType.BOLD``, ``DataType.T1w``,             ``DataType.VBM_CSF``, ``DataType.VBM_GM``, ``DataType.VBM_WM``,             ``DataType.DWI``, ``DataType.FreeSurfer``, ``DataType.Warp``},             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 : :enum:`.AOMICSpace`, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "VBM_CSF",
               "VBM_GM",
               "VBM_WM",
               "DWI",
               "FreeSurfer",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "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",
         "maxLength": 2083,
         "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:
  • use_enum_values: bool = True

  • extra: str = allow

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

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

  • replacements (list[str])

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

  • types (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]])

  • uri (pydantic.networks.HttpUrl)

Validators:

field confounds_format: ConfoundsFormat = ConfoundsFormat.FMRIPrep
field patterns: dict[str, dict[str, str | dict[str, str] | list[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: list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]] = [<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'>]
field uri: HttpUrl = HttpUrl('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:
typeslist of {DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp}, 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.

taskslist of {AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory}, optional

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

spaceAOMICSpace, 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 : list of {``DataType.BOLD``, ``DataType.T1w``,             ``DataType.VBM_CSF``, ``DataType.VBM_GM``, ``DataType.VBM_WM``,             ``DataType.DWI``, ``DataType.FreeSurfer``, ``DataType.Warp``},             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 : list of {``AOMICTask.RestingState``, ``AOMICTask.Anticipation``,             ``AOMICTask.EmoMatching``, ``AOMICTask.Faces``,             ``AOMICTask.Gstroop``, ``AOMICTask.WorkingMemory``}, optional\n    AOMIC PIOP1 task sessions.\n    By default, all available task sessions are selected.\nspace : :enum:`.AOMICSpace`, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "VBM_CSF",
               "VBM_GM",
               "VBM_WM",
               "DWI",
               "FreeSurfer",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-preproc_bold.nii.gz",
               "reference": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{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",
         "maxLength": 2083,
         "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": {
         "default": [
            "restingstate",
            "anticipation",
            "emomatching",
            "faces",
            "gstroop",
            "workingmemory"
         ],
         "items": {
            "enum": [
               "restingstate",
               "anticipation",
               "emomatching",
               "faces",
               "gstroop",
               "workingmemory"
            ],
            "type": "string"
         },
         "title": "Tasks",
         "type": "array"
      },
      "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:
  • use_enum_values: bool = True

  • extra: str = allow

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

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

  • replacements (list[str])

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

  • tasks (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]])

  • types (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]])

  • uri (pydantic.networks.HttpUrl)

Validators:

field confounds_format: ConfoundsFormat = ConfoundsFormat.FMRIPrep
field patterns: dict[str, dict[str, str | dict[str, str] | list[dict[str, str]]] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-preproc_bold.nii.gz', 'reference': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{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: list[Literal[AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory]] = [AOMICTask.RestingState, AOMICTask.Anticipation, AOMICTask.EmoMatching, AOMICTask.Faces, AOMICTask.Gstroop, AOMICTask.WorkingMemory]
field types: list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]] = [<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'>]
field uri: HttpUrl = HttpUrl('https://github.com/OpenNeuroDatasets/ds002785')
get_elements()

Implement fetching list of subjects in the dataset.

Returns:
list of str

The list of subjects in the dataset.

get_item(subject, task)

Get the specified item from the dataset.

Parameters:
subjectstr

The subject ID.

task{“restingstate”, “anticipation”, “emomatching”, “faces”, “gstroop”, “workingmemory”}

The task to get.

Returns:
outdict

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

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:
typeslist of {DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp}, 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.

taskslist of {AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.WorkingMemory, AOMICTask.EmoMatching}, optional

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

spaceAOMICSpace, 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 : list of {``DataType.BOLD``, ``DataType.T1w``,             ``DataType.VBM_CSF``, ``DataType.VBM_GM``, ``DataType.VBM_WM``,             ``DataType.DWI``, ``DataType.FreeSurfer``, ``DataType.Warp``},             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 : list of {``AOMICTask.RestingState``, ``AOMICTask.StopSignal``,             ``AOMICTask.WorkingMemory``, ``AOMICTask.EmoMatching``}, optional\n    AOMIC PIOP2 task sessions.\n    By default, all available task sessions are selected.\nspace : :enum:`.AOMICSpace`, optional\n    AOMIC space (default ``AOMICSpace.MNI152NLin2009cAsym``).",
   "type": "object",
   "properties": {
      "types": {
         "default": [
            "BOLD",
            "T1w",
            "VBM_CSF",
            "VBM_GM",
            "VBM_WM",
            "DWI",
            "FreeSurfer",
            "Warp"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "VBM_CSF",
               "VBM_GM",
               "VBM_WM",
               "DWI",
               "FreeSurfer",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "confounds": {
                  "format": "fmriprep",
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_desc-confounds_regressors.tsv"
               },
               "mask": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-brain_mask.nii.gz"
               },
               "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-preproc_bold.nii.gz",
               "reference": {
                  "pattern": "derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{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",
         "maxLength": 2083,
         "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": {
         "default": [
            "restingstate",
            "stopsignal",
            "emomatching",
            "workingmemory"
         ],
         "items": {
            "enum": [
               "restingstate",
               "stopsignal",
               "emomatching",
               "workingmemory"
            ],
            "type": "string"
         },
         "title": "Tasks",
         "type": "array"
      },
      "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:
  • use_enum_values: bool = True

  • extra: str = allow

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

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

  • replacements (list[str])

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

  • tasks (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]])

  • types (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]])

  • uri (pydantic.networks.HttpUrl)

Validators:

field confounds_format: ConfoundsFormat = ConfoundsFormat.FMRIPrep
field patterns: dict[str, dict[str, str | dict[str, str] | list[dict[str, str]]] | list[dict[str, str]]] = {'BOLD': {'confounds': {'format': 'fmriprep', 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_desc-confounds_regressors.tsv'}, 'mask': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-brain_mask.nii.gz'}, 'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{sp_func_desc}desc-preproc_bold.nii.gz', 'reference': {'pattern': 'derivatives/fmriprep/{subject}/func/{subject}_task-{task}_{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: list[Literal[AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.EmoMatching, AOMICTask.WorkingMemory]] = [AOMICTask.RestingState, AOMICTask.StopSignal, AOMICTask.EmoMatching, AOMICTask.WorkingMemory]
field types: list[Literal[DataType.BOLD, DataType.T1w, DataType.VBM_CSF, DataType.VBM_GM, DataType.VBM_WM, DataType.DWI, DataType.FreeSurfer, DataType.Warp]] = [<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'>]
field uri: HttpUrl = HttpUrl('https://github.com/OpenNeuroDatasets/ds002790')
get_elements()

Implement fetching list of elements in the dataset.

Returns:
list

The list of elements that can be grabbed in the dataset after imposing constraints based on specified tasks.

get_item(subject, task)

Get the specified item from the dataset.

Parameters:
subjectstr

The subject ID.

task{“restingstate”, “stopsignal”, “workingmemory”}

The task to get.

Returns:
outdict

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

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.HttpUrl

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.

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.HttpUrl\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.",
   "type": "object",
   "properties": {
      "types": {
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "uri": {
         "format": "uri",
         "maxLength": 2083,
         "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"
      }
   },
   "required": [
      "types",
      "uri"
   ]
}

Config:
  • 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.HttpUrl)

Validators:
  • disable_tag » datalad_dirty

field datadir: Path [Optional]
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: HttpUrl [Required]
cleanup()

Cleanup the datalad dataset.

validator disable_tag  »  datalad_dirty

Disable setting datalad_dirty directly.

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:
typeslist of {DataType.BOLD, DataType.T1w, DataType.Warp}, 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.

taskslist of HCP1200Task, optional

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

phase_encodingslist of HCP1200PhaseEncoding, 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 : list of {``DataType.BOLD``, ``DataType.T1w``, ``DataType.Warp``},             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 : list of :enum:`.HCP1200Task`, optional\n    HCP task sessions.\n    By default, all available task sessions are selected.\nphase_encodings : list of :enum:`.HCP1200PhaseEncoding`, 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": {
         "default": [
            "BOLD",
            "T1w",
            "Warp"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "pattern": "{subject}/MNINonLinear/Results/{task}_{phase_encoding}/{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": {
         "default": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "items": {
            "$ref": "#/$defs/HCP1200Task"
         },
         "title": "Tasks",
         "type": "array"
      },
      "phase_encodings": {
         "default": [
            "RL",
            "LR"
         ],
         "items": {
            "$ref": "#/$defs/HCP1200PhaseEncoding"
         },
         "title": "Phase Encodings",
         "type": "array"
      },
      "ica_fix": {
         "default": false,
         "title": "Ica Fix",
         "type": "boolean"
      },
      "uri": {
         "default": "https://github.com/datalad-datasets/human-connectome-project-openaccess.git",
         "format": "uri",
         "maxLength": 2083,
         "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"
      },
      "HCP1200PhaseEncoding": {
         "description": "Accepted HCP1200 phase encoding directions.",
         "enum": [
            "LR",
            "RL"
         ],
         "title": "HCP1200PhaseEncoding",
         "type": "string"
      },
      "HCP1200Task": {
         "description": "Accepted HCP1200 tasks.",
         "enum": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "title": "HCP1200Task",
         "type": "string"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
  • rootdir (pathlib.Path)

  • types (list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp]])

  • uri (pydantic.networks.HttpUrl)

Validators:

field rootdir: Path = PosixPath('HCP1200')
field types: list[Literal[DataType.BOLD, DataType.T1w, DataType.Warp]] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.Warp: 'Warp'>]
field uri: HttpUrl = HttpUrl('https://github.com/datalad-datasets/human-connectome-project-openaccess.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.

property skip_file_check: bool

Skip file check existence.

pydantic model junifer.datagrabber.HCP1200

Concrete implementation for pattern-based data fetching of HCP1200.

Parameters:
typeslist of {DataType.BOLD, DataType.T1w, DataType.Warp}, optional

The data type(s) to grab.

datadirpathlib.Path

The path where the data is stored.

taskslist of HCP1200Task, optional

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

phase_encodingslist of HCP1200PhaseEncoding, 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 : list of {``DataType.BOLD``, ``DataType.T1w``, ``DataType.Warp``},             optional\n    The data type(s) to grab.\ndatadir : pathlib.Path\n    The path where the data is stored.\ntasks : list of :enum:`.HCP1200Task`, optional\n    HCP task sessions.\n    By default, all available task sessions are selected.\nphase_encodings : list of :enum:`.HCP1200PhaseEncoding`, 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": {
         "default": [
            "BOLD",
            "T1w",
            "Warp"
         ],
         "items": {
            "enum": [
               "BOLD",
               "T1w",
               "Warp"
            ],
            "type": "string"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "default": {
            "BOLD": {
               "pattern": "{subject}/MNINonLinear/Results/{task}_{phase_encoding}/{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": {
         "default": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "items": {
            "$ref": "#/$defs/HCP1200Task"
         },
         "title": "Tasks",
         "type": "array"
      },
      "phase_encodings": {
         "default": [
            "RL",
            "LR"
         ],
         "items": {
            "$ref": "#/$defs/HCP1200PhaseEncoding"
         },
         "title": "Phase Encodings",
         "type": "array"
      },
      "ica_fix": {
         "default": false,
         "title": "Ica Fix",
         "type": "boolean"
      }
   },
   "$defs": {
      "ConfoundsFormat": {
         "description": "Accepted confounds format.",
         "enum": [
            "fmriprep",
            "adhoc"
         ],
         "title": "ConfoundsFormat",
         "type": "string"
      },
      "HCP1200PhaseEncoding": {
         "description": "Accepted HCP1200 phase encoding directions.",
         "enum": [
            "LR",
            "RL"
         ],
         "title": "HCP1200PhaseEncoding",
         "type": "string"
      },
      "HCP1200Task": {
         "description": "Accepted HCP1200 tasks.",
         "enum": [
            "REST1",
            "REST2",
            "SOCIAL",
            "WM",
            "RELATIONAL",
            "EMOTION",
            "LANGUAGE",
            "GAMBLING",
            "MOTOR"
         ],
         "title": "HCP1200Task",
         "type": "string"
      }
   },
   "required": [
      "datadir"
   ]
}

Config:
  • use_enum_values: bool = True

Fields:
  • ica_fix (bool)

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

  • phase_encodings (list[junifer.datagrabber.hcp1200.hcp1200.HCP1200PhaseEncoding])

  • replacements (list[str])

  • tasks (list[junifer.datagrabber.hcp1200.hcp1200.HCP1200Task])

  • types (list[Literal[junifer.datagrabber.base.DataType.BOLD, junifer.datagrabber.base.DataType.T1w, junifer.datagrabber.base.DataType.Warp]])

field ica_fix: bool = False
field patterns: dict[str, dict[str, str | dict[str, str] | list[dict[str, str]]] | list[dict[str, str]]] = {'BOLD': {'pattern': '{subject}/MNINonLinear/Results/{task}_{phase_encoding}/{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: list[HCP1200PhaseEncoding] = [HCP1200PhaseEncoding.RL, HCP1200PhaseEncoding.LR]
field replacements: list[str] = ['subject', 'task', 'phase_encoding']
field tasks: list[HCP1200Task] = [HCP1200Task.REST1, HCP1200Task.REST2, HCP1200Task.SOCIAL, HCP1200Task.WM, HCP1200Task.RELATIONAL, HCP1200Task.EMOTION, HCP1200Task.LANGUAGE, HCP1200Task.GAMBLING, HCP1200Task.MOTOR]
field types: list[Literal[DataType.BOLD, DataType.T1w, DataType.Warp]] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>, <DataType.Warp: 'Warp'>]
get_elements()

Implement fetching list of elements in the dataset.

Returns:
list

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

get_item(subject, task, phase_encoding)

Get the specified item from the dataset.

Parameters:
subjectstr

The subject ID.

task{“REST1”, “REST2”, “SOCIAL”, “WM”, “RELATIONAL”, “EMOTION”, “LANGUAGE”, “GAMBLING”, “MOTOR”}

The task.

phase_encoding{“LR”, “RL”}

The phase encoding.

Returns:
dict

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

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.

Parameters:
datagrabberslist of DataGrabber-like objects

The DataGrabbers to use for fetching data.

**kwargs

Keyword arguments passed to superclass.

Raises:
RuntimeError

If datagrabbers have different element keys or overlapping data types or nested data types.

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.\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 ``datagrabbers`` have different element keys or\n    overlapping data types or nested data types.",
   "type": "object",
   "properties": {
      "types": {
         "default": [],
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "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": {
         "description": "Concrete implementation for pattern-based data fetching.\n\nImplements a DataGrabber that understands patterns to grab data.\n\nParameters\n----------\ntypes : list of :enum:`.DataType`\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\n    All possible replacements in ``patterns.<data_type>.pattern``.\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": {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "title": "Types",
               "type": "array"
            },
            "datadir": {
               "format": "path",
               "title": "Datadir",
               "type": "string"
            },
            "patterns": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "type": "string"
                              },
                              {
                                 "additionalProperties": {
                                    "type": "string"
                                 },
                                 "type": "object"
                              },
                              {
                                 "items": {
                                    "additionalProperties": {
                                       "type": "string"
                                    },
                                    "type": "object"
                                 },
                                 "type": "array"
                              }
                           ]
                        },
                        "type": "object"
                     },
                     {
                        "items": {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Patterns",
               "type": "object"
            },
            "replacements": {
               "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"
            }
         },
         "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.HttpUrl\n    URI of the datalad sibling.\ntypes : list of :enum:`.DataType`\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": {
               "items": {
                  "$ref": "#/$defs/DataType"
               },
               "title": "Types",
               "type": "array"
            },
            "datadir": {
               "format": "path",
               "title": "Datadir",
               "type": "string"
            },
            "patterns": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "type": "string"
                              },
                              {
                                 "additionalProperties": {
                                    "type": "string"
                                 },
                                 "type": "object"
                              },
                              {
                                 "items": {
                                    "additionalProperties": {
                                       "type": "string"
                                    },
                                    "type": "object"
                                 },
                                 "type": "array"
                              }
                           ]
                        },
                        "type": "object"
                     },
                     {
                        "items": {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Patterns",
               "type": "object"
            },
            "replacements": {
               "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"
            },
            "uri": {
               "format": "uri",
               "maxLength": 2083,
               "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:
  • use_enum_values: bool = True

  • extra: str = allow

Fields:
  • datadir (pathlib.Path)

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

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

field datadir: Path = PosixPath('.')
field datagrabbers: list[type[BaseDataGrabber] | PatternDataGrabber | PatternDataladDataGrabber] [Required]
field types: list[DataType] = []
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.

get_elements()

Get elements.

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_types()

Get types.

Returns:
list of 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:
typeslist of DataType

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

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

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 : list of :enum:`.DataType`\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\n    All possible replacements in ``patterns.<data_type>.pattern``.\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": {
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "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"
      }
   },
   "$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"
      }
   },
   "required": [
      "types",
      "datadir",
      "patterns",
      "replacements"
   ]
}

Config:
  • use_enum_values: bool = True

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

  • partial_pattern_ok (bool)

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

  • replacements (list[str])

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

Get element keys.

For each item in the “element” tuple, this functions returns the corresponding key, that is, the replacements of patterns defined in the constructor.

Returns:
list of str

The element keys.

get_elements()

Implement fetching list of elements in the dataset.

It will use regex to search for “replacements” in the “patterns” and return the intersection of the results for each type 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.

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.HttpUrl

URI of the datalad sibling.

typeslist of DataType

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.HttpUrl\n    URI of the datalad sibling.\ntypes : list of :enum:`.DataType`\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": {
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "patterns": {
         "additionalProperties": {
            "anyOf": [
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "additionalProperties": {
                              "type": "string"
                           },
                           "type": "object"
                        },
                        {
                           "items": {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "type": "object"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               },
               {
                  "items": {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  "type": "array"
               }
            ]
         },
         "title": "Patterns",
         "type": "object"
      },
      "replacements": {
         "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"
      },
      "uri": {
         "format": "uri",
         "maxLength": 2083,
         "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:
  • use_enum_values: bool = True

  • extra: str = allow

Fields:

Validators:

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_data_type(name, schema)

Register custom data type.

Parameters:
namestr

The data type name.

schemaDataTypeSchema

The data type schema.