def mask(identity_transform): o = MaskI() populate_shape(o, identity_transform) o.x = rdouble(0.0) o.y = rdouble(0.0) o.width = rdouble(1.0) o.height = rdouble(2.0) o.id = rlong(8) return o
def mask(): o = MaskI() populate_shape(o) o.x = rdouble(0.0) o.y = rdouble(0.0) o.width = rdouble(1.0) o.height = rdouble(2.0) o.id = rlong(8L) return o
def make_mask(x, y, h, w): mask = MaskI() mask.x = rdouble(x) mask.y = rdouble(y) mask.height = rdouble(h) mask.width = rdouble(w) mask.bytes = make_circle(h, w) roi = RoiI() roi.description = rstring("created by overlapping-masks.py") roi.addShape(mask) roi.image = image roi = update_service.saveAndReturnObject(roi) print(f"Roi:{roi.id.val}")
local.connect() query_service = idr.getQueryService() update_service = local.getUpdateService() query = "FROM Mask WHERE roi.image.id = :id" params = ParametersI() params.addId(image_id_src) count = 0 for mask_src in query_service.findAllByQuery(query, params): mask_dst = MaskI() mask_dst.x = mask_src.x mask_dst.y = mask_src.y mask_dst.width = mask_src.width mask_dst.height = mask_src.height mask_dst.theZ = mask_src.theZ mask_dst.theC = mask_src.theC mask_dst.theT = mask_src.theT mask_dst.bytes = mask_src.bytes mask_dst.fillColor = mask_src.fillColor mask_dst.transform = mask_src.transform roi_dst = RoiI() roi_dst.description = rstring( "created by copy-masks script for original mask #{}".format( mask_src.id.val)) roi_dst.image = ImageI(image_id_dst, False) roi_dst.addShape(mask_dst) update_service.saveObject(roi_dst)