From 8ec94daccb9b202639ebf45666aebac8e95886d6 Mon Sep 17 00:00:00 2001 From: Phil Chlap Date: Mon, 19 Aug 2024 18:02:30 -0500 Subject: [PATCH] Add check for whole heart segmentation result --- platipy/imaging/projects/cardiac/run.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platipy/imaging/projects/cardiac/run.py b/platipy/imaging/projects/cardiac/run.py index a20e24ad..5252153f 100644 --- a/platipy/imaging/projects/cardiac/run.py +++ b/platipy/imaging/projects/cardiac/run.py @@ -494,6 +494,10 @@ def run_hybrid_segmentation(img, settings=HYBRID_SETTINGS_DEFAULTS): # Run the whole heart nnUNet segmentation mask_wh = run_segmentation(img, settings["nnunet_settings"]) + if "Struct_0" not in mask_wh.keys(): + logger.warning("Whole Heart segmentation failed. Unable to proceed.") + return {} + # Run the 2nd part of the hybrid approach return run_cardiac_segmentation( img, guide_structure=mask_wh["Struct_0"], settings=settings["cardiac_settings"]