ij.plugin.filter
Class ParticleAnalyzer

java.lang.Object
  extended by 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
static int ADD_TO_MANAGER
          Add particles to ROI Manager.
protected  boolean addToManager
           
protected  Analyzer analyzer
           
static int CLEAR_WORKSHEET
          Clear ImageJ console before starting.
static int DISPLAY_SUMMARY
          Display a summary.
protected  boolean displaySummary
           
protected static int ELLIPSES
           
static int EXCLUDE_EDGE_PARTICLES
          Do not measure particles touching edge of image.
protected  boolean excludeEdgeParticles
           
protected  boolean floodFill
           
protected  ImagePlus imp
           
static int INCLUDE_HOLES
          Flood fill to ignore interior holes.
protected static int MASKS
           
protected static int NOTHING
           
protected static int OUTLINES
           
protected  boolean processStack
           
static int RECORD_STARTS
          Record starting coordinates so outline can be recreated later using doWand(x,y).
protected  boolean recordStarts
           
protected  boolean resetCounter
           
protected  ResultsTable rt
           
static int SHOW_NONE
          Do not display particle outline image.
static int SHOW_OUTLINES
          Display image containing outlines of measured paticles.
static int SHOW_PROGRESS
          Display a progress bar.
static int SHOW_RESULTS
          Display results in the ImageJ console.
static int SHOW_SUMMARY
          Obsolete
protected static int showChoice
           
protected  boolean showProgress
           
protected  boolean showResults
           
protected  boolean showSizeDistribution
           
protected  int slice
           
 
Fields inherited from interface ij.plugin.filter.PlugInFilter
DOES_16, DOES_32, DOES_8C, DOES_8G, DOES_ALL, DOES_RGB, DOES_STACKS, DONE, NO_CHANGES, NO_IMAGE_REQUIRED, NO_UNDO, ROI_REQUIRED, STACK_REQUIRED, SUPPORTS_MASKING
 
Fields inherited from interface ij.measure.Measurements
AREA, AREA_FRACTION, CENTER_OF_MASS, CENTROID, CIRCULARITY, ELLIPSE, FERET, INTEGRATED_DENSITY, INVERT_Y, KURTOSIS, LABELS, LIMIT, MAX_STANDARDS, MEAN, MEDIAN, MIN_MAX, MODE, PERIMETER, RECT, SKEWNESS, SLICE, STD_DEV
 
Constructor Summary
ParticleAnalyzer()
          Default constructor
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(int options, int measurements, ResultsTable rt, double minSize, double maxSize, double minCirc, double maxCirc)
          Constructs a ParticleAnalyzer.
 
Method Summary
 boolean analyze(ImagePlus imp)
          Performs particle analysis on 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.
 void run(ImageProcessor ip)
          Filters use this method to process the image.
static void savePreferences(java.util.Properties prefs)
          Called once when ImageJ quits.
protected  void saveResults(ImageStatistics stats, Roi roi)
          Saves statistics for one particle in a results table.
 int setup(java.lang.String arg, ImagePlus imp)
          This method is called once when the filter is loaded.
 boolean showDialog()
          Displays a modal options dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

See Also:
Constant Field Values

SHOW_OUTLINES

public static final int SHOW_OUTLINES
Display image containing outlines of measured paticles.

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_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 ImageJ console 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

NOTHING

protected static final int NOTHING
See Also:
Constant Field Values

OUTLINES

protected static final int OUTLINES
See Also:
Constant Field Values

MASKS

protected static final int MASKS
See Also:
Constant Field Values

ELLIPSES

protected static final int ELLIPSES
See Also:
Constant Field Values

showChoice

protected static int showChoice

imp

protected ImagePlus imp

rt

protected ResultsTable rt

analyzer

protected Analyzer 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
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 interface
rt - a ResultsTable where the measurements will be stored
minSize - the smallest particle size in pixels
maxSize - the largest particle size in pixels
minCirc - minimum circularity
maxCirc - 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: 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. 'imp' is the currently active image. This method should return a flag word that specifies the filters capabilities.

Specified by:
setup in interface PlugInFilter

run

public void run(ImageProcessor ip)
Description copied from interface: PlugInFilter
Filters use this method to process the image. If the SUPPORTS_STACKS flag was set, it is called for each slice in a stack. ImageJ will lock the image before calling this method and unlock it when the filter is finished.

Specified by:
run in interface PlugInFilter

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.


saveResults

protected void saveResults(ImageStatistics stats,
                           Roi roi)
Saves statistics for one particle in a results table. This is a method subclasses may want to 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.


savePreferences

public static void savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.