From 4682cc18d8eaddda3be1b1de010ac9c10db5f2bf Mon Sep 17 00:00:00 2001 From: mhdominguez Date: Mon, 26 Aug 2024 21:07:33 -0400 Subject: [PATCH 1/3] modified: src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java modified: src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java --- .../interactive/HelperFunctions.java | 23 ++++++++++--------- .../interactive/InteractiveDoG.java | 6 ++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java index 943d4f1f5..de9789d52 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java @@ -3,7 +3,7 @@ * Software for the reconstruction of multi-view microscopic acquisitions * like Selective Plane Illumination Microscopy (SPIM) Data. * %% - * Copyright (C) 2012 - 2024 Multiview Reconstruction developers. + * Copyright (C) 2012 - 2022 Multiview Reconstruction developers. * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -110,18 +110,19 @@ public static void drawRealLocalizable(final Collect for (final L peak : peaks) { - // we only draw a 3d peak when it is +- 1.0 pixel away - if ( peak.numDimensions() > 2 && imp.getNSlices() > 1 ) - if ( Math.abs( peak.getDoublePosition( 2 ) - currentSlice ) > 1.0 ) - continue; - + // determine Z distance from peak center and adjust scale radius final float x = peak.getFloatPosition(0); final float y = peak.getFloatPosition(1); - - // +0.5 is to center in on the middle of the detection pixel - final OvalRoi or = new OvalRoi(x - radius + 0.5, y - radius + 0.5, radius * 2, radius * 2); - or.setStrokeColor(col); - overlay.add(or); + final float zDistance = Math.abs(peak.getFloatPosition(2) - currentSlice) + 1; + double drawRadius = 1.5 * radius / Math.sqrt( zDistance ); + + // only draw nearby peaks + if ( drawRadius > 0.67 ) + { + final OvalRoi or = new OvalRoi(x - radius + 0.5, y - radius + 0.5, drawRadius * 2, drawRadius * 2); + or.setStrokeColor(col); + overlay.add(or); + } } // this part might be useful for debugging diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java index 4dc394ae0..5c6d40cc4 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java @@ -104,7 +104,7 @@ public static enum ValueChange { public static final float sigmaMin = 0.5f; public static final float sigmaMax = 10f; public static final float thresholdMin = 0.00001f; - public static final float thresholdMax = 0.3f; + public static final float thresholdMax = 1f; final int scrollbarSize = 1000; // ---------------------------------------- @@ -265,11 +265,11 @@ protected void updatePreview(final ValueChange change) { min = new long []{ rectangle.x, rectangle.y, - Math.max( imgTmp.min( 2 ), currentSlice - 1 ) }; + Math.max( imgTmp.min( 2 ), currentSlice - (long) (2.5 * Math.ceil(params.sigma) ) ) }; max = new long []{ rectangle.width + rectangle.x - 1, rectangle.height + rectangle.y - 1, - Math.min( imgTmp.max( 2 ), currentSlice + 1 ) }; + Math.min( imgTmp.max( 2 ), currentSlice + (long) (2.5 * Math.ceil(params.sigma) ) ) }; } else { // 2d or 2d+t case From af126be0a218cc6b4bb34c741784cb4f69c4deb8 Mon Sep 17 00:00:00 2001 From: mhdominguez Date: Mon, 26 Aug 2024 21:14:50 -0400 Subject: [PATCH 2/3] modified: HelperFunctions.java modified: InteractiveDoG.java --- .../interestpointdetection/interactive/HelperFunctions.java | 2 +- .../interestpointdetection/interactive/InteractiveDoG.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java index de9789d52..c10127dfd 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/HelperFunctions.java @@ -3,7 +3,7 @@ * Software for the reconstruction of multi-view microscopic acquisitions * like Selective Plane Illumination Microscopy (SPIM) Data. * %% - * Copyright (C) 2012 - 2022 Multiview Reconstruction developers. + * Copyright (C) 2012 - 2024 Multiview Reconstruction developers. * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java index 5c6d40cc4..e0bac8748 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java @@ -104,7 +104,7 @@ public static enum ValueChange { public static final float sigmaMin = 0.5f; public static final float sigmaMax = 10f; public static final float thresholdMin = 0.00001f; - public static final float thresholdMax = 1f; + public static final float thresholdMax = 0.3f; final int scrollbarSize = 1000; // ---------------------------------------- From 3b10a21d4dbbb3c4a8ac44a7714332b4e0c02223 Mon Sep 17 00:00:00 2001 From: mhdominguez Date: Mon, 26 Aug 2024 22:03:21 -0400 Subject: [PATCH 3/3] modified: src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java --- .../interestpointdetection/interactive/InteractiveDoG.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java index e0bac8748..795c36013 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointdetection/interactive/InteractiveDoG.java @@ -296,8 +296,8 @@ protected void updatePreview(final ValueChange change) { } final double radius = ( ( params.sigma + HelperFunctions.computeSigma2( params.sigma, sensitivity ) ) / 2.0 ); - final ArrayList< RefinedPeak< Point > > filteredPeaksMax = HelperFunctions.filterPeaks( peaksMax, rectangle, params.threshold ); - final ArrayList< RefinedPeak< Point > > filteredPeaksMin = HelperFunctions.filterPeaks( peaksMin, rectangle, params.threshold ); + final ArrayList< RefinedPeak< Point > > filteredPeaksMax = HelperFunctions.filterPeaks( peaksMax, rectangle, params.threshold / 2.5 ); // correction factor of 2.5 applied to match thresholding in final DoG IP detection + final ArrayList< RefinedPeak< Point > > filteredPeaksMin = HelperFunctions.filterPeaks( peaksMin, rectangle, params.threshold / 2.5 ); // correction factor of 2.5 applied to match thresholding in HelperFunctions.drawRealLocalizable( filteredPeaksMax, imagePlus, radius, Color.RED, true ); HelperFunctions.drawRealLocalizable( filteredPeaksMin, imagePlus, radius, Color.GREEN, false );