def create_omero_point(data, image): point = PointI() point.x = rdouble(get_x(data)) point.y = rdouble(get_y(data)) point.theZ = rint(get_z(data, image)) point.theT = rint(get_t(data, image)) point.textValue = rstring("point-from-napari") return point
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) # Only save theT, not theZ rect.theT = rint(0) 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 without saving theZ & theT 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(200) line.x2 = rdouble(300) line.y1 = rdouble(400) line.y2 = rdouble(500) line.textValue = rstring("test-Line") point = PointI() point.x = rdouble(1) point.y = rdouble(1) point.theZ = rint(1) point.theT = rint(1) point.textValue = rstring("test-Point") polygon = PolygonI() polygon.theZ = rint(5) polygon.theT = rint(5) 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, 200,200, 250,75" polygon.points = rstring(points) mask = MaskI() mask.setTheC(rint(0)) mask.setTheZ(rint(0)) mask.setTheT(rint(0)) mask.setX(rdouble(100)) mask.setY(rdouble(100)) mask.setWidth(rdouble(500)) mask.setHeight(rdouble(500)) mask.setTextValue(rstring("test-Mask")) mask.setBytes(None) return [rect, ellipse, line, point, polygon, mask]
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 parse(self): provider = self.original_file_provider data = provider.get_original_file_data(self.original_file) try: rows = list(csv.reader(data, delimiter=",")) finally: data.close() columns = [ ImageColumn("Image", "", list()), RoiColumn("ROI", "", list()), StringColumn("Type", "", 12, list()), ] for row in rows[1:]: wellnumber = self.well_name_to_number(row[0]) image = self.analysis_ctx.\ image_from_wellnumber(wellnumber) # TODO: what to do with the field?! # field = int(row[1]) # image = images[field] roi = RoiI() shape = PointI() shape.cx = rdouble(float(row[2])) shape.cy = rdouble(float(row[3])) shape.textValue = rstring(row[4]) roi.addShape(shape) roi.image = image.proxy() rid = self.update_service\ .saveAndReturnIds([roi])[0] columns[0].values.append(image.id.val) columns[1].values.append(rid) columns[2].values.append(row[4]) return MeasurementParsingResult([columns])