MERGE_MASK Module
The MERGE_MASKS module enables the merging of multiple masks (segmentation files) using either regular expressions or lists of masks to add and subtract. This process creates a final segmentation mask suitable for radiomics analysis.
Options
The MERGE_MASKS module accepts the following options:
verbose: Enable verbose output for more detailed process information (default: False).
timer: Enable a timer to record execution time (default: False).
inputFolder: Path to the folder containing the input masks.
outputFolder: Path to save the merged mask files.
outputFolderSuffix: Adds a suffix to the inputFolder name to create the output folder.
log: Path to a log file for saving detailed output information.
new_log_file: Create a new log file, overwriting any existing file with the same name.
skip: Path to a file listing subfolders in inputFolder to exclude from processing.
include: Path to a file listing subfolders in inputFolder to include in processing (all subfolders included by default).
multiprocessing: Specify the number of CPU cores to use for parallel processing.
mask_name: Name for the output merged mask file.
reg: Regular expression to add all matching masks and subtract non-matching masks.
add: List of specific masks to add.
sub: List of specific masks to subtract.
Example Usage
The following examples demonstrate how to use the MERGE_MASKS module:
Using a regular expression to merge masks:
MERGE_MASKS:
{
inputFolder: /path/to/NIFTI_folder
mask_name: msk_111.nii.gz
reg: Pancr*
log: /path/to/logs/merge_masks.log
}
Using specific lists of masks to add and subtract:
MERGE_MASKS:
{
inputFolder: /path/to/NIFTI_folder
mask_name: msk_111.nii.gz
add: Mask_Pancreatic_Tumor.nii.gz,Mask_Pancreas.nii.gz
sub: Mask_CBD.nii.gz,Mask_Arteries.nii.gz
log: /path/to/logs/merge_masks.log
}
In these examples:
inputFolder: Specifies the folder containing mask files for merging.
mask_name: Sets the filename for the merged output mask.
reg: Adds masks matching “Pancr*” and subtracts those that don’t.
add and sub: Explicitly define masks to add and subtract.
log: Specifies the log file path to record processing details.