from skimage import data
from skimage.filter.rank import median
from skimage.morphology import disk

from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons
from skimage.viewer.plugins.base import Plugin

def median_filter(image, radius):
    return median(image, selem=disk(radius))

image = data.coins()
viewer = ImageViewer(image)

plugin = Plugin(image_filter=median_filter)
plugin += Slider('radius', 2, 10, value_type='int')
plugin += SaveButtons()
plugin += OKCancelButtons()

viewer += plugin
viewer.show()

[((348, 360), 'skimage.data.coins', 'data.coins', ([], {}), '()\n', (358, 360), False, 'from skimage import data\n'), ((370, 388), 'skimage.viewer.ImageViewer', 'ImageViewer', (['image'], {}), '(image)\n', (381, 388), False, 'from skimage.viewer import ImageViewer\n'), ((399, 433), 'skimage.viewer.plugins.base.Plugin', 'Plugin', ([], {'image_filter': 'median_filter'}), '(image_filter=median_filter)\n', (405, 433), False, 'from skimage.viewer.plugins.base import Plugin\n'), ((444, 485), 'skimage.viewer.widgets.Slider', 'Slider', (['"""radius"""', '(2)', '(10)'], {'value_type': '"""int"""'}), "('radius', 2, 10, value_type='int')\n", (450, 485), False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((496, 509), 'skimage.viewer.widgets.SaveButtons', 'SaveButtons', ([], {}), '()\n', (507, 509), False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((520, 537), 'skimage.viewer.widgets.OKCancelButtons', 'OKCancelButtons', ([], {}), '()\n', (535, 537), False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((325, 337), 'skimage.morphology.disk', 'disk', (['radius'], {}), '(radius)\n', (329, 337), False, 'from skimage.morphology import disk\n')]