In Schindelin et al. 2012 (the Fiji paper), figure 2a, we wrote a small jython script that detects cells by difference of gaussian on a stack of a Drosophila first instar brain where the nuclei of glial cells are labeled in the red channel. That 5-year-old script still runs (after adding all the now missing imports; they used to be imported automatically), and you can find it in my Fiji python scripting tutorial:
Below is a modern version of the script using ImgLib2. The issue: it detects zero peaks, when 27 should be reported.
# A script to find cells by difference of Gaussian using imglib2. # Uses as an example the "first-instar-brain.tif" RGB stack availalable # from Fiji's "Open Samples" menu. from ij import IJ from net.imglib2.img.display.imagej import ImageJFunctions as IJF from net.imglib2.view import Views from net.imglib2.converter import Converters from net.imglib2.algorithm.dog import DogDetection from net.imglib2.type.numeric.real import DoubleType # Fetch the "first-instar-brain.tif" file #imp = IJ.openImage("http://downloads.imagej.net/fiji/snapshots/samples/first-instar-brain.zip") imp = IJ.getImage() cal = imp.getCalibration() # in microns img = IJF.wrap(imp) # Extract the red channel red = Converters.argbChannel(img, 1) # Create a variable of the correct type (UnsignedByteType) for the value-extended view zero = red.randomAccess().get().createVariable() # Run the difference of Gaussian cell = 5.0 # microns in diameter min_peak = 40.0 # min intensity for a peak to be considered dog = DogDetection(Views.extendValue(red, zero), img, [cal.pixelWidth, cal.pixelHeight, cal.pixelDepth], cell / 2, cell, DogDetection.ExtremaType.MAXIMA, min_peak, False, DoubleType()) peaks = dog.getPeaks() # Should print 27, but prints zero! print len(peaks)
What is wrong in the above script with the DoG detection?