From 3d2af717444ee80563f7eb00b4b957a6b43aee74 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Thu, 8 May 2014 17:21:35 +1000 Subject: [PATCH] Update description of viewer output in docs --- doc/source/user_guide/viewer.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/source/user_guide/viewer.txt b/doc/source/user_guide/viewer.txt index 4cdde7db..73c4dc00 100644 --- a/doc/source/user_guide/viewer.txt +++ b/doc/source/user_guide/viewer.txt @@ -34,12 +34,16 @@ let's see an example of how a pre-defined plugin is added to the viewer: viewer += LineProfile(viewer) overlay, data = viewer.show()[0] -The viewer's ``show`` method will return an overlay (of the same shape as the -input image) and data (possibly ``None``) for each attached plugin. In this -case, there is only one plugin, so we can directly name both. You can see the -plugin class's ``output`` method to see what will be returned. Here, -``overlay`` contains a drawing of the line (including its width), and ``data`` -contains the measured line profile. +The viewer's ``show()`` method returns a list of tuples, one for each attached +plugin. Each tuple contains two elements: an overlay of the same shape as the +input image, and a data field (which may be ``None``). A plugin class documents +its return value in its ``output`` method. + +In this example, only one plugin is attached, so the list returned by ``show`` +will have length 1. We extract that single tuple and bind its ``overlay`` and +``data`` elements to individual variables. Here, ``overlay`` contains an image +of the line drawn on the viewer, and ``data`` contains the 1-dimensional +intensity profile along that line. At the moment, there are not many plugins pre-defined, but there is a really simple interface for creating your own plugin. First, let us create a plugin to @@ -83,8 +87,8 @@ All that's left is to create an image viewer and add the plugin to that viewer. viewer += denoise_plugin denoised = viewer.show()[0][0] -When we close the viewer, ``denoised`` will contain the filtered image for the -last used setting of ``weight``. +Here, we access only the overlay returned by the plugin, which contains the +filtered image for the last used setting of ``weight``. .. image:: data/denoise_viewer_window.png .. image:: data/denoise_plugin_window.png