Package fr.igred.omero.annotations
Class TableWrapper
- java.lang.Object
-
- fr.igred.omero.annotations.TableWrapper
-
public class TableWrapper extends Object
Class containing the information to create a Table in OMERO.The TableData itself is not contained, only the elements to create it, because once created the TableData cannot be altered.
To get the TableData corresponding to the elements contained use createTable.
-
-
Constructor Summary
Constructors Constructor Description TableWrapper(int columnCount, String name)Constructor of the class TableWrapperTableWrapper(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois)Constructor of the class TableWrapper.TableWrapper(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois, String roiProperty)Constructor of the class TableWrapper.TableWrapper(TableData table)Constructor of the class TableWrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRow(Object... os)Adds a row to the table.voidaddRows(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois)Adds rows from an ImageJResultsTable.voidaddRows(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois, String roiProperty)Adds rows from an ImageJResultsTable.TableDatacreateTable()Creates the corresponding TableData object.intgetColumnCount()Returns the number of columns in the table.StringgetColumnName(int column)Returns the name of the column.TableDataColumn[]getColumns()Gets theTableDataColumnwhich contains information on each column of the tableClass<?>getColumnType(int column)Returns the type of the column.Object[][]getData()Gets the value contained in the tableObjectgetData(int x, int y)Gets a certain value of the tableLonggetFileId()Returns the fileId of the table.LonggetId()Returns the table ID.StringgetName()Returns the name of the table.intgetRowCount()Returns the number of rows in the table.booleanisComplete()Checks if the table is completevoidsaveAs(String path, char delimiter)Saves the current table as a character-delimited text file.voidsetColumn(int column, String columnName, Class<?> type)Sets the information about a certain column.voidsetFileId(Long fileId)Sets the fileId of the table.voidsetId(Long id)Sets the id of the table.voidsetName(String name)Sets the name of the table.voidsetRowCount(int rowCount)Sets the number of row in the table.StringtoString()Overridden to return the name of the class and the object id.voidtruncateRow()Deletes all unused row in the table
-
-
-
Constructor Detail
-
TableWrapper
public TableWrapper(int columnCount, String name)Constructor of the class TableWrapper- Parameters:
columnCount- Number of column in the table.name- Name of the table.
-
TableWrapper
public TableWrapper(TableData table)
Constructor of the class TableWrapper. Uses an already existing table to create.- Parameters:
table- The table.
-
TableWrapper
public TableWrapper(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois) throws ServiceException, AccessException, ExecutionException
Constructor of the class TableWrapper. Uses an ImageJResultsTableto create.- Parameters:
client- The client handling the connection.results- An ImageJ results table.imageId- An image ID.ijRois- A list of ImageJ Rois.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.ExecutionException- A Facility can't be retrieved or instantiated.
-
TableWrapper
public TableWrapper(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois, String roiProperty) throws ServiceException, AccessException, ExecutionException
Constructor of the class TableWrapper. Uses an ImageJResultsTableto create.- Parameters:
client- The client handling the connection.results- An ImageJ results table.imageId- An image ID.ijRois- A list of ImageJ Rois.roiProperty- The Roi property storing the local index/label. Defaults toROIWrapper.IJ_PROPERTYif null or empty.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.ExecutionException- A Facility can't be retrieved or instantiated.
-
-
Method Detail
-
toString
public String toString()
Overridden to return the name of the class and the object id.
-
addRows
public void addRows(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois) throws ServiceException, AccessException, ExecutionException
Adds rows from an ImageJResultsTable.- Parameters:
client- The client handling the connection.results- An ImageJ results table.imageId- An image ID.ijRois- A list of ImageJ Rois.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.ExecutionException- A Facility can't be retrieved or instantiated.
-
addRows
public void addRows(Client client, ResultsTable results, Long imageId, List<? extends Roi> ijRois, String roiProperty) throws ServiceException, AccessException, ExecutionException
Adds rows from an ImageJResultsTable.- Parameters:
client- The client handling the connection.results- An ImageJ results table.imageId- An image ID.ijRois- A list of ImageJ Rois.roiProperty- The Roi property storing the local ROI index/label. Defaults toROIWrapper.IJ_PROPERTYif null or empty.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.ExecutionException- A Facility can't be retrieved or instantiated.
-
getColumns
public TableDataColumn[] getColumns()
Gets theTableDataColumnwhich contains information on each column of the table- Returns:
- the
TableDataColumnwhich contains information on each column of the table.
-
getData
public Object[][] getData()
Gets the value contained in the table- Returns:
- the value contained in the table.
-
getData
public Object getData(int x, int y)
Gets a certain value of the table- Parameters:
x- Row position.y- Column position.- Returns:
- the value at position data[y][x].
-
getFileId
public Long getFileId()
Returns the fileId of the table.- Returns:
- See above.
-
setFileId
public void setFileId(Long fileId)
Sets the fileId of the table.- Parameters:
fileId- New fileId.
-
getId
public Long getId()
Returns the table ID.- Returns:
- See above.
-
setId
public void setId(Long id)
Sets the id of the table.- Parameters:
id- New id.
-
getName
public String getName()
Returns the name of the table.- Returns:
- See above.
-
setName
public void setName(String name)
Sets the name of the table.- Parameters:
name- New name.
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Returns:
- See above.
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Parameters:
column- Column number.- Returns:
- See above.
-
getColumnType
public Class<?> getColumnType(int column)
Returns the type of the column.- Parameters:
column- Column number.- Returns:
- See above.
-
getRowCount
public int getRowCount()
Returns the number of rows in the table.- Returns:
- See above.
-
setRowCount
public void setRowCount(int rowCount)
Sets the number of row in the table. Copies already existing data if some were already in the data- Parameters:
rowCount- New rowCount.
-
isComplete
public boolean isComplete()
Checks if the table is complete- Returns:
- true if the table is completed, false if some rows are still empty.
-
setColumn
public void setColumn(int column, String columnName, Class<?> type)Sets the information about a certain column.- Parameters:
column- Column number.columnName- Name of the column.type- Type of the column.- Throws:
IndexOutOfBoundsException- Column number is bigger than actual number of column in the table.
-
addRow
public void addRow(Object... os)
Adds a row to the table.- Parameters:
os- Value for each column for the row.- Throws:
IndexOutOfBoundsException- Table is not initialized or already full.IllegalArgumentException- Incorrect argument number.
-
truncateRow
public void truncateRow()
Deletes all unused row in the table
-
createTable
public TableData createTable()
Creates the corresponding TableData object.- Returns:
- See above.
-
saveAs
public void saveAs(String path, char delimiter) throws FileNotFoundException, UnsupportedEncodingException
Saves the current table as a character-delimited text file.- Parameters:
path- The path to the file where the table will be saved.delimiter- The character used to specify the boundary between columns.- Throws:
FileNotFoundException- The requested file cannot be written.UnsupportedEncodingException- If the UTF8 charset is not supported.
-
-