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..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 @@ -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..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 @@ -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 @@ -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 );