Class SNTTable
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<org.scijava.table.Column<? extends Object>>,Collection<org.scijava.table.Column<? extends Object>>,List<org.scijava.table.Column<? extends Object>>,RandomAccess,SequencedCollection<org.scijava.table.Column<? extends Object>>,org.scijava.table.GenericTable,org.scijava.table.Table<org.scijava.table.Column<? extends Object>,,Object> org.scijava.util.Sizable
- Direct Known Subclasses:
ShollTable
DefaultGenericTable with (minor) scripting conveniences.- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddColumn(String colHeader, Collection<Double> array) voidaddGenericColumn(String colHeader, Collection<?> collection) voidappendToLastRow(String colHeader, Object value) Appends a value to the last row in the specified column.voidclear()voidCreates a new display or updates an existing one.voidfillEmptyCells(Object value) Fills all empty cells in the table with the specified value.static SNTTableScript-friendly method for loading CSV data from a file/URL.static SNTTableScript-friendly method for loading tabular data from a file/URL.static SNTTablefromGenericTable(org.scijava.table.GenericTable source) org.apache.commons.math3.stat.descriptive.SummaryStatisticsgeColumnStats(int columnIndex, int startRowIndex, int endRowIndex) org.apache.commons.math3.stat.descriptive.SummaryStatisticsgeColumnStats(String colHeader, int startRowIndex, int endRowIndex) org.apache.commons.math3.stat.descriptive.SummaryStatisticsgeRowStats(int rowIndex, int startColumnIndex, int endColumnIndex) org.apache.commons.math3.stat.descriptive.SummaryStatisticsgeRowStats(String rowHeader, int startColumnIndex, int endColumnIndex) getColumnHeaders(String pattern) intgetTitle()Gets the title of the table.booleanChecks if the table has unsaved data.intbooleanChecks if the table contains summary statistics.org.scijava.table.Column<?> removeColumn(String header) voidRemoves summary statistics from the table.voidvoidbooleanstatic voidsave(org.scijava.table.Table<?, ?> table, char columnSep, boolean saveColHeaders, boolean saveRowHeaders, File outputFile) voidvoidvoidvoidsetContext(org.scijava.Context context) Sets a SciJava context to this table.voidSets the title of the table.voidshow()Displays the table in a window.voidvoidstatic StringtoString(org.scijava.table.GenericTable table) static StringtoString(org.scijava.table.GenericTable table, int firstRow, int lastRow) voidUpdates the existing table display.protected voidvalidate()Methods inherited from class org.scijava.table.DefaultGenericTable
createColumnMethods inherited from class org.scijava.table.AbstractTable
add, add, addAll, addAll, getRowCount, getRowHeader, insertColumns, removeRows, setColumnCount, setRowCount, setRowHeaderMethods inherited from class org.scijava.util.SizableArrayList
ensureCapacity, setSizeMethods inherited from class java.util.ArrayList
addFirst, addLast, clone, contains, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliteratorMethods inherited from interface org.scijava.util.Sizable
sizeMethods inherited from interface org.scijava.table.Table
add, add, addAll, addAll, appendColumn, appendColumn, appendColumns, appendColumns, appendRow, appendRow, appendRows, appendRows, contains, containsAll, get, get, get, get, getColumnCount, getColumnHeader, getColumnIndex, getRowCount, getRowHeader, getRowIndex, indexOf, insertColumn, insertColumn, insertColumns, insertColumns, insertRow, insertRow, insertRows, insertRows, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeColumn, removeColumns, removeColumns, removeRow, removeRow, removeRows, removeRows, retainAll, set, setColumnCount, setColumnHeader, setDimensions, setRowCount, setRowHeader, size, subList, toArray, toArray
-
Constructor Details
-
SNTTable
public SNTTable() -
SNTTable
-
SNTTable
- Throws:
IOException
-
SNTTable
- Throws:
IOException
-
-
Method Details
-
validate
protected void validate() -
fillEmptyCells
Fills all empty cells in the table with the specified value.Iterates through all cells in the table and replaces null values with the provided replacement value.
- Parameters:
value- the value to use for filling empty cells
-
replace
-
hasUnsavedData
public boolean hasUnsavedData()Checks if the table has unsaved data.Returns true if the table contains data and has been modified since the last save operation.
- Returns:
- true if there is unsaved data, false otherwise
-
appendToLastRow
Appends a value to the last row in the specified column.If the table is empty, a new row is created first. The value is then set in the specified column of the last row.
- Parameters:
colHeader- the column headervalue- the value to append
-
addColumn
-
set
-
clear
public void clear()- Specified by:
clearin interfaceCollection<org.scijava.table.Column<? extends Object>>- Specified by:
clearin interfaceList<org.scijava.table.Column<? extends Object>>- Specified by:
clearin interfaceorg.scijava.table.Table<org.scijava.table.Column<? extends Object>,Object> - Overrides:
clearin classArrayList<org.scijava.table.Column<? extends Object>>
-
addColumn
-
addGenericColumn
-
insertRow
-
set
-
set
-
removeColumn
-
save
-
setContext
Sets a SciJava context to this table.- Parameters:
context- the SciJava application context- Throws:
IllegalArgumentException
-
getColumnHeaders
-
getColumnHeaders
-
isSummarized
public boolean isSummarized()Checks if the table contains summary statistics.Returns true if the table has been summarized with statistical measures like mean, standard deviation, etc. This is determined by looking for specific row headers in the expected positions.
- Returns:
- true if table contains summary statistics, false otherwise
-
removeSummary
public void removeSummary()Removes summary statistics from the table.If the table contains summary statistics, this method removes the summary rows to return the table to its raw data state.
-
getSummaryRow
public int getSummaryRow() -
geRowStats
public org.apache.commons.math3.stat.descriptive.SummaryStatistics geRowStats(String rowHeader, int startColumnIndex, int endColumnIndex) -
geRowStats
public org.apache.commons.math3.stat.descriptive.SummaryStatistics geRowStats(int rowIndex, int startColumnIndex, int endColumnIndex) -
geColumnStats
public org.apache.commons.math3.stat.descriptive.SummaryStatistics geColumnStats(String colHeader, int startRowIndex, int endRowIndex) -
geColumnStats
public org.apache.commons.math3.stat.descriptive.SummaryStatistics geColumnStats(int columnIndex, int startRowIndex, int endRowIndex) -
summarize
public void summarize() -
save
- Throws:
IOException
-
show
public void show()Displays the table in a window.Creates or updates the table display window. If a display already exists, it is updated with the current table contents.
-
show
-
updateDisplay
public void updateDisplay()Updates the existing table display.Refreshes the table display with the current table contents without creating a new display window.
-
createOrUpdateDisplay
public void createOrUpdateDisplay()Creates a new display or updates an existing one.If no display exists, creates a new table display window. If a display already exists, updates it with the current table contents.
-
getTitle
Gets the title of the table.Returns the table's title, or "SNT Measurements" if no title has been set.
- Returns:
- the table title
-
setTitle
Sets the title of the table.- Parameters:
title- the table's title
-
fromFile
Script-friendly method for loading CSV data from a file/URL.- Parameters:
filePathOrURL- the absolute path or URL to the CSV file to be imported- Returns:
- the SNTTable or null if file could not be imported
-
fromFile
Script-friendly method for loading tabular data from a file/URL.- Parameters:
filePathOrURL- the absolute path or URL to the tabular file to be importeddelimiter- the column delimiter (comma, tab, etc.). A single character expected.- Returns:
- the SNTTable or null if file could not be imported
-
toString
-
toString
-
save
public static void save(org.scijava.table.Table<?, ?> table, char columnSep, boolean saveColHeaders, boolean saveRowHeaders, File outputFile) throws IOException- Throws:
IOException
-
fromGenericTable
-