Skip to content

Commit

Permalink
set split_level as the default configuration and removed fast configu…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
FJDorfner committed Dec 3, 2024
1 parent 8ef8980 commit 290c7fd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
1 change: 0 additions & 1 deletion models/mrsegmentator/config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ modules:
mod: '%Modality'

MRSegmentatorMLRunner:
use_fast_mode: false

DsegConverter:
model_name: MRSegmentator
Expand Down
33 changes: 0 additions & 33 deletions models/mrsegmentator/config/fast.yml

This file was deleted.

14 changes: 1 addition & 13 deletions models/mrsegmentator/utils/MRSegmentatorMLRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
# register custom segmentation before class definition
Segment.register("SPINE", name="Spine")

@IO.Config('use_fast_mode', bool, False, the="flag to set to run MRSegmentator in a faster mode")
class MRSegmentatorMLRunner(Module):

use_fast_mode: bool

@IO.Instance()
@IO.Input('in_data', 'nifti:mod=ct|mr', the="input whole body mr/ct scan")
@IO.Output('out_data', 'segmentations.nii.gz', 'nifti:mod=seg:model=MRSegmentator:roi=SPLEEN,RIGHT_KIDNEY,LEFT_KIDNEY,GALLBLADDER,LIVER,STOMACH,PANCREAS,RIGHT_ADRENAL_GLAND,LEFT_ADRENAL_GLAND,LEFT_LUNG,RIGHT_LUNG,HEART,AORTA,INFERIOR_VENA_CAVA,PORTAL_AND_SPLENIC_VEIN,LEFT_ILIAC_ARTERY,RIGHT_ILIAC_ARTERY,ESOPHAGUS,SMALL_INTESTINE,DUODENUM,COLON,URINARY_BLADDER,SPINE,SACRUM,LEFT_HIP,RIGHT_HIP,LEFT_FEMUR,RIGHT_FEMUR,LEFT_AUTOCHTHONOUS_BACK_MUSCLE,RIGHT_AUTOCHTHONOUS_BACK_MUSCLE,LEFT_ILIOPSOAS,RIGHT_ILIOPSOAS,LEFT_GLUTEUS_MAXIMUS,RIGHT_GLUTEUS_MAXIMUS,LEFT_GLUTEUS_MEDIUS,RIGHT_GLUTEUS_MEDIUS,LEFT_GLUTEUS_MINIMUS,RIGHT_GLUTEUS_MINIMUS', data='in_data', the="output segmentation mask containing all labels")
Expand All @@ -34,16 +31,7 @@ def task(self, instance: Instance, in_data: InstanceData, out_data: InstanceData
bash_command = ["mrsegmentator"]
bash_command += ["-i", in_data.abspath]
bash_command += ["--outdir", tmp_dir]
bash_command += ["--nproc_export", "1"]
bash_command += ["--nproc", "1"]
bash_command += ["--batchsize", "1"]

if self.use_fast_mode:
self.v("Running MRSegmentator in lower memory footprint mode ('--split_level', 1)")
self.v("Note: This increases runtime and possibly reduces segmentation performance.")
bash_command += ["--split_level", "1"]
else:
self.v("Running MRSegmentator in default mode.")
bash_command += ["--split_level", "1"]

self.v(">> run: ", " ".join(bash_command))

Expand Down

0 comments on commit 290c7fd

Please sign in to comment.