STY: Clean up formatting and remove repeated imports

This commit is contained in:
Tony S Yu
2012-09-05 10:12:50 -04:00
parent d98a92a603
commit 5a632dda3f
+15 -17
View File
@@ -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()