Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ def getAnnotationLinkTableName(objecttype):
if objecttype == "project":
return "ProjectAnnotationLink"
if objecttype == "dataset":
return"DatasetAnnotationLink"
return "DatasetAnnotationLink"
if objecttype == "image":
return"ImageAnnotationLink"
return "ImageAnnotationLink"
if objecttype == "screen":
return "ScreenAnnotationLink"
if objecttype == "plate":
Expand All @@ -165,6 +165,8 @@ def getAnnotationLinkTableName(objecttype):
return "PlateAcquisitionAnnotationLink"
if objecttype == "well":
return "WellAnnotationLink"
if objecttype == "roi":
return "RoiAnnotationLink"
return None


Expand Down Expand Up @@ -5237,7 +5239,7 @@ def setValue(self, val): # pragma: no cover
def getParentLinks(self, ptype, pids=None):
ptype = ptype.title().replace("Plateacquisition", "PlateAcquisition")
objs = ('Project', 'Dataset', 'Image', 'Screen',
'Plate', 'Well', 'PlateAcquisition')
'Plate', 'Well', 'PlateAcquisition', 'Roi')
if ptype not in objs:
raise AttributeError(
"getParentLinks(): ptype '%s' not supported" % ptype)
Expand Down Expand Up @@ -5591,7 +5593,7 @@ def setValue(self, val):

class TagAnnotationWrapper (AnnotationWrapper):
"""
omero_model_BooleanAnnotationI class wrapper extends AnnotationWrapper.
omero_model_TagAnnotationWrapper class wrapper extends AnnotationWrapper.
"""

OMERO_TYPE = TagAnnotationI
Expand Down Expand Up @@ -5920,8 +5922,6 @@ class _RoiWrapper (BlitzObjectWrapper):
omero_model_ExperimenterI class wrapper extends BlitzObjectWrapper.
"""
OMERO_CLASS = 'Roi'
# TODO: test listChildren() to use ShapeWrapper? or remove?
CHILD_WRAPPER_CLASS = 'ShapeWrapper'

@classmethod
def _getQueryString(cls, opts=None):
Expand Down Expand Up @@ -5956,6 +5956,16 @@ def getImage(self):
if self._obj.image is not None:
return ImageWrapper(self._conn, self._obj.image)

def listChildren(self):
"""
Gets shapes associated to an ROI.
Shapes must be pre-loaded, use opts={"load_shapes":True}

:return: list of shapes in this ROI.
"""
return [ShapeWrapper(self._conn, shape) for shape in
self._obj._shapesSeq]

RoiWrapper = _RoiWrapper


Expand Down Expand Up @@ -9491,7 +9501,7 @@ def _wordwrap(self, width, text, font):
p1 = 0
p2 = 1
while (p2 <= len(tokens) and
(font.getbbox(' '.join(tokens[p1:p2]))[2] -
(font.getbbox(' '.join(tokens[p1:p2]))[2] -
font.getbbox(' '.join(tokens[p1:p2]))[0]) < width):
p2 += 1
rv.append(' '.join(tokens[p1:p2-1]))
Expand Down Expand Up @@ -10407,9 +10417,9 @@ def getROIs(self, shapeType=None, filterByCurrentUser=False):
filterByCurrentUser is True, otherwise the total rois
found.
"""
return [RoiWrapper(self._conn, roi) for roi in
return [RoiWrapper(self._conn, roi) for roi in
self._get_rois(shapeType, filterByCurrentUser)]


def getROICount(self, shapeType=None, filterByCurrentUser=False):
"""
Expand Down
Loading