MCPcopy Create free account
hub / github.com/Image-Py/imagepy / commit

Method commit

imagepy/core/roi/polygonroi.py:45–62  ·  view source on GitHub ↗
(self, buf, oper)

Source from the content-addressed store, hash-verified

43 self.buf[0].append(p)
44
45 def commit(self, buf, oper):
46 pgs = []
47 if len(buf[0])==0:return False
48 if buf[0][0]!=buf[0][-1]:
49 buf[0].append(buf[0][0])
50 if len(self.body)==0:
51 self.body.append(buf)
52 buf = [[],[]]
53 self.update, self.infoupdate = True, True
54 return True
55 for i in self.body:
56 pgs.extend(to_segment(i))
57 unin = cascaded_union(pgs)
58 cur = cascaded_union(list(to_segment(buf)))
59 if oper=='+':rst = unin.union(cur)
60 if oper=='-':rst = unin.difference(cur)
61 self.body = parse_mpoly(rst)
62 self.update, self.infoupdate = True, True
63
64 def snap(self, x, y, z, lim):
65 if not self.issimple():return None

Callers

nothing calls this directly

Calls 4

to_segmentFunction · 0.85
parse_mpolyFunction · 0.85
appendMethod · 0.80
unionMethod · 0.80

Tested by

no test coverage detected