public ArrayList< RefinedPeak< Point > > getSubpixelPeaks() { final boolean savedKeepDoGImg = keepDoGImg; keepDoGImg = true; final ArrayList< Point > peaks = getPeaks(); final SubpixelLocalization< Point, F > spl = new SubpixelLocalization<>( dogImg.numDimensions() ); spl.setAllowMaximaTolerance( true ); spl.setMaxNumMoves( 10 ); final ArrayList< RefinedPeak< Point > > refined = spl.process( peaks, dogImg, dogImg ); keepDoGImg = savedKeepDoGImg; if ( !keepDoGImg ) dogImg = null; return refined; } }
public ArrayList< Point > getPeaks() { final ExecutorService service; if ( executorService == null ) service = Executors.newFixedThreadPool( numThreads ); else service = executorService; dogImg = Util.getArrayOrCellImgFactory( interval, type ).create( interval ); final long[] translation = new long[ interval.numDimensions() ]; interval.min( translation ); dogImg = Views.translate( dogImg, translation ); final double[][] sigmas = DifferenceOfGaussian.computeSigmas( imageSigma, minf, pixelSize, sigmaSmaller, sigmaLarger ); DifferenceOfGaussian.DoG( sigmas[ 0 ], sigmas[ 1 ], input, dogImg, service ); final F val = type.createVariable(); final double minValueT = type.getMinValue(); final double maxValueT = type.getMaxValue(); final LocalNeighborhoodCheck< Point, F > localNeighborhoodCheck; final double normalization = normalizeMinPeakValue ? ( sigmaLarger / sigmaSmaller - 1.0 ) : 1.0; switch ( extremaType ) { case MINIMA: val.setReal( Math.max( Math.min( -minPeakValue * normalization, maxValueT ), minValueT ) ); localNeighborhoodCheck = new LocalExtrema.MinimumCheck<>( val ); break; case MAXIMA: default: val.setReal( Math.max( Math.min( minPeakValue * normalization, maxValueT ), minValueT ) ); localNeighborhoodCheck = new LocalExtrema.MaximumCheck<>( val );
public static enum ExtremaType { /** * Bright blobs on dark background. */ MINIMA, /** * Dark blobs on bright background. */ MAXIMA }
isoSigma2[ d ] = sigma2 * scaleFactor[ d ]; DifferenceOfGaussian.DoG( isoSigma1, isoSigma2, mirrorImg, image2, exe );
final double[][] sigmas = DifferenceOfGaussian.computeSigmas( 0.5, 2, calibration, sigma1, sigma2 ); try
final long[] translation = new long[ dog.numDimensions() ]; dog.min( translation ); DoG( sigmaSmaller, sigmaLarger, input, Views.translate( g1, translation ), dog, service );
for ( int d = 0; d < cal.length; d++ ) cal[ d ] = calibration[ d ]; final double[][] sigmas = DifferenceOfGaussian.computeSigmas( 0.5, 2, cal, sigma1, sigma2 ); try
isoSigma2[ d ] = sigma2 * scaleFactor[ d ]; DifferenceOfGaussian.DoG( isoSigma1, isoSigma2, mirrorImg, image2, exe );
@Test public void dogRAITest() { final double[] sigmas1 = new double[] { 1, 1 }; final double[] sigmas2 = new double[] { 2, 2 }; final long[] dims = new long[] { 10, 10 }; final Img<ByteType> in = generateByteArrayTestImg(true, dims); final Img<ByteType> out1 = generateByteArrayTestImg(false, dims); final Img<ByteType> out2 = generateByteArrayTestImg(false, dims); ops.run(DoGVaryingSigmas.class, out1, in, sigmas1, sigmas2); // test against native imglib2 implementation DifferenceOfGaussian.DoG(sigmas1, sigmas2, Views.extendMirrorSingle(in), out2, Executors.newFixedThreadPool(10)); final Cursor<ByteType> out1Cursor = out1.cursor(); final Cursor<ByteType> out2Cursor = out2.cursor(); while (out1Cursor.hasNext()) { org.junit.Assert.assertEquals(out1Cursor.next().getRealDouble(), out2Cursor.next().getRealDouble(), 0); } }