SEGMENTATION Module

The SEGMENTATION module enables automatic segmentation of DICOM or NIfTI images. Currently, TotalSegmentator is the only supported method for segmentation. The module will submit a new job task for each patient using either SGE or SLURM job schedulers.

Options

The SEGMENTATION module can be configured with the following options:

  • verbose: Enable or disable verbose mode to display detailed process information.

  • timer: Enable a timer to record the module’s execution time.

  • inputFolder: Path to the folder containing the input images.

  • log: Path to save a log file with detailed information about the segmentation process.

  • new_log_file: Create a new log file, overwriting any existing file with the same name.

  • skip: Path to a file listing subfolders inside inputFolder to exclude from processing.

  • skip-segmented-data: If set to True, the module will skip data that has already been segmented (default: False).

  • multiprocessing: Specify the number of CPU cores to use for parallel processing.

  • method: Specify the segmentation method (currently, only “TotalSegmentator” is supported).

  • segmentation-list: Path to a file listing specific volumes to segment.

  • image_type: Specify whether the input images are in “DICOM” or “NIFTI” format: - For DICOM, the module generates an RTSTRUCT file (RTSTRUCT.dcm) containing segmentations. - For NIFTI, the module creates separate segmentations for each structure listed in segmentation-list, named as Mask_<structure_name>.nii.gz.

  • image_filename: Name of the image file to segment when working with NIfTI images. For DICOM images, the module looks for images in the “DCM” folder.

  • job_scheduler: Select the job scheduler for batch processing (“SGE” or “SLURM”).

Example Usage

The following example demonstrates how to use the SEGMENTATION module:

SEGMENTATION:
{
    inputFolder: /path/to/NIFTI_folder
    method: TotalSegmentator
    image_type: dicom
    segmentation-list: /path/to/img2radiomics/v0.8.4/list_totalSegmentator_full.txt
    log: /path/to/logs/segmentation.log
}

In this example:

  • inputFolder: Specifies the folder containing images to segment.

  • method: Selects “TotalSegmentator” for autosegmentation.

  • image_type: Specifies DICOM format, producing an RTSTRUCT file with segmentations.

  • segmentation-list: Points to a list of structures for segmentation.

  • log: Specifies a path for the log file.

segmentation_multiprocessing.add_prefix(patient, segmentation_list, img_type)[source]
segmentation_multiprocessing.image_segmentation(path, patient, img_name, img_type, method, segmentation_list, skip_files, include_files, skipSegmented, verbose, log, job_scheduler)[source]
segmentation_multiprocessing.main(argv)[source]
segmentation_multiprocessing.remove_finished_jobs(path, job_scheduler)[source]