diff --git a/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/Localization.java b/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/Localization.java index 6c4a9585..c06822e6 100644 --- a/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/Localization.java +++ b/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/Localization.java @@ -50,6 +50,9 @@ public static ArrayList< InterestPoint > noLocalization( final ArrayList< Simple if ( !DoGImgLib2.silent ) IOFunctions.println("(" + new Date(System.currentTimeMillis()) + "): NO subpixel localization" ); + if ( peaks == null || peaks.size() == 0 ) + return new ArrayList<>(); + final int n = peaks.get( 0 ).location.length; final ArrayList< InterestPoint > peaks2 = new ArrayList< InterestPoint >(); diff --git a/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/methods/dog/DoGImgLib2.java b/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/methods/dog/DoGImgLib2.java index e1114fce..e89174af 100644 --- a/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/methods/dog/DoGImgLib2.java +++ b/src/main/java/net/preibisch/mvrecon/process/interestpointdetection/methods/dog/DoGImgLib2.java @@ -243,7 +243,7 @@ public static < T extends RealType< T > > ArrayList< InterestPoint > computeDoG( if ( cuda == null ) { gauss1 = LazyGauss.init( inputFloat, interval, new FloatType(), sigma1, blockSize ); - gauss2 = LazyGauss.init( inputFloat, interval , new FloatType(), sigma2, blockSize ); + gauss2 = LazyGauss.init( inputFloat, interval, new FloatType(), sigma2, blockSize ); } else { @@ -269,8 +269,8 @@ public void convert( final FloatType inputA, final FloatType inputB, final Float } }, new FloatType() ); - //avoid double-caching for weighted gauss (i.e. mask != null) - //final RandomAccessibleInterval< FloatType > dogCached = (mask == null) ? FusionTools.cacheRandomAccessibleInterval( dog, new FloatType(), blockSize ) : dog; + + // no caching since it is a simple subtraction operation, the underlying Gauss is expensive final RandomAccessibleInterval< FloatType > dogCached = dog; if ( !silent ) @@ -289,15 +289,6 @@ public void convert( final FloatType inputA, final FloatType inputB, final Float } else if ( localization == 1 ) { - // TODO: remove last Imglib1 crap - //final Img< FloatType > dogCopy = new ArrayImgFactory<>( new FloatType() ).create( dogCached ); - - //if ( !silent ) - // IOFunctions.println("(" + new Date(System.currentTimeMillis()) + "): Mem-copying image." ); - - //FusionTools.copyImg( Views.zeroMin( dogCached ), dogCopy, service ); - //final Image imglib1 = ImgLib2.wrapArrayFloatToImgLib1( dogCopy ); - for ( final SimplePeak peak : peaks ) for ( int d = 0; d < peak.location.length; ++d ) peak.location[ d ] -= minInterval[ d ]; @@ -305,6 +296,7 @@ else if ( localization == 1 ) if ( !silent ) IOFunctions.println("(" + new Date(System.currentTimeMillis()) + "): Quadratic localization." ); + // TODO: something requires a zeroMin dataset in here finalPeaks = Localization.computeQuadraticLocalization( peaks, Views.extendMirrorDouble( Views.zeroMin( dogCached ) ), new FinalInterval( Views.zeroMin( dogCached ) ), findMin, findMax, minPeakValue, true, service ); // adjust detections for min coordinates of the RandomAccessibleInterval