예제 #1
0
 def run(self, ips, imgs, para=None):
     dist = -ndimg.distance_transform_edt(imgs)
     pts = find_maximum(dist, para['tor'], False)
     buf = np.zeros(imgs.shape, dtype=np.uint16)
     buf[pts[:, 0], pts[:, 1], pts[:, 2]] = 1
     markers, n = ndimg.label(buf, np.ones((3, 3, 3)))
     line = watershed(dist, markers, line=True, conn=para['con'] + 1)
     imgs[line == 0] = 0
예제 #2
0
 def run(self, ips, snap, img, para=None):
     img[:] = snap
     dist = -ndimg.distance_transform_edt(snap)
     pts = find_maximum(dist, para['tor'], False)
     buf = np.zeros(ips.size, dtype=np.uint16)
     buf[pts[:, 0], pts[:, 1]] = 1
     markers, n = ndimg.label(buf, np.ones((3, 3)))
     line = watershed(dist, markers)
     img[line == 0] = 0
예제 #3
0
 def run(self, ips, snap, img, para=None):
     img[:] = snap > 0
     dist = -ndimg.distance_transform_edt(snap)
     pts = find_maximum(dist, para['tor'], False)
     buf = np.zeros(ips.size, dtype=np.uint32)
     buf[pts[:, 0], pts[:, 1]] = img[pts[:, 0], pts[:, 1]] = 2
     markers, n = ndimg.label(buf, np.ones((3, 3)))
     line = watershed(dist, markers, line=True, conn=para['con'] + 1)
     msk = apply_hysteresis_threshold(img, 0, 1)
     img[:] = snap * ~((line == 0) & msk)
예제 #4
0
 def run(self, ips, imgs, para=None):
     imgs[:] = imgs > 0
     dist = -ndimg.distance_transform_edt(imgs)
     pts = find_maximum(dist, para['tor'], False)
     buf = np.zeros(imgs.shape, dtype=np.uint32)
     buf[pts[:, 0], pts[:, 1], pts[:, 2]] = 2
     imgs[pts[:, 0], pts[:, 1], pts[:, 2]] = 2
     markers, n = ndimg.label(buf, np.ones((3, 3, 3)))
     line = watershed(dist, markers, line=True, conn=para['con'] + 1)
     msk = apply_hysteresis_threshold(imgs, 0, 1)
     imgs[:] = imgs > 0
     imgs *= 255
     imgs *= ~((line == 0) & msk)
예제 #5
0
 def run(self, ips, snap, img, para=None):
     pts = find_maximum(self.ips.img, para['tol'], False)
     self.ips.roi = PointRoi([tuple(i) for i in pts[:, ::-1]])
     self.ips.update = True
예제 #6
0
 def run(self, ips, snap, img, para=None):
     pts = find_maximum(self.ips.img, para['tol'], False)
     ips.roi = ROI([Points(pts[:, ::-1])])
     ips.update()