Skip to content

Commit

Permalink
Change default Slider update_on value to 'release'
Browse files Browse the repository at this point in the history
Image filtering is usually slow, so updating on move was usually a bad idea.
tonysyu committed Jun 26, 2013
1 parent ed7c75d commit c826935
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions skimage/viewer/widgets/core.py
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 3 additions & 3 deletions viewer_examples/plugins/canny_simple.py
Original file line number Diff line number Diff line change
@@ -12,9 +12,9 @@
# 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:')

2 changes: 1 addition & 1 deletion viewer_examples/plugins/collection_plugin.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion viewer_examples/plugins/median_filter.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
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()

4 changes: 2 additions & 2 deletions viewer_examples/plugins/probabilistic_hough.py
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ def hough_lines(image, *args, **kwargs):
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)

0 comments on commit c826935

Please sign in to comment.