Package ij.measure
Class ResultsTable
java.lang.Object
ij.measure.ResultsTable
- All Implemented Interfaces:
Cloneable
This is a table for storing measurement results and strings as columns of values.
Call the static ResultsTable.getResultsTable() method to get a reference to the
ResultsTable used by the Analyze/Measure command.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final short
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Obsolete; use getLastColumn().static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty ResultsTable with the counter=0, no columns and the precision set to 3 or the "Decimal places" value in Analyze/Set Measurements if that value is higher than 3. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Obsolete; the addValue() method automatically adds columns as needed.void
Adds a label to the beginning of the current row.void
Deprecated.Replaced by setValue(String,int,String)void
Adds the last row in this table to the Results window without updating it.void
addValue
(int column, double value) Adds a value to the end of the given column.void
Adds a value to the end of the given column.void
Adds a string value to the end of the given column.clone()
Duplicates this ResultsTable.boolean
columnExists
(int column) Returns true if the specified column exists and is not empty.static ResultsTable
Creates a ResultsTable from an image or image selection.static String
d2s
(double n, int decimalPlaces) This is a version of IJ.d2s() that uses scientific notation for small numbes that would otherwise display as zero.void
deleteRow
(int row) Deletes the specified row.void
Set the row label column to null if the column label is "Label".float[]
getColumn
(int column) Returns a copy of the given column as a float array, or null if the column is empty.double[]
getColumnAsDoubles
(int column) Returns a copy of the given column as a double array, or null if the column is empty.getColumnHeading
(int column) Returns the heading of the specified column or null if the column is empty.Returns a tab or comma delimited string containing the column headings.int
getColumnIndex
(String heading) Returns the index of the first column with the given heading.int
Returns the current value of the measurement counter.static String
getDefaultHeading
(int index) int
getFreeColumn
(String heading) Sets the heading of the the first available column and returns that column's index.String[]
Returns the column headings as an array of Strings.getLabel
(int row) Returns the label of the specified row.int
Returns the index of the last used column, or -1 if no columns are used.static ResultsTable
Returns the ResultsTable used by the Measure command.static TextWindow
Returns the "Results" TextWindow.getRowAsString
(int row) Returns a tab or comma delimited string representing the given row, where 0<=row<=counter-1.getStringValue
(int column, int row) Returns the string value of the given column and row, where column must be less than or equal the value returned by getLastColumn() and row must be greater than or equal zero and less than the value returned by size().getStringValue
(String column, int row) Returns the string value of the given column and row, where row must be greater than or equal zero and less than the value returned by size().Returns the contents of this ResultsTable as a FloatProcessor.float
getValue
(int column, int row) Deprecated.replaced by getValueAsDoubledouble
Returns the value of the specified column and row, where column is the column heading and row is a number greater than or equal zero and less than value returned by size().double
getValueAsDouble
(int column, int row) Returns the value of the given column and row, where column must be less than or equal the value returned by getLastColumn() and row must be greater than or equal zero and less than the value returned by size().void
Increments the measurement counter by one.static ResultsTable
Opens a tab or comma delimited text file and returns it as a ResultsTable.static ResultsTable
Opens a tab or comma delimited text file and returns it as a ResultsTable, without requiring a try/catch statement.void
reset()
boolean
Saves this ResultsTable as a tab or comma delimited text file.void
void
setDecimalPlaces
(int column, int digits) void
Sets the headings used by the Measure command ("Area", "Mean", etc.).void
setHeading
(int column, String heading) Deprecated.Replaced by addValue(String,double) and setValue(String,int,double)void
Adds a label to the beginning of the specified row, or updates an existing lable, where 0<=row<counter.void
setNaNEmptyCells
(boolean NaNEmptyCells) Set 'true' to initially fill data arrays with NaNs instead of zeros.void
setPrecision
(int precision) Sets the decimal places (digits to the right of decimal point) that are used when this table is displayed.void
setValue
(int column, int row, double value) Sets the value of the given column and row, where where 0<=column<=(lastRow+1 and 0<=row<=counter.void
Sets the string value of the given column and row, where where 0<=column<=(lastRow+1 and 0<=row<=counter.void
Sets the value of the given column and row, where where 0<=row<counter.void
Sets the string value of the given column and row, where where 0<=row<counter.void
Displays the contents of this ResultsTable in a window with the specified title, or updates an existing results window.void
showRowNumbers
(boolean showNumbers) int
size()
Returns the size of this ResultsTable.toString()
void
void
Updates the Results window.
-
Field Details
-
MAX_COLUMNS
public static final int MAX_COLUMNSObsolete; use getLastColumn().- See Also:
-
COLUMN_NOT_FOUND
public static final int COLUMN_NOT_FOUND- See Also:
-
COLUMN_IN_USE
public static final int COLUMN_IN_USE- See Also:
-
TABLE_FULL
public static final int TABLE_FULL- See Also:
-
AUTO_FORMAT
public static final short AUTO_FORMAT- See Also:
-
AREA
public static final int AREA- See Also:
-
MEAN
public static final int MEAN- See Also:
-
STD_DEV
public static final int STD_DEV- See Also:
-
MODE
public static final int MODE- See Also:
-
MIN
public static final int MIN- See Also:
-
MAX
public static final int MAX- See Also:
-
X_CENTROID
public static final int X_CENTROID- See Also:
-
Y_CENTROID
public static final int Y_CENTROID- See Also:
-
X_CENTER_OF_MASS
public static final int X_CENTER_OF_MASS- See Also:
-
Y_CENTER_OF_MASS
public static final int Y_CENTER_OF_MASS- See Also:
-
PERIMETER
public static final int PERIMETER- See Also:
-
ROI_X
public static final int ROI_X- See Also:
-
ROI_Y
public static final int ROI_Y- See Also:
-
ROI_WIDTH
public static final int ROI_WIDTH- See Also:
-
ROI_HEIGHT
public static final int ROI_HEIGHT- See Also:
-
MAJOR
public static final int MAJOR- See Also:
-
MINOR
public static final int MINOR- See Also:
-
ANGLE
public static final int ANGLE- See Also:
-
CIRCULARITY
public static final int CIRCULARITY- See Also:
-
FERET
public static final int FERET- See Also:
-
INTEGRATED_DENSITY
public static final int INTEGRATED_DENSITY- See Also:
-
MEDIAN
public static final int MEDIAN- See Also:
-
SKEWNESS
public static final int SKEWNESS- See Also:
-
KURTOSIS
public static final int KURTOSIS- See Also:
-
AREA_FRACTION
public static final int AREA_FRACTION- See Also:
-
RAW_INTEGRATED_DENSITY
public static final int RAW_INTEGRATED_DENSITY- See Also:
-
CHANNEL
public static final int CHANNEL- See Also:
-
SLICE
public static final int SLICE- See Also:
-
FRAME
public static final int FRAME- See Also:
-
FERET_X
public static final int FERET_X- See Also:
-
FERET_Y
public static final int FERET_Y- See Also:
-
FERET_ANGLE
public static final int FERET_ANGLE- See Also:
-
MIN_FERET
public static final int MIN_FERET- See Also:
-
ASPECT_RATIO
public static final int ASPECT_RATIO- See Also:
-
ROUNDNESS
public static final int ROUNDNESS- See Also:
-
SOLIDITY
public static final int SOLIDITY- See Also:
-
MIN_THRESHOLD
public static final int MIN_THRESHOLD- See Also:
-
MAX_THRESHOLD
public static final int MAX_THRESHOLD- See Also:
-
LAST_HEADING
public static final int LAST_HEADING- See Also:
-
-
Constructor Details
-
ResultsTable
public ResultsTable()Constructs an empty ResultsTable with the counter=0, no columns and the precision set to 3 or the "Decimal places" value in Analyze/Set Measurements if that value is higher than 3.
-
-
Method Details
-
getResultsTable
Returns the ResultsTable used by the Measure command. This table must be displayed in the "Results" window. -
getResultsWindow
Returns the "Results" TextWindow. -
incrementCounter
public void incrementCounter()Increments the measurement counter by one. -
addColumns
public void addColumns()Obsolete; the addValue() method automatically adds columns as needed.- See Also:
-
getCounter
public int getCounter()Returns the current value of the measurement counter. -
size
public int size()Returns the size of this ResultsTable. -
addValue
public void addValue(int column, double value) Adds a value to the end of the given column. Counter must be >0. -
addValue
Adds a value to the end of the given column. If the column does not exist, it is created. Counter must be >0. There is an example at:
http://imagej.nih.gov/ij/plugins/sine-cosine.html -
addValue
Adds a string value to the end of the given column. If the column does not exist, it is created. Counter must be >0. -
addLabel
Adds a label to the beginning of the current row. Counter must be >0. -
addLabel
Deprecated.Replaced by setValue(String,int,String) -
setLabel
Adds a label to the beginning of the specified row, or updates an existing lable, where 0<=row<counter. After labels are added or modified, callshow()
to update the window displaying the table. -
disableRowLabels
public void disableRowLabels()Set the row label column to null if the column label is "Label". -
getColumn
public float[] getColumn(int column) Returns a copy of the given column as a float array, or null if the column is empty. -
getColumnAsDoubles
public double[] getColumnAsDoubles(int column) Returns a copy of the given column as a double array, or null if the column is empty. -
getTableAsImage
Returns the contents of this ResultsTable as a FloatProcessor. -
createTableFromImage
Creates a ResultsTable from an image or image selection. -
columnExists
public boolean columnExists(int column) Returns true if the specified column exists and is not empty. -
getColumnIndex
Returns the index of the first column with the given heading. heading. If not found, returns COLUMN_NOT_FOUND. -
getFreeColumn
Sets the heading of the the first available column and returns that column's index. Returns COLUMN_IN_USE if this is a duplicate heading. -
getValueAsDouble
public double getValueAsDouble(int column, int row) Returns the value of the given column and row, where column must be less than or equal the value returned by getLastColumn() and row must be greater than or equal zero and less than the value returned by size(). -
getValue
public float getValue(int column, int row) Deprecated.replaced by getValueAsDouble -
getValue
Returns the value of the specified column and row, where column is the column heading and row is a number greater than or equal zero and less than value returned by size(). Throws an IllegalArgumentException if this ResultsTable does not have a column with the specified heading. -
getStringValue
Returns the string value of the given column and row, where row must be greater than or equal zero and less than the value returned by size(). -
getStringValue
Returns the string value of the given column and row, where column must be less than or equal the value returned by getLastColumn() and row must be greater than or equal zero and less than the value returned by size(). -
getLabel
Returns the label of the specified row. Returns null if the row does not have a label. -
setValue
Sets the value of the given column and row, where where 0<=row<counter. If the specified column does not exist, it is created. When adding columns,show()
must be called to update the window that displays the table. -
setValue
public void setValue(int column, int row, double value) Sets the value of the given column and row, where where 0<=column<=(lastRow+1 and 0<=row<=counter. -
setValue
Sets the string value of the given column and row, where where 0<=row<counter. If the specified column does not exist, it is created. When adding columns,show()
must be called to update the window that displays the table. -
setValue
Sets the string value of the given column and row, where where 0<=column<=(lastRow+1 and 0<=row<=counter. -
getColumnHeadings
Returns a tab or comma delimited string containing the column headings. -
getHeadings
Returns the column headings as an array of Strings. -
getColumnHeading
Returns the heading of the specified column or null if the column is empty. -
getRowAsString
Returns a tab or comma delimited string representing the given row, where 0<=row<=counter-1. -
setHeading
Deprecated.Replaced by addValue(String,double) and setValue(String,int,double) -
setDefaultHeadings
public void setDefaultHeadings()Sets the headings used by the Measure command ("Area", "Mean", etc.). -
setPrecision
public void setPrecision(int precision) Sets the decimal places (digits to the right of decimal point) that are used when this table is displayed. -
setDecimalPlaces
public void setDecimalPlaces(int column, int digits) -
setNaNEmptyCells
public void setNaNEmptyCells(boolean NaNEmptyCells) Set 'true' to initially fill data arrays with NaNs instead of zeros. -
showRowNumbers
public void showRowNumbers(boolean showNumbers) -
d2s
This is a version of IJ.d2s() that uses scientific notation for small numbes that would otherwise display as zero. -
deleteRow
public void deleteRow(int row) Deletes the specified row. -
reset
public void reset() -
getLastColumn
public int getLastColumn()Returns the index of the last used column, or -1 if no columns are used. -
addResults
public void addResults()Adds the last row in this table to the Results window without updating it. -
updateResults
public void updateResults()Updates the Results window. -
show
Displays the contents of this ResultsTable in a window with the specified title, or updates an existing results window. Opens a new window if there is no open text window with this title. The title must be "Results" if this table was obtained using ResultsTable.getResultsTable() or Analyzer.getResultsTable . -
update
-
open2
Opens a tab or comma delimited text file and returns it as a ResultsTable, without requiring a try/catch statement. Displays a file open dialog if 'path' is empty or null. -
open
Opens a tab or comma delimited text file and returns it as a ResultsTable. Displays a file open dialog if 'path' is empty or null.- Throws:
IOException
- See Also:
-
save
Saves this ResultsTable as a tab or comma delimited text file. The table is saved as a CSV (comma-separated values) file if 'path' ends with ".csv". Displays a file save dialog if 'path' is empty or null. Does nothing if the table is empty. Displays an error message and returns 'false' if there is an error. -
saveAs
- Throws:
IOException
-
getDefaultHeading
-
clone
Duplicates this ResultsTable. -
toString
-