DCM2NII Module
The DCM2NII module converts DICOM files into NIfTI format, making the data compatible for use in downstream image analysis pipelines. This module can handle folders containing segmentation files, and it includes options for selective processing and multi-core execution.
Options
The DCM2NII module can be used with the following options:
verbose: Enable or disable verbose mode for more detailed output (default: False).
timer: Enable a timer to record the execution time (default: False).
inputFolder: Path to the folder containing the DICOM files to be converted.
outputFolder: Path to the folder where the converted NIfTI files will be saved.
outputFolderSuffix: Adds a suffix to the input folder name to create an output folder.
regMatch: Process only masks that match a specified regular expression (by default, all masks are processed).
with-segmentation: Indicate whether the folders contain segmentation files (default: True).
all-data-with-segmentation: Specify if all folders contain segmentation files (default: True).
log: Path to a log file for saving detailed information about the conversion process.
new_log_file: Create a new log file; if a file with the same name exists, it will be overwritten.
skip: Path to a file listing subfolders in the input folder to exclude from the conversion.
include: Path to a file listing subfolders in the input folder to include in the conversion (all subfolders included by default).
multiprocessing: Specify the number of CPU cores to use for parallel processing.
Example Usage
The following example demonstrates how to use the DCM2NII module to convert a folder of DICOM files to NIfTI format:
DCM2NII:
{
inputFolder: /path/to/DICOM_folder
outputFolderSuffix: nii
log: /path/to/logs/dcm2nii.log
}
In this example:
inputFolder: Specifies the folder containing DICOM files to be converted.
outputFolderSuffix: Appends the suffix “nii” to the name of the inputFolder for the output directory.
log: Saves a log file at the specified location, recording details of the conversion process.
- dcm2nii_multiprocessing.convert_dicom_with_timeout(patient_subdirectory, nifti_output, reorient=True, timeout_duration=60)[source]
Attempt to convert DICOM to Nifti with a specified timeout.