edu.jhu.tmaj.beans.masks.results
Class ParticleAnalyzer2

java.lang.Object
  extended by edu.jhu.tmaj.beans.masks.results.ParticleAnalyzer2
All Implemented Interfaces:
ij.measure.Measurements, ij.plugin.filter.PlugInFilter

public class ParticleAnalyzer2
extends java.lang.Object
implements ij.plugin.filter.PlugInFilter, ij.measure.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  Analyzer2 analyzer
           
(package private) static int BYTE
           
static int CLEAR_WORKSHEET
          Clear ImageJ console before starting.
(package private)  int counter
           
(package private) static double DEFAULT_MAX_SIZE
           
(package private) static double DEFAULT_MIN_SIZE
           
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
           
(package private) static int FLOAT
           
protected  boolean floodFill
           
static int FOUR_CONNECTED
          Use 4-connected particle tracing.
protected  ij.ImagePlus imp
           
static int INCLUDE_HOLES
          Flood fill to ignore interior holes.
protected static int MASKS
           
protected static int NOTHING
           
(package private) static java.lang.String OPTIONS
           
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
           
(package private) static int RGB
           
protected static int ROI_MASKS
           
protected  ij.measure.ResultsTable rt
           
(package private) static int SHORT
           
static int SHOW_MASKS
          Display image containing binary masks of measured particles.
static int SHOW_NONE
          Do not display particle outline image.
static int SHOW_OUTLINES
          Display image containing outlines of measured particles.
static int SHOW_PROGRESS
          Display a progress bar.
static int SHOW_RESULTS
          Display results in the ImageJ console.
static int SHOW_ROI_MASKS
          Display image containing grayscales masks that identify measured particles.
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
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_STACKS, ROI_REQUIRED, SNAPSHOT, 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, SCIENTIFIC_NOTATION, SHAPE_DESCRIPTORS, SKEWNESS, SLICE, STACK_POSITION, STD_DEV
 
Constructor Summary
ParticleAnalyzer2()
          Default constructor
ParticleAnalyzer2(int options, int measurements, ij.measure.ResultsTable rt, double minSize, double maxSize)
          Constructs a ParticleAnalyzer using the default min and max circularity values (0 and 1).
ParticleAnalyzer2(int options, int measurements, ij.measure.ResultsTable rt, double minSize, double maxSize, double minCirc, double maxCirc)
          Constructs a ParticleAnalyzer.
 
Method Summary
(package private)  java.lang.String addMeans(java.lang.String line, int start)
           
 boolean analyze(ij.ImagePlus imp)
          Performs particle analysis on the specified image.
 boolean analyze(ij.ImagePlus imp, ij.process.ImageProcessor ip)
          Performs particle analysis on the specified ImagePlus and ImageProcessor.
(package private)  void analyzeParticle(int x, int y, ij.ImagePlus imp, ij.process.ImageProcessor ip)
           
(package private)  void drawEllipse(ij.process.ImageProcessor ip, ij.process.ImageStatistics stats, int count)
           
(package private)  void drawFilledParticle(ij.process.ImageProcessor ip, ij.gui.Roi roi, ij.process.ImageProcessor mask)
           
(package private)  void drawOutline(ij.process.ImageProcessor ip, ij.gui.Roi roi, int count)
           
protected  void drawParticle(ij.process.ImageProcessor drawIP, ij.gui.Roi roi, ij.process.ImageStatistics stats, ij.process.ImageProcessor mask)
          Draws a selected particle in a separate image.
(package private)  void drawRoiFilledParticle(ij.process.ImageProcessor ip, ij.gui.Roi roi, ij.process.ImageProcessor mask, int count)
           
(package private)  boolean eraseOutsideRoi(ij.process.ImageProcessor ip, java.awt.Rectangle r, ij.process.ImageProcessor mask)
           
(package private)  int getColumnID(java.lang.String name)
           
 ij.ImagePlus getOutputImage()
          Returns the "Outlines", "Masks", "Elipses" or "Count Masks" image, or null if "Nothing" is selected in the "Show:" menu.
(package private)  ij.process.ImageStatistics getStatistics(ij.process.ImageProcessor ip, int mOptions, ij.measure.Calibration cal)
           
(package private)  void makeCustomLut()
           
(package private)  java.lang.String n(double n)
           
 void run(ij.process.ImageProcessor ip)
           
static void savePreferences(java.util.Properties prefs)
          Called once when ImageJ quits.
protected  void saveResults(ij.process.ImageStatistics stats, ij.gui.Roi roi)
          Saves statistics for one particle in a results table.
 void setHideOutputImage(boolean hideOutputImage)
          Set 'hideOutputImage' true to not display the "Show:" image.
(package private)  boolean setThresholdLevels(ij.ImagePlus imp, ij.process.ImageProcessor ip)
           
 int setup(java.lang.String arg, ij.ImagePlus imp)
           
 boolean showDialog()
          Displays a modal options dialog.
(package private)  void showResults()
           
(package private)  boolean updateMacroOptions()
           
(package private)  void updateSliceSummary()
           
 
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 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 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

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

OPTIONS

static final java.lang.String OPTIONS
See Also:
Constant Field Values

BYTE

static final int BYTE
See Also:
Constant Field Values

SHORT

static final int SHORT
See Also:
Constant Field Values

FLOAT

static final int FLOAT
See Also:
Constant Field Values

RGB

static final int RGB
See Also:
Constant Field Values

DEFAULT_MIN_SIZE

static final double DEFAULT_MIN_SIZE
See Also:
Constant Field Values

DEFAULT_MAX_SIZE

static final double DEFAULT_MAX_SIZE
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

ROI_MASKS

protected static final int ROI_MASKS
See Also:
Constant Field Values

showChoice

protected static int showChoice

imp

protected ij.ImagePlus imp

rt

protected ij.measure.ResultsTable rt

analyzer

protected Analyzer2 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

counter

int counter
Constructor Detail

ParticleAnalyzer2

public ParticleAnalyzer2(int options,
                         int measurements,
                         ij.measure.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

ParticleAnalyzer2

public ParticleAnalyzer2(int options,
                         int measurements,
                         ij.measure.ResultsTable rt,
                         double minSize,
                         double maxSize)
Constructs a ParticleAnalyzer using the default min and max circularity values (0 and 1).


ParticleAnalyzer2

public ParticleAnalyzer2()
Default constructor

Method Detail

setup

public int setup(java.lang.String arg,
                 ij.ImagePlus imp)
Specified by:
setup in interface ij.plugin.filter.PlugInFilter

run

public void run(ij.process.ImageProcessor ip)
Specified by:
run in interface ij.plugin.filter.PlugInFilter

showDialog

public boolean showDialog()
Displays a modal options dialog.


updateMacroOptions

boolean updateMacroOptions()

analyze

public boolean analyze(ij.ImagePlus imp)
Performs particle analysis on the specified image. Returns false if there is an error.


analyze

public boolean analyze(ij.ImagePlus imp,
                       ij.process.ImageProcessor ip)
Performs particle analysis on the specified ImagePlus and ImageProcessor. Returns false if there is an error.


updateSliceSummary

void updateSliceSummary()

addMeans

java.lang.String addMeans(java.lang.String line,
                          int start)

n

java.lang.String n(double n)

eraseOutsideRoi

boolean eraseOutsideRoi(ij.process.ImageProcessor ip,
                        java.awt.Rectangle r,
                        ij.process.ImageProcessor mask)

setThresholdLevels

boolean setThresholdLevels(ij.ImagePlus imp,
                           ij.process.ImageProcessor ip)

analyzeParticle

void analyzeParticle(int x,
                     int y,
                     ij.ImagePlus imp,
                     ij.process.ImageProcessor ip)

getStatistics

ij.process.ImageStatistics getStatistics(ij.process.ImageProcessor ip,
                                         int mOptions,
                                         ij.measure.Calibration cal)

saveResults

protected void saveResults(ij.process.ImageStatistics stats,
                           ij.gui.Roi roi)
Saves statistics for one particle in a results table. This is a method subclasses may want to override.


drawParticle

protected void drawParticle(ij.process.ImageProcessor drawIP,
                            ij.gui.Roi roi,
                            ij.process.ImageStatistics stats,
                            ij.process.ImageProcessor mask)
Draws a selected particle in a separate image. This is another method subclasses may want to override.


drawFilledParticle

void drawFilledParticle(ij.process.ImageProcessor ip,
                        ij.gui.Roi roi,
                        ij.process.ImageProcessor mask)

drawOutline

void drawOutline(ij.process.ImageProcessor ip,
                 ij.gui.Roi roi,
                 int count)

drawEllipse

void drawEllipse(ij.process.ImageProcessor ip,
                 ij.process.ImageStatistics stats,
                 int count)

drawRoiFilledParticle

void drawRoiFilledParticle(ij.process.ImageProcessor ip,
                           ij.gui.Roi roi,
                           ij.process.ImageProcessor mask,
                           int count)

showResults

void showResults()

getOutputImage

public ij.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.


getColumnID

int getColumnID(java.lang.String name)

makeCustomLut

void makeCustomLut()

savePreferences

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