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 int
Add particles to ROI Manager.protected boolean
protected Analyzer
protected static final int
static final int
Clear "Results" window before starting.static final int
Use composite ROIs for particles with holes.protected boolean
static final int
Display a summary.protected boolean
protected static final int
static final int
Do not measure particles touching edge of image.protected boolean
protected boolean
static final int
Use 4-connected particle tracing.protected ImagePlus
static final int
Replace original image with masks.static final int
Flood fill to ignore interior holes.protected boolean
protected static final int
protected static final int
protected static final int
static final int
Use "Overlay" checkbox to display overlay.protected static final int
protected static final int
protected boolean
static final int
Record starting coordinates so outline can be recreated later using doWand(x,y).protected boolean
protected boolean
protected static final int
protected ResultsTable
static final int
Display image containing binary masks of measured particles.static final int
Do not display particle outline image.static final int
Display image containing outlines of measured particles.static final int
Display filled particle as an overlay.static final int
Display particle outlines as an overlay.static final int
Display a progress bar.static final int
Display results in the ImageJ console.static final int
Display image containing grayscales masks that identify measured particles.static final int
Obsolete, replaced by DISPLAY_SUMMARYprotected boolean
protected boolean
protected boolean
protected boolean
protected int
protected static int
Fields 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_DEV
Fields 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 TypeMethodDescriptionboolean
Performs particle analysis on the current slice of the specified image.boolean
analyze
(ImagePlus imp, ImageProcessor ip) Performs particle analysis on the specified ImagePlus and ImageProcessor.protected void
drawParticle
(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.void
run
(ImageProcessor ip) Filters use this method to process the image.static void
savePreferences
(Properties prefs) Called once when ImageJ quits.protected void
saveResults
(ImageStatistics stats, Roi roi) Saves statistics for one particle in a results table.static void
setFontColor
(String color) Sets the color ("blue", "black", etc.) of the font used to label outlines in the next particle analyzer instance.static void
setFontSize
(int size) Sets the size of the font used to label outlines in the next particle analyzer instance.void
setHideOutputImage
(boolean hideOutputImage) Set 'hideOutputImage' true to not display the "Show:" image.static void
setLineWidth
(int width) Sets the outline line width for the next ParticleAnalyzer instance.static void
Sets the ResultsTable to be used by the next ParticleAnalyzer instance.static void
setRoiManager
(RoiManager manager) Sets the RoiManager to be used by the next ParticleAnalyzer instance.static void
Sets the ResultsTable to be used by the next ParticleAnalyzer instance for the summary.int
This method is called once when the filter is loaded.boolean
Displays 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:PlugInFilter
This 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_PROCESSING
flag, the setup method will be called again, this time with arg = "final" after all other processing is done.- Specified by:
setup
in interfacePlugInFilter
-
run
Description copied from interface:PlugInFilter
Filters use this method to process the image. If thePlugInFilter.DOES_STACKS
flag 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_REQUIRED
flag and not thePlugInFilter.DONE
flag, run(ip) is called once with the argumentnull
. Use ip.getSliceNumber() to get the stack position (1-n).- Specified by:
run
in 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.
-