Hive_convert_semantic_to_instance_segmentation script#
Script to convert a semantic segmentation dataset (with the Patient ID as the folder name) into an instance segmentation dataset. Instance segmentation masks are saved within the same patient folder with the standard format “INST_SEG.nii.gz”. Regions in instance segmentation containing less than 10 voxels are ignored and the number of labels in each instance segmentation mask is saved in a separate json file (‘inst_seg_labels.json’) alongside its ‘Patient ID’.
usage: Hive_convert_semantic_to_instance_segmentation [-h] --data-folder
DATA_FOLDER
--sem-seg-suffix
SEM_SEG_SUFFIX
--inst-seg-suffix
INST_SEG_SUFFIX
--output-json-path
OUTPUT_JSON_PATH
[-v | -q]
Named Arguments#
- --data-folder
AutoPET patient dataset folder.
- --sem-seg-suffix
Semantic Segmentation suffix.
- --inst-seg-suffix
Instance Segmentation suffix.
- --output-json-path
Output path of json file.
- -v, --verbose
Enable verbose output in terminal. Add multiple times to increase verbosity.
- -q, --silent
Suppress most log outputs in terminal.
Example call:
Hive_convert_semantic_to_instance_segmentation --data-folder /PATH/TO/SEMANTIC_SEG_DATA --sem-seg-suffix _SEG.nii.gz --inst-seg-suffix _INST_SEG.nii.gz --output-json-path /PATH/TO/JSON/inst_seg_labels.json