REORGANIZE Module

The REORGANIZE module restructures data within a folder to prepare it for further processing with img2radiomics. This module organizes the data in a consistent format, ensuring compatibility with other processing modules.

Note: It’s recommended to run the CHECK_FOLDER module first to verify the folder structure before attempting reorganization. This helps avoid errors if the folder is incorrectly structured.

Options

The REORGANIZE module accepts the following options:

  • verbose: Enables verbose mode, providing additional details during execution (default: False).

  • timer: Enables the timer to measure execution time (default: False).

  • inputFolder: Specifies the path to the folder containing subfolders with DICOM or NIfTI files to reorganize.

  • outputFolder: Specifies the path where the reorganized data will be saved. If omitted, inplace must be set to True.

  • outputFolderSuffix: Adds a suffix to the name of inputFolder to create an output folder with a modified name (useful if outputFolder is not specified).

  • inplace: Directly modifies the input folder instead of creating a new one. Warning: Use with caution, as any failure during reorganization may corrupt the data.

    Warning

    If the reorganization fails, inplace mode may corrupt the data in the input folder.

  • with-segmentation: Indicates whether some subfolders contain segmentation files (default: True).

  • all-data-with-segmentation: Specifies that all subfolders contain segmentation files (default: True).

  • log: Specifies the path to a log file for recording detailed output information.

  • new_log_file: Overwrites any existing log file with the same name.

  • skip: Specifies a file containing a list of subfolders to exclude from reorganization.

  • include: Specifies a file containing a list of subfolders to include in reorganization.

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

Example Usage

The following example demonstrates how to use the REORGANIZE module to restructure a study folder:

REORGANIZE:
{
    inputFolder: /path/to/DICOM_folder
    outputFolderSuffix: ready
    inplace: False
    log: /path/to/logs/reorganize.log
}

In this example:

  • The folder /path/to/DICOM_folder will be reorganized, and the output folder will be named DICOM_folder_ready.

  • Data will be saved to a new folder (inplace is set to False).

  • A log of the operation will be saved at /path/to/logs/reorganize.log.

reorganize_multiprocessing.main(argv)[source]
reorganize_multiprocessing.reorganize(patient, inpath, outpath, inplace, skip_files, include_files, verbose, log, NoSegmentation, AllSegmentation)[source]