Exemple #1
0
 def run(self, ips, snap, img, para=None):
     mark = np.zeros_like(img, dtype=np.uint8)
     ips.roi.sketch(mark, color=1)
     ridge(img, mark, para['ud'])
     if para['type'] == 'white line':
         img[:] = mark
     if para['type'] == 'gray line':
         np.minimum(snap, mark, out=img)
     if para['type'] == 'white line on ori':
         #img //=2
         np.maximum(snap, mark, out=img)
Exemple #2
0
    def run(self, ips, snap, img, para=None):
        self.ips.lut[:] = self.buflut
        ndimg.gaussian_filter(snap, para['sigma'], output=img)
        mark = img < para['thr'] if para['ud'] else img > para['thr']
        mark = mark.astype(np.uint8)

        ridge(img, mark, para['ud'])
        if para['type'] == 'white line':
            img[:] = mark
        if para['type'] == 'gray line':
            np.minimum(snap, mark, out=img)
        if para['type'] == 'white line on ori':
            #img //=2
            np.maximum(snap, mark, out=img)
Exemple #3
0
    def run(self, ips, snap, img, para=None):
        self.ips.lut[:] = self.buflut
        img2 = ndimg.gaussian_filter(snap, para['sigma'])
        mark = img2 < para['thr'] if para['ud'] else img2 > para['thr']
        mark = mark.astype(np.uint8)
        ridge(img2, mark, para['ud'])
        imgs = []

        for i in range(0, 255, 10)[::1 if para['ud'] else -1]:
            msk = i > img if para['ud'] else i < img
            sl = img.copy()
            sl[msk] = mark[msk]
            imgs.append(sl)
        self.app.show_img(imgs, ips.title + '-ridgesub')