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