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

Method snap

imagepy/core/roi/polygonroi.py:64–71  ·  view source on GitHub ↗
(self, x, y, z, lim)

Source from the content-addressed store, hash-verified

62 self.update, self.infoupdate = True, True
63
64 def snap(self, x, y, z, lim):
65 if not self.issimple():return None
66 cur, minl = None, 1e8
67 for i in self.body[0][0]:
68 d = (i[0]-x)**2+(i[1]-y)**2
69 if d < minl:cur,minl = i,d
70 if minl**0.5>lim:return None
71 return self.body[0][0], self.body[0][0].index(cur)
72
73 def pick(self, x, y, z, lim):
74 rst = self.snap(x, y, z, lim)

Callers 1

pickMethod · 0.95

Calls 1

issimpleMethod · 0.95

Tested by

no test coverage detected