ij.plugin.filter
Class ParticleAnalyzer
- java.lang.Object
-
- ij.plugin.filter.ParticleAnalyzer
-
- All Implemented Interfaces:
- Measurements, PlugInFilter
public class ParticleAnalyzer extends java.lang.Object implements PlugInFilter, Measurements
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
Fields Modifier and Type Field and Description static intADD_TO_MANAGERAdd particles to ROI Manager.static intCLEAR_WORKSHEETClear "Results" window before starting.static intDISPLAY_SUMMARYDisplay a summary.static intEXCLUDE_EDGE_PARTICLESDo not measure particles touching edge of image.static intFOUR_CONNECTEDUse 4-connected particle tracing.static intIN_SITU_SHOWReplace original image with masks.static intINCLUDE_HOLESFlood fill to ignore interior holes.static intRECORD_STARTSRecord starting coordinates so outline can be recreated later using doWand(x,y).static intSHOW_MASKSDisplay image containing binary masks of measured particles.static intSHOW_NONEDo not display particle outline image.static intSHOW_OUTLINESDisplay image containing outlines of measured particles.static intSHOW_OVERLAY_MASKSDisplay filled particle as an overlay.static intSHOW_OVERLAY_OUTLINESDisplay particle outlines as an overlay.static intSHOW_PROGRESSDisplay a progress bar.static intSHOW_RESULTSDisplay results in the ImageJ console.static intSHOW_ROI_MASKSDisplay image containing grayscales masks that identify measured particles.static intSHOW_SUMMARYObsolete, replaced by DISPLAY_SUMMARY-
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, PARALLELIZE_IMAGES, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING
-
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
-
-
Constructor Summary
Constructors Constructor and Description ParticleAnalyzer()Default 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleananalyze(ImagePlus imp)Performs particle analysis on the specified image.booleananalyze(ImagePlus imp, ImageProcessor ip)Performs particle analysis on the specified ImagePlus and ImageProcessor.ImagePlusgetOutputImage()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(java.util.Properties prefs)Called once when ImageJ quits.static voidsetFontColor(java.lang.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 voidsetResultsTable(ResultsTable rt)Sets 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.intsetup(java.lang.String arg, ImagePlus imp)This method is called once when the filter is loaded.booleanshowDialog()Displays a modal options dialog.
-
-
-
Field Detail
-
SHOW_RESULTS
public static final int SHOW_RESULTS
Display results in the ImageJ console.- See Also:
- Constant Field Values
-
SHOW_SUMMARY
public static final int SHOW_SUMMARY
Obsolete, replaced by DISPLAY_SUMMARY- See Also:
- Constant Field Values
-
SHOW_OUTLINES
public static final int SHOW_OUTLINES
Display image containing outlines of measured particles.- See Also:
- Constant Field Values
-
EXCLUDE_EDGE_PARTICLES
public static final int EXCLUDE_EDGE_PARTICLES
Do not measure particles touching edge of image.- See Also:
- Constant Field Values
-
SHOW_ROI_MASKS
public static final int SHOW_ROI_MASKS
Display image containing grayscales masks that identify measured particles.- See Also:
- Constant Field Values
-
SHOW_PROGRESS
public static final int SHOW_PROGRESS
Display a progress bar.- See Also:
- Constant Field Values
-
CLEAR_WORKSHEET
public static final int CLEAR_WORKSHEET
Clear "Results" window before starting.- See Also:
- Constant Field Values
-
RECORD_STARTS
public static final int RECORD_STARTS
Record starting coordinates so outline can be recreated later using doWand(x,y).- See Also:
- Constant Field Values
-
DISPLAY_SUMMARY
public static final int DISPLAY_SUMMARY
Display a summary.- See Also:
- Constant Field Values
-
SHOW_NONE
public static final int SHOW_NONE
Do not display particle outline image.- See Also:
- Constant Field Values
-
INCLUDE_HOLES
public static final int INCLUDE_HOLES
Flood fill to ignore interior holes.- See Also:
- Constant Field Values
-
ADD_TO_MANAGER
public static final int ADD_TO_MANAGER
Add particles to ROI Manager.- See Also:
- Constant Field Values
-
SHOW_MASKS
public static final int SHOW_MASKS
Display image containing binary masks of measured particles.- See Also:
- Constant Field Values
-
FOUR_CONNECTED
public static final int FOUR_CONNECTED
Use 4-connected particle tracing.- See Also:
- Constant Field Values
-
IN_SITU_SHOW
public static final int IN_SITU_SHOW
Replace original image with masks.- See Also:
- Constant Field Values
-
SHOW_OVERLAY_OUTLINES
public static final int SHOW_OVERLAY_OUTLINES
Display particle outlines as an overlay.- See Also:
- Constant Field Values
-
SHOW_OVERLAY_MASKS
public static final int SHOW_OVERLAY_MASKS
Display filled particle as an overlay.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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
-
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 Detail
-
setup
public int setup(java.lang.String arg, ImagePlus imp)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
public void run(ImageProcessor ip)
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.- Specified by:
runin interfacePlugInFilter
-
showDialog
public boolean showDialog()
Displays a modal options dialog.
-
analyze
public boolean analyze(ImagePlus imp)
Performs particle analysis on the specified image. Returns false if there is an error.
-
analyze
public boolean analyze(ImagePlus imp, ImageProcessor ip)
Performs particle analysis on the specified ImagePlus and ImageProcessor. Returns false if there is an error.
-
getOutputImage
public ImagePlus 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
public static void setFontColor(java.lang.String color)
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
public static void setRoiManager(RoiManager manager)
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
public static void setResultsTable(ResultsTable rt)
Sets the ResultsTable to be used by the next ParticleAnalyzer instance.
-
savePreferences
public static void savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.
-
-
DMelt 3.0 © DataMelt by jWork.ORG