dicom2nifti
tit.pre.dicom2nifti ¶
DICOM-to-NIfTI conversion with BIDS-compliant naming.
Wraps dcm2niix to convert DICOM series into NIfTI files that follow
the BIDS naming convention (sub-{id}_{modality}.nii.gz).
Public API¶
run_dicom_to_nifti Convert DICOM files for a subject to BIDS-compliant NIfTI.
See Also¶
tit.pre.structural.run_pipeline : Full preprocessing pipeline.
run_dicom_to_nifti ¶
run_dicom_to_nifti(project_dir: str, subject_id: str, *, logger, runner: CommandRunner | None = None) -> None
Convert DICOM files to BIDS-compliant NIfTI for a subject.
Looks for T1w, T2w, and dwi DICOM directories under
sourcedata/sub-{subject_id}/ (modality folder names are matched
case-insensitively) and converts each found modality using
dcm2niix. Anatomical images go to the subject anat/ folder
and diffusion images to dwi/ (with .bval/.bvec sidecars).
DICOM discovery is recursive under each modality's dicom/
directory and includes .dcm and .dicom files. Supported
archives (.zip, .tar, .tar.gz, .tgz) placed directly
in the modality folder or its dicom/ folder are safely extracted
to dicom/extracted_archives/ before discovery.
Parameters¶
project_dir : str
BIDS project root directory.
subject_id : str
Subject identifier without the sub- prefix.
logger : logging.Logger
Logger for progress messages.
runner : CommandRunner or None, optional
Subprocess runner for streaming output.
Raises¶
PreprocessError If output NIfTI files already exist for a modality.
See Also¶
run_pipeline : Full preprocessing pipeline.