Files
scikit-image/skimage/viewer/plugins/canny.py
T
Tony S Yu bc6c81606f Fix add_argument.
`arguments` is a list, but I was treating it like a dict.
2012-07-22 01:25:58 -04:00

31 lines
1.1 KiB
Python

from skimage.filter import canny
from .overlayplugin import OverlayPlugin
class CannyPlugin(OverlayPlugin):
name = 'Canny Filter'
def __init__(self, image_viewer, *args, **kwargs):
height = kwargs.get('height', 100)
width = kwargs.get('width', 400)
super(CannyPlugin, self).__init__(image_viewer,
width=width, height=height)
self.add_keyword_argument('sigma', 0.005, 0, self.caller,
update_on='release')
self.add_keyword_argument('low_threshold', 0.255, 0, self.caller,
update_on='release')
self.add_keyword_argument('high_threshold', 0.255, 0, self.caller,
update_on='release')
# Call callback so that image is updated to slider values.
self.caller()
def callback(self, *args, **kwargs):
image = canny(*args, **kwargs)
self.overlay = image
def closeEvent(self, event):
self.overlay = None
super(CannyPlugin, self).closeEvent(event)