Package qupath.lib.gui.measure
Interface PathTableData<T>
- Type Parameters:
T
-
- All Known Implementing Classes:
ObservableMeasurementTableData
public interface PathTableData<T>
Interface defining a table model that enables measurement names to be mapped to string or numeric values (as appropriate).
This can be thought of a table, where items (often PathObject
correspond to rows and named columns either return
numeric or String
data.
This provides a useful method of wrapping one or more objects, and providing access to metadata, stored measurements and dynamically computed values in a way that is amenable to display within a table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default number of decimal places when converting floating point values to strings.static final String
The default delimiter to use. -
Method Summary
Modifier and TypeMethodDescriptionReturn an ordered list of all names, including both numeric measurements andString
values.double[]
getDoubleValues
(String name) Get all double values for all items.getItems()
Get internal list of the items used to provide measurements.Get the names of all numeric measurements.double
getNumericValue
(T item, String name) Get the numeric value from an item for the specific measurement.Get a list of Strings representing table data for all items.getRowStrings
(String delim, int nDecimalPlaces, Predicate<String> columnFilter) Get a list of Strings representing table data for all items.getRowStrings
(Collection<? extends T> items, String delim, int nDecimalPlaces, Predicate<String> columnFilter) Get a list of Strings representing table data for specific items.getStringValue
(T item, String name) Get a string representation of the value.getStringValue
(T item, String name, int decimalPlaces) Get a string value, converting to a fixed number of decimal places if the column is numeric.
-
Field Details
-
DEFAULT_DECIMAL_PLACES
static final int DEFAULT_DECIMAL_PLACESThe default number of decimal places when converting floating point values to strings. This is permitted to change the number of decimal places based upon the magnitude of the value.- See Also:
-
DEFAULT_DELIMITER
The default delimiter to use. This is a tab, to avoid confusion between decimal separators in different locales.- See Also:
-
-
Method Details
-
getAllNames
Return an ordered list of all names, including both numeric measurements andString
values.- Returns:
- See Also:
-
getStringValue
Get a string representation of the value.For this method, numbers should be formatted according to the
Locale
.- Parameters:
item
-name
-- Returns:
-
getStringValue
Get a string value, converting to a fixed number of decimal places if the column is numeric.- Parameters:
item
-name
-decimalPlaces
-- Returns:
-
getMeasurementNames
Get the names of all numeric measurements.- Returns:
- See Also:
-
getNumericValue
Get the numeric value from an item for the specific measurement.- Parameters:
item
-name
-- Returns:
-
getDoubleValues
Get all double values for all items.- Parameters:
name
-- Returns:
-
getItems
Get internal list of the items used to provide measurements.- Returns:
-
getRowStrings
Get a list of Strings representing table data for all items.This will use
DEFAULT_DELIMITER
andDEFAULT_DECIMAL_PLACES
, with no column filter.- Returns:
- a list of strings, with the first item giving the column names and each additional string representing a row in the table
- Since:
- v0.6.0
-
getRowStrings
default List<String> getRowStrings(String delim, int nDecimalPlaces, Predicate<String> columnFilter) Get a list of Strings representing table data for all items.Each entry in the list corresponds to a row.
This is equivalent to calling
getRowStrings(getItems(), delim, nDecimalPlaces, columnFilter)
.- Parameters:
delim
- the delimiter to use between columnsnDecimalPlaces
- the number of decimal places to use for numeric valuescolumnFilter
- a predicate to choose which columns to include; if null, all columns from the table are used- Returns:
- a list of strings, with the first item giving the column names and each additional string representing a row in the table
- Since:
- v0.6.0
-
getRowStrings
default List<String> getRowStrings(Collection<? extends T> items, String delim, int nDecimalPlaces, Predicate<String> columnFilter) Get a list of Strings representing table data for specific items.Each entry in the list corresponds to a row.
- Parameters:
items
- the items to use; one row will be returned for eachdelim
- the delimiter to use between columnsnDecimalPlaces
- the number of decimal places to use for numeric values; if negative, the default number of decimal places is usedcolumnFilter
- a predicate to choose which columns to include; if null, all columns from the table are used- Returns:
- a list of strings, with the first item giving the column names and each additional string representing a row in the table
- Since:
- v0.6.0
-