From 5a632dda3f79db1ecd8c321969ca7b71f0601389 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Tue, 4 Sep 2012 23:21:27 -0400 Subject: [PATCH] STY: Clean up formatting and remove repeated imports --- doc/source/user_guide/viewer.txt | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/doc/source/user_guide/viewer.txt b/doc/source/user_guide/viewer.txt index f194ade6..17387240 100644 --- a/doc/source/user_guide/viewer.txt +++ b/doc/source/user_guide/viewer.txt @@ -8,29 +8,31 @@ Quick Start ``skimage.viewer`` provides a matplotlib_-based canvas for displaying images and a Qt-based GUI-toolkit, with the goal of making it easy to create interactive -image editors. You can simply use it to display an image:: +image editors. You can simply use it to display an image: - >>> from skimage import data - >>> from skimage.viewer import ImageViewer +.. code-block:: python - >>> image = data.camera() - >>> view = ImageViewer(image) - >>> view.show() + from skimage import data + from skimage.viewer import ImageViewer + + image = data.coins() + viewer = ImageViewer(image) + viewer.show() Of course, you could just as easily use ``imshow`` from matplotlib_ (or alternatively, ``skimage.io.imshow`` which adds support for multiple io-plugins) to display images. The advantage of ``ImageViewer`` is that you can easily add plugins for manipulating images. Currently, only a few plugins are implemented, but it is easy to write your own. Before going into the details, -let's see an example of how a plugin is added to the viewer:: +let's see an example of how a plugin is added to the viewer: - >>> import skimage - >>> from skimage.viewer.plugins import Canny +.. code-block:: python - >>> image = skimage.img_as_float(data.camera()) - >>> viewer = ImageViewer(image) - >>> viewer += Canny(view) - >>> viewer.show() + from skimage.viewer.plugins import Canny + + viewer = ImageViewer(image) + viewer += Canny(view) + viewer.show() At the moment, there aren't very many plugins pre-defined, but there's a really simple interface for creating your own plugin. First, let's create a plugin to @@ -70,10 +72,6 @@ All that's left is to create an image viewer and add the plugin to that viewer. .. code-block:: python - from skimage import data - from skimage.viewer import ImageViewer - - image = data.coins() viewer = ImageViewer(image) viewer += denoise_plugin viewer.show()