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}")
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) count += 1 idr._closeSession() local._closeSession() print("from image #{} to #{}, mask count = {}".format(image_id_src,