Skip to content

Commit e7f4ce3

Browse files
authored
[*] fix run_TotalSegmentator.sh
1 parent dde4588 commit e7f4ce3

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

scripts/run_TotalSegmentator.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# segment_folder.sh
33
#
44
# This script loops over all nii.gz files in an input folder,
5-
# runs TotalSegmentator with a restricted ROI subset, and then
6-
# remaps the resulting multi-label segmentation to a custom label mapping.
5+
# runs TotalSegmentator (generating all classes) with multi-label output,
6+
# and then remaps the resulting multi-label segmentation to a custom label mapping.
77
#
88
# The desired final mapping is:
99
# background: 0
@@ -21,12 +21,6 @@
2121
# Prostate: 12
2222
# Spinal-Canal: 13
2323
#
24-
# Note:
25-
# The names used with --roi_subset must match the TotalSegmentator classes.
26-
# Here we use:
27-
# spleen kidney_right kidney_left gallbladder liver stomach pancreas esophagus small_bowel duodenum urinary_bladder prostate spinal_cord
28-
# which correspond to the desired labels (with small naming differences).
29-
#
3024
# Usage:
3125
# ./segment_folder.sh /path/to/input_folder /path/to/output_folder
3226

@@ -56,10 +50,8 @@ process_file() {
5650
local FILE_TMP_DIR="$TMP_DIR/$base"
5751
mkdir -p "$FILE_TMP_DIR"
5852

59-
# Run TotalSegmentator using ROI subset and multi-label output
60-
if ! TotalSegmentator -i "$file" -o "$FILE_TMP_DIR" \
61-
--roi_subset spleen kidney_right kidney_left gallbladder liver stomach pancreas esophagus small_bowel duodenum urinary_bladder prostate spinal_cord \
62-
--ml; then
53+
# Run TotalSegmentator generating all classes with multi-label output
54+
if ! TotalSegmentator -i "$file" -o "$FILE_TMP_DIR" --ml; then
6355
echo "TotalSegmentator failed for $file; skipping."
6456
return
6557
fi
@@ -93,4 +85,4 @@ find "$INPUT_FOLDER" -name "*.nii.gz" -print0 | xargs -0 -n 1 -P 4 bash -c 'proc
9385

9486
# Clean up temporary files
9587
rm -rf "$TMP_DIR"
96-
echo "Processing complete."
88+
echo "Processing complete."

0 commit comments

Comments
 (0)