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

Function to_segment

imagepy/core/roi/polygonroi.py:25–30  ·  view source on GitHub ↗
(pg)

Source from the content-addressed store, hash-verified

23 return [parse_poly(i) for i in list(geom)]
24
25def to_segment(pg):
26 p = Polygon(pg) if len(pg)>2 else Polygon(*pg)
27 if p.is_valid: return [p]
28 if len(pg)<3: pg = pg[0]
29 line = LineString(pg)
30 return polygonize([line.intersection(line)])
31
32class PolygonRoi(ROI):
33 dtype = 'polygon'

Callers 2

commitMethod · 0.85
pickMethod · 0.85

Calls 1

polygonizeFunction · 0.50

Tested by

no test coverage detected