mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 07:11:31 +08:00
Change default Slider update_on value to 'release'
Image filtering is usually slow, so updating on move was usually a bad idea.
This commit is contained in:
@@ -90,12 +90,12 @@ class Slider(BaseWidget):
|
||||
is typically set when the widget is added to a plugin.
|
||||
orientation : {'horizontal' | 'vertical'}
|
||||
Slider orientation.
|
||||
update_on : {'move' | 'release'}
|
||||
update_on : {'release' | 'move'}
|
||||
Control when callback function is called: on slider move or release.
|
||||
"""
|
||||
def __init__(self, name, low=0.0, high=1.0, value=None, value_type='float',
|
||||
ptype='kwarg', callback=None, max_edit_width=60,
|
||||
orientation='horizontal', update_on='move'):
|
||||
orientation='horizontal', update_on='release'):
|
||||
super(Slider, self).__init__(name, ptype, callback)
|
||||
|
||||
if value is None:
|
||||
|
||||
@@ -12,9 +12,9 @@ image = data.camera()
|
||||
# You can create a UI for a filter just by passing a filter function...
|
||||
plugin = OverlayPlugin(image_filter=canny)
|
||||
# ... and adding widgets to adjust parameter values.
|
||||
plugin += Slider('sigma', 0, 5, update_on='release')
|
||||
plugin += Slider('low threshold', 0, 255, update_on='release')
|
||||
plugin += Slider('high threshold', 0, 255, update_on='release')
|
||||
plugin += Slider('sigma', 0, 5)
|
||||
plugin += Slider('low threshold', 0, 255)
|
||||
plugin += Slider('high threshold', 0, 255)
|
||||
# ... and we can also add buttons to save the overlay:
|
||||
plugin += SaveButtons(name='Save overlay to:')
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def autolevel(image, disk_size):
|
||||
img_collection = [data.camera(), data.coins(), data.text()]
|
||||
|
||||
plugin = Plugin(image_filter=autolevel)
|
||||
plugin += Slider('disk_size', 2, 8, value_type='int', update_on='release')
|
||||
plugin += Slider('disk_size', 2, 8, value_type='int')
|
||||
plugin.name = "Autolevel"
|
||||
|
||||
viewer = CollectionViewer(img_collection)
|
||||
|
||||
@@ -10,7 +10,7 @@ image = data.coins()
|
||||
viewer = ImageViewer(image)
|
||||
|
||||
plugin = Plugin(image_filter=median_filter)
|
||||
plugin += Slider('radius', 2, 10, value_type='int', update_on='release')
|
||||
plugin += Slider('radius', 2, 10, value_type='int')
|
||||
plugin += SaveButtons()
|
||||
plugin += OKCancelButtons()
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ canny_viewer += canny_plugin
|
||||
hough_plugin = OverlayPlugin(image_filter=hough_lines)
|
||||
hough_plugin.name = 'Hough Lines'
|
||||
|
||||
hough_plugin += Slider('line length', 0, 100, update_on='release')
|
||||
hough_plugin += Slider('line gap', 0, 20, update_on='release')
|
||||
hough_plugin += Slider('line length', 0, 100)
|
||||
hough_plugin += Slider('line gap', 0, 20)
|
||||
|
||||
# Passing a plugin to a viewer connects the output of the plugin to the viewer.
|
||||
hough_viewer = ImageViewer(canny_plugin)
|
||||
|
||||
Reference in New Issue
Block a user