mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-20 12:50:52 +08:00
API Change: Attach ImageViewer to Plugin after init.
Plugin is now added to the viewer using an inplace add on the viewer instead of on initialization of the plugin. This change means that operations requiring the viewer must be delayed until attach operation.
This commit is contained in:
@@ -8,15 +8,18 @@ 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)
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs.setdefault('height', 100)
|
||||
kwargs.setdefault('width', 400)
|
||||
super(CannyPlugin, self).__init__(**kwargs)
|
||||
|
||||
self.add_widget(Slider('sigma', 0, 5, update_on='release'))
|
||||
self.add_widget(Slider('low threshold', 0, 255, update_on='release'))
|
||||
self.add_widget(Slider('high threshold', 0, 255, update_on='release'))
|
||||
self.add_widget(ComboBox('color', self.color_names, ptype='plugin'))
|
||||
|
||||
def attach(self, image_viewer):
|
||||
super(CannyPlugin, self).attach(image_viewer)
|
||||
# Update image overlay to default slider values.
|
||||
self.filter_image()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user