Package fr.igred.omero.roi
Interface ROI
-
- All Superinterfaces:
Annotatable,RemoteObject
- All Known Implementing Classes:
ROIWrapper
public interface ROI extends Annotatable
Interface to handle ROIs on OMERO.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIJ_PROPERTYDefault IJ property to store ROI local labels / indices.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddShape(Shape shape)Adds a Shape to the ROI.default voidaddShapes(java.lang.Iterable<? extends Shape> shapes)Adds shape objects from a list of shapes to the ROI.ROIDataasDataObject()Returns a ROIData corresponding to the handled object.static java.lang.StringcheckProperty(java.lang.String property)Checks the provided property.voiddeleteShape(int pos)Deletes a shape from the ROI.voiddeleteShape(ShapeData shape)Deletes a ShapeData from the ROI.static java.util.List<ROI>fromImageJ(java.util.Collection<? extends Roi> ijRois, java.lang.String property, java.util.function.Supplier<? extends ROI> constructor, java.util.function.Function<? super Roi,? extends java.lang.Iterable<? extends Shape>> converter)Converts a collection of ImageJ ROIs to a list of OMERO ROIs using the provided constructor and shape converter.static java.util.List<ROI>fromImageJ(java.util.Collection<? extends Roi> ijRois, java.util.function.Supplier<? extends ROI> constructor, java.util.function.Function<? super Roi,java.lang.Iterable<? extends Shape>> converter)Converts an ImageJ list of ROIs to a list of OMERO ROIs using the provided constructor and shape converter.default BoundsgetBounds()Returns the 5D bounds containing the ROI.java.lang.StringgetName()Gets the ROI name.java.util.List<Shape>getShapes()Returns the list of shapes contained in the ROI.static java.lang.StringijIDProperty(java.lang.String property)Returns the ID property corresponding to the input local index/label property (appends "_ID" to said property).static java.lang.StringijNameProperty(java.lang.String property)Returns the ID property corresponding to the input local index/label property (appends "_NAME" to said property).default <A extends AnnotationData>
voidlink(DataManager dm, A annotation)Attach anAnnotationDatato this object.voidsaveROI(DataManager dm)Saves the ROI.voidsetImage(Image image)Sets the image linked to the ROI.voidsetName(java.lang.String name)Sets the ROI name.default java.util.List<Roi>toImageJ()Converts the ROI to a list of ImageJ ROIs.default java.util.List<Roi>toImageJ(java.lang.String property)Converts the ROI to a list of ImageJ ROIs.static java.util.List<Roi>toImageJ(java.util.Collection<? extends ROI> rois)Converts a collection of OMERO ROIs to a list of ImageJ ROIs.static java.util.List<Roi>toImageJ(java.util.Collection<? extends ROI> rois, java.lang.String property)Converts a collection of OMERO ROIs to a list of ImageJ ROIs.static java.util.List<Roi>toImageJ(java.util.Collection<? extends ROI> rois, java.lang.String property, boolean groupRois)Converts a collection of OMERO ROIs to a list of ImageJ ROIs.-
Methods inherited from interface fr.igred.omero.Annotatable
addAndReplaceFile, addAndReplaceFile, addAndReplaceTable, addAndReplaceTable, addFile, addKeyValuePair, addTable, addTag, addTag, addTags, copyAnnotationLinks, getAnnotationData, getAnnotations, getFileAnnotations, getKeyValuePairs, getMapAnnotations, getMyRating, getTable, getTables, getTags, getValues, isLinked, link, link, linkIfNotLinked, rate, unlink
-
Methods inherited from interface fr.igred.omero.RemoteObject
canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, getCreated, getGroupId, getId, getOwner, saveAndUpdate
-
-
-
-
Field Detail
-
IJ_PROPERTY
static final java.lang.String IJ_PROPERTY
Default IJ property to store ROI local labels / indices.- See Also:
- Constant Field Values
-
-
Method Detail
-
checkProperty
static java.lang.String checkProperty(java.lang.String property)
Checks the provided property.- Parameters:
property- The property where the 4D ROI local index/label is stored.- Returns:
- The property, or the default value
IJ_PROPERTY(= "ROI") if it is null or empty.
-
ijIDProperty
static java.lang.String ijIDProperty(java.lang.String property)
Returns the ID property corresponding to the input local index/label property (appends "_ID" to said property).- Parameters:
property- The property where the 4D ROI local index/label is stored. Defaults to "ROI" if null or empty.- Returns:
- See above.
-
ijNameProperty
static java.lang.String ijNameProperty(java.lang.String property)
Returns the ID property corresponding to the input local index/label property (appends "_NAME" to said property).- Parameters:
property- The property where the 4D ROI local index/label is stored. Defaults to "ROI" if null or empty.- Returns:
- See above.
-
fromImageJ
static java.util.List<ROI> fromImageJ(java.util.Collection<? extends Roi> ijRois, java.util.function.Supplier<? extends ROI> constructor, java.util.function.Function<? super Roi,java.lang.Iterable<? extends Shape>> converter)
Converts an ImageJ list of ROIs to a list of OMERO ROIs using the provided constructor and shape converter.- Parameters:
ijRois- A collection of ImageJ ROIs.constructor- A constructor to create ROI instances.converter- A function to convert an IJ Roi to a list of OMERO Shapes.- Returns:
- The converted list of OMERO ROIs.
-
fromImageJ
static java.util.List<ROI> fromImageJ(java.util.Collection<? extends Roi> ijRois, java.lang.String property, java.util.function.Supplier<? extends ROI> constructor, java.util.function.Function<? super Roi,? extends java.lang.Iterable<? extends Shape>> converter)
Converts a collection of ImageJ ROIs to a list of OMERO ROIs using the provided constructor and shape converter.- Parameters:
ijRois- A collection of ImageJ ROIs.property- The property used to store the 4D ROI local index/label. Defaults to "ROI" if null or empty.constructor- A constructor to create ROI instances.converter- A function to convert an IJ Roi to a list of OMERO Shapes.- Returns:
- The converted list of OMERO ROIs.
-
toImageJ
static java.util.List<Roi> toImageJ(java.util.Collection<? extends ROI> rois)
Converts a collection of OMERO ROIs to a list of ImageJ ROIs.- Parameters:
rois- A collection of OMERO ROIs.- Returns:
- The converted list of ImageJ ROIs.
-
toImageJ
static java.util.List<Roi> toImageJ(java.util.Collection<? extends ROI> rois, java.lang.String property)
Converts a collection of OMERO ROIs to a list of ImageJ ROIs.- Parameters:
rois- A collection of OMERO ROIs.property- The property used to store the 4D ROI local index/label. Defaults to "ROI" if null or empty.- Returns:
- The converted list of ImageJ ROIs.
-
toImageJ
static java.util.List<Roi> toImageJ(java.util.Collection<? extends ROI> rois, java.lang.String property, boolean groupRois)
Converts a collection of OMERO ROIs to a list of ImageJ ROIs.- Parameters:
rois- A collection of OMERO ROIs.property- The property used to store the 4D ROI local labels/IDs. Defaults to "ROI" if null or empty.groupRois- Whether ImageJ Rois belonging to the same OMERO ROI should be grouped or not.- Returns:
- The converted list of ImageJ ROIs.
-
asDataObject
ROIData asDataObject()
Returns a ROIData corresponding to the handled object.- Specified by:
asDataObjectin interfaceRemoteObject- Returns:
- See above.
-
getName
java.lang.String getName()
Gets the ROI name.- Returns:
- The ROI name (can be null).
-
setName
void setName(java.lang.String name)
Sets the ROI name.- Parameters:
name- The ROI name.
-
addShapes
default void addShapes(java.lang.Iterable<? extends Shape> shapes)
Adds shape objects from a list of shapes to the ROI.- Parameters:
shapes- List of Shape.
-
addShape
void addShape(Shape shape)
Adds a Shape to the ROI.- Parameters:
shape- Shape to add.
-
getShapes
java.util.List<Shape> getShapes()
Returns the list of shapes contained in the ROI.- Returns:
- See above.
-
setImage
void setImage(Image image)
Sets the image linked to the ROI.- Parameters:
image- Image linked to the ROI.
-
deleteShape
void deleteShape(ShapeData shape)
Deletes a ShapeData from the ROI.- Parameters:
shape- ShapeData to delete.
-
deleteShape
void deleteShape(int pos)
Deletes a shape from the ROI.- Parameters:
pos- Position of the ShapeData in the ShapeData list from the ROI.- Throws:
java.lang.IndexOutOfBoundsException- If pos is out of the ShapeData list bounds.
-
saveROI
void saveROI(DataManager dm) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Saves the ROI.- Parameters:
dm- The data manager.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.java.util.concurrent.ExecutionException- A Facility can't be retrieved or instantiated.
-
getBounds
default Bounds getBounds()
Returns the 5D bounds containing the ROI.- Returns:
- The 5D bounds.
-
toImageJ
default java.util.List<Roi> toImageJ()
Converts the ROI to a list of ImageJ ROIs.- Returns:
- A list of ROIs.
-
toImageJ
default java.util.List<Roi> toImageJ(java.lang.String property)
Converts the ROI to a list of ImageJ ROIs.- Parameters:
property- The property where the 4D ROI local index will be stored.- Returns:
- A list of ROIs.
-
link
default <A extends AnnotationData> void link(DataManager dm, A annotation) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Attach anAnnotationDatato this object.- Specified by:
linkin interfaceAnnotatable- Type Parameters:
A- The type of the annotation.- Parameters:
dm- The client handling the connection.annotation- TheAnnotationData.- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.java.util.concurrent.ExecutionException- A Facility can't be retrieved or instantiated.
-
-