java.lang.Object
ij.plugin.filter.ParticleAnalyzer
- All Implemented Interfaces:
Measurements,PlugInFilter
Implements ImageJ's Analyze Particles command.
for each line do
for each pixel in this line do
if the pixel value is "inside" the threshold range then
trace the edge to mark the object
do the measurement
fill the object with a color outside the threshold range
else
continue the scan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAdd particles to ROI Manager.protected booleanprotected Analyzerprotected static final intstatic final intClear "Results" window before starting.static final intUse composite ROIs for particles with holes.protected booleanstatic final intDisplay a summary.protected booleanprotected static final intstatic final intDo not measure particles touching edge of image.protected booleanprotected booleanstatic final intUse 4-connected particle tracing.protected ImagePlusstatic final intReplace original image with masks.static final intFlood fill to ignore interior holes.protected booleanprotected static final intprotected static final intprotected static final intstatic final intUse "Overlay" checkbox to display overlay.protected static final intprotected static final intprotected booleanstatic final intRecord starting coordinates so outline can be recreated later using doWand(x,y).protected booleanprotected booleanprotected static final intprotected ResultsTablestatic final intDisplay image containing binary masks of measured particles.static final intDo not display particle outline image.static final intDisplay image containing outlines of measured particles.static final intDisplay filled particle as an overlay.static final intDisplay particle outlines as an overlay.static final intDisplay a progress bar.static final intDisplay results in the ImageJ console.static final intDisplay image containing grayscales masks that identify measured particles.static final intObsolete, replaced by DISPLAY_SUMMARYprotected booleanprotected booleanprotected booleanprotected booleanprotected intprotected static intFields inherited from interface ij.measure.Measurements
ADD_TO_OVERLAY, ALL_STATS, AREA, AREA_FRACTION, CENTER_OF_MASS, CENTROID, CIRCULARITY, ELLIPSE, FERET, INTEGRATED_DENSITY, INVERT_Y, KURTOSIS, LABELS, LIMIT, MAX_STANDARDS, MEAN, MEDIAN, MIN_MAX, MODE, NaN_EMPTY_CELLS, PERIMETER, RECT, SCIENTIFIC_NOTATION, SHAPE_DESCRIPTORS, SKEWNESS, SLICE, STACK_POSITION, STD_DEVFields inherited from interface ij.plugin.filter.PlugInFilter
CONVERT_TO_FLOAT, DOES_16, DOES_32, DOES_8C, DOES_8G, DOES_ALL, DOES_RGB, DOES_STACKS, DONE, FINAL_PROCESSING, KEEP_THRESHOLD, NO_CHANGES, NO_IMAGE_REQUIRED, NO_UNDO, NO_UNDO_RESET, PARALLELIZE_IMAGES, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorParticleAnalyzer(int options, int measurements, ResultsTable rt, double minSize, double maxSize) Constructs a ParticleAnalyzer using the default min and max circularity values (0 and 1).ParticleAnalyzer(int options, int measurements, ResultsTable rt, double minSize, double maxSize, double minCirc, double maxCirc) Constructs a ParticleAnalyzer. -
Method Summary
Modifier and TypeMethodDescriptionbooleanPerforms particle analysis on the current slice of the specified image.booleananalyze(ImagePlus imp, ImageProcessor ip) Performs particle analysis on the specified ImagePlus and ImageProcessor.protected voiddrawParticle(ImageProcessor drawIP, Roi roi, ImageStatistics stats, ImageProcessor mask) Draws a selected particle in a separate image.Returns the "Outlines", "Masks", "Elipses" or "Count Masks" image, or null if "Nothing" is selected in the "Show:" menu.voidrun(ImageProcessor ip) Filters use this method to process the image.static voidsavePreferences(Properties prefs) Called once when ImageJ quits.protected voidsaveResults(ImageStatistics stats, Roi roi) Saves statistics for one particle in a results table.static voidsetFontColor(String color) Sets the color ("blue", "black", etc.) of the font used to label outlines in the next particle analyzer instance.static voidsetFontSize(int size) Sets the size of the font used to label outlines in the next particle analyzer instance.voidsetHideOutputImage(boolean hideOutputImage) Set 'hideOutputImage' true to not display the "Show:" image.static voidsetLineWidth(int width) Sets the outline line width for the next ParticleAnalyzer instance.static voidSets the ResultsTable to be used by the next ParticleAnalyzer instance.static voidsetRoiManager(RoiManager manager) Sets the RoiManager to be used by the next ParticleAnalyzer instance.static voidSets the ResultsTable to be used by the next ParticleAnalyzer instance for the summary.intThis method is called once when the filter is loaded.booleanDisplays a modal options dialog.
-
Field Details
-
SHOW_RESULTS
public static final int SHOW_RESULTSDisplay results in the ImageJ console.- See Also:
-
SHOW_SUMMARY
public static final int SHOW_SUMMARYObsolete, replaced by DISPLAY_SUMMARY- See Also:
-
SHOW_OUTLINES
public static final int SHOW_OUTLINESDisplay image containing outlines of measured particles.- See Also:
-
EXCLUDE_EDGE_PARTICLES
public static final int EXCLUDE_EDGE_PARTICLESDo not measure particles touching edge of image.- See Also:
-
SHOW_ROI_MASKS
public static final int SHOW_ROI_MASKSDisplay image containing grayscales masks that identify measured particles.- See Also:
-
SHOW_PROGRESS
public static final int SHOW_PROGRESSDisplay a progress bar.- See Also:
-
CLEAR_WORKSHEET
public static final int CLEAR_WORKSHEETClear "Results" window before starting.- See Also:
-
RECORD_STARTS
public static final int RECORD_STARTSRecord starting coordinates so outline can be recreated later using doWand(x,y).- See Also:
-
DISPLAY_SUMMARY
public static final int DISPLAY_SUMMARYDisplay a summary.- See Also:
-
SHOW_NONE
public static final int SHOW_NONEDo not display particle outline image.- See Also:
-
INCLUDE_HOLES
public static final int INCLUDE_HOLESFlood fill to ignore interior holes.- See Also:
-
ADD_TO_MANAGER
public static final int ADD_TO_MANAGERAdd particles to ROI Manager.- See Also:
-
SHOW_MASKS
public static final int SHOW_MASKSDisplay image containing binary masks of measured particles.- See Also:
-
FOUR_CONNECTED
public static final int FOUR_CONNECTEDUse 4-connected particle tracing.- See Also:
-
IN_SITU_SHOW
public static final int IN_SITU_SHOWReplace original image with masks.- See Also:
-
SHOW_OVERLAY_OUTLINES
public static final int SHOW_OVERLAY_OUTLINESDisplay particle outlines as an overlay.- See Also:
-
SHOW_OVERLAY_MASKS
public static final int SHOW_OVERLAY_MASKSDisplay filled particle as an overlay.- See Also:
-
COMPOSITE_ROIS
public static final int COMPOSITE_ROISUse composite ROIs for particles with holes.- See Also:
-
OVERLAY
public static final int OVERLAYUse "Overlay" checkbox to display overlay.- See Also:
-
NOTHING
protected static final int NOTHING- See Also:
-
OUTLINES
protected static final int OUTLINES- See Also:
-
BARE_OUTLINES
protected static final int BARE_OUTLINES- See Also:
-
ELLIPSES
protected static final int ELLIPSES- See Also:
-
MASKS
protected static final int MASKS- See Also:
-
ROI_MASKS
protected static final int ROI_MASKS- See Also:
-
OVERLAY_OUTLINES
protected static final int OVERLAY_OUTLINES- See Also:
-
OVERLAY_MASKS
protected static final int OVERLAY_MASKS- See Also:
-
staticShowChoice
protected static int staticShowChoice -
imp
-
rt
-
analyzer
-
slice
protected int slice -
processStack
protected boolean processStack -
showResults
protected boolean showResults -
excludeEdgeParticles
protected boolean excludeEdgeParticles -
showSizeDistribution
protected boolean showSizeDistribution -
resetCounter
protected boolean resetCounter -
showProgress
protected boolean showProgress -
recordStarts
protected boolean recordStarts -
displaySummary
protected boolean displaySummary -
floodFill
protected boolean floodFill -
addToManager
protected boolean addToManager -
inSituShow
protected boolean inSituShow -
compositeRois
protected boolean compositeRois -
showOverlay
protected boolean showOverlay
-
-
Constructor Details
-
ParticleAnalyzer
public ParticleAnalyzer(int options, int measurements, ResultsTable rt, double minSize, double maxSize, double minCirc, double maxCirc) Constructs a ParticleAnalyzer.- Parameters:
options- a flag word created by Oring SHOW_RESULTS, EXCLUDE_EDGE_PARTICLES, etc.measurements- a flag word created by ORing constants defined in the Measurements interfacert- a ResultsTable where the measurements will be storedminSize- the smallest particle size in pixelsmaxSize- the largest particle size in pixelsminCirc- minimum circularitymaxCirc- maximum circularity// JavaScript example imp = IJ.openImage("https://imagej.net/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); rt = new ResultsTable(); options = ParticleAnalyzer.SHOW_NONE; measurements = Measurements.AREA + Measurements.PERIMETER; pa = new ParticleAnalyzer(options, measurements, rt, 0, Double.MAX_VALUE, 0, 1); pa.analyze(imp); rt.show("Results");
-
ParticleAnalyzer
public ParticleAnalyzer(int options, int measurements, ResultsTable rt, double minSize, double maxSize) Constructs a ParticleAnalyzer using the default min and max circularity values (0 and 1). -
ParticleAnalyzer
public ParticleAnalyzer()Default constructor
-
-
Method Details
-
setup
Description copied from interface:PlugInFilterThis method is called once when the filter is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt or in the plugins.config file of a jar archive containing the plugin. 'imp' is the currently active image. This method should return a flag word that specifies the filters capabilities.For Plugin-filters specifying the
PlugInFilter.FINAL_PROCESSINGflag, the setup method will be called again, this time with arg = "final" after all other processing is done.- Specified by:
setupin interfacePlugInFilter
-
run
Description copied from interface:PlugInFilterFilters use this method to process the image. If thePlugInFilter.DOES_STACKSflag was set, it is called for each slice in a stack. WithPlugInFilter.CONVERT_TO_FLOAT, the filter is called with the image data converted to a FloatProcessor (3 times per image for RGB images). ImageJ will lock the image before calling this method and unlock it when the filter is finished. For PlugInFilters specifying thePlugInFilter.NO_IMAGE_REQUIREDflag and not thePlugInFilter.DONEflag, run(ip) is called once with the argumentnull. Use ip.getSliceNumber() to get the stack position (1-n).- Specified by:
runin interfacePlugInFilter
-
showDialog
public boolean showDialog()Displays a modal options dialog. -
analyze
Performs particle analysis on the current slice of the specified image. Returns false if there is an error. -
analyze
Performs particle analysis on the specified ImagePlus and ImageProcessor. Returns false if there is an error. -
saveResults
Saves statistics for one particle in a results table. This is a method subclasses can override. -
drawParticle
protected void drawParticle(ImageProcessor drawIP, Roi roi, ImageStatistics stats, ImageProcessor mask) Draws a selected particle in a separate image. This is another method subclasses may want to override. -
getOutputImage
Returns the "Outlines", "Masks", "Elipses" or "Count Masks" image, or null if "Nothing" is selected in the "Show:" menu. -
setHideOutputImage
public void setHideOutputImage(boolean hideOutputImage) Set 'hideOutputImage' true to not display the "Show:" image. -
setFontSize
public static void setFontSize(int size) Sets the size of the font used to label outlines in the next particle analyzer instance. -
setFontColor
Sets the color ("blue", "black", etc.) of the font used to label outlines in the next particle analyzer instance. -
setLineWidth
public static void setLineWidth(int width) Sets the outline line width for the next ParticleAnalyzer instance. -
setRoiManager
Sets the RoiManager to be used by the next ParticleAnalyzer instance. There is a JavaScript example at http://imagej.nih.gov/ij/macros/js/HiddenRoiManager.js -
setResultsTable
Sets the ResultsTable to be used by the next ParticleAnalyzer instance. -
setSummaryTable
Sets the ResultsTable to be used by the next ParticleAnalyzer instance for the summary. -
savePreferences
Called once when ImageJ quits.
-