From 4d5b71c233a64c167a45356222e4cac9d09c491b Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 28 Oct 2022 09:31:55 +0100 Subject: [PATCH 1/2] Fix z-stack bug Fixes issue where non-zero padding could result in the first plane of a stack always being used for detection, rather than the correct one. See https://forum.image.sc/t/cell-detection-with-stardist-on-2d-stack-images/73264/5 --- src/main/java/qupath/ext/stardist/StarDist2D.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/qupath/ext/stardist/StarDist2D.java b/src/main/java/qupath/ext/stardist/StarDist2D.java index 9b88a40..23fbc3d 100644 --- a/src/main/java/qupath/ext/stardist/StarDist2D.java +++ b/src/main/java/qupath/ext/stardist/StarDist2D.java @@ -102,7 +102,7 @@ */ public class StarDist2D implements AutoCloseable { - private final static Logger logger = LoggerFactory.getLogger(StarDist2D.class); + private static final Logger logger = LoggerFactory.getLogger(StarDist2D.class); private static int defaultTileSize = 1024; @@ -737,7 +737,7 @@ private void detectObjectsImpl(ImageData imageData, Collection imageData, PathObject parent, boolean fireUpdate) { - Objects.nonNull(parent); + Objects.requireNonNull(parent); // Lock early, so the user doesn't make modifications boolean wasLocked = parent.isLocked(); parent.setLocked(true); @@ -1083,7 +1083,7 @@ private List detectObjectsForTile(ImageDataOp op, DnnModel int y1 = (int)Math.max(0, Math.round(request.getY() - downsample * pad)); int x2 = (int)Math.min(server.getWidth(), Math.round(request.getMaxX() + downsample * pad)); int y2 = (int)Math.min(server.getHeight(), Math.round(request.getMaxY() + downsample * pad)); - requestPadded = RegionRequest.createInstance(server.getPath(), downsample, x1, y1, x2-x1, y2-y1); + requestPadded = RegionRequest.createInstance(server.getPath(), downsample, x1, y1, x2-x1, y2-y1, request.getZ(), request.getT()); } // // Hack to visualize the tiles that are computed (for debugging) From 33f2fb4c33f0137b8b5d173aafe0dfa280e533f2 Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 28 Oct 2022 09:36:24 +0100 Subject: [PATCH 2/2] Update version number --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 241ad52..6122bfa 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ ext.moduleName = 'qupath.extension.stardist' description = 'QuPath extension to use StarDist' -version = "0.3.1" +version = "0.3.2" dependencies { def qupathVersion = "0.3.0" // For now