DicomToBidsProcedure Class API

class src.yalab_procedures.procedures.dicom_to_bids.dicom_to_bids.DicomToBidsInputSpec(**kwargs)[source]

Bases: ProcedureInputSpec, CommandLineInputSpec

Input specification for the DicomToBidsProcedure

class src.yalab_procedures.procedures.dicom_to_bids.dicom_to_bids.DicomToBidsOutputSpec(**kwargs)[source]

Bases: ProcedureOutputSpec

Output specification for the DicomToBidsProcedure

class src.yalab_procedures.procedures.dicom_to_bids.dicom_to_bids.DicomToBidsProcedure(**inputs)[source]

Bases: Procedure, CommandLine

Convert DICOM files to BIDS format using HeuDiConv.

Examples

>>> from yalab_procedures.procedures.dicom_to_bids import DicomToBidsProcedure
>>> dcm2bids = DicomToBidsProcedure()
>>> dcm2bids.inputs.subject_id = '01'
>>> dcm2bids.inputs.input_directory = '/path/to/dicom'
>>> dcm2bids.inputs.output_directory = '/path/to/bids'
>>> dcm2bids.inputs.session_id = '01'
>>> dcm2bids.inputs.heuristic_file = '/path/to/heuristic.py'
>>> dcm2bids.inputs.cmdline
'heudiconv -s 01 -ss 01 -f /path/to/heuristic.py --files /path/to/dicom/*/*.dcm -o /path/to/bids -c dcm2niix --overwrite --bids'
>>> res = dcmtobids.run() 
input_spec

alias of DicomToBidsInputSpec

output_spec

alias of DicomToBidsOutputSpec

run_procedure(**kwargs)[source]

Run the DicomToBidsProcedure

Raises:

CalledProcessError – If the command fails to run. The error message will be logged.

post_heudiconv_fieldmap_correction()[source]

Post-process fieldmap correction if needed

infer_session_id()[source]

Infer the session ID from the input directory name. This is useful for DICOM directories provided by TAU’s MRI facility.

standardize_input_directory()[source]

Standardize the input directory path

build_commandline() str[source]

Build the command line arguments for the heudiconv command

Returns:

The command line arguments as a string

Return type:

str