public class SlideSet extends Object
SlideSet
class);dm
package);pi
package); andui
package).The Slide Set core provides a complete workflow for basic image analysis tasks repeated over multiple images and associated data, such as regions of interest and treatment group identifiers. However, Slide Set is also designed to be extensible, and can be leveraged to facilitate the automation and recording of custom image analysis tasks.
Extensions are possible at levels 2 through 4. Slide Set commands
are discovered at run-time, and custom commands can be added using a
simple variant
of the ImageJ version 2 Command API. Many general
ImageJ plugins developed using the version 2 API can also be used with
Slide Set, provided appropriate ElementReader
s
and ElementWriter
s are
available to link the data types of the plugins' input and output values
to the Slide Set data model. If appropriate linkers are not available
in the Slide Set core, custom ElementReader
s and
ElementWriter
s can be
developed, and, as with custom Slide Set commands, loaded at run-time.
Finally, the data model and plugins have no dependencies on the user
interface, and can be used programmatically or wrapped with different
user controls. The set of DataElement
s used in Slide Set tables is
currently fixed, but dynamically loaded extensions may be possible
in future releases.
Slide Set projects organize data into tables, represented by
the SlideSet
class. Fields are represented as table columns,
and entries are represented as table rows. Commands are run by
matching table columns to the command inputs, then repeating the
command with the inputs set to each row of values in the table.
Command results are then stored in a new table, linked as a "child"
to the input table "parent." Columns are therefore typed; each
element in the column must represent the same kind of data.
SlideSet
table elements are represented by descendants
of the DataElement
class. Each element contains "underlying"
data, methods for converting the underlying data to and from a
String
(used to save Slide Set table data as XML and CSV files),
and an additional parameter representing the data's MIME type.
The underlying type and String conversion methods are determined
by the DataElement
class, while the MIME type String is
independent. Thus, elements representing image files and ROI set
files may use the same DataElement class, with an underlying data
String
containing the path to the relevant file, but they
will have different values for their MIME type String
s.
In order for two DataElements
to be of the same overall data type
(and therefore column-compatible), they must both be instances
of the same DataElement
class and have the same value
set for their MIME type.
The underlying data is not passed directly to or from commands.
Rather, it is interpreted through ElementReader
s
and ElementWriter
s which
translate between the data representation in the table
(ex.: an image file path String
) and the actual data
used by the command (ex.: a Dataset
representing the
actual image data). This data form used by commands is called
the "processed" type to distinguish it from the DataElement
's
underlying data type. ElementReader
s and ElementWriter
s
contain annotations specifying the DataElement
classes and
MIME types with which they are compatible, allowing a relatively
limited number of DataElement
types to wrap many different
kinds of information.
In addition to the DataElements, SlideSet
s
contain metadata specifying the name, DataElement
class, and MIME type associated with each column,
the "working directory" of the table (used to resolve relative
paths; generally the directory where the project XML file is saved),
a list of parameters used to create the table (set only for
tables which are created to store the results of commands),
a table name, a reference to the parent table,
and references to any child tables.
DataTypeIDService
)SlideSetPlugin
)SlideSetPluginLoader
)Modifier and Type | Field and Description |
---|---|
private ArrayList<SlideSet> |
children
Children of this
SlideSet |
private ArrayList<LinkedHashMap<String,String>> |
columnProperties
Index of column properties:
elementClass - Name of DataElement subclass used
mimeType - MIME type used
name - Name associated with the column (required)
defaultPath - Default relative path for this column (relevant for links only)
defaultLinkPrefix - Prefix for generating default links (ex.
|
private ArrayList<ArrayList<DataElement>> |
columns
Columns in the SlideSet
|
private CommandTemplate |
commandTemplate
Command template data
|
private LinkedHashMap<String,String> |
creationParams
The input parameters used in the creation of this
SlideSet |
private String |
dir
Working directory of this
SlideSet |
private DataTypeIDService |
dtid
DataTypeIDService reference
|
private net.imagej.ImageJ |
ij
ImageJ context reference
|
private boolean |
locked
Is this
SlideSet locked? |
private String |
name
Name of this
SlideSet |
private int |
numRows
Number of rows in the SlideSet
|
private SlideSet |
parent
Parent of this
SlideSet |
Constructor and Description |
---|
SlideSet(net.imagej.ImageJ context,
DataTypeIDService dtid) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(SlideSet child)
Register a
SlideSet as the child of this SlideSet |
int |
addColumn(LinkedHashMap<String,String> properties)
Add an empty column
|
int |
addColumn(LinkedHashMap<String,String> properties,
ArrayList<DataElement<?>> data)
Add a column with data
|
int |
addColumn(String name,
Class<? extends DataElement> elementClass)
Add an empty column with no (
null ) MIME type. |
int |
addColumn(String name,
Class<? extends DataElement> elementClass,
String mimeType)
Add an empty column.
|
int |
addColumn(String name,
String elementClass)
Add an empty column with no (
null ) MIME type. |
int |
addColumn(String name,
String elementClass,
String mimeType)
Add an empty column.
|
int |
addRow()
Add a row with default values
|
int |
addRow(List<DataElement> data)
Add a row from a
List of DataElement s. |
private boolean |
checkBounds(int column,
int row)
Check validity of an index pair
|
private boolean |
checkColumnBounds(int index)
Check validity of a column index
|
private boolean |
checkColumnElementConsistency(int column)
Check if all the
DataElement s in this column
are of the same type and have the same MIME type set. |
private boolean |
checkColumnLengths()
Check to make sure each column is of equal length
|
private boolean |
checkDataElementCompatibility(int column,
DataElement<?> element)
Check if the class and MIME type of a
DataElement
match those of a column in this table. |
private boolean |
checkRowBounds(int index)
Check validity of a row index
|
private boolean |
checkUnderlyingCompatability(int column,
Object underlying)
Check if an object may be stored in a column directly
using a
setUnderlying() method (i.e. |
void |
convertColumn(int index,
Class<? extends DataElement<?>> elementType,
String mimeType)
Convert the data type stored in a column.
|
private String |
generateDefaultLinkPath(int column,
int row)
Generate a default link path for a specified cell.
|
ArrayList<SlideSet> |
getChildren()
Get a list of this
SlideSet 's children |
String |
getColumnDefaultPath(int index)
Get the default relative path associated with the column.
|
private Class<? extends DataElement<?>> |
getColumnElementClass(int index) |
Class<? extends DataElement> |
getColumnElementType(int index)
Get the
DataElement type used in a column. |
int |
getColumnIndex(String name)
Get the index of the first column with a matching name, or -1 if no such column
|
String |
getColumnMimeType(int index)
Get the column MIME type
|
String |
getColumnName(int index)
Get the name of a column
|
LinkedHashMap<String,String> |
getColumnProperties(int index)
Get the properties of a column
|
String |
getColumnTypeName(int index)
Get a human-readable name for the data type of a column.
|
Class<?> |
getColumnUnderlyingType(int index)
Get the underlying type used to store data in a column.
|
CommandTemplate |
getCommandTemplate()
Get the command template data for this
SlideSet |
org.scijava.Context |
getContext()
Get the SciJava application
Context |
LinkedHashMap<String,String> |
getCreationParams()
Get the creation parameters of this
SlideSet |
DataElement |
getDataElement(int column,
int row)
Get a
DataElement |
int |
getDefaultLinkCount(int column)
Get the counter for default links for a column.
|
String |
getDefaultLinkExtension(int column)
Get the default link extension for a column.
|
String |
getDefaultLinkPrefix(int column)
Get the prefix for default links for a column.
|
String |
getItemText(int column,
int row)
Get a text representation of an item, i.e.
|
String |
getName()
Get the name of this
SlideSet |
private DataElement<?> |
getNewColumnElement(int index)
Generate a new
DataElement appropriate
for the selected column. |
int |
getNumCols()
Get the number of columns
|
int |
getNumRows()
Get the number of rows
|
SlideSet |
getParent()
Get the parent of this
SlideSet |
Object |
getUnderlying(int column,
int row)
Get an item as the underlying data object, i.e.
|
String |
getWorkingDirectory()
Get the working directory of this
SlideSet |
boolean |
isLocked()
Is the read-only flag set on this
SlideSet ? |
void |
makeDefaultLink(int column,
int row)
Set a cell to an auto-generated link
|
void |
removeChild(SlideSet child)
Remove a
SlideSet as a child of this SlideSet |
void |
removeColumn(int index)
Remove a column
|
void |
removeRow(int index)
Remove a row
|
String |
resolvePath(String path)
Resolve a possibly abstract path using this
SlideSet 's working directory. |
void |
setColumnDefaultPath(int index,
String path)
Set the default relative path associated with the column.
|
void |
setColumnMimeType(int index,
String type)
Set the column MIME type
|
void |
setColumnName(int index,
String name)
Set the name of a column
|
void |
setCommandTemplate(CommandTemplate ct)
Set the command template data for this
SlideSet |
void |
setCreationParams(LinkedHashMap parameters)
Set the creation parameters of this
SlideSet |
void |
setDefaultLinkCount(int column,
int counter)
Set the counter for default links for a column.
|
void |
setDefaultLinkExtension(int column,
String extension)
Set the default link extension for a column.
|
void |
setDefaultLinkPrefix(int column,
String prefix)
Set the prefix for default links for a column.
|
void |
setLock(boolean lock)
Set the read-only flag for this
SlideSet . |
void |
setName(String name)
Set the name of this
SlideSet |
void |
setParent(SlideSet parent)
Register a
SlideSet as the parent of this SlideSet |
void |
setUnderlying(int column,
int row,
Object underlying)
Change the underlying table-stored value of an item.
|
void |
setWorkingDirectory(String path)
Set the working directory of this
SlideSet |
String |
toString()
Get the name of this
SlideSet |
private ArrayList<ArrayList<DataElement>> columns
private ArrayList<LinkedHashMap<String,String>> columnProperties
private int numRows
private SlideSet parent
SlideSet
private LinkedHashMap<String,String> creationParams
SlideSet
private String name
SlideSet
private String dir
SlideSet
private boolean locked
SlideSet
locked?private CommandTemplate commandTemplate
private net.imagej.ImageJ ij
private DataTypeIDService dtid
public SlideSet(net.imagej.ImageJ context, DataTypeIDService dtid)
public int getNumCols()
public int getNumRows()
public DataElement getDataElement(int column, int row)
DataElement
public Object getUnderlying(int column, int row)
public String getItemText(int column, int row)
public LinkedHashMap<String,String> getColumnProperties(int index)
public String getColumnName(int index)
public void setColumnName(int index, String name)
public String getColumnMimeType(int index)
public void setColumnMimeType(int index, String type)
public String getColumnTypeName(int index)
public Class<?> getColumnUnderlyingType(int index) throws SlideSetException
SlideSetException
public Class<? extends DataElement> getColumnElementType(int index) throws SlideSetException
DataElement
type used in a column.SlideSetException
public int getColumnIndex(String name)
public String getColumnDefaultPath(int index)
null
.
This property is used for auto-generating new links. Not relevant for columns
in which the data is stored directly (i.e. String
, int
, etc.).
public void setColumnDefaultPath(int index, String path)
null
.
This property is used for auto-generating new links. Not relevant for columns
in which the data is stored directly (i.e. String
, int
, etc.).
public void setUnderlying(int column, int row, Object underlying) throws SlideSetException
SlideSetException
public int addColumn(LinkedHashMap<String,String> properties) throws SlideSetException
properties
- Column propertiesSlideSetException
public int addColumn(String name, String elementClass) throws SlideSetException
null
) MIME type.name
- Label for the columnelementClass
- Name of the DataElement
type to use for this columnSlideSetException
public int addColumn(String name, Class<? extends DataElement> elementClass) throws SlideSetException
null
) MIME type.name
- Label for the columnelementClass
- DataElement
type to use for this columnSlideSetException
public int addColumn(String name, String elementClass, String mimeType) throws SlideSetException
name
- Label for the columnelementClass
- Name of the DataElement
type to use for this columnmimeType
- MIME type to associate with the columnSlideSetException
public int addColumn(String name, Class<? extends DataElement> elementClass, String mimeType) throws SlideSetException
name
- Label for the columnelementClass
- DataElement
type to use for this columnmimeType
- MIME type to associate with the columnSlideSetException
public int addColumn(LinkedHashMap<String,String> properties, ArrayList<DataElement<?>> data) throws SlideSetException
properties
- Column propertiesdata
- An ArrayList
of the DataElement
s in the columnSlideSetException
public void removeColumn(int index)
Note that columns are re-indexed after a deletion, so if this function is called repeatedly, indeces should be given from high to low.
public void convertColumn(int index, Class<? extends DataElement<?>> elementType, String mimeType) throws SlideSetException
String
intermediates.index
- Column to convertelementType
- Target DataElement
mimeType
- Target MIME typeSlideSetException
- If the conversion is aborted, usually
because the target data type is not compatible
with pre-existing data.DataElement.getUnderlyingText()
,
DataElement.setUnderlyingText(java.lang.String)
public int addRow() throws SlideSetException
SlideSetException
public int addRow(List<DataElement> data) throws SlideSetException
List
of DataElement
s.
The DataElement
types must match the column types.SlideSetException
checkUnderlyingCompatability(int, java.lang.Object)
public void removeRow(int index)
Note that rows are re-indexed after a deletion, so if this function is called repeatedly, indeces should be given from hight to low.
public SlideSet getParent()
SlideSet
public void setParent(SlideSet parent)
SlideSet
as the parent of this SlideSet
public void addChild(SlideSet child)
SlideSet
as the child of this SlideSet
public void removeChild(SlideSet child) throws SlideSetException
SlideSet
as a child of this SlideSet
SlideSetException
public String getName()
SlideSet
public void setName(String name)
SlideSet
public LinkedHashMap<String,String> getCreationParams()
SlideSet
public void setCreationParams(LinkedHashMap parameters)
SlideSet
public CommandTemplate getCommandTemplate()
SlideSet
public void setCommandTemplate(CommandTemplate ct)
SlideSet
public String getWorkingDirectory()
SlideSet
public void setWorkingDirectory(String path)
SlideSet
public org.scijava.Context getContext()
Context
public String getDefaultLinkPrefix(int column)
null
if unset.
ex. file-01.xml
public void setDefaultLinkPrefix(int column, String prefix)
ex. file-01.xml
public int getDefaultLinkCount(int column)
null
if unset.
ex. file-01.xml
public void setDefaultLinkCount(int column, int counter)
ex. file-01.xml
public String getDefaultLinkExtension(int column)
null
if unset.
ex. file-01.xml
public void setDefaultLinkExtension(int column, String extension)
ex. file-01.xml
public String resolvePath(String path)
SlideSet
's working directory.public void makeDefaultLink(int column, int row) throws SlideSetException
column
- row
- DefaultPathNotSetException
SlideSetException
public boolean isLocked()
SlideSet
?public void setLock(boolean lock)
SlideSet
.
Note that setting the flag will not actually prevent
changes to the table, but it intended to be used as
a signal for the UI.private boolean checkColumnBounds(int index)
private boolean checkRowBounds(int index)
private boolean checkBounds(int column, int row)
private boolean checkColumnLengths()
private String generateDefaultLinkPath(int column, int row) throws DefaultPathNotSetException
DefaultPathNotSetException
private Class<? extends DataElement<?>> getColumnElementClass(int index) throws SlideSetException
SlideSetException
private DataElement<?> getNewColumnElement(int index) throws SlideSetException
DataElement
appropriate
for the selected column. The element is initialized
with the type's default value.SlideSetException
private boolean checkUnderlyingCompatability(int column, Object underlying) throws SlideSetException
setUnderlying()
method (i.e. without
using an ElementWriter
).SlideSetException
private boolean checkDataElementCompatibility(int column, DataElement<?> element) throws SlideSetException
DataElement
match those of a column in this table.SlideSetException
private boolean checkColumnElementConsistency(int column) throws SlideSetException
DataElement
s in this column
are of the same type and have the same MIME type set.SlideSetException
Copyright © 2023. All rights reserved.