From b3fadec6f6a33ecd8230641d78b9d252ae39d724 Mon Sep 17 00:00:00 2001 From: Alan O'Callaghan Date: Thu, 1 Feb 2024 15:34:20 +0000 Subject: [PATCH] Remove interrupted exception, but do nothing --- .../instanseg/core/TilePredictionProcessor.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/qupath/ext/instanseg/core/TilePredictionProcessor.java b/src/main/java/qupath/ext/instanseg/core/TilePredictionProcessor.java index 0f65702..db6f8f7 100644 --- a/src/main/java/qupath/ext/instanseg/core/TilePredictionProcessor.java +++ b/src/main/java/qupath/ext/instanseg/core/TilePredictionProcessor.java @@ -4,9 +4,12 @@ import ai.djl.ndarray.NDManager; import ai.djl.translate.TranslateException; import org.bytedeco.opencv.global.opencv_core; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import qupath.lib.experimental.pixels.Processor; import org.bytedeco.opencv.opencv_core.Mat; import qupath.lib.experimental.pixels.Parameters; +import qupath.lib.plugins.objects.SmoothFeaturesPlugin; import qupath.lib.regions.Padding; import qupath.opencv.ops.ImageOp; import qupath.opencv.tools.OpenCVTools; @@ -15,6 +18,7 @@ import java.util.concurrent.BlockingQueue; class TilePredictionProcessor implements Processor { + private static final Logger logger = LoggerFactory.getLogger(TilePredictionProcessor.class); private final BlockingQueue> predictors; @@ -40,7 +44,7 @@ class TilePredictionProcessor implements Processor { } @Override - public Mat process(Parameters params) throws IOException, InterruptedException { + public Mat process(Parameters params) throws IOException { var mat = params.getImage(); mat = preprocessing.apply(mat); @@ -69,8 +73,13 @@ public Mat process(Parameters params) throws IOException, InterruptedE // todo: deal with exception throw new RuntimeException(e); } finally { - if (predictor != null) - predictors.put(predictor); + if (predictor != null) { + try { + predictors.put(predictor); + } catch (InterruptedException e) { + logger.warn("Tiling interrupted"); + } + } } } }