from ij import IJ, WindowManager from ij.plugin.frame import RoiManager from ij.plugin import ChannelSplitter, Thresholder from ij.plugin.filter import ParticleAnalyzer from ij.io import FileSaver import time, sys imp = IJ.getImage() csplitter = ChannelSplitter() thresholder = Thresholder() channels = csplitter.splitRGB(imp.getStack(), False) blueImp = ImagePlus("blue", channels[2]) blueImp.getProcessor().invert() blueImp.show() WindowManager.setTempCurrentImage(blueImp) IJ.run("Make Binary") blueImp.hide() roim = RoiManager(True) # Create a ParticleAnalyzer, with arguments: # 1. options (could be SHOW_ROI_MASKS, SHOW_OUTLINES, SHOW_MASKS, SHOW_NONE, ADD_TO_MANAGER, and others; combined with bitwise-or) # 2. measurement options (see [http://rsb.info.nih.gov/ij/developer/api/ij/measure/Measurements.html Measurements]) # 3. a ResultsTable to store the measurements # 4,5. The min and max size of a particle to consider for measurement # 6,7. The min and max circularity (values between 0 and 1 perfect circle) pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER, Measurements.AREA, None, 200, 4000, 0.4, 1.0) pa.setHideOutputImage(True)