Class SNTTable

java.lang.Object
java.util.AbstractCollection<org.scijava.table.Column<? extends Object>>
java.util.AbstractList<org.scijava.table.Column<? extends Object>>
java.util.ArrayList<org.scijava.table.Column<? extends Object>>
org.scijava.util.SizableArrayList<org.scijava.table.Column<? extends Object>>
org.scijava.table.AbstractTable<org.scijava.table.Column<? extends Object>,Object>
org.scijava.table.DefaultGenericTable
sc.fiji.snt.analysis.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

public class SNTTable extends org.scijava.table.DefaultGenericTable
Extension of DefaultGenericTable with (minor) scripting conveniences.
Author:
Tiago Ferreira
See Also:
  • Constructor Details

  • Method Details

    • validate

      protected void validate()
    • fillEmptyCells

      public void fillEmptyCells(Object value)
      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

      public void replace(String columnHeadersPattern, double originalValue, double replacementValue)
    • 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

      public void appendToLastRow(String colHeader, Object value)
      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 header
      value - the value to append
    • addColumn

      public void addColumn(String colHeader, double[] array)
    • set

      public void set(String colHeader, String rowHeader, Object value)
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<org.scijava.table.Column<? extends Object>>
      Specified by:
      clear in interface List<org.scijava.table.Column<? extends Object>>
      Specified by:
      clear in interface org.scijava.table.Table<org.scijava.table.Column<? extends Object>,Object>
      Overrides:
      clear in class ArrayList<org.scijava.table.Column<? extends Object>>
    • addColumn

      public void addColumn(String colHeader, Collection<Double> array)
    • addGenericColumn

      public void addGenericColumn(String colHeader, Collection<?> collection)
    • insertRow

      public int insertRow(String header)
    • set

      public void set(String colHeader, int row, Object value)
      Specified by:
      set in interface org.scijava.table.Table<org.scijava.table.Column<? extends Object>,Object>
      Overrides:
      set in class org.scijava.table.AbstractTable<org.scijava.table.Column<? extends Object>,Object>
    • set

      public void set(int col, int row, Object value)
    • removeColumn

      public org.scijava.table.Column<?> removeColumn(String header)
    • save

      public boolean save(String filePath)
    • setContext

      public void setContext(org.scijava.Context context) throws IllegalArgumentException
      Sets a SciJava context to this table.
      Parameters:
      context - the SciJava application context
      Throws:
      IllegalArgumentException
    • getColumnHeaders

      public List<String> getColumnHeaders()
    • getColumnHeaders

      public List<String> getColumnHeaders(String pattern)
    • 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

      public void save(File outputFile) throws IOException
      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

      public void show(String windowTitle)
    • 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

      public String 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

      public void setTitle(String title)
      Sets the title of the table.
      Parameters:
      title - the table's title
    • fromFile

      public static SNTTable fromFile(String filePathOrURL)
      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

      public static SNTTable fromFile(String filePathOrURL, String delimiter)
      Script-friendly method for loading tabular data from a file/URL.
      Parameters:
      filePathOrURL - the absolute path or URL to the tabular file to be imported
      delimiter - the column delimiter (comma, tab, etc.). A single character expected.
      Returns:
      the SNTTable or null if file could not be imported
    • toString

      public static String toString(org.scijava.table.GenericTable table)
    • toString

      public static String toString(org.scijava.table.GenericTable table, int firstRow, int lastRow)
    • save

      public static void save(org.scijava.table.Table<?,?> table, char columnSep, boolean saveColHeaders, boolean saveRowHeaders, File outputFile) throws IOException
      Throws:
      IOException
    • fromGenericTable

      public static SNTTable fromGenericTable(org.scijava.table.GenericTable source)