nipoppy.tabular.dicom_dir_map

Classes for the DICOM directory mapping.

Module Contents

class nipoppy.tabular.dicom_dir_map.DicomDirMap(*args, **kwargs)

Bases: nipoppy.tabular.base.BaseTabular

A dataset’s DICOM directory mapping.

This mapping is used during DICOM reorganization and doughnut generation.

col_participant_dicom_dir = 'participant_dicom_dir'
col_participant_id = 'participant_id'
col_session_id = 'session_id'
index_cols
model
get_dicom_dir(participant_id, session_id)

Return the participant’s raw DICOM directory for a given session.

Parameters:
  • participant_id (str) – Participant ID, without the BIDS prefix

  • session_id (str) – Session, with the BIDS prefix

Return type:

str

classmethod load_or_generate(manifest, fpath_dicom_dir_map, participant_first, validate=True)

Load or generate a DicomDirMap instance.

Parameters:
  • manifest (nipoppy.tabular.manifest.Manifest) – Manifest for generating the mapping (not used if fpath_dicom_dir_map is not None).

  • fpath_dicom_dir_map (str | Path | None) – Path to a custom DICOM directory mapping file. If None, the DICOM directory mapping will be generated from the manifest.

  • participant_first (bool) – Whether the generated uses <PARTICIPANT>/<SESSION> order (True) or <SESSION>/<PARTICIPANT> (False). Not used if fpath_dicom_dir_map is not None

  • validate (bool, optional) – Whether to validate (through Pydantic) the created object, by default True

Return type:

nipoppy.tabular.dicom_dir_map.DicomDirMap

class nipoppy.tabular.dicom_dir_map.DicomDirMapModel(/, **data)

Bases: nipoppy.tabular.base.BaseTabularModel

A file for mapping participant IDs to DICOM directories.

Note: This class is called “model” to be consistent with Pydantic nomenclature, but it can be thought of as a schema for each row in the mapping file.

Parameters:

data (Any)

participant_dicom_dir: str
participant_id: str
session_id: str
validate_after()

Validate participant_id and session fields.

Return type:

typing_extensions.Self