- java.lang.Object
-
- ij.plugin.filter.Analyzer
-
- All Implemented Interfaces:
Measurements
,PlugInFilter
public class Analyzer extends java.lang.Object implements PlugInFilter, Measurements
This plugin implements ImageJ's Analyze/Measure and Analyze/Set Measurements commands.
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color
darkBlue
static int
markWidth
static int
precision
-
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
Constructors Constructor Description Analyzer()
Analyzer(ImagePlus imp)
Constructs a new Analyzer using the specified ImagePlus object and the current measurement options and default results table.Analyzer(ImagePlus imp, int measurements, ResultsTable rt)
Construct a new Analyzer using an ImagePlus object and private measurement options and a ResultsTable.Analyzer(ImagePlus imp, ResultsTable rt)
Construct a new Analyzer using an ImagePlus object and a ResultsTable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
addToOverlay()
void
disableReset(boolean b)
Used by RoiManager.multiMeasure() to suppress save as dialogs.void
displayResults()
Writes the last row in the system results table to the Results window.static void
drawLabels(boolean b)
static int
getCounter()
Returns the current measurement count.static int
getMeasurements()
static int
getPrecision()
Returns the number of digits displayed to the right of decimal point.static ImagePlus
getRedirectImage(ImagePlus cimp)
Returns the image selected in the "Redirect To:" popup menu of the Analyze/Set Measurements dialog, or null if "None" is selected, the image was not found or the image is not the same size ascurrentImage
.static ResultsTable
getResultsTable()
Returns the default results table.static float[]
getUMeans()
Returns an array containing the first 20 uncalibrated means.static boolean
isRedirectImage()
Returnstrue
if an image is selected in the "Redirect To:" popup menu of the Analyze/Set Measurements dialog box.void
measure()
Measures the image or selection and adds the results to the default results table.java.lang.String
n(double n)
Converts a number to a formatted string with a tab at the end.static boolean
resetCounter()
Sets the measurement counter to zero.void
run(ImageProcessor ip)
Filters use this method to process the image.static void
savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.void
saveResults(ImageStatistics stats, Roi roi)
Saves the measurements specified in the "Set Measurements" dialog, or by calling setMeasurements(), in the default results table.static void
setDefaultHeadings()
Sets the default headings ("Area", "Mean", etc.).static void
setMeasurement(int option, boolean state)
Sets the specified system-wide measurement option.static void
setMeasurements(int measurements)
Sets the system-wide measurement options.static void
setOption(java.lang.String option, boolean b)
static void
setPrecision(int decimalPlaces)
Sets the number of digits displayed to the right of decimal point.static void
setRedirectImage(ImagePlus imp)
Set the "Redirect To" image.static void
setResultsTable(ResultsTable rt)
static void
setUnsavedMeasurements(boolean b)
int
setup(java.lang.String arg, ImagePlus imp)
This method is called once when the filter is loaded.void
summarize()
void
updateHeadings()
Redisplays the results table.static double
updateY(double y, int imageHeight)
Returns an updated Y coordinate based on the current "Invert Y Coordinates" flag.static int
updateY(int y, int imageHeight)
Returns an updated Y coordinate based on the current "Invert Y Coordinates" flag.
-
-
-
Constructor Detail
-
Analyzer
public Analyzer()
-
Analyzer
public Analyzer(ImagePlus imp)
Constructs a new Analyzer using the specified ImagePlus object and the current measurement options and default results table.
-
Analyzer
public Analyzer(ImagePlus imp, ResultsTable rt)
Construct a new Analyzer using an ImagePlus object and a ResultsTable.
-
Analyzer
public Analyzer(ImagePlus imp, int measurements, ResultsTable rt)
Construct a new Analyzer using an ImagePlus object and private measurement options and a ResultsTable.
-
-
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 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
public void run(ImageProcessor ip)
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
.- Specified by:
run
in interfacePlugInFilter
-
measure
public void measure()
Measures the image or selection and adds the results to the default results table.
-
isRedirectImage
public static boolean isRedirectImage()
Returnstrue
if an image is selected in the "Redirect To:" popup menu of the Analyze/Set Measurements dialog box.
-
setRedirectImage
public static void setRedirectImage(ImagePlus imp)
Set the "Redirect To" image. Pass 'null' as the argument to disable redirected sampling.
-
getRedirectImage
public static ImagePlus getRedirectImage(ImagePlus cimp)
Returns the image selected in the "Redirect To:" popup menu of the Analyze/Set Measurements dialog, or null if "None" is selected, the image was not found or the image is not the same size ascurrentImage
.
-
saveResults
public void saveResults(ImageStatistics stats, Roi roi)
Saves the measurements specified in the "Set Measurements" dialog, or by calling setMeasurements(), in the default results table.
-
displayResults
public void displayResults()
Writes the last row in the system results table to the Results window.
-
updateHeadings
public void updateHeadings()
Redisplays the results table.
-
n
public java.lang.String n(double n)
Converts a number to a formatted string with a tab at the end.
-
summarize
public void summarize()
-
getCounter
public static int getCounter()
Returns the current measurement count.
-
resetCounter
public static boolean resetCounter()
Sets the measurement counter to zero. Displays a dialog that allows the user to save any existing measurements. Returns false if the user cancels the dialog.
-
setUnsavedMeasurements
public static void setUnsavedMeasurements(boolean b)
-
getMeasurements
public static int getMeasurements()
-
setMeasurements
public static void setMeasurements(int measurements)
Sets the system-wide measurement options.
-
setMeasurement
public static void setMeasurement(int option, boolean state)
Sets the specified system-wide measurement option.
-
savePreferences
public static void savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.
-
getUMeans
public static float[] getUMeans()
Returns an array containing the first 20 uncalibrated means.
-
getResultsTable
public static ResultsTable getResultsTable()
Returns the default results table. This table should only be displayed in a the "Results" window.
-
getPrecision
public static int getPrecision()
Returns the number of digits displayed to the right of decimal point.
-
setPrecision
public static void setPrecision(int decimalPlaces)
Sets the number of digits displayed to the right of decimal point.
-
updateY
public static int updateY(int y, int imageHeight)
Returns an updated Y coordinate based on the current "Invert Y Coordinates" flag.
-
updateY
public static double updateY(double y, int imageHeight)
Returns an updated Y coordinate based on the current "Invert Y Coordinates" flag.
-
setDefaultHeadings
public static void setDefaultHeadings()
Sets the default headings ("Area", "Mean", etc.).
-
setOption
public static void setOption(java.lang.String option, boolean b)
-
addToOverlay
public static boolean addToOverlay()
-
setResultsTable
public static void setResultsTable(ResultsTable rt)
-
drawLabels
public static void drawLabels(boolean b)
-
disableReset
public void disableReset(boolean b)
Used by RoiManager.multiMeasure() to suppress save as dialogs.
-
-