Package fr.igred.omero.roi
Class GenericShapeWrapper<T extends ShapeData>
- java.lang.Object
-
- fr.igred.omero.GenericObjectWrapper<T>
-
- fr.igred.omero.AnnotatableWrapper<T>
-
- fr.igred.omero.roi.GenericShapeWrapper<T>
-
- Type Parameters:
T
- Subclass ofShapeData
- Direct Known Subclasses:
EllipseWrapper
,LineWrapper
,MaskWrapper
,PointWrapper
,PolygonWrapper
,PolylineWrapper
,RectangleWrapper
,TextWrapper
public abstract class GenericShapeWrapper<T extends ShapeData> extends AnnotatableWrapper<T>
Generic class containing a ShapeData (or a subclass) object.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ANNOTATION_LINK
Annotation link name for this type of object-
Fields inherited from class fr.igred.omero.GenericObjectWrapper
data
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericShapeWrapper(T s)
Constructor of the GenericShapeWrapper class using a ShapeData.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
annotationLinkType()
Returns the type of annotation link for this object.T
asShapeData()
Deprecated.Gets the ShapeData object contained.protected void
copyFromIJRoi(Roi ijRoi)
Copies details from an ImageJ ROI (position, stroke color, stroke width).protected void
copyToIJRoi(Roi ijRoi)
Copies details to an ImageJ ROI (name, position, stroke color, fill color, stroke width).Shape
createTransformedAWTShape()
Returns a newShape
defined by the geometry of the specified Shape after it has been transformed by the transform.RectangleWrapper
getBoundingBox()
Returns a newRectangleWrapper
corresponding to the bounding box of the shape, once the relatedAffineTransform
has been applied.int
getC()
Gets the channel.Color
getFill()
Gets ShapeData fill color.double
getFontSize()
Gets ShapeData font size.Color
getStroke()
Gets the ShapeData stroke color.int
getT()
Sets the time-point.abstract String
getText()
Gets the text on the ShapeData.int
getZ()
Gets the z-section.<A extends AnnotationData>
voidlink(Client client, A annotation)
Attach anAnnotationData
to this object.void
setC(int c)
Sets the channel.void
setCZT(int c, int z, int t)
Sets the channel, z-section and time-point at once.void
setFill(Color fillColour)
Sets the ShapeData fill color.void
setFontSize(double value)
Sets ShapeData font size.void
setStroke(Color strokeColour)
Sets ShapeData stroke color.void
setT(int t)
Sets the time-point.abstract void
setText(String text)
Sets the text on the ShapeData.void
setTransform(double a00, double a10, double a01, double a11, double a02, double a12)
Sets the transform to the matrix specified by the 6 double precision values.void
setTransform(AffineTransform transform)
Sets the transform from aAffineTransform
.void
setZ(int z)
Sets the z-section.abstract Shape
toAWTShape()
Converts the shape to anShape
.AffineTransform
toAWTTransform()
ConvertsAffineTransform
toAffineTransform
.Roi
toImageJ()
Converts shape to ImageJ ROI.-
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, getTable, getTables, getTags, getValue, isLinked, link, link, linkIfNotLinked, rate, removeLink, unlink
-
Methods inherited from class fr.igred.omero.GenericObjectWrapper
asDataObject, canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, delete, distinct, flatten, getCreated, getGroupId, getId, getOwner, 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
-
-
Constructor Detail
-
GenericShapeWrapper
protected GenericShapeWrapper(T s)
Constructor of the GenericShapeWrapper class using a ShapeData.- Parameters:
s
- The shape.
-
-
Method Detail
-
copyFromIJRoi
protected void copyFromIJRoi(Roi ijRoi)
Copies details from an ImageJ ROI (position, stroke color, stroke width).- Parameters:
ijRoi
- An ImageJ Roi.
-
copyToIJRoi
protected void copyToIJRoi(Roi ijRoi)
Copies details to an ImageJ ROI (name, position, stroke color, fill color, stroke width).- Parameters:
ijRoi
- An ImageJ Roi.
-
asShapeData
@Deprecated public T asShapeData()
Deprecated.Gets the ShapeData object contained.- Returns:
- the shape.
-
getC
public int getC()
Gets the channel.- Returns:
- the channel. -1 if the shape applies to all channels of the image.
-
setC
public void setC(int c)
Sets the channel.- Parameters:
c
- the channel. Pass -1 to remove z value, i.e. shape applies to all channels of the image.
-
getZ
public int getZ()
Gets the z-section.- Returns:
- the z-section. -1 if the shape applies to all z-sections of the image.
-
setZ
public void setZ(int z)
Sets the z-section.- Parameters:
z
- the z-section. Pass -1 to remove z value, i.e. shape applies to all z-sections of the image.
-
getT
public int getT()
Sets the time-point.- Returns:
- the time-point. -1 if the shape applies to all time-points of the image.
-
setT
public void setT(int t)
Sets the time-point.- Parameters:
t
- the time-point. Pass -1 to remove t value, i.e. shape applies to all time-points of the image.
-
setCZT
public void setCZT(int c, int z, int t)
Sets the channel, z-section and time-point at once.- Parameters:
c
- the channel. Pass -1 to remove z value, i.e. shape applies to all channels of the image.z
- the z-section. Pass -1 to remove z value, i.e. shape applies to all z-sections of the image.t
- the time-point. Pass -1 to remove t value, i.e. shape applies to all time-points of the image.
-
getFontSize
public double getFontSize()
Gets ShapeData font size.- Returns:
- The font size (in typography points)
-
setFontSize
public void setFontSize(double value)
Sets ShapeData font size.- Parameters:
value
- The font size (in typography points)
-
getStroke
public Color getStroke()
Gets the ShapeData stroke color.- Returns:
- The stroke color
-
setStroke
public void setStroke(Color strokeColour)
Sets ShapeData stroke color.- Parameters:
strokeColour
- The stroke color
-
getFill
public Color getFill()
Gets ShapeData fill color.- Returns:
- The fill color
-
setFill
public void setFill(Color fillColour)
Sets the ShapeData fill color.- Parameters:
fillColour
- The fill color
-
getText
public abstract String getText()
Gets the text on the ShapeData.- Returns:
- the text
-
setText
public abstract void setText(String text)
Sets the text on the ShapeData.- Parameters:
text
- the text
-
toAWTShape
public abstract Shape toAWTShape()
Converts the shape to anShape
.- Returns:
- The converted AWT Shape.
-
setTransform
public void setTransform(double a00, double a10, double a01, double a11, double a02, double a12)
Sets the transform to the matrix specified by the 6 double precision values.- Parameters:
a00
- the X coordinate scaling element of the 3x3 matrixa10
- the Y coordinate shearing element of the 3x3 matrixa01
- the X coordinate shearing element of the 3x3 matrixa11
- the Y coordinate scaling element of the 3x3 matrixa02
- the X coordinate translation element of the 3x3 matrixa12
- the Y coordinate translation element of the 3x3 matrix
-
setTransform
public void setTransform(AffineTransform transform)
Sets the transform from aAffineTransform
.- Parameters:
transform
- A Java AffineTransform.
-
toAWTTransform
public AffineTransform toAWTTransform()
ConvertsAffineTransform
toAffineTransform
.- Returns:
- The converted affine transform.
-
createTransformedAWTShape
public Shape createTransformedAWTShape()
Returns a newShape
defined by the geometry of the specified Shape after it has been transformed by the transform.- Returns:
- A new transformed
Shape
.
-
getBoundingBox
public RectangleWrapper getBoundingBox()
Returns a newRectangleWrapper
corresponding to the bounding box of the shape, once the relatedAffineTransform
has been applied.- Returns:
- The bounding box.
-
toImageJ
public Roi toImageJ()
Converts shape to ImageJ ROI.- Returns:
- An ImageJ ROI.
-
annotationLinkType
protected String annotationLinkType()
Returns the type of annotation link for this object.- Specified by:
annotationLinkType
in classAnnotatableWrapper<T extends ShapeData>
- Returns:
- See above.
-
link
public <A extends AnnotationData> void link(Client client, A annotation) throws ServiceException, AccessException, ExecutionException
Attach anAnnotationData
to this object.- Overrides:
link
in classAnnotatableWrapper<T extends ShapeData>
- 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.
-
-