def polyline(): o = PolylineI() populate_shape(o) o.points = rstring('0,0 1,2 3,5') if SCHEMA_VERSION != '2015-01': o.setMarkerStart('Arrow') o.setMarkerEnd('Arrow') o.id = rlong(4L) return o
def polyline(): o = PolylineI() populate_shape(o) o.points = rstring("0,0 1,2 3,5") if SCHEMA_VERSION != "2015-01": o.setMarkerStart("Arrow") o.setMarkerEnd("Arrow") o.id = rlong(4L) return o
def shapes(self): """Create a bunch of unsaved Shapes.""" rect = RectangleI() rect.x = rdouble(10) rect.y = rdouble(20) rect.width = rdouble(30) rect.height = rdouble(40) rect.textValue = rstring("test-Rectangle") rect.fillColor = rint(rgba_to_int(255, 255, 255, 255)) rect.strokeColor = rint(rgba_to_int(255, 255, 0, 255)) ellipse = EllipseI() ellipse.x = rdouble(33) ellipse.y = rdouble(44) ellipse.radiusX = rdouble(55) ellipse.radiusY = rdouble(66) ellipse.textValue = rstring("test-Ellipse") line = LineI() line.x1 = rdouble(20) line.x2 = rdouble(30) line.y1 = rdouble(40) line.y2 = rdouble(50) line.textValue = rstring("test-Line") point = PointI() point.x = rdouble(50) point.y = rdouble(50) point.textValue = rstring("test-Point") polygon = PolygonI() polygon.fillColor = rint(rgba_to_int(255, 0, 255, 50)) polygon.strokeColor = rint(rgba_to_int(255, 255, 0)) polygon.strokeWidth = LengthI(10, UnitsLength.PIXEL) points = "10,20, 50,150, 100,100, 150,75" polygon.points = rstring(points) polyline = PolylineI() polyline.points = rstring(points) return [rect, ellipse, line, point, polygon, polyline]
def polyline(): o = PolylineI() populate_shape(o) o.points = rstring('0,0 1,2 3,5') o.id = rlong(4L) return o
def createBaseType(self): return PolylineI()
def createBaseType(self): warnings.warn("This module is deprecated as of OMERO 5.3.0", DeprecationWarning) return PolylineI()
def create_omero_shape(shape_type, data, image): # "line", "path", "polygon", "rectangle", "ellipse" # NB: assume all points on same plane. # Use first point to get Z and T index z_index = get_z(data[0], image) t_index = get_t(data[0], image) shape = None if shape_type == "line": shape = LineI() shape.x1 = rdouble(get_x(data[0])) shape.y1 = rdouble(get_y(data[0])) shape.x2 = rdouble(get_x(data[1])) shape.y2 = rdouble(get_y(data[1])) shape.textValue = rstring("line-from-napari") elif shape_type == "path" or shape_type == "polygon": shape = PolylineI() if shape_type == "path" else PolygonI() # points = "10,20, 50,150, 200,200, 250,75" points = ["%s,%s" % (get_x(d), get_y(d)) for d in data] shape.points = rstring(", ".join(points)) shape.textValue = rstring("polyline-from-napari") if shape_type == "path" else rstring("polygon-from-napari") elif shape_type == "rectangle" or shape_type == "ellipse": # corners go anti-clockwise starting top-left x1 = get_x(data[0]) x2 = get_x(data[1]) x3 = get_x(data[2]) x4 = get_x(data[3]) y1 = get_y(data[0]) y2 = get_y(data[1]) y3 = get_y(data[2]) y4 = get_y(data[3]) print(x1,x2) if shape_type == "rectangle": # Rectangle not rotated if x1 == x2: shape = RectangleI() # TODO: handle 'updside down' rectangle x3 < x1 shape.x = rdouble(x1) shape.y = rdouble(y1) shape.width = rdouble(x3 - x1) shape.height = rdouble(y2 - y1) else: # Rotated Rectangle - save as Polygon shape = PolygonI() points = "%s,%s, %s,%s, %s,%s, %s,%s" % ( x1, y1, x2, y2, x3, y3, x4, y4 ) shape.points = rstring(points) shape.textValue = rstring("rectangle-from-napari") elif shape_type == "ellipse": # Ellipse not rotated (ignore floating point rouding) if int(x1) == int(x2): shape = EllipseI() shape.x = rdouble((x1 + x3) / 2) shape.y = rdouble((y1 + y2) / 2) shape.radiusX = rdouble(abs(x3 - x1) / 2) shape.radiusY = rdouble(abs(y2 - y1) / 2) else: # TODO: Need to calculate transformation matrix print("Rotated Ellipse not yet supported!") shape.textValue = rstring("ellipse-from-napari") if shape is not None: shape.theZ = rint(z_index) shape.theT = rint(t_index) return shape