From 5364e9a5eaed8b5cc6e24043b18a40bae181c63b Mon Sep 17 00:00:00 2001 From: PengGuanjun Date: Mon, 14 Sep 2020 20:15:29 +0800 Subject: [PATCH] Update awatershed_plg.py update --- menus/Opencv/Segmentation/awatershed_plg.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/menus/Opencv/Segmentation/awatershed_plg.py b/menus/Opencv/Segmentation/awatershed_plg.py index 1f9c09b..aa4a78a 100644 --- a/menus/Opencv/Segmentation/awatershed_plg.py +++ b/menus/Opencv/Segmentation/awatershed_plg.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -* -from imagepy.core.engine import Filter +from sciapp.action import Filter import numpy as np, cv2 +from sciapp.object import image class Plugin(Filter): - title = 'Active Watershed' - note = ['rgb', 'not_slice', 'auto_snap'] - - def run(self, ips, snap, img, para = None): - a, msk = cv2.connectedComponents(ips.get_msk().astype(np.uint8)) - msk = cv2.watershed(img, msk)==-1 - img //= 2 - img[msk] = 255 \ No newline at end of file + title = 'Active Watershed' + note = ['rgb', 'req_roi', 'not_slice', 'auto_snap'] + + def run(self, ips, snap, img, para=None): + a, msk = cv2.connectedComponents(ips.mask('in').astype(np.uint8)) + msk = cv2.watershed(ips.img, msk) == -1 + ips.img //= 2 + ips.img[msk] = 255