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()

[((12, 8, 12, 20), 'skimage.data.coins', 'data.coins', ({}, {}), '()', False, 'from skimage import data\n'), ((13, 9, 13, 27), 'skimage.viewer.ImageViewer', 'ImageViewer', ({(13, 21, 13, 26): 'image'}, {}), '(image)', False, 'from skimage.viewer import ImageViewer\n'), ((15, 9, 15, 43), 'skimage.viewer.plugins.base.Plugin', 'Plugin', (), '', False, 'from skimage.viewer.plugins.base import Plugin\n'), ((16, 10, 16, 51), 'skimage.viewer.widgets.Slider', 'Slider', (), '', False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((17, 10, 17, 23), 'skimage.viewer.widgets.SaveButtons', 'SaveButtons', ({}, {}), '()', False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((18, 10, 18, 27), 'skimage.viewer.widgets.OKCancelButtons', 'OKCancelButtons', ({}, {}), '()', False, 'from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons\n'), ((10, 31, 10, 43), 'skimage.morphology.disk', 'disk', ({(10, 36, 10, 42): 'radius'}, {}), '(radius)', False, 'from skimage.morphology import disk\n')]