Package fr.igred.omero.roi
Class ROIWrapper
- java.lang.Object
-
- fr.igred.omero.GenericObjectWrapper<T>
-
- fr.igred.omero.AnnotatableWrapper<ROIData>
-
- fr.igred.omero.roi.ROIWrapper
-
public class ROIWrapper extends AnnotatableWrapper<ROIData>
Class containing a ROIData object.Wraps function calls to the ROIData contained.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ANNOTATION_LINK
Annotation link name for this type of objectstatic String
IJ_PROPERTY
Default IJ property to store ROI local labels / indices.-
Fields inherited from class fr.igred.omero.GenericObjectWrapper
data
-
-
Constructor Summary
Constructors Constructor Description ROIWrapper()
Constructor of the ROIWrapper class.ROIWrapper(Iterable<? extends GenericShapeWrapper<?>> shapes)
Constructor of the ROIWrapper class.ROIWrapper(ROIData roi)
Constructor of the ROIWrapper class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addShape(GenericShapeWrapper<?> shape)
Adds a ShapeData from a GenericShapeWrapper to the ROIDatavoid
addShapes(List<? extends GenericShapeWrapper<?>> shapes)
Adds ShapeData objects from a list of GenericShapeWrapper to the ROIDataprotected String
annotationLinkType()
Returns the type of annotation link for this object.ROIData
asROIData()
Deprecated.Returns the ROIData contained.static String
checkProperty(String property)
Checks the provided property.void
deleteShape(int pos)
Deletes a shape from the ROI.void
deleteShape(ShapeData shape)
Deletes a ShapeData from the ROI.static List<ROIWrapper>
fromImageJ(List<? extends Roi> ijRois)
Converts an ImageJ list of ROIs to a list of OMERO ROIsstatic List<ROIWrapper>
fromImageJ(List<? extends Roi> ijRois, String property)
Converts an ImageJ list of ROIs to a list of OMERO ROIsPixelsWrapper.Bounds
getBounds()
Returns the 5D bounds containing the ROI.String
getName()
Gets the ROI name.ShapeList
getShapes()
Returns the list of shapes contained in the ROIData.static String
ijIDProperty(String property)
Returns the ID property corresponding to the input local index/label property (appends "_ID" to said property).static String
ijNameProperty(String property)
Returns the ID property corresponding to the input local index/label property (appends "_NAME" to said property).protected <A extends AnnotationData>
voidlink(Client client, A annotation)
Attach anAnnotationData
to this object.void
saveROI(Client client)
Saves the ROI.void
setData(ROIData data)
Deprecated.Changes the wrapped data.void
setImage(ImageWrapper image)
Sets the image linked to the ROI.void
setName(String name)
Sets the ROI name.List<Roi>
toImageJ()
Converts the ROI to a list of ImageJ ROIs.List<Roi>
toImageJ(String property)
Converts the ROI to a list of ImageJ ROIs.static List<Roi>
toImageJ(Collection<? extends ROIWrapper> rois, String property, boolean groupRois)
Converts an OMERO list of ROIs to a list of ImageJ ROIsstatic List<Roi>
toImageJ(List<? extends ROIWrapper> rois)
Converts an OMERO list of ROIs to a list of ImageJ ROIsstatic List<Roi>
toImageJ(List<? extends ROIWrapper> rois, String property)
Converts an OMERO list of ROIs to a list of ImageJ ROIs-
Methods inherited from class fr.igred.omero.AnnotatableWrapper
addAndReplaceFile, addAndReplaceFile, addAndReplaceTable, addAndReplaceTable, addFile, addFileAnnotation, addKeyValuePair, addMapAnnotation, addPairKeyValue, addTable, addTag, addTag, addTag, addTags, addTags, copyAnnotationLinks, getAnnotations, getFileAnnotations, getKeyValuePairs, getMapAnnotations, getMyRating, getRatings, getTable, getTables, getTags, getValue, isLinked, link, link, linkIfNotLinked, rate, removeLink, removeLinks, unlink, unlink
-
Methods inherited from class fr.igred.omero.GenericObjectWrapper
asDataObject, canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, distinct, flatten, getCreated, getGroupId, getId, getOwner, getUpdated, saveAndUpdate, toString, wrap, wrap
-
-
-
-
Field Detail
-
ANNOTATION_LINK
public static final String ANNOTATION_LINK
Annotation link name for this type of object- See Also:
- Constant Field Values
-
IJ_PROPERTY
public static final String IJ_PROPERTY
Default IJ property to store ROI local labels / indices.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ROIWrapper
public ROIWrapper()
Constructor of the ROIWrapper class.
-
ROIWrapper
public ROIWrapper(Iterable<? extends GenericShapeWrapper<?>> shapes)
Constructor of the ROIWrapper class.- Parameters:
shapes
- List of shapes to add to the ROIData.
-
ROIWrapper
public ROIWrapper(ROIData roi)
Constructor of the ROIWrapper class.- Parameters:
roi
- The ROIData to wrap.
-
-
Method Detail
-
checkProperty
public static String checkProperty(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
public static String ijIDProperty(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
public static String ijNameProperty(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
public static List<ROIWrapper> fromImageJ(List<? extends Roi> ijRois)
Converts an ImageJ list of ROIs to a list of OMERO ROIs- Parameters:
ijRois
- A list of ImageJ ROIs.- Returns:
- The converted list of OMERO ROIs.
-
fromImageJ
public static List<ROIWrapper> fromImageJ(List<? extends Roi> ijRois, String property)
Converts an ImageJ list of ROIs to a list of OMERO ROIs- Parameters:
ijRois
- A list of ImageJ 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 OMERO ROIs.
-
toImageJ
public static List<Roi> toImageJ(List<? extends ROIWrapper> rois)
Converts an OMERO list of ROIs to a list of ImageJ ROIs- Parameters:
rois
- A list of OMERO ROIs.- Returns:
- The converted list of ImageJ ROIs.
-
toImageJ
public static List<Roi> toImageJ(List<? extends ROIWrapper> rois, String property)
Converts an OMERO list of ROIs to a list of ImageJ ROIs- Parameters:
rois
- A list 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
public static List<Roi> toImageJ(Collection<? extends ROIWrapper> rois, String property, boolean groupRois)
Converts an OMERO list of ROIs to a list of ImageJ ROIs- Parameters:
rois
- A list 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.
-
getName
public String getName()
Gets the ROI name.- Returns:
- The ROI name (can be null).
-
setName
public void setName(String name)
Sets the ROI name.- Parameters:
name
- The ROI name.
-
setData
@Deprecated public void setData(ROIData data)
Deprecated.Changes the wrapped data.- Parameters:
data
- The ROI data.
-
addShapes
public void addShapes(List<? extends GenericShapeWrapper<?>> shapes)
Adds ShapeData objects from a list of GenericShapeWrapper to the ROIData- Parameters:
shapes
- List of GenericShapeWrapper.
-
addShape
public void addShape(GenericShapeWrapper<?> shape)
Adds a ShapeData from a GenericShapeWrapper to the ROIData- Parameters:
shape
- GenericShapeWrapper to add.
-
getShapes
public ShapeList getShapes()
Returns the list of shapes contained in the ROIData.- Returns:
- list of shape contained in the ROIData.
-
setImage
public void setImage(ImageWrapper image)
Sets the image linked to the ROI.- Parameters:
image
- Image linked to the ROIData.
-
asROIData
@Deprecated public ROIData asROIData()
Deprecated.Returns the ROIData contained. UseGenericObjectWrapper.asDataObject()
instead.- Returns:
- the
ROIData
contained.
-
deleteShape
public void deleteShape(ShapeData shape)
Deletes a ShapeData from the ROI.- Parameters:
shape
- ShapeData to delete.
-
deleteShape
public void deleteShape(int pos)
Deletes a shape from the ROI.- Parameters:
pos
- Position of the ShapeData in the ShapeData list from the ROIData.- Throws:
IndexOutOfBoundsException
- If pos is out of the ShapeData list bounds.
-
saveROI
public void saveROI(Client client) throws OMEROServerError, ServiceException
Saves the ROI.- Parameters:
client
- The client handling the connection.- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.
-
getBounds
public PixelsWrapper.Bounds getBounds()
Returns the 5D bounds containing the ROI.- Returns:
- The 5D bounds.
-
toImageJ
public List<Roi> toImageJ()
Converts the ROI to a list of ImageJ ROIs.- Returns:
- A list of ROIs.
-
toImageJ
public List<Roi> toImageJ(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.
-
annotationLinkType
protected String annotationLinkType()
Returns the type of annotation link for this object.- Specified by:
annotationLinkType
in classAnnotatableWrapper<ROIData>
- Returns:
- See above.
-
link
protected <A extends AnnotationData> void link(Client client, A annotation) throws ServiceException, AccessException, ExecutionException
Attach anAnnotationData
to this object.- Overrides:
link
in classAnnotatableWrapper<ROIData>
- Type Parameters:
A
- The type of the annotation.- Parameters:
client
- The client handling the connection.annotation
- TheAnnotationData
.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
-