100% found this document useful (1 vote)
256 views132 pages

Assess2 Manual

Manual del programa Assess2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
256 views132 pages

Assess2 Manual

Manual del programa Assess2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 132

ASSESS

Image Analysis Software for


Plant Disease Quantification
2.0

By Lakhdar Lamari
Assess 2.0 
Image Analysis Software for Disease Quantification

BY

Lakhdar Lamari
Professor of Plant Pathology
Department of Plant Science
University of Manitoba
Winnipeg, MB, R3T 2N2
Canada

The American Phytopathological Society


Saint Paul, Minnesota
This book has been reproduced directly from materials provided
in final form to APS PRESS by the author. No editing or
proofreading has been done by the Press.

Library of Congress Catalog Card Number: 2008930064


International Standard Book Number: 0-89054-394-1

© 2008 The American Phytopathological Society

All rights reserved.


No portion of this book or the accompanying program may be
reproduced in any form, including photocopy, microfilm,
information storage and retrieval system, electronic database, or
software, or by any means, including electronic or mechanical,
without written permission from the publisher.

License.
This Program is a Personal User Version unless you purchased the Multi User Version License.
The specific version you purchased is designated on your invoice or packing slip. If you no
longer have your invoice or packing slip and need to identify which license version you
purchased, please contact The American Phytopathological Society. Telephone
+1.651.454.7250; [email protected]; www.apsnet.org. If you wish to read the complete
licensing information, open the file on the program CD-ROM entitled License.txt

The American Phytopathological Society


3340 Pilot Knob Road
St. Paul, MN 55121 U.S.A.

ii
To Professor C.C. Bernier, to whom I owe so much

Acknowledgments

The watershed operation in Assess is adapted, by permission, from the implementation of the
watershed algorithm by Wayne Rusband in NIH-Image for the Macintosh computer
(http://rsb.info.nih.gov/nih-image/ ). I am greatly thankful for this permission.

Many thanks to all who tested the current software or sent comments about the original version of
Assess. I wish to thank all those who forwarded pictures of diseases when asking for help with
specific problems. These pictures helped in the design of the Assess 2.0. The development of
software, especially of this nature, relies heavily on input from the users.

The development of Assess 2.0 came at a very critical time. I had hoped to do more on this project
in the past few years. Fate had it otherwise! However, I am quite pleased that the project reached
an important milestone: the era of user-independence in disease measurement! It will be
presumptuous and naïve to think that our problems are over. Assess 2.0, while quite revolutionary
compared to the original version and other commercial packages, does not cover all diseases. It
represents a ‘proof’ of concept and shows that it is possible to dream of an objective solution to
disease quantification. Software packages of the future will have to go beyond Assess before they
are used by pathologists. I hope that the release of this version of Assess will make it unattractive
for software developers in this field to keep beating on old concepts. Automation and objectivity
in disease measurement must become the norm, if we hope to progress!

I am indebted to Ardelle Grieger (University of Manitoba) for proofreading the manual and testing
the software. Also, many thanks to Lorne Adam (U of M) for his thorough testing of both versions
of Assess.

The smooth and pleasant relationship I had (and still have) with APS Press is gratefully
acknowledged. Special thanks to Steve Kronmiller for patiently handling so well my lengthy
technical support e-mails.

This software is dedicated to my wife, Janet Alsip, and my children, Adam and Louise.

iii
Table of Contents

System requirement .........................................................................................................................1

Installation.........................................................................................................................................2

Removal ............................................................................................................................................2

Features .............................................................................................................................................3

I Introduction...........................................................................................................................4

II. Starting Assess .....................................................................................................................6

III. The threshold panel ...........................................................................................................11

IV. Working with images: Some basics ..................................................................................22

V. Working with the Area of Interest (AOI) ........................................................................28

VI. Spatial calibration...............................................................................................................33

VII. The spreadsheet ..................................................................................................................37

VIII. Measurement .....................................................................................................................40

VIII. The image histogram .........................................................................................................45

X. Feature extraction ..............................................................................................................48

XI. The Digital Ruler ...............................................................................................................52

XII. Filtering ...............................................................................................................................54

XIII. Macro utility .......................................................................................................................56

XIV. Image menu ........................................................................................................................68

XV. Tools ....................................................................................................................................71

XVI. Options .................................................................................................................................72

v
XVII. Tutorials ..............................................................................................................................75

XVIII. Questions and answers ...................................................................................................122

Appendix .......................................................................................................................................124

Suggested Reading .......................................................................................................................126

Technical Support

Technical support for Assess is available from:

http://www.apsnet.org/press/assess/

vi
System requirements
Operating system
Assess is a 32-bit program and will only run on 32-bit Windows operating systems. It has
been tested on Windows 95, 98, Me, NT, 2000, XP and Vista.

CPU
Pentium 200 or higher is recommended for good performance. However, program speed is
not determined by the CPU alone. Other components play a major role (amount of RAM,
size and speed of hard disk and quality of display card).

RAM
Assess will run on systems with relatively low memory. For computers produced recently
(after 2005), the “standard” memory (512 MB-1 GB), hard disk space (100-200GB) and
display cards (128 MB RAM) are more than adequate to run Assess at a reasonable speed.
Memory becomes critical as you open and process bitmap images. In low-RAM systems,
it is highly recommended that you close all other programs when running Assess. Failure
to do so will force Windows to use the hard disk, making the system unacceptably slow.

Display card and monitor


This component is critical. Assess will run on systems that can display 24 bits (16.7
million colors) at (at least) 1024 x 768 pixels. Fortunately all computer systems acquired
in the past 4 or 5 years are capable of much better resolutions. Furthermore, display cards
with excellent capabilities can be purchased for less than US$100.
Optimum: 24-bit color depth (16.7 million colors) at 1280 (width) x 1024 (height)
pixels. For best visibility and user-friendliness, a 19-inch monitor (or larger) is highly
desirable.

Hard disk space


Minimum: 60 MB of hard disk space (for installation, including sample images and
user manual). The operating system may be extremely sluggish on slow and small hard
drives. Large amounts of disk space are needed to store images.

Pointing device
A mouse or a Windows-supported pointing device is required. Assess was not designed to
run with the keyboard alone.

Image acquisition
Images must be provided by the user on file (typically on hard disk, CD ROM or memory
sticks). Assess also supports Twain-compliant imaging devices. Virtually all scanners
come with Twain drivers. Some frame grabber manufacturers also supply Twain drivers
for their boards. Pictures from digital cameras can also be used for analysis. When using
digital cameras (or other devices), avoid archiving files using high-compression JPG
formats.

1
Installation

Insert the CD in the CD ROM drive. The installation program should start automatically
and you will be guided through the process. If your CD autorun was disabled or the
installation does not start automatically, go to ‘Start’ at the lower left corner of your
Windows desktop and select ‘Run’. Press on ‘Browse’ and locate the CD ROM drive
where you inserted the CD. Double-click on file ‘Setup.exe’ to select this file and return
to ‘Run’. Click on ‘OK’.

Follow the on-screen instructions. The software must be installed using the installation
program provided on the CD. Do not attempt to install it otherwise.

The installation program will create the following


directories (default). A shortcut to Assess will also be
created and placed on your desktop.

Removal
Go to ‘Start’, locate and click on Control Panel.
Run the program ‘Add/Remove Programs’.
Select Assess from the list and click on ‘Remove’.
Follow the on-screen instructions (if any). Note that ‘Add/Remove Programs’ will not
remove files created by the user.

2
Features

™ Automatic measurement of many plant diseases (user-independent).

™ Automatic measurement of ground cover (user-independent).

™ Simple and intuitive user interface, requiring no knowledge of computer programming or


image processing.

™ Simple and rapid measurement of area, percent disease, percent ground cover, lesion count
and root length.

™ Real-time user interactive tool for area, length and angle measurement.

™ Image filtering, mirroring, resizing, 90o, 180o and arbitrary angle rotation.

™ Standard and many nonstandard file formats for reading and writing. Assess can handle
over 60 file formats, including several RAW formats for digital cameras.

™ Frame capture from several video formats.

™ Simple macro utility and language to automate tasks and perform batch processing.

™ Batch conversion to all the file formats supported for writing by Assess (through macro
programming).

™ Image acquisition from any Twain-compliant device, including scanners, digital cameras
and frame grabbers.

™ Printing to Windows-supported printers.

3
I. Introduction

Welcome to Assess, the software for routine disease measurement. Assess was designed
and implemented to help plant pathologists and agronomists quantify plant diseases, while
providing a simple and easy-to-learn user interface. The software is optimized for
measuring leaf area, percent area infected, lesion/pustule count, root length and ground
cover.

What is Assess?
Assess is an application of existing image analysis algorithms to disease measurement. It
is not a general-purpose image analysis software package. There are several commercial
and non commercial packages available for image enhancement and analysis, which are far
more comprehensive, but also far more complex and costly.

Who needs Assess?


It is primarily intended for researchers who routinely perform disease measurements on
large numbers of samples, without prior knowledge of image analysis concepts and
computer programming.

What can you do with Assess?


Even though Assess is optimized for disease measurement, it is flexible enough to be used
as a laboratory tool for measurement, image enhancement and archiving. The
measurements performed are not limited to plants or plant diseases. Generally, if the
objects of interest can be selected (separated from the background), they can be measured.

How does Assess work?


The principle behind Assess is simple. All measurements are based on objects selected by
the user and overlaid on the original image. What is shown on-screen is what is measured.
The selection of the objects is interactive through an intuitive user interface. The problem
of ‘eye-balling’ a leaf to determine the percent infection is replaced with one of matching
surfaces. The user interactively sets threshold levels, using a slider, and Assess
automatically translates the user action on the slider into an overlay over the original color
image. Once the overlaid image adequately covers the object or objects of interest, the
work is done. One simply chooses a measurement and clicks the appropriate button. In
short, Assess reduces the complex problem of disease quantification to a simple
shape-filling exercise.

The process by which we visually assess diseases may appear to be very simple to the
human brain, but presents several problems when implemented on a machine. The
approach taken in Assess is to reduce the process into basic and meaningful components.

1. Defining the problem: An image of a typical diseased leaf consists of a background,


‘healthy’ tissue and ‘not-healthy’ tissue. If we were to carry out accurate disease
measurement ‘by hand’, we would automatically recognize that the background is not of

4
interest and ignore it. We would then measure the area of the entire leaf using a
mechanical device, or derive an estimate of the area from simple measurements (length,
width, etc.) by mathematical techniques. We would then process the lesions in a similar
fashion (to get the total area occupied by the lesions). Finally, we would compute the ratio
of lesions to the total leaf area.

2. Implementing a solution: From its inception, Assess was designed and optimized to
handle the difficult issue of quantifying plant diseases, with no a priori knowledge of the
type of disease. Regardless of the disease to be measured, the same basic components need
to be isolated and measured:

a) Separation of the leaf from the background


b) Separation of the lesions (diseased tissue) from the healthy tissue within the boundary
of the leaf.

The separation of the leaf from the background or the lesions from the leaf requires
that the two components differ in some property, e.g., color or brightness. Assess relies
heavily on the Hue-Saturation-Intensity color model (explained in the Appendix) to enable
the user to effectively extract the leaf from the background and then the lesions from the
leaf. Since we do not know in advance about the specifics of any disease, the user is given
a major role in determining what needs to be measured.

The effectiveness of Assess in providing an acceptable solution to the problem of


disease quantification is due mainly to the fact that it provides the user with great flexibility
in using and combining different color models (RGB and HSI) and color planes to extract
the various required components.

3. The user interface: To reduce the learning curve, the user interface of Assess was
designed specifically to deal with disease quantification and other types of measurements
needed by plant pathologists, agronomists and other agricultural scientists. Many tasks
were combined and presented to the user as action buttons on a specialized control panel
(the Threshold Panel). These action buttons would have required the use of macros, scripts
or programming in other image analysis software packages. With the simplification of the
user interface and customization to make the various tasks almost transparent to the user,
Assess is highly suited for individuals with little or no knowledge of computer science and
image analysis

4. Automating disease measurement. Assess takes disease measurement to the next


level. For some diseases, the process is now fully user-independent.

5
II. Starting Assess
Running Assess

The installation program should have installed the APS Assess icon on your desktop.
Click on the icon to start the program.

Alternatively you can launch the program as follows:

Click on ‘Start’ at the bottom left of your Windows Desktop.


Go to ‘Programs’ and click on APS Assess.

If you get the message below when you launch the program, you must set your
display settings at 24 bits (16.7 million colors) with a screen resolution of at least
1024 x 768.

Changing the screen resolution

1. Right-click on the screen (away from any icon).


2. Windows will display a popup menu.
3. Select ‘Properties’.
4. A tabbed page will be displayed.
5. Click on ‘Settings’.
6. Change the color setting to 24 bits (or True Color or 16777216 Colors)
7. Change the screen resolution to 1024 x 768 or higher.
8. Press OK to confirm the changes and exit the setup.

If you are using Windows Vista, select “Personalize” at step 3, and “Display
settings” in step 5 above.

6
The application screen

Tool Bar
Menu Bar

Threshold Panel
Image Window

Application area
Status Bar

When Assess is launched, most of the buttons are initially ‘grayed’. They are inactive until
you open an image.

When you open an image, it will automatically be placed in an ‘image window’. You
can resize, move, minimize or maximize the image window.

You can open multiple images in Assess. However, this practice is not recommended,
particularly in systems with low amounts of memory.

The image window stores all the settings. Do not close it after completing your
measurements/analysis of an image. Just load/acquire your next image into the same
image window. Your settings will be kept.

7
The Menu Bar

The Menu Bar consists of a set of ten menus:

File Commands to input, acquire, save and print images. See Chapter IV,
“Working with Images” for details.

Edit Commands to edit images, such as the familiar Cut, Copy, Paste and Crop.

View Commands to zoom in and out (shrink or expand the current image).

Image Commands related to image transformation and thresholding.

Filter Filter commands that can be applied to a color image, prior to measurement.
See Chapter XII, “Filtering” for details.

Tools Commands related to the control of the various control boxes.

Options Configuration of Assess and setting of options.

Macro Commands create, edit, play and record macros. See Chapter XIII, “Macro
utility” for details.

Window Standard Windows commands to arrange multiple documents on the


application area.

Help Technical help via e-mail or the Assess Web site.

The items in the Menu Bar will be referred to in other chapters. The following standard
referencing convention will be used:

The Menu Bar group heading (e.g., ‘File’) will be used first, followed by a sub-menu item
(e.g. ‘Open’) and in some cases by a sub-sub-menu item. These items are separated by a
vertical bar ‘|’.

Example: ‘File|Open’ means:


1. Select ‘File’ from the Menu Bar
2. Select ‘Open’ from the list of items in the File menu.

8
The Toolbar

The main toolbar consists of the buttons described in the table below. Some of the buttons are
enabled only if an image is open.

Button Name Function


Open Opens the ‘Open’ dialog box, from which an
image can be opened

Save Saves image to disk

Acquire Image Calls a Twain imaging device

Print Prints image

Cut Cuts image from current window to


clipboard

Copy Copies image from current window to


clipboard

Paste Pastes image from clipboard into current


window

Reset AOI Resets Area of Interest to entire image

Toggle Overlay Turns overlay on and off


ON/OFF

Spreadsheet Shows spreadsheet

Slider Shows Threshold Panel

9
Button Name Function
Pixel Values Displays pixel values at the location of the
mouse cursor

Digital Ruler Calls/hides the Digital Ruler

Rectangular AOI Sets AOI type to rectangular; show/hide AOI

Freehand AOI Sets AOI type to freehand drawing;


show/hide AOI

Leaf AOI Sets AOI type to leaf; show/hide AOI

Crosshairs Shows and hides crosshair cursor

Manual Separate Allows user to draw on overlay to separate


objects

Touch up Allows user to draw on the actual image to


separate objects (as opposed drawing on the
overlay)
View 50% Togglea between 50% and 100% view of
image

Palette Switches between two palettes for the overlay

Color Space Selects HSI, HSV or L*a*b

Exit Assess Exits the application

10
III. The threshold panels
A) The Classic Threshold Panel

Overview:
The Classic Threshold Panel is the most important tool in Assess. It is used to set the
threshold levels, process the segmented image and perform all the measurements. In most
cases, the Threshold Panel is all that is needed to count objects and measure area, percent
area and root length. The Classic Threshold Panel is so called because it was the only
threshold panel available in Assess 1.0. Its functions remain unchanged in recent versions.
However, other threshold panels are now available (see below). The Classic Threshold
Panel is described in the figure below.
1. Slider: Interactive tool to set the low and high threshold values.
2. Setup section: A set of buttons allowing the user to select the ‘Leaf’ or ‘Lesion’overlay,
the color space and the color plane.
3. Processing section: A set of buttons to perform various morphological operations on
the segmented image.
4. Analysis section: A set of buttons to perform measurements on the segmented image.
5. Display section: Edit boxes to report the results of measurements.

Important: Even though the Threshold Panel is critical to Assess, it does not store any
data at all. All the settings, including threshold levels, are kept in the image window.
Do not close the image window after you have completed your analysis. Just load your
next image and reuse your previous settings!

11
1. Slider:

Operation

Selecting one version of the slider

The default version of the slider is the one with the edit boxes (left figure above).
To change to the version with the spin buttons (right figure above):

• Place the mouse cursor anywhere on the Threshold Panel


• Right-click on the mouse to display a popup menu
• Select ‘Show Spin Buttons’ from the popup menu

The spin buttons allow you to move the slider thumbs by one pixel value for
each mouse click. Use the spin buttons only to fine-tune the positions of the
thumbs.

Moving the thumbs


The slider consists of a track (middle rectangle) and two triangular ‘thumbs’. In its
default configuration, the track displays graphically the entire range of pixel values.
The positions of the upper and lower thumbs represent, respectively, the high and
low threshold values. As they are moved, their respective positions are shown in
the edit boxes to the left of the slider, if they are visible. The threshold values are
also shown in ‘hint boxes’ when you move the mouse on the slider or the spin
buttons.

To set threshold levels for an image, position the mouse cursor on the desired
thumb and drag to the left or to the right. When the mouse button is released, the
program will process the image using the newly set high and low threshold values
and highlight all the pixels selected.

a) Using the edit boxes:


You can also set the threshold levels using the edit boxes to the left of the
slider. After you enter a value, press ‘Enter’ or ‘Tab’ to see the effect.
The upper and lower edit boxes control the upper and lower thumbs,
respectively.

b) Thumb color:
In the default configuration, the thumb color will change with its position
along the middle track. Each thumb will pick up the color of the track at the
position to which it has been dragged. In other words, the colors of the

12
thumbs represent the threshold values (i.e., [red to yellow], [green to
purple], [dark to light] etc.).

c) Moving the lower thumb past the upper thumb:


When we threshold an image, we are selecting pixels with values that fall
within a certain range. Typically this range is in increasing order, as pixel
values represent amounts between 0 and 255 (in any one color plane).

The slider is programmed to prevent the user from setting the position
of the lower thumb higher than that of the upper thumb. However,
there is one exception: when the HSI color space and the ‘Hue’ color plane
are selected, the lower thumb is allowed to be dragged past the upper
thumb. This way, one can select hues of 0 and 255 (simultaneously),
without selecting any value in-between. This ‘wrap-around’ is due to the
mathematical definition of hue as an angle (angles of 0 and 360Ε have
similar trigonometric properties) (see appendix p. 125). The slider will
automatically configure itself to allow the user to select any range of hue
with the following rules:

a) Lower thumb position smaller than the upper thumb position: The
range of hues selected is the normal one: [low... high].

Example:
Lower thumb value = 10
Upper thumb value = 240
Range selected = [10, 11, 12,..., 240]
Range excluded = [0, 1, 2,...,9] + [241, 242, 243,... 255]

b) Lower thumb position larger than upper thumb position:

The range of hues selected is as follows: [lower thumb...255] + [0...upper thumb].

Example (see slider figure above):


Lower thumb value = 198
Upper thumb value = 25
Range selected = [198, 199, 200,..., 255] + [0, 1, 2,..., 25]
Range excluded = [26, 27, 28,...,197]

13
2. Setup section:

Leaf/Lesion button:

This button will select either the ‘Leaf’ or the ‘Lesion’. Each time it is
pressed, the caption changes indicating whether it is set on ‘Leaf’ or
‘Lesion’. This button is used in disease quantification only. If you get
percent area (percent disease) values greater than 100% (!), it is likely that
you have set threshold values for lesions when the button was set on ‘leaf’
or vice versa.

Color space (HSI/RGB) button:

This button toggles between two color models: HSI and RGB. Unless you have
a special reason for using the RGB model, this button should be kept on ‘HSI’.

Color plane radio buttons:

The value displayed on the color space button automatically sets the names for the color
planes. R, G and B (red, green and blue) are used with the RGB color space. H, S and I
(hue, saturation and intensity) are used with the HSI color space. Click on one radio button
to select the color plane you want to use. In analysis of foliar diseases, the most useful color
plane is Hue, which is the default color plane in Assess. However, there are instances when
other color planes are more effective for analysis. See Tutorials 6, 10 and 13 for more.

3. Processing section:

The buttons in the processing section perform various


morphological operations on the segmented image.

They are enabled only if a previous threshold operation was


successful in segmenting the image (i.e., some objects are
highlighted on the overlay).

14
Filtering drop-down list box:

This feature allows the user to select a filtering action to be performed following a
thresholding operation. There are four options:
1. No filtering: Thresholding is not followed by any filtering operation.
2. Open (Erode/Dilate): Binary erosion followed by a binary dilation. This operation will
eliminate isolated pixels in the segmented image.
3. Close (Dilate/Erode): Binary dilation followed by binary erosion (the opposite of
‘Open’). This operation is used to close small holes in the selected objects.
4. Smooth (Median): Median filter (default option).

Assess will automatically process the image with whatever option is selected. The median
filter smoothes the contours of the selected objects, removes any isolated pixels and closes
small holes. A smoothing operation is recommended and sometimes required (automatic
separation of touching objects).

Buttons in the processing section:

Toggle: Pressing on this button will hide and show the overlay. Toggling
the overlay a few times will allow the user to check if the objects have
been correctly detected. Make sure that the overlay is not turned off after
you have finished toggling. You can check the state of the overlay on the
main toolbar (it should indicate Ovl ON or Ovl OFF).

Separate (button with leaf icon): Performs a ‘watershed’ operation to


automatically separate touching objects. The procedure may create artifacts on
overlapping objects. The selected objects must not have holes, as these will interfere with
the procedure. Smoothing operations, such as the median filter, ‘Close’ and ‘Open’, may
be used to eliminate holes in selected objects.

Outline: Outlines all the selected objects on the overlay. This has essentially the same
function as the Toggle button. The user will use this feature to check if the lesions (or
objects of interest) have been correctly detected.

Smooth: Applies a median filter. This operation consists in visiting each pixel, getting
all the neighboring pixels, sorting them based on their value and assigning the median
value to the pixel being visited. Understandably, this is a computer-intensive operation.
The result of a median filter is a ‘smoothing’, as isolated pixels are converted to
background (i.e., disappear) and small holes filled. Jagged lines tend to appear less jagged.
A pseudo-median filter is actually used in Assess to process the overlay in conjunction

15
with the Threshold Panel, as we are dealing with a binary image. The pseudo-median
achieves the same results and is much faster than the true median filter.

Erode: Performs one erosion on the selected objects on the overlay. Erosion converts
object pixels touching the background into background pixels. The result is that the
objects will shrink by a one-pixel-thick layer. Pixels that are isolated disappear.

Dilate: Does the opposite of ‘Erode’. A dilation consists in converting background pixels
adjacent to object pixels into object pixels. The objects will, therefore, grow by a one-
pixel-thick layer. Small holes are filled.

Open: Performs one erosion followed by one dilation. The erosion will eliminate
isolated pixels but also shrink objects. The objects are ‘grown’ back to their original size
by the dilation.

Close blob: Performs one dilation followed by one erosion. The effect is opposite that
of the ‘Open’ operation.

4. Measurement section:

Before using any of the buttons shown on the left (green box), you must
ensure that the threshold levels have been set.

Area: Used to measure the area of the objects detected in the area of interest
(AOI) by a previous thresholding operation. Note that the measurement
performed corresponds to what is displayed on the overlay; this may be
‘Leaf’or ‘Lesion’. The result is reported in the corresponding edit box at the
bottom of the Threshold Panel (see the description of the Display section).

Note: Before using the “Area” button, make sure there is something
to measure on the overlay. This command will not threshold the
image automatically.

% Area: Used to estimate disease severity. The user would have set the threshold values
for ‘Leaf’ and for ‘Lesion’. When you click on this button, Assess will measure the leaf
area and the lesion area and compute the percent area infected [% area = (lesion area / leaf
area)*100]. The result is expressed as a percentage and reported in the edit box labeled
‘Percent=. Leaf and lesion areas are also reported in the corresponding edit boxes.

Note: You don’t need to threshold the image before using this command. However,
you must set the threshold levels for both leaf and lesion before using the ‘% Area’
button.

Count: All blobs on the overlay (from a previous threshold operation) will be counted,
labeled and redrawn with arbitrary colors for visibility. To extract features, such as area,
perimeter, major axes, average colors etc., you must select them prior to counting, by

16
using the ‘Options’ button. These features are written to the spreadsheet, if it is activated.

Root L: Assess can be used to measure plant root length. When this button is pressed,
the program will perform a ‘skeletonization’ operation, followed by root length
measurement. The process of skeletonization consists in reducing the roots to a single
pixel in width. If the spreadsheet is activated when the button is pressed, the result is
written to the spreadsheet.

5. Display section:

This section consists of four edit boxes. Results of measurement operations are displayed
in these boxes.

Area: Leaf area


Lesion: Lesion area
Percent: Percent area diseased
Count: Number of objects on the overlay

6. Other controls on the Threshold Panel

Apply: This button allows the user to apply the values displayed on the Threshold Panel
to segment the image. This is useful when a new image is opened in the current window
or if the overlay was cleared by the user.

(Clear) Ovl: This button clears the overlay, without destroying it. Since the
overlay is transparent, it becomes invisible until the next threshold operation.

Spreadsheet: Check this box if you want the data generated by the four measurement
operations (Area, %Area, Count and Root L) to be written to the spreadsheet.

Options: This button opens a dialog box to allow you to select several features to be
extracted. These features are descriptors of each of the objects detected by the count
operation. The features available are described in Chapter X and used in Tutorial 11.
‘Options’ is used mostly in conjunction with the ‘Count’ procedure.

Calibrate: This button calls the calibration utility.

17
B. The Automatic Threshold Panel

The Automatic Panel, as the name suggests, enables the user to compute the percentage
infection with one mouse click. The buttons with the same names as in the Classic
Threshold Panel have the same functions. They will not be re-described here.

1. Enhance image

2. Automatic % disease for active image

3. Automatic % disease for individual leaves

4. Compute % disease using slider setting

5. Compute ground cover (automatic)

6. Shows Manual (Threshold) Panel, and


hides the Automatic Panel

1. Enhance Image: Calls the Enhance Image windows. The user can change the
brightness, contrast and saturation of the image. It is the same call as the one in the
Main Menu Bar (‘Image|Enhance Image’).

2. Automatic Disease Measurement: This version of Assess introduces, as an attempt,


the ability to automatically (i.e., without user intervention) measure percent infection
for diseases of plants with green leaves and brown-reddish-yellow lesions. Fortunately,
most foliar diseases are of this type. The automatic feature is not to be used with
powdery mildews (wrong symptom color) or with diseases of red cabbage and the likes
(wrong leaf color)! Furthermore, the background must be uniformly white or
uniformly blue. To ensure success, the images must have a good contrast and colors
must be saturated (vivid colors). Do not use this feature on pictures with low light or
low contrast. Always check the result by clicking on the Leaf/Lesion button to see if
the leaf or lesions were correctly detected by Assess.

18
3. Detail (automatic): This feature requires the adherence to the same restrictions as the
ones described above, as far as the type of disease, background and quality of the
pictures are concerned. The ‘Detail’ button enables the user to measure disease for
each leaf on the screen and report the results for each individual leaf. This feature is
extremely useful, as it save considerable time. As long as the leaves are not touching,
one click will 1) set the threshold levels for the image, 2) detect each leaf and 3)
measure and record the % infection for each leaf. The leaves (seen in the figure below)
are labeled and colorized differently for visibility. The results are shown the bottom
part of the threshold panel as a scrollable list.

4. Manual: After the use of the automatic feature, the threshold levels will be set by
Assess. These can be seen on the slider. The user may decide to change them a bit by
adjusting the slider as in the Classic Threshold Panel. To measure the percent infection
after the adjustment, use this button (i.e., not the % Area button).

5. Compute Ground Cover: This feature allows agronomists to automatically compute


ground cover. It was added to this panel for convenience only. Essentially, Assess will
set the threshold levels of the ground to cover the entire range (i.e., low = 0, high = 255)
and then automatically detect the area occupied by the green plants. The ratio of the
plants to the ground area is computed and multiplied by 100 to obtain the ground cover.
There is a panel called The Agronomist which does the same (described below).

19
6. Show Manual (Threshold) Panel: Calls the Manual Panel and hides the Automatic
Panel.

C) The Manual Threshold Panel


Except for the two buttons shown on the figure, the Manual Panel is identical to the Classic
Panel.

Detail: Computes % infection for individual


leaves.

Shows the Automatic Panel and hides the


Manual Panel.

1. Detail button: This feature allows the user to measure percent infection for individual
leaves. It assumes that the threshold levels were set for leaf and lesions. This feature
is identical to the one described for the Automatic Panel, except that it requires that the
user hand set the leaf and lesion threshold levels (i.e., user-dependent).

2. Show Automatic (Threshold) Panel: Calls the Automatic Panel and hides the Manual
Panel.

20
D) The Agronomist Threshold Panel

1. Ground cover using slider values (manual)

2. Ground cover automatic

The Agronomist is almost a clone of the Classic Panel, described above. Labels were
changed to make the panel more specific to the task.

1. GC-user: The user will set the threshold levels first, then click on GC-user to compute
the ground cover (function similar to %Area in the Classic Panel).

2. GC-Auto: Computes the ground cover without user intervention on the threshold panel
or the slider. It assumes that the ground is brown-red-yellow and the plants are green.
The user must be aware that wet soils with green coloration (algae, moss etc.) are not
suitable for user-independent measurements. As always, check your results!

21
IV. Working with images: Some basics
A. Loading images

Assess provides three ways of loading an image: 1) an enhanced standard ‘Open’ dialog
box, such as those found in many Windows programs, 2) drag-and-drop operations from
Windows Explorer and 3) drag-and-drop operations from other applications.

1. Using the enhanced standard ‘Open’ dialog box

This option is accessed from the main menu as ‘File|Open’.


Typically, the user will navigate through the various directories, select a file and
click on the ‘Open’ button found on this dialog box. If the file format is supported,
a preview of the image is shown on the right side of the dialog box, as the user
selects a file from the list. Only one image can be previewed at a time.

The preview option of the enhanced ‘Open’ dialog box is enabled/disabled by


checking the ‘Preview’ box at the bottom of the dialog box. It is checked by
default.

2. Using drag-and-drop file operations from Windows Explorer

Assess supports drag-and-drop file operations from Windows Explorer or other


file management programs. To use this method of opening an image file:

• Select the directory containing the desired image files using Windows
Explorer.

22
• Select the file (or files) you want to open.
• Locate the mouse cursor on the selection.
• Hold down the left mouse button.
• Drag the mouse cursor to the Application Area of Assess.
• Release the mouse button.

Dragging a file into an already open image window:

You may drag only one file into an already opened image window. The
image window will keep all the previous settings (threshold levels, color
space, color plane etc.). This is useful if you are working with images that
have similar color characteristics.

3. Using drag-and-drop operations from other applications

Assess can import bitmap images using the drag-and-drop method available in
some commercial, off-the-shelf software applications. The exporting application
must support drag-and-drop operations.

Dragging an image into Assess:

From the exporting application, locate your mouse cursor on the image (or
a selection in the image), press and hold down the left button and drag the
mouse cursor into an already open image window in Assess. The dragged
image will replace the current one. If you want to place the image into a
new window, drop it anywhere on the Main Toolbar.

B. Capturing frames from .avi movies

Assess will capture images from video cameras or digital movies (on file) if Video for
Windows is installed. To open a movie, go to ‘File’ in the Menu Bar and select ‘Open
Movie/Multimedia’. The Video Capture dialog box, shown below, will open.

Video cameras (web cameras and non-Twain video devices)

To output images from a video camera, live in Assess, the camera must first be selected.
To view the video, click on the ‘Video’ tab and then on ‘Video Camera On’. You can
also configure the output of the camera in terms of resolution of the incoming images.

Once the video images start showing on your screen (in Assess), you can click on
‘Capture’ to freeze one frame, just as you would do with a playing video file (described
below).

23
How to load a movie from the Video Capture dialog box

Click on the ‘Open’ button, select a file and double-click on it. When the file is
loaded, the VCR-like play button will turn green.

Play a movie: Click on the play button.

Capturing a frame:
1. Set the speed using the track bar labeled ‘Frame speed’.
2. While the movie is playing, click on the ‘Capture’ button to freeze a frame.
3. The captured image is transferred to the image frame on the right.
4. Click ‘OK’ to go back to the main program.

Video Capture Dialog Box

24
C. Acquiring images from imaging hardware

Assess is hardware-independent. It acquires images using the Twain drivers supplied,


generally, by imaging hardware manufacturers.

Important: Before you attempt to acquire an image, make sure that you have
installed and successfully tested your hardware and software.

How to acquire an image in Assess:

1a. You have more than one Twain device in your system:
Go to ‘File|Select source’. Assess will list all the devices registered in your
computer. Select (double-click on) the device you wish to use and return to the
main program.

1b. You have a single Twain device:


You may skip the ‘Select Source’ step; in most cases Assess will detect single
devices. However, it is good practice to always select the source.

2. Acquire image

Press F4 to acquire an image. This step can also be executed from ‘File|Acquire
image’ or by clicking on the ‘Acquire image’ button on the Toolbar (shown
above).
When the acquire command is issued, Assess will call the manufacturer’s Twain
interface for the device. Different manufacturers supply different interfaces.
However, there are some features which are common to most:

ƒ Preview image (or something similar)


ƒ Acquire, Scan or Final (i.e., scan image into calling program)
ƒ Various setups such as color resolution, spatial resolution, filtering,
image contrast and brightness

o Set the color resolution to 24 bits (Millions of Colors, True Color...).

o Set scanning resolution: Depending on the type of information you need, the
resolution may vary.

Routine disease assessment (percent area infected): A scanning resolution


of 300 dpi (dots per inch) may be sufficient.

Counting small objects: If the objects to be counted are too small, higher
resolutions may be needed (300-600 dpi); the area scanned should be reduced,
as the files generated with high resolution can be excessively large.

25
Even though Assess will handle large bitmaps, image files should not be
larger than 13-15 MB (2200x2200), as images are kept in memory for rapid
analysis. Assess requires an amount of memory approximately three times
the size of the opened image to operate smoothly. For this reason, the user
should also refrain from opening multiple large images or run other programs
concurrently with Assess.
Preview the image: Ideally, you should preview a scanned image and select
the area to capture. Since bitmap files tend to be large, there is no need to
acquire parts of a scene that are not going to be used in your measurements.
o Acquire the image: The command names are different depending on the
manufacturer. These may be ‘Final’, ‘Scan’, ’Capture’, ‘Finish’ etc. Check the
documentation supplied with your imaging device.
o Assess comes with its own user interface (figure below). It is recommended to
use it (if it works for you), as Assess will use the information to automatically
calibrate the system, saving you time. Should Assess’s Twain interface fail to
operate correctly, check the ‘Use manufacturer’s interface’ box under the
‘Options’ of the Twain dialog box; this will call the manufacturer’s interface. If
you want to use the manufacturer’s interface all the time, enable it from ‘File|Use
Manufacturer’s Interface’. Assess will remember the setting until you change
it again.

If Assess’s interface does not


operate correctly, check this
box (arrow) to use the
manufacturer’s interface

26
If you do not see the above Assess’s interface when you call the scanner, then the
manufacturer’s interface is enabled in the ‘File’ menu (‘File|Use
Manufacturer’s Interface’). Disable this feature (uncheck it) and call the scanner
again.

Note: Always set the color resolution to 24 bits (True Color, Millions of Colors
etc.). Turn off any sharpening filters; they are good for image display, but
introduce unwanted noise.

Video cameras and frame grabbers: These are generally very fast (real-time)
devices. However, their resolution is much lower than that of scanners. They are
excellent for small objects (seeds, small leaves). The most common resolution (at
24 bits) is 640 x 480 pixels for frame grabbers. The small image size makes the
analysis almost real-time (even on old Pentium machines).

Digital cameras: They can be used with Assess via their Twain interfaces, as ‘cut-
and-paste’ or by other means. There is a heavy use of JPEG formats (.JPG
or .JPEG) in digital cameras for obvious storage space considerations. JPEG uses
lossy compression to achieve its significant file size reduction. This format is
acceptable for viewing and e-mailing images, but should be avoided for analysis,
as it produces artifacts, most noticeable in the hue component of HSI, the color
space most used by Assess.

27
V. Working with the Area of Interest (AOI)
What is the Area of Interest?

When only a portion of the picture is needed for analysis, the user may select a specific
area of the image for analysis. This region is called the ‘Area of Interest’, or AOI. All
filtering and measurement operations are restricted to the AOI.

1 2 3

1: Rectangular AOI
2: Freehand AOI
3: Leaf AOI

These three buttons are located on the Toolbar. In addition to selecting


the corresponding features, they will show and hide the AOI.

You can use only one option at a time.

Area of Interest options

Assess supports three types of AOI, which can be selected from the Toolbar: 1)
Rectangular AOI, 2) Freehand AOI (a user-drawn curve of arbitrary shape) and 3) Leaf
AOI (the surface of the leaf is the AOI).

1. Rectangular AOI:
Rectangular AOI is commonly used in image analysis and graphics programs. Assess
defaults to this type of AOI. To select this feature press the button on the Toolbar labeled
with a rectangle and 8 small aqua-colored boxes as shown above. A rectangular shape,

28
similar to the one on the button face, should become visible on the image, if it is not already
active. A second click on the button will hide the rectangular selection tool. Even though
the selection tool may be hidden, this feature will still be set (until another type of AOI is
selected). All the processing and measurements are confined to the area contained within
the selection rectangle.

Setting the Rectangular AOI: Move the mouse cursor to the desired location on the
image, hold down the left mouse button and drag the mouse to draw a rectangle as you
would with any Windows program. Once the Rectangular AOI tool is visible on the image
(see the figure below), simply resize it or drag it to any region of the image. The AOI will
automatically be set to the size and position of the selection rectangle.

Note: You cannot draw inside the AOI when the Rectangular AOI tool is active.
You can draw on the image when the mouse cursor appears as a cross. If the cursor
is located inside an active selection tool, it appears as a pointing hand, as shown on
icon on the left. If the cursor appears as an arrow, the overlay is off. Enable the
overlay from the Threshold Panel, using the ‘Toggle’ button, or, the Toolbar (Ovl
ON/Ovl OFF button).

Resizing the rectangular selection tool: Place the mouse cursor on one of the
eight control points (little aqua-colored squares on the corners and sides of the
selection rectangle). The cursor changes into a double arrow. Hold the left mouse
button down and drag the mouse to resize the selection.

Repositioning the rectangular selection tool: Place the mouse cursor inside the
rectangle. The cursor changes into a pointing hand. Hold the left mouse button
down and drag. The selection rectangle moves as you move the mouse.

29
Resetting the AOI: To select the entire bitmap as an AOI, simply click on the
reset button on the Toolbar. This button is labeled with a red rectangle (shown
above).

Additional features of the rectangular selection tool:


The rectangular selection tool has a popup menu, which allows the user to set a few
options for convenience. Right-click on the selection rectangle to call the popup
menu (see the figure below).

Popup menu of rectangular selection tool

‘Threshold on-the-fly’: When the rectangular selection tool is moved or


resized, Assess will automatically threshold the image and display the
detected objects, at the threshold levels shown on the slider. The area of the
objects is also reported in the corresponding edit box in the Threshold Panel
and on the top left corner of the rectangular selection tool. This feature is
convenient for checking small regions of your image. Turn it off when
using large AOI’s. For more on this topic, see Tutorial 3.

30
‘Show size of Area of Interest (AOI)’: Displays the size of the AOI, as it is
being resized. If calibration was previously performed, the size of the AOI
will be displayed in physical units. The default unit is the pixel.

‘Outline on-the-fly’: Similar to the ‘Threshold on-the-fly’ option, except


that the outline of the objects is shown. When used alone, no measurements
are performed. For more on this topic, see Tutorial 3.

‘Percent disease on-the-fly’: Computes and displays the percent disease,


using the threshold values set for ‘Leaf’ and ‘Lesion’ in the Threshold Panel.
Turn off this when using large AOI’s. For more on this topic, see Tutorial 3.

‘Cut’: Cuts the area inside the AOI to the Windows clipboard. Other
Windows programs can paste it.

‘Copy’: Copies the area inside the AOI to the Windows clipboard.

‘Paste’: Copies the contents of the Windows clipboard into the current
image, starting at the top left corner of the AOI.

‘Crop’: The image will be cropped to the size of the AOI. All the threshold
values are kept. The original image is deleted from memory and replaced
with the new image. The window holding the original image is resized to
reflect the size of the new image. You can ‘undo’ the cropping operation, if it
was the last operation you performed on the image.

‘Make new bitmap from AOI’: Clones the AOI and creates a new image.
Threshold values are not transferred. The original image window remains on
the desktop.

‘Substitute Background’: Replaces all the pixels in background by a


user-selected color (the default color is blue). This operation assumes that a
threshold operation was performed and that all objects of interest are
highlighted on the overlay. Any pixel which was not highlighted is
considered to be a background pixel and will, therefore, be modified to the
new color. All highlighted objects will be ‘protected’. For more on
background substitution, see Tutorial 6. Note that the original image is
modified. You can undo this operation from the Menu Bar ‘Edit|Undo’.

There are instances when it is practical to change the background color into
a color that does not occur in the leaf or lesions, thereby simplifying any
subsequent threshold operations of the leaf and lesions.

‘Substitute Object Color’: Replaces all the pixels in the selected object by
a user-selected color (the default color is blue). This is exactly as described
above under “Substitute Background”, except that only the areas that are
highlighted (selected) are converted.

31
2. Freehand AOI: (Freehand AOI button on the Toolbar)

To select an area of interest of arbitrary shape, click on the ‘Freehand AOI’ button on the
Toolbar, go to the image and draw a curve of any shape. When you finish drawing (by
releasing the left mouse button), you will see that the shape you have drawn is filled in.
As long as the Freehand AOI option is selected, the area inside the user drawn shape will
serve as the AOI. You can draw a new Freehand AOI at any time during a session. To
view/hide the contours of the freehand area of interest, click on the ‘Freehand AOI’
button on the Toolbar.

3. Leaf AOI: (Leaf AOI button on the Toolbar)


To set the surface of the leaf as an AOI, the following steps must be performed:
1) Set the threshold levels for the leaf (make sure the leaf is highlighted).
2) Select this option from the Toolbar by clicking on the ‘Leaf AOI’ button.
3) An option in the Menu Bar (‘Tools|Always Update Leaf Mask’) is used to
enable the update of the leaf mask each time the image is thresholded to extract the
leaf (default option). If this option is disabled (not checked), the program will use
the same mask over and over, leading to erroneous results if the original image is
replaced by a different one.

32
Each time you threshold the leaf, a mask is created automatically, stored in memory and
used to restrict all subsequent processing of the lesions to this surface. Used properly, this
feature ensures that no noise is picked up from the background (assuming that the detected
leaf surface does not extend to the background) and that percent disease is never greater
than 100%. This is true even if the threshold levels for the lesions are set to the maximum.
See Tutorial 5 for an example.

VI. Spatial calibration


A) Using the scanner with Assess 2.0. No calibration is needed for the session, if the image
was scanned in Assess 2.0 or later, using Assess’s Twain interface. The calibration ratios
are recalculated with each newly scanned image and will stay valid for the session (until
changed or a scan at a different resolutions from within Assess).
B) Scanner calibration: The quick way to calibrate the system, when you know the
resolution (dpi) of the scanned image. If you open an image or import it from a source
(memory stick, hard drive, CD, Web, etc.), you can enter the scan resolution if you know
it.

To open the dialog box above, click on ‘Calibrate’ on any threshold panel. You can also
open the dialog box from the Main Menu Bar (“Tools|Calibrate”). Assess will
automatically take you to the dialog box shown above. Enter the resolution and click on
the button labeled ‘Calibrate with dpi info’. The number you enter (300 in the example
above) indicates that the scanning resolution is (was) 300 dots-per-inch. If the value you

33
entered is in any other unit, you must first convert it to dpi. Assess 2.0 allows you to
select a unit of measurement. Unlike the original version, Assess 2.0 will convert
between units. The conversion between units is independent of the calibration process.
You may open the dialog box to just change the unit of measurement, without
re-calibrating the system (assuming it was calibrated earlier).

C. Video and digital cameras

Purpose: To compute conversion factors from pixels to actual physical units in the
X and Y dimensions.

What is needed:
A surface of known size is needed to serve as a reference. A sheet of graph
paper scanned at the same resolution as the objects you intend to measure
can be used with flatbed scanners. For microscopy (video camera attached
to frame grabbers, digital cameras), the image of a haemocytometer may
provide a good reference for calibration.

Accessing the ‘Calibration’ tab sheet of the ‘Measurement defaults’ dialog box:
The dialog box (shown above) can be opened from the Threshold Panel by
clicking on the ‘Calibrate’ button or by selecting ‘Calibrate’ found under
‘Tools’ in the Menu Bar.

Performing the calibration:


1. Load the image containing the calibration grid.

2. Draw a rectangular AOI of known size. Use a large area and be as accurate
as possible.

3. Click on a radio button in the ‘Unit of Measurement’ section of the dialog


box, to select the unit of measurement for the values you will input.

4. Input the actual size of the width and the height of the rectangular AOI into
the edit boxes labelled ‘Horizontal’ and ‘Vertical’, respectively. To input
the horizontal and vertical values, click on the ‘Horizontal’ and ‘Vertical’
labels. You will be directed to the corresponding edit box, where you will
enter the physical measurement.

34
Very important: For proper calibration, you must provide both horizontal and vertical
values for the rectangle used in the calibration process. However, Assess will allow you to
calibrate a single side (X or Y), but makes the assumption that the side for which the
physical value is missing is similar to the one for which the value is provided (i.e., assigns
the same calibration value to both sides). This is highly discouraged, as only the side for
which a physical value was provided will be calibrated properly.

1. Press the ‘Calibrate’ button found on the ‘Measurement defaults’ dialog box.
2. Press OK to accept the new setting and exit the form.

Retrieving previously saved calibration values:

1. Click on the ‘Load Calibration File’ button (top left), select a previously saved
calibration file (*.cal) and double click on it.
2. Press OK to exit the dialog box.

Saving the calibration values for future use:

Click on the ‘Save Calibration File’ button (next to the ‘Load Calibration
File’ button). Select a directory, enter the new calibration file name
(without extension) and click on ‘Save’.

Note 1: The calibration values are used throughout the system to convert
measurements from pixels into physical values. If the images you are
analyzing have different scanning resolutions, you must calibrate the
system each time the resolution changes. In general, any time you suspect
the resolution has changed, you should perform a new calibration. This is
particularly true for video and digital cameras, as their vertical position on
a copy stand could be easily changed. Flatbed scanners are much more
reliable.

Note 2: The calibration values are saved in the same file as the feature extraction
options and will load together. Always check that you have the proper
values in both the ‘Scanner Calibration’ and the ‘Feature extraction
options’ pages.

35
D) Unit of measurement

The default measurement unit is the pixel (system not calibrated). Before or after
calibration (preferably before), the user must select a physical unit. Unlike the original
version, however, the calibration values are converted automatically when the user
changes physical units. For example, if you calibrated your system in inches and later
decided to view your measurements in centimeters, all you have to do is click on
‘Calibrate’ on any threshold panel; select the new unit (under ‘Unit of measurement’),
press ‘OK’ and exit. You no longer have to recalibrate a previously calibrated system.

Calibration dialog box.

36
VII. The spreadsheet

Introduction

An Excel-compatible spreadsheet is included with Assess. It is intended for data logging


only. Typically, data should be saved to disk at regular intervals and processed with other
spreadsheet or statistical programs. The user may also cut or copy data from this
spreadsheet and paste it into Microsoft Excel, Corel Quattro Pro or other spreadsheets for
processing and/or archiving.

The spreadsheet in Assess has many functions and behaviors similar to those of Excel, but
these are not described in this document, and no technical support will be available on
spreadsheet use and/or programming.

The Main Menu

There are three submenus (‘File’, ‘Edit’ and ‘Window’), which are duplicated in the
‘Spreadsheet Toolbar’ described below, except for ‘File|Page Setup’, which enables the
user to configure the spreadsheet for printing and a few self-explanatory items
(‘Edit|Insert row’, ‘Edit|Insert column’ etc.).

37
The Spreadsheet Toolbar:

Button Name Function

New Replaces current sheet with a new one

Open Opens an existing spreadsheet

Save Saves spreadsheet to disk

Print Prints contents of spreadsheet

Copy Copies selected range to clipboard

Cut Cuts selected range to clipboard

Paste Pastes compatible data from clipboard

Advance line Advances current row by one

Add header Adds a new header (column descriptor) to the


spreadsheet

Hide Hides, but does not close, the spreadsheet

Stay on top: When this option is checked, the spreadsheet remains on top (i.e.
does not disappear behind other dialog boxes or image windows).

Enable writing: When this option is checked, data from Assess will be automatically
recorded on the spreadsheet.

38
Locating a specific object in the image using its record in the spreadsheet:

• Make sure you have enabled writing to the spreadsheet and counted some
objects.

• Bring the spreadsheet to the front; locate the mouse cursor in the row
containing the record of the desired object, and click on any cell in that row.

• Go to the image (move the spreadsheet or other forms out the way), and you
should see crosshairs at the origin of the object (top left corner of the object).

Saving data to disk

The spreadsheet in Assess supports the formats listed below and shown in the figure under this
heading. Click on the drop-down window labeled ‘Save as type’ to select a file format.

Supported file formats:


• Microsoft Excel (*.xls) versions 4 and 5
• Tabbed text (*.txt)
• Tabbed text values only (*.txt) (similar to tabbed text)
• Formula One versions 2 and 3 (*.vts): proprietary format of Visual Components,
Inc., the maker of the Formula One spreadsheet used in Assess.

39
VIII. Measurement

Overview
Once an image has been loaded or acquired from an imaging device, the Threshold Panel
is used to identify objects for measurement. It is desirable that the noise in the image be
kept to a minimum and that the objects to be identified and measured be clearly visible and
large enough not to be treated as noise.

Assess measures what is highlighted on screen!

Automatic (user-independent) measurement in Assess


Assess introduces, for the first time, user-independence in disease measurement. This
attempt, as revolutionary as it may be, does not cover all diseases, unfortunately.
However, this does not mean that a general solution to automatic disease measurement
could not be implemented. It is just a matter of time and resources. For now the user
has to strictly respect the following restrictions when using the automatic measurement
features:

1. Background: The background must be white or blue and very uniform. For this
reason, a scanner will always be superior to a digital camera. The white cover of a
scanner is quite acceptable, as long as it is clean. For blue backgrounds, use a blue
sheet of paper (or a piece of blue poster board with no patterns).
2. Leaf: The leaf must be green for the algorithm to work properly. Fortunately, most
plants have green leaves! The algorithm will not work with plants such as red/purple
cabbage (wrong leaf color)!
3. Lesions: The lesions must be red-brown-purple-yellow of any shade. Lesions must not
be blue, green or white. Again, this color range covers the majority of diseases. These
include most leaf-spotting diseases, rusts (caused by basidiomycetes) and anything
similar. Diseases not covered by the algorithm include powdery mildews, white rust
(caused by oomycetes) and the like (wrong lesion/pustule/colony color). The diseases
not covered by the automatic feature can still be measured using the manual features of
Assess (e.g., the Classic or the Manual Panel)

4. How to make automatic (user-independent) measurements:


a. Bring the Automatic Panel to the front (Tools|Show Automatic Panel)
or click on the Threshold Panel button and select the Automatic Panel.
b. Percent disease: Simply click on the ‘%Area’ button. If your picture conforms
to the three conditions above, you should get a measurement almost
instantaneously!
c. Percent ground cover: Simply click on ‘%GC’ from the Automatic Panel or
on ‘%GC-Auto’ on the Agronomist panel.

40
The mechanics of measurement in Assess (manual threshold)
The process of going from an image to measurement results is very simple using
Assess. There are essentially two actions: thresholding the image to select the
objects to be measured and measuring the objects. Following are the steps
involved in the process. Please note that the automatic measurement of disease is
identical to the process described below, except that decisions to set the threshold
levels (segment the image) are mathematically based (user-independent):

1. Select ‘Leaf’ or ‘Lesion’ in the Threshold Panel, depending on what you are
about to threshold.
2. Select the color space to be used (RGB or HSI). In most cases HSI will be
the option of choice.
3. Select the color plane to be used to identify the objects of interest. For
disease measurement, ‘Hue’ is often the best. However, depending on the
image, other color planes may give better results.
4. Using the slider on the Threshold Panel, set the ‘low’ and the ‘high’
threshold levels by dragging the upper and lower thumbs, until the objects
you want to measure are accurately highlighted. The best analogy to this
operation is a coloring book, where the outline of objects is provided and
the user ‘fills in’. As the slider thumbs are moved, Assess will fill in areas
that have pixel values within the range specified between the two thumbs.
The ‘Outline’ and/or ‘Toggle’ buttons can be used to help fine-tune the
threshold levels.
5. Measurement: Once the threshold levels are set, the process is complete.
Just click on one of the four measurements provided by Assess (area,
percent area, and count or root length).
6. Note that steps 1 and 2 are generally performed only once during a session.
In disease measurement, most activity is on the slider to set the threshold
levels. It is very important that these are set properly for each image.

Working with black-and-white images


The black-and-white scale (also called gray scale) is a special case in the RGB
model, defined in the RGB cube (Appendix 2) as a set of points which have equal
values on the R,G,B axes (i.e., R = G = B). In the HSI model, the intensity
component represents the gray scale and is defined (no surprise!) as I = (R+G+B)/3.
Since there is, by definition, no predominance of any color component making up
a gray pixel, the saturation is zero. In short, a monochrome black-and-white image
consists of pixels which have a saturation of zero and undefined hue (i.e., no color).

Black-and-white images: Important note:


One should never attempt to use the saturation or hue planes (HSI color space)
to analyze a black-and-white image. In this version of Assess, you can use any

41
of the R, G, B of the RGB color space or the Intensity color plane of the HSI color
space. The use of R, G, and B will yield identical results, as they are equal by
definition.

The following sections deal essentially with color images.

Selecting a color space

In most cases the Hue-Saturation-Intensity (HSI) color space is the one to use. The
advantage of this color space in analysis of color images resides in the fact that the
three components (H, S, I) are independent, as opposed to RGB, where the R, G and
B components are not independent. Furthermore, the HSI model is more intuitive
and corresponds to our understanding of color.

Selecting a color plane

True color pixels (24 bits) consist of three components, each with 256 possible
values (8 bits). These components are R, G, B in the RGB color space and H, S, I
in the HSI color space. Think of a color plane as a two-dimensional matrix that
holds one component only (i.e., all the red values of an image are together, all the
blue values are together etc.). In fact Assess uses six of these planes (R, G, B and
H, S, I). When you select a color plane in the Threshold Panel, you are in fact
setting a pointer to one of these matrices (they are actually not organized separately,
but they are accessed as if they were). In order to speed up the analysis, we look at
one plane at a time. Since a single component can have at most 256 values,
computing is much faster and the meaning easier to grasp than if we were dealing
with 16.7 million values at once. For example, an intensity of 128 represents the
middle gray and is situated halfway between pure white and pure black. Try to
imagine or understand what a value of 15,893,437 means!

When to use ‘Hue’:

Never use Hue with black-and-white images!

The Hue component represents ‘pure colors’ and is very effective in separating
different-colored objects (green vs. red, for example). In disease measurement,
we are interested in 1) separating the entire leaf from the background and then 2)
separating the lesions from the leaf. If precautions were taken to use a background
color different from those of the leaf and lesions, using Hue will make it very easy
and rapid to threshold images and perform measurements.

42
When to use ‘Intensity’:

Intensity is the only color plane in the HSI color space to use for analysis of
black-and-white images!

Intensity should always be used with black-and-white images. With color


images, use Intensity if the objects you want to measure are brighter
than the background. Typical use of intensity is in leaf area measurement
(not disease measurement) in systems where images are backlit (light
coming from behind the objects, such as from a light box). The object is
generally dark and the background light.

When to use ‘Saturation’:

Never use Saturation with black-and-white images!

Monochrome images (gray pixels) have a saturation of zero.


Understandably, saturation should be used only with color images.
Saturation is most useful in cases when colors are of the same range (i.e.,
from faded green to deep green or from faded red to vivid red). Saturation
will separate objects of similar hues, but varying in the amount of
white mixed with the hue.

Disease measurement from color images with white backgrounds:


Another use of Saturation, specific to this application, is in cases when
pictures of leaves have been taken on a white background. The saturation
value of white background pixels will be very close to zero, and those of the
leaf and lesion much higher. On the other hand, hues associated with a
white color are generally undefined (default to zero in Assess). A hue of
zero is a color similar to a hue of 255 (see Appendix) and ‘white-looking’
pixels in the background having the same hue as lesion pixels will,
therefore, be selected, causing problems in thresholding operations.
Solution: we can use the Saturation plane to separate non-colored
(background) from colored objects (leaves). (See Tutorials 5 and 6.)

Replacing a white background in a color image with a new color:


As in the point above, threshold the leaf using Saturation. Once the entire
leaf has been highlighted on the overlay, right-click on the rectangular AOI
tool if it is active (visible) to display the popup menu (see Chapter V,
‘Working with the Area of Interest’) and select ‘Substitute Background’.
All the areas not overlaid with white will be converted to a default color
(Assess defaults to blue). You can now measure disease percent using
the hue for both leaf and lesions! (See Tutorials 5 and 6 for a
demonstration.)

43
How to optimize images for measurement:
There are no special requirements for sample preparation prior to
measurement with Assess. However, you can significantly improve the time
you spend setting up threshold levels, if you take some simple actions prior
to acquiring your images.

1. Background color:
Before taking pictures (scanning or otherwise), select a background color
that does not occur in your sample. Since the whole process consists of
separating the background from the objects of interest, it makes sense to put
the odds in your favour by selecting a background color different from the
objects.
• Scanner: Cover the leaf samples with a blue cardboard prior to
scanning (assuming you are working with leaves).

• Video and digital cameras: In the field, place a blue piece of


fabric or cardboard under the leaf samples. In a laboratory, you
could build-in a glass window’under the camera. Place a flat blue
object (cardboard, fabric) 20 or 30 cm below the glass. The shadow
of the samples is projected onto the fabric or cardboard. Relatively
uniform backgrounds can be obtained with this setting.

• Using Assess as a ‘leaf area meter’: If you are using a video


camera, backlighting is the preferred method. You do not need any
colored material, since you will be measuring a dark object against a
bright background.

2. Hardware setup:
Color analysis: If you intend to characterize objects for color, turn off the
automatic features of the camera if possible. Adjust the lighting manually,
and avoid using the automatic gain control of the camera. This feature may
introduce noise into the image, when the camera tries to compensate for low
light. Incandescent bulbs are preferable to fluorescent tubes (with video
cameras). These suggestions are meant to provide greater control over the
acquisition process and to reduce ‘random’ conditions created by the
camera’s electronics.

3. Hardware quality:
The quality of the hardware used to acquire images is very critical. For
color analysis (such as used in disease measurement), the colors should be
balanced as much as possible. The green of the leaf should look green and
not bluish green, for example. Sometimes, a proper setup of the hardware
and appropriate lighting (video and digital cameras) is all that is needed.

44
IX. The image histogram
The image histogram is an additional tool to help you decide which color
space/color plane to use in separating the leaf from the background and the lesions
from the leaf. In fact the thresholding and measurements operations in Assess are
based on the image histogram.

What is an image histogram? The image histogram is a representation of an


image based on the distribution of pixel values contained in the image (0-255 for
each color plane). The distribution of pixels is plotted as a bar graph, where the
X-axis represents the pixel values (0-255) and the Y-axis the number of pixels in
each class. Assess plots and displays one color plane at a time.

Accessing the histogram


The Histogram dialog box (shown below) is called from the Menu Bar by
selecting ‘Image|Show Histogram’. Once opened, the dialog box will
display the histogram of the image in the active image window (the top
image window, if you have multiple images opened simultaneously).

Using the histogram for thresholding


The presence of multiple peaks separated by low regions (valleys) is
indicative of clustering of pixels; some of these clusters may represent the
objects we are interested in. In such (lucky) cases, the flat region between
peaks is likely to contain a good cut off point for thresholding an image.

Description and operation of the Histogram dialog box

‘Link to Threshold Panel’ check box:


When this box is checked, the action on the histogram dialog box is
reflected in the Threshold Panel and vice versa. With this option selected,
the histogram represents the Rectangular AOI currently selected on the
active image window, otherwise the displayed histogram is that of the entire
image. When this box is checked, the color plane can be selected only
from the Threshold Panel.
‘Smooth’ check box:
Check this box (default) to enable Histogram smoothing. In most cases, the
‘raw’ histogram needs to be transformed to reveal the presence of peaks,
which may correspond to objects of interest.
Smoothing tool:
The track bar labeled ‘Histogram smoothing tool’ in the figure below
allows you to interactively ‘smooth’ the histogram. To set the level of
smoothing you may 1) drag the track bar thumb 2) click on the middle track
or 3) use the arrows and PgDn-PgUp keys. Each time the track bar thumb
position is changed, the histogram is transformed accordingly and

45
displayed. Typically, you will move the track bar thumb slowly (or use the
keyboard) until you see the peaks you are interested in. These multiple
peaks may or may not be present. Also, their presence may or may not
correspond to an object of interest. In the figure shown below, the three
peaks correspond to three objects of interest (lesions, healthy tissue and
background).

‘Blinking’ check box:


This check box is effective only when the Histogram dialog box is linked to
the Threshold Panel. The histogram bars corresponding to the selected
range will blink. This has no other purpose than visualizing the threshold
levels.

The spin buttons on the left and right of the histogram box:
You can use these buttons to fine-tune the threshold levels. The buttons on
the left control the low threshold level and the ones on the right the high
threshold level.

Selection tool (rectangle):


This tool is similar to the rectangular selection tool used to select an AOI
described in Chapter V. In the Histogram dialog box, the rectangle both

46
represents and controls the threshold levels. The left and right sides of the
rectangle correspond, respectively, to the low and high threshold levels.
Their positions on the X axis are exactly the same as those of the thumbs on
the slider in the Threshold Panel, when the ‘Link to Threshold Panel’ check
box is checked.

Setting threshold levels with the rectangular tool:


• Simply stretch the rectangle or move it left or right
• The vertical size and/or vertical movements have no effect.

If the selection tool is not visible:


• Link to Threshold Panel’ is probably not checked.
• If ‘Link to Threshold Panel’ is checked and the rectangular tool is not
visible, use the spin buttons on the Histogram dialog box or the slider
on the Threshold Panel to set a non zero range. It is likely that the
low and high threshold levels are of the same value, giving the
rectangular tool a length of zero (i.e., making it invisible).

‘Apply’ button:
Click on the ‘Apply’ button after using the spin buttons. The positions of
the left and right sides of the rectangular tool are communicated to the
Threshold Panel, and the image is thresholded with the new values.

Popup menu:
To zoom in or out the histogram, right-click anywhere on the Histogram
dialog box and select a magnification factor.

Popup menu: zooming and displaying data

47
X. Feature extraction
The features shown below and described in detail in the next table are available in the
‘Count’ operation only. It is assumed that threshold levels have been set and objects
identified on the overlay.

How to open the form show above:


• Click on ‘Options’ in the Threshold Panel.
• Alternatively, select ‘Tools|Measurement options’ from the Menu Bar.

In addition to feature selection, you can also set up how counting is performed:
• ‘Accept edge-touching objects’ check box: When checked, objects touching the
edge of the rectangular AOI will be accepted (measured). Generally, you would
reject objects that are touching the edge, as they may represent only portions of
the real objects you are interested in.

• ‘Label objects’ check box: At the end of the ‘Count’ operation, Assess will label
each object if this check box is set. If you have many objects on the screen (100s
or 1000s) you may want to turn-off labeling, as the screen may become very
crowded. Generally, this option is kept on.

48
• ‘Show axis’ check box: When this option is on, Assess will draw the long axis
of each object (even if this option is not selected for extraction).

• ‘Separate objects’ check box: Check this box if you want Assess to separate
the objects automatically, before the counting process starts. You can do the
same thing manually from the Threshold Panel. However, you will have to
remember to do it. Use this option if the objects you are measuring are
touching each other (not overlapping).

• Exclude objects
o ‘Less than’: Enter the smallest size of an object (in pixels) to be
accepted. Any object of a smaller size will be rejected.

o ‘Greater than’: Enter the size of the largest object (in pixels) to be
accepted. Anything larger will be rejected.

Description of features available in Assess


For the meaning of some of the features available, refer to the figure below.

Feature Description

Origin x,y coordinates of the topmost left pixel of the object (in pixels).
x,y coordinates of ‘center of gravity’ of the object, computed from
Centroid the object boundary as X= Σxi/n and Y = Σyi/n, where n = number
of edge pixels.
Area of the object highlighted on screen. Area of holes inside the
Area without holes
boundary is not counted.
Total area of object computed from boundary pixels coordinates by
Area with holes integration. Holes inside the boundary are included and measured
as part of the object. Total Area = ½Σ(xiyi+1-xi+1yi ), where x,y are
(total area)
the coordinates of boundary pixels. Total area is then corrected for
pixels located under the object’s contour.
Number of edge pixels The number pixels on the boundary of the object.
The average ‘darkness’ of an object. The higher the value, the
darker the object. Computed as I.D. = (Σ (255-i)*ni)/N, where i is
Integrated density the intensity class (from 0 to 255), ni the number of pixels in class
i, and N the total number of pixels in the object, defined as N =Σni.
Note that this feature is not an OD (optical density).

49
Perimeter The length of the boundary of the object, adjusted for aspect ratio.
Length The longest axis of the object (length of bounding rectangle).
Width The greatest width of the object (width of bounding rectangle).
Width at centroid The width of the object passing through the centroid
Elongation The ratio of Length to Width, always greater than or equal to 1.
Describes how circular the object is. Computed as
Roundness = Sqr(Perimeter)/(4*Area), where ‘Area’ is the total
Roundness
area of the object. A value close to 1 indicates that the object is
nearly circular.
Difference between x coordinates of the centroid and the center of
X symmetry bounding box. A value of or close to 0 indicates symmetry relative
to the x axis.
Difference between y coordinates of the centroid and the center of
Y symmetry bounding box. A value of or close to 0 indicates symmetry relative
to the y axis.
Arithmetic mean of the Red, Green and Blue values of the object.
Average R is computed by adding all the R values of an object and
Average R,G,B
dividing by the total number of pixels. Averages of G and B values
are computed in a similar manner.
The mode of the Red, Green and Blue distributions of the object.
Mode R,G,B Represents the most prominent value. The mode is the class with
the largest number of pixels.
Arithmetic mean of Hue, Saturation and Intensity of the object.
Average H,S,I Computed as in ‘Average R, G, B’. Note: This will return an
integer value.
Like R, G, B mode, but computed from H,S,I histograms. The
Mode H,S,I mode statistic may be a better descriptor than the arithmetic mean
in some cases (hue, for example).

Same as AVG H,S,I but for HSV color space. Note: This will
Average H,S,V
return an integer value.

Mode H,S,V Same as H,S,I mode but computed for HSV color space.

50
The average value of each of the CIE L, a and b components. Note:
Average CIE L,a,b
This will return an integer value.

The mode for each of the L, a and b components. Note: This will
Mode CIE L,a,b return an integer value.

Features extracted by Assess

51
XI. The Digital Ruler

Click on the ‘Digital Ruler’ button on the Toolbar. A dialog box will be displayed as
shown below:
1. Click on the buttons at the top left of the dialog box to select an option (line, rectangle,
horizontal line, vertical line, freehand drawing).

Graphical hint shows


real-time measurement

Save to spreadsheet

2. Position the mouse cursor on the boundary of the object you want to measure, hold down
the left mouse button, and move the mouse. As the mouse moves, Assess will compute, in
real time, the length and angle (from the horizontal) of the line or the area of the rectangle.
These data are not sent to the spreadsheet. The user must copy them manually. The unit
area is given in both pixels and physical units, if the system was previously calibrated.
3. When done, you must close the dialog box by clicking on the ‘Digital Ruler’ button
on the Toolbar or on the [x] in the upper right corner of the dialog box. You cannot use the
AOI when this feature is enabled. See Tutorial 8.

52
The features of the digital ruler are described below.

Button Description

Line drawing. Returns length of line and angle from horizontal.

Freehand curve drawing. Returns length of curve.

Horizontal line drawing. Returns length of horizontal line.

Vertical line drawing. Returns length of vertical line.

Rectangle Drawing. Returns the perimeter and area of the rectangle.

Freehand drawing. The curve is closed when the user releases the mouse.
Returns the length of the curve (perimeter) and area enclosed by the curve.

Selects the drawing color.

53
XII. Filtering
The filtering operations listed below work on the original RGB image only. Only the AOI
is processed. The effects of these filters can be undone from ‘Edit|Undo’.
The filters are included for convenience only. In most cases they are not needed for image
measurement. Some of them (High Pass, Emboss, Laplacian, Sobel, Sharpen, Negative)
should never be used on images that are meant for measurement. They have unwanted
effects which interfere with image segmentation (thresholding).

Executing a digital filter:

Go to ‘Filter’ on the main menu bar and select one option.

Filters:

Note: Except for the Median Filter, all the filtering operations listed
below are convolutions and use specific kernels (two-dimensional
matrices) to achieve their respective effects.

1. Laplacian: A general purpose edge detection filter.

2. Sobel: A two-directional (Y-X) edge detection filter, which


produces stronger outlines than the Laplacian.

3. Sharpen: Performs a digital sharpening.

4. Blur: Produces a slightly blurred image by averaging


neighboring pixels.

5. High Pass: Enhances ‘high energy’ pixels in an image (similar to but not identical
to sharpening) .

6. Low Pass: Removes ‘high energy’ pixels from an image (similar to but not
identical to blurring).

7. Negative: Produces a negative of the image.

8. Emboss (NW, NE, West): ‘Cosmetic’ filters. These non standard filters produce
a pseudo-3D effect.

9. General Convolution

1. 3x3: Make your own 3 x 3 kernel and apply it to the image.


2. 5x5: Make a 5 x 5 filter.
3. File: Load a large kernel (up to 15 x 15) from file and apply it to the image.
The menu item is renamed with the kernel’s file name.

54
10. Median Filter: Performs a median filter on the original RGB image. This filter
removes some noise and has a smoothing effect. See the description of the median
filter in Chapter III, ‘The Threshold Panels’.

11. User 3x3: This is the kernel designed under ‘General Convolution|3x3', or
loaded through ‘General Convolution|File’. You can now use it with any
subsequent images.

12. User 5x5: Same as ‘User 3x3’ above, except that the kernel is 5 x 5.

55
XIII. Macro utility
Overview
Assess provides a simple macro language to enable the user to automate some commonly
used operations. Batch file processing is also supported. However, the user is cautioned
against using unattended batch processing in performing thresholding and measurements,
as each image tends to be different.

A user macro program can be developed from within Assess as explained below. This is
the preferred method, as it eliminates the potential for syntax errors. However, macro
programs can be written in any word processor and saved as a text file, with no formatting.

Several sample macros are provided with Assess. Feel free to use and modify them (at
your own risk!). Just remember, the computer will execute any command that you issue,
correct or incorrect! While the utility provided in Assess eliminates syntax errors, the user
should carefully check for the order in which the commands are issued (i.e., program logic).
Assess does not check for any logic errors.

1. How to create a macro

Open the macro utility by selecting ‘Macro|Create macro’.

The commands in the list boxes on the left are grouped by function and color coded for
visibility. The list box on the right (white) is where the user program will be placed.

56
How to add a command
There are two ways you can add commands to the user list:
• Double-click on a command from the list of available commands to append it
to the end of the program.
• Select a command from the list, drag it to your program and drop it. This
method allows you to place the command anywhere within a program.

How to delete and move commands and clear the macro list

• You can delete one or more commands from your program by selecting them
and pressing the ‘Delete’ key or clicking on the ‘Delete’ button provided on
the form.
• You can use the ‘Up’ and ‘Down’ buttons (red arrow icons) on the form to
move a selected command up and down
• The program may be cleared (erased) by the ‘Clear’ button on the form.

Testing your macro program

Click on the ‘Test Macro’ button.

Pausing and resuming execution during testing

If a ‘Pause’ command was issued from within your macro program, the button
below the ‘Test Macro’ button will display ‘Resume’. Simply click on ‘Resume’
to continue execution.

Posting a macro

Click on ‘Post Macro’ when your program is ready. Your macro program is then
stored in memory and can be ‘played’ by the Macro Player described below. You
should always post your macro after editing.

Saving a macro program

Click on ‘Save Macro’ to display the Windows Save dialog box, locate the desired
directory, name the file and save it. Macros should be given a ‘.mac’ extension.

Loading a macro for editing and testing

Click on the ‘Load Macro’ button to display the Windows Open dialog box, select
a macro file (.mac) and open it (double-click or press on ‘Open’).

2. Recording a macro

57
You can record user activity by selecting ‘Macro|Record Mode’ from the Menu
Bar. The macro utility box will open, and user activity on the Threshold Panel is
automatically logged in the ‘User Macro List’. Note that not all activity is recorded.
This feature may be disabled in Assess 2.0.

Downloading the current settings of the Threshold Panel

Click on the button labeled ‘Settings’ (see the figure on the left of this paragraph)
to download the current settings of the Threshold Panel. Typically, you would
suspend recording (as described below), set the color space, the color plane and the
threshold levels for ‘Leaf’ and ‘Lesion’ of an image to be used as your default in
future processing. The color space, color plane and threshold levels of each of the
‘Leaf’ and ‘Lesion’ will be recorded in your macro program. Now you can click on
the ‘Resume Rec’ button to resume recording.

Suspend recording without turning-off the record mode

Click on the ‘Suspend’ button to temporarily suspend recording. The icon on the
button will turn red and the button label should read ‘Resume Rec’.

Resume recording

Click on the ‘Resume’ button (same as ‘Suspend’) to resume recording operations.


The icon on the button should start blinking in green to indicate that recording is
enabled.

Turning off the recording mode

Select ‘Macro|Record Mode’ from the Menu Bar. You should always turn off
recording when you are done.

3. Editing an existing macro

Select ‘Macro|Edit Macro’ from the Menu Bar. If the player is on and loaded
with a macro or if you have previously ‘posted’ one, it will automatically be
loaded in the ‘User Macro List’ of the macro utility form shown above. If the
player is not open, the macro utility form will be opened, and you can load a new
macro.

Once a macro is loaded onto the form, you may edit it by adding, removing or
recording new commands. You must post it or save it. If you post it while the
Macro Player is on, the edited macro program will replace the old one in the player.

58
4. Macro Player

Select ‘Macro|Play a Macro’ to open the Macro Player (shown below).

Collapsed version of the


Macro Player
If you are using batch
processing, drop files to be
processed here.

Expanded version of the Macro Player

Generally, the Macro Player is loaded when it is opened. However, if the list box on the
left is empty, you must load a new macro.

Loading a macro:
Click on the ‘Load macro’ button, which is visible on the expanded form only,
and load a macro.

Playing a macro:
Click on the ‘Play’ button.

Batch processing:
This option is part of your macro. If there is one occurrence of ‘Batch_Process’
command in you macro, you are expected to provide at least one file name. File
names of images to be processed are placed in the corresponding list box (the
yellow box on the right of the form).

Loading file names for batch processing:


The Macro Player supports ‘drag-and-drop’ operations from Windows Explorer.
Simply select one or more files, drag and drop them into the list box.
Alternatively, use the ‘Files’ button on the Macro Player to select files.

Loading/saving a file list into the Macro Player:


Once image files have been selected, the user may save that list to the hard disk
for later use. Since the macro utility (and the Macro Player) can take pictures
from different subfolders, a list can be very practical and should be saved if the

59
intent is to reuse it later. To load the file list, click on ‘File’ on the macro player
menu and select ‘Open File List’ or ‘Reopen File List’. To save the file list go
to ‘File|Save File List’ on the Macro Player.

Deleting files from the file list:


Select the files you want to delete and press the ‘Delete’ key. You can also use
“Edit|Delete” on the Macro Player’s menu.

Editing a macro:
You cannot edit a macro from the Macro Player. Go to the Menu Bar and select
‘Macro|Edit Macro’. The macro utility form described previously will be
opened and will contain your macro. You must use the ‘Post Macro’ button at the
end of the editing to apply the changes to the macro program in the Macro Player.

Suspending/resuming macro execution:

• You can click on the ‘Suspend’ button if you are running a batch. This button
has no effect on the execution of the ‘loop’, i.e., all the commands after
‘Start_batch_here’. The program will pause after finishing the current file, not
the current operation.

• You can pause the execution of the loop programmatically by inserting a


‘Pause’ command. The program will pause to let you perform whatever tasks
you need. In general you should not take drastic actions such as deleting the
current image when the macro is suspended. When execution is resumed, the
interpreter expects to find an image to process.

• Always finish the job by clicking on the ‘Resume’ or the ‘Abort’ button, or
the pause loop will continue executing until you close the entire application.
This obviously may result in wasted time resources on the CPU and may also
cause unexpected behavior of the program.

Expanding/collapsing the Macro Player:

Click on the ‘Collapse/Expand’ button to shrink or expand the Macro Player.

Progress bar:

The progress bar on the Macro Player displays the percentage of files processed.
It will be inactive if you are not running a batch.

60
5. Macro language reference

The following macro commands (routines) are available in Assess. The macro commands
are case-insensitive.

Macro command Description

The following routines work on whole images. They are


Control and Input/Output used to set the type of macro program, to select directories
Routines for saving files and to save files in various formats.

//<Comment> Add a comment to a macro program. This command is


ignored by the interpreter.

A flag to indicate that batch processing will take place. If


Batch_Process this command is issued, Assess will expect a list of files to
be processed. You will input this list in the Macro Player
form at execution time. (See Macro Player above.)

A flag to indicate the position where the processing starts on


Start_Batch_here each of the files supplied. All the commands between this
call and the end of the macro program will be executed on
each file.

Macro_End End of macro. For future use only. Ignored in this version.

Macro_Start Start of macro. For future use only. Ignored in this version.

The Macro Player will pause to allow the user to perform


some operations such as setting threshold levels, selecting
a default color, setting up features for extraction etc. The
Pause
user must click on the ‘Resume’ button provided on the
Macro Player dialog box. The macro will resume executing
at the position immediately following ‘Pause’.

Get_FileName Will prompt you at execution time for a file name.

Open_File() Will prompt for a file name at design time. Use this option
if you know exactly the name and the path of the file.

Selects the ‘Smooth (Median)’ filter on the Threshold


Set_TPFilter_Median Panel. Each thresholding operation is followed by a median
filter on the overlay.

61
Selects the ‘Close’ filter on the Threshold Panel. Each
Set_TPFilter_CloseBlob thresholding operation is followed by this filter on the
overlay.

Disable filtering on the Threshold Panel. Thresholding


Set_TPFilter_None operations are not followed by any filter. You should issue
your own filtering commands (if needed).

Selects the ‘Open’ filter on the Threshold Panel. Each


Set_TPFilter_OpenBlob thresholding operation is followed by this filter on the
overlay.

Will open a dialog box to enable the user to set a directory


Set_Save_Directory where files can be saved. Execution resumes after the user
closes the dialog box.

The Save_as_xxx routines will output to a directory set by a previous call to


‘Set_Save_Directory’.

Save_as_JPG Saves the currently opened image in JPG format.

Saves the currently opened image in Windows bitmap


Save_as_BMP
(.BMP) format.

Saves the currently opened image in Encapsulated PostScript


Save_as_EPS
(.EPS) format.

Save_as_TGA Saves the currently opened image in Targa (.TGA) format.

Save_as_TIF Saves the currently opened image in TIF format.

Save_as_PNG Saves the currently opened image in Portable Network


Graphic (.PNG) format.

Save_as_PCX Saves the currently opened image in PCX format.

62
Setup routines

Sets the rectangular AOI. You will be prompted for


coordinates of the top left and bottom right corners. The
Set_Rectangular_AOI coordinate system has its origin at the top left (0,0), not at
the bottom left of the image; the parameters (x1,y1)
represent the top left corner of the rectangle, and (x2,y2) the
bottom right corner. Note: the values are in pixels (integer
values).

Opens the ‘Features’ dialog box to enable the user to select


Set_Lesion_Features which features are to be extracted in subsequent calls to
‘Get_Lesion_Count’.

Turns off writing to the spreadsheet. A call to


Set_SpreadSheet_OFF
Set_SpreadSheet_ON is required to re-enable writing.

Turns on writing to the spreadsheet. Valid only with


Set_SpreadSheet_ON
measurement commands.
Automatic setting of threshold levels for the leaf in an image.
Set_Leaf_Threshold_Auto Use only for disease-related operations, not for ground
cover.
Automatic setting of threshold levels for the lesions on a
Set_Lesion_Threshold_Auto green leaf. Use only for disease-related operations, not for
ground cover.
Automatic setting of threshold levels for green plants in a
Set_Vegetation_Threshold_Auto (“brownish”) field. Use only for ground cover operations,
not for diseases.
Will set the threshold level for the ground to Low= 0 and
Set_Field_Threshold_Auto
High=255 (entire image).
Sets the high threshold level for whatever options are current
SetHighThreshold(n: byte) (color plane, color space and leaf/lesion). A parameter is
needed. The routine takes a value from 0 to 255.

SetHSIColorSpace Sets the color space to HSI.

Selects the ‘Leaf’ in the ‘Leaf/Lesion’ option of the


Select_Leaf
Threshold Panel.

Selects the ‘Lesion’ in the ‘Leaf/Lesion’ option of the


Select_Lesion
Threshold Panel.

63
Selects the Red color plane. A call to
Select_RedPlane ‘SetRGBColorSpace’is required before issuing this
command.

Selects the Green color plane. A call to


Select_GreenPlane ‘SetRGBColorSpace’ is required before issuing this
command.

Selects the Blue color plane. A call to ‘SetRGBColorSpace’


Select_BluePlane
is required before issuing this command.

Selects the Hue color plane. A call to ‘SetHSIColorSpace’ is


Select_HuePlane
required before issuing this command.

Selects the Saturation color plane. A call to


Select_SaturationPlane ‘SetHSIColorSpace’ is required before issuing this
command.

Selects the Intensity color plane. A call to


Select_IntensityPlane ‘SetHSIColorSpace’ is required before issuing this
command.

Sets the low threshold level for whatever options are current
SetLowThreshold (value: byte) (color plane, color space and leaf/lesion). A parameter is
needed. The routine takes a value from 0 to 255.

SetRGBColorSpace Sets the color space to RGB.

Reset_AOI Sets the AOI to the entire image.

The commands listed below are restricted to the AOI. If


you want the processing to be performed on the entire
Processing routines image, a call to ‘Reset_AOI’ must be issued prior to
calling these processing routines. A call to
‘Ovl_Threshold_Image’ must precede this command.

Ovl_Close Performs a binary close operation on the overlay.

Performs a binary dilation on the overlay. The number of


Ovl_Dilate (n: byte) dilations to be executed as a parameter must be supplied. If
no number is supplied, the routine will execute once.

64
Performs a binary erosion on the overlay. The number of
Ovl_Erode(n: byte) erosions to be executed as a parameter must be supplied. If
no number is supplied, the routine will execute once.

Ovl_Open Performs a binary ‘Open’ operation on the overlay.

Ovl_Median Performs a median filter on the overlay.

Ovl_Draw_Outline Draws the outlines of the selected objects on the overlay.

Executes a ‘skeletonization’ operation on the overlay. The


Ovl_Skeletonize
objects will be thinned to the width of a single pixel.

Ovl_Watershed Performs an automatic separation of touching objects.

Ovl_ClearOverlay Clears the overlay. Works on entire image.

Thresholds the image with the current settings of


‘Leaf-Lesion’, color space, color plane and threshold levels.
Ovl_Threshold_Image Works on Rectangular AOI. Issue a call to ‘Reset_AOI’
prior to calling ‘Ovl_Threshold_Image’ if you need to
threshold the entire image.

The following filtering and processing routines work on


Filtering and Processing the original RGB image. Only the AOI is processed.
routines Issue a prior call to ‘Reset_AOI’ if you need to filter the
entire image.

RGB_Median_Filter Performs a median filter on the original RGB image.

RGB_LowPass_Filter Performs a low-pass filter on the original RGB image.

RGB_HiPass_Filter Performs a high-pass filter on the original RGB image.

RGB_Emboss_NE_Filter Performs an embossing filter on the original RGB image.

RGB_Emboss_NW_Filter Performs an embossing filter on the original RGB image.

RGB_Emboss_W_Filter Performs an embossing filter on the original RGB image.

RGB_Negative_Filter Converts the original RGB image into a ‘negative’.

RGB_Sharpen_Filter Performs a sharpening filter on the original RGB image.

65
RGB_Sobel_Filter Performs an edge-detection filter on the original RGB image.

RGB_Laplacian Filter Performs an edge-detection filter on the original RGB image.

RGB_To_Monochrome Converts original RGB image to black-and-white.

RGB_Blur_Filter Performs a ‘blurring’ filter on the original RGB image.

Converts all pixels not selected by a previous call to


‘Ovl_Threshold_Image’ by a default color. It is very
important that the objects that the user does not want to
RGB_Substitute_Background
convert be protected by the overlay. If nothing is overlaid,
all the pixels of the image will be considered as background
pixels and converted.

Opens a standard Windows color dialog box. The user will


RGB_Set_BackGround_Color
select a color and close the box.
Loads a convolution kernel (see help file) into Assess. This
is a one-time call. The kernel will stay in memory and can
be called from Assess’s Main Menu Bar (‘Filter|General
RGB_Load_UserKernel Convolution|File’). The Menu item’s name will be the
kernel’s filename. If you load a second kernel from the
menu or from a macro, the new kernel will replace the old
one. Only one user-provided kernel is kept in memory.
Applies the convolution kernel entered by a previous call to
RGB_User_Filter ‘RGB_Load_UserKernel’

The following routines work on the AOI only. Issue a


Measurement Routines
‘Reset_AOI’ to process the entire overlay.
Computes the area of the “leaf’ selected on the overlay. A
call to ‘Ovl_Threshold_Image’ is necessary before calling
Get_Leaf_Area ‘Get_Leaf_Area’. If you want the results saved in the
spreadsheet you must issue a call to ‘Set_Spreadsheet_On’
prior to calling this routine.
Computes the area of the ‘lesions’ selected on the overlay.
A call to ‘Ovl_Threshold_Image’ is necessary before calling
Get_Lesion_Area ‘Get_Lesion_Area’. If you want the results saved in the
spreadsheet you must issue a call to ‘Set_Spreadsheet_On’
prior to calling this routine.

66
Counts and measures the objects on the overlay. A call to
‘Ovl_Threshold_Image’ is necessary before calling
‘Get_Lesion_Count’. If you want the results saved in the
Get_Lesion_Count spreadsheet you must issue a call to ‘Set_Spreadsheet_On’
prior to calling this routine. Also, you must set the features
to be extracted (using the ‘Options’ button on the Threshold
Panel) before making this call.

Computes the percent area infected. This call must be


preceded by successive calls ‘Get_Leaf_Area’ and
Get_Percent_Disease
‘Get_Lesion_Area’. This is different from the ‘%Area’
feature of the Threshold Panel.

Measures root length. The roots must be selected by a call to


‘Ovl_Threshold_Image’ and any desired filtering of the
Get_Root_Length overlay prior to issuing the ‘Get_Root_Length’ command.
Results are sent to the spreadsheet if a previous call to
‘Set_Spreadsheet_On’ was issued.
This operation is equivalent to the “Detail” operation of the
“Manual Panel”. After the threshold levels for leaf and
Get_Percent_per_Leaf lesions have been set (by any method), this operation will
perform a disease measurement for each leaf on the image,
using the set levels.
Computes percent infection automatically
(user-independent).
Restrictions: Leaves must be green; lesions must be
Get_Percent_Disease_Auto
reddish-brown-yellow. The background must be blue or
white and uniform. Percent disease will be written to the
spreadsheet if enabled.
Computes percent infection automatically
(user-independent) for individual leaves in an image. It is
the automatic version of the “Get_Percent_Per_Leaf”
Get_Percent_Per_Leaf_Auto
described above.
Restrictions: Same as ‘Get_Percent_Disease_Auto’ above.
Percent disease will be written to the spreadsheet if enabled.
Computes percent ground cover automatically
Get_Ground_Cover_Auto (user-independent).
Restrictions: Plants must be green and ground brown-red.

See Tutorials 16 and 19 for an example.

67
XIV. Image menu
The Image menu consists of items related to work with images, once they are opened.

Enhance Image: Use this option to adjust the brightness, contrast and colors of an opened
image. Some elementary filtering options are also available with this option.

Note: Use the ‘Apply’ button after each process if you


want the last change to become permanent, before
processing the image further. At the end of your processing
select ‘Accept changes and Exit’ to keep the changes or
‘Cancel and exit’ to cancel the changes.

Enhance image form Image Menu

Gamma (brightness): This menu item will display a dialog box. You can adjust the
gamma value of the image. This will make the image darker (low gamma) or brighter (high
gamma).

Histogram Equalize: Performs histogram equalization.

Suggest threshold for % disease: This command assumes that you are working with a
color image of diseased leaves taken on a blue background. It is also assumed that
the leaves are green and the lesions/pustules yellow-red-brown (common colors for
most foliar diseases).
This command will set the Threshold Panel to Hue for both leaves and lesions and
determine the threshold levels. You may need to make small adjustments depending on
your particular circumstances. This feature is now replaced with the automatic disease
measurement found on the Automatic Panel.

68
Suggest threshold for % ground cover: This command is similar to the one above. It is
used with seedlings only. Because we only have to threshold for the seedlings, this
procedure has a higher success rate than for diseases. It is assumed that the seedlings are
green with no flowers. This feature is now replaced with the automatic feature of
user-independent ground cover measurement found on the The Agronomist and the
Automatic Panel.

Note: Both commands provide you with tentative threshold levels in the HSI/HSV color
spaces. You must check that the objects of interest have been accurately identified and
take appropriate action if they are not. As an exercise, you can open ‘TestLeaf.png’ and
use it with ‘Suggest threshold for % disease’ (use the ‘%Auto’ feature of the
Automatic Panel to compare). You can try ‘canola2.tif’, ‘fababeans.png’ and
‘fababean_weeds.png’ with ‘Suggest threshold for % ground cover’. Try the ‘%GC’
from the Automatic Panel or the ‘%GC-Auto’ from the Agronomist Panel to
automatically measure ground cover.

Watershed Segmentation: Automatic separation of objects. This procedure is partly


based on the ‘Euclidian Distance Map’ (EDM) algorithm as described in J.C. Russ (1998)
and implemented in NIH-Image (http://rsb.info.nih.gov/nih-image/)

Show Histogram: Will call the histogram dialog box described in Chapter VIII (The
Image Histogram).

Clear Image: Erases the color image. You can undo this operation from ‘Edit|undo’

Clear Overlay: Erases the overlay. You must perform a threshold operation again, if you
wanted to measure objects.

Add Overlay to Image: Adds the content of the overlay to the original image. This
feature is for documentation only. The image can then be saved and used in publication
and/or presentation. You must not use the image for measurement.

Make new bitmap from AOI: This feature is the same as the one in the rectangular AOI
tool described in Chapter V (Working with the Area of Interest). This command creates a
new image window containing the portion of the image corresponding to the current
rectangular AOI.

Color Space: In addition to the RGB color space (available on the Threshold Panel), you
can select one of three alternative models (HSV, HIS and CIE L*a*b). Assess defaults
‘arbitrarily’ to HSV. The automatic measurements (on the Automatic Panel) are
performed using the L*a*b color space. This space is not easy to use manually. If you
need to threshold an image manually, use HIS or HSV instead.

View HSV Bitmap: Produces H, S, and V (or I) components to view on screen. Do not use
these images for processing.

69
View L*a*b: Produces L, a and b components to view on screen. Do not use these images
for processing.

Monochrome: Converts an RGB image to black-and-white. This operation can be


undone.

Alternate palette: Changes the palette from white to red and vice versa. The palette is
only for viewing the overlay. If you are using images with a white background, you can
select the red palette for visibility. The palette has no effect on processing or measurement
and is merely a tool for mapping the 255 values of the overlay to the 16.7 million colors of
the display card (i.e., we could have picked up any 255 colors out of the 16.7 millions).

Flip Vertical: Mirrors the image along the horizontal axis (top-bottom or bottom-top).

Flip Horizontal: Mirrors the image along the vertical axis (left-right or right-left).

Rotate 90: Performs a 90o rotation of the image.

Rotate 180: Performs a 180o rotation of the image.

Rotate by any angle: Calls the Rotation dialog box. You can rotate the image by any
angle. The utility allows you to draw a line in your image, and rotate the image so that the
line is vertical or horizontal. This is useful for adjusting calibration grids, in case they were
not scanned in the proper position. You may have to crop the image after rotation, as it
may become too big or have ‘leftover’ pieces of the original image.

Resize Image: Allows increases or decreases in the size of the original image. This is not
a zoom operation. The image is stretched (shrunk) in the x and y directions to the sizes
selected. Two options for resizing are available:

ƒ Resize AOI: When checked, Assess


resizes the area of interest to the newly
entered width and height. Other parts of
the image are discarded.

ƒ If the ‘Resize AOI’ is not checked, the


entire bitmap will be resized to fit the
new dimensions.

ƒ Resampling filter: Select a method of


interpolation to be used during the resizing of an image. There are 11 filters to
choose from. They will not be described further. To find out which filter is best
for the application, the user needs to try them and make an informed selection.

Note: You can stretch/shrink an image while keeping the aspect ratio, in which case you
only change one parameter (height or width) and Assess computes the other.

70
XV. Tools Menu
Save Threshold Values: Writes the current threshold
values of the active image window (the topmost image
window) to the file ‘Assess.ini’.

Load Saved Threshold Values: Retrieves the threshold


values saved by the ‘Save Threshold Values’.

Show Manual Panel: Brings the Manual Panel to the


front.

Show Automatic Panel: Brings the Automatic Panel to


the front.

Show Agronomist Panel: Brings the Agronomist Panel to


the front.

Show Threshold Panel: Brings the Classic Panel to the


front.

Show Spreadsheet: Brings the spreadsheet to the front.

Show Digital Ruler: Brings the Digital Ruler to the front.

Calibrate: Calls the ‘Calibration’ tabsheet of the ‘Measurement defaults’ dialog box
(same as pressing ‘Calibrate’ on the Threshold Panel).

Measurement Options: Calls the feature extraction form (same as pressing the ‘Options’
button on the Threshold Panel).

Freehand AOI: Selects the ‘Freehand Area of Interest’ option.

Root Measurements|Show nodes: This feature is for future use.

Note: Assess does not write to the Windows registry, to avoid cluttering this cumbersome,
dangerous and often ‘fatal’ file. Assess uses one old-style ‘ini’ file called ‘Assess.ini’ but
will work fine without it. Use it only if you want to reconfigure the slider to new colors or
to save and retrieve old threshold values, etc. If you destroy this file by accident or by
intention, Assess will run with its default values. However, it will create a new ‘ini’ file in
the directory where Assess is located.

71
XVI. Options
Save area with % disease: Set this flag (check)
if you want the lesion and leaf areas saved
when you calculate % area. Default: off (not
checked).

All Manual: This is a very important flag.


When this option is set (checked), Assess will
use two overlays: one for the lesions and the
second for the leaf. It gives the user full
control over the thresholding process. You can
threshold any area of the image individually
(each spot can be identified individually).
With the ‘All Manual’ flag set (checked),
Assess will not threshold the image on its own,
as it normally does. Instead, the user must
click on ‘Apply’ or move the thumbs of the slider. When switching from ‘Leaf’ to
‘Lesions’ and vice-versa, Assess will only display the corresponding overlay, without
thresholding the image. The overlay will contain whatever the user knowingly thresholded
previously. When all objects are highlighted, the user clicks on ‘% area’. Please note that
this flag is only active with manual measurements. Default: off (not checked). Make
sure it is off when not needed.

Configure Assess: Opens the ‘Configuration’ dialog box. The user can configure the
slider (colors and behavior) (see figure below).

HSI Shift factor (on the dialog box below): The value in this edit box controls the look
of the slider and the conversion from RGB to HSI. Assess does not conform exactly to the
standard definition of hue. Normally, red starts at zero (0), but in Assess, we shifted this
value by 196 for practical reasons. This puts the red color (used extensively in lesion
analysis) in the middle of the slider (see the slider track below) and makes it very easy to
select all the ‘reddish’ colors, in a straight fashion (no need to wrap around). You can reset
this value to zero (at your own risk!) but resetting the value is not recommended!

Reset Slider to Default: Resets the slider to its original state (when it was installed for the
first time).

Always Update Leaf Mask: A flag used in conjunction with ‘Leaf AOI’. When this
option is checked (default), Assess makes a new mask each time the leaf is thresholded, so
that the mask is always current and the lesions are restricted to the leaf. Keep it on when
measuring diseases on different leaves. Default: on (checked).

72
Perform Median Filter on Image at opening: When checked, Assess performs a median
filter on the image. This has the effect of ‘smoothing’ the data before analysis. Once
selected, Assess will ‘remember’ the setting permanently until the option is turned off.
Default: off (not checked).

Perform Low Pass on Image at Opening: When checked, Assess performs a low-pass
filter on the image. This has the effect of removing ‘high-energy’ pixels from the data
before analysis. Once selected, Assess will remember the setting permanently until the
option is turned off. Default: off (not checked).

Use Image Background in Cut Operations: This will use a piece of background from
the image to fill-in cut portions during a “Cut” operation. This must be checked if you are
using the Automatic Panel to measure diseases. Default: on (checked).

Outline leaves at opening: This option will instruct Assess to outline the leaves,
immediately after opening the image. Default: off (not checked).

Process Leaves at Opening: This option will instruct Assess to determine the threshold
levels for the leaf. It must be left on if you are using the Automatic Panel. Default: on
(checked)

73
XVII. Tutorials
In the following tutorials, you will be asked to threshold images. Typically, values will be given
to you to set threshold levels to select the leaf or the lesions. One may ask: How did we come up
with such values? The answer is quite simple: Common sense, the image histogram, and trial and
error! Throughout these tutorials, you will realize that there is no single ‘best’ solution to a
problem of this nature. The examples provided in this section are based on the author’s personal
experience and do not, by any means, suggest that this is the only way to measure diseases or to
use the software. The primary objective of the tutorials is to help you become familiar with the
most important features of Assess, without having to spend too much time reading the manual.
This section contains 19 tutorials.

Unless stated otherwise, the default threshold panel is the ‘Classic’.

List of Tutorials.

Tutorial Title Page


1 Thresholding an image 75
2 Using filters on the Threshold Panel 77
3 Working with the ‘Rectangular Area of Interest (AOI)’ tool 79
4 Using the ‘Freehand Area of Interest’ tool 82
5 Using the Leaf Area of Interest (‘Leaf AOI’) 83
6 Converting the background color 84
7 Disease measurement 87
8 Spatial calibration 90
9 Measurement of ground cover 93
10 Measuring root length 96
11 Counting and measuring lesions 98
12 Manual separation of touching objects 101
13 Automatic separation of touching objects 104
14 Blue versus white background in assessment of foliar
106
diseases
15 Using the image histogram 109
16 Programming a macro 111
17 Automatic Panel (automatic measurement of disease) 116
18 Agronomist Panel (% ground cover automatic) 118
19 Macros and the automatic features of Assess 119

The files to be used in these tutorials are found at the beginning of each tutorial as in the
example below.

Open the file ‘Leaves_blue_bkg.bmp’ provided in the ‘...\images’ subdirectory.

74
The sample images are assumed to be in the directory where Assess was installed. If you
choose the default installation, these files will be under:
C:\Program Files\Assess Image Analysis\images
Note: To get results identical to those in the tutorials, make sure that the following filter
options are turned off: ‘Options|Perform Low Pass Filter on Image at Opening’ and
‘Options|Perform Median Filter on Image at Opening’.

Tutorial 1. Thresholding an image

Purpose: To familiarize the user with the operation of the Threshold Panel.
This tool is central to all the activities in Assess.
Activity: You will open a test image and set the low and high threshold levels to separate
the leaf from the background.

Open the file Leaves_blue_bkg.bmp provided in the ‘...\images’ subdirectory.

Click on the ‘Slider’ button in the Toolbar to bring up the


Threshold Panel, if it is not visible.
1. Keep all default settings on the Threshold Panel
(see figure of slider at right)
2. Move lower thumb to 31
3. Move upper thumb to 162
4. The image should appear as in the figure below, with the leaves highlighted in white.
That is all! This simple operation isolated the leaves from the background. We could
now measure the combined area of these two leaves by simply clicking on the ‘Area’
button on the Threshold Panel.

Highlighted leaves at threshold levels of 31-162

75
5. Measure leaf area (optional): Simply click on the button labeled ‘Area’ and read the
result in the ‘Area’ edit box at the bottom of the Threshold Panel. It should read 100594.
This is the number of pixels in the combined area of the leaves. Of course, a measurement
in pixels is in most cases useless. The system must be calibrated in order to get the real
physical area of the leaves. This will be done in another tutorial.

Conclusion: You have learned how to set threshold levels to select objects of interest (leaves
in this case). This is the most critical part of the process. Once objects have been selected and
highlighted on screen, they can be analyzed or measured by a single mouse click and without
additional input from the user.

76
Tutorial 2. Using filters on the Threshold Panel

Purpose: To demonstrate the noise removal capability in Assess. Depending on the


circumstances at the time of image acquisition (lighting, hardware quality, etc.), images are
rarely ‘clean’. Furthermore, the threshold operation to isolate the object(s) of interest
results in a binary image, based on whether a pixel falls in the threshold range. Images may
contain isolated pixels that can have the same properties as those in the object of interest,
without being in the object. Often, we need to filter the image to obtain solid-looking
objects (no holes) and clean background (no isolated pixels). The median filter used in
Assess (actually a pseudo-median filter) performs this task.

Activity: The user will use a test image containing a leaf and threshold the image to select
the leaf with and without filtering.

Open the file ‘spots.png’ provided in the ‘...\images’ subdirectory.

Keep the default settings of the Threshold Panel as follows:


‘Leaf/Lesion’ button = ‘Leaf’
Color space = ‘HSI’
Color plane = ‘H’

Step 1. Set threshold levels:


a) move lower thumb to 0
b) move upper thumb to 198

Step 2. Look carefully at the resulting image (overlay in white).

Step 3. Go to the Filtering drop-down list box (in the processing section of the Threshold
Panel): it should read ‘Smooth (median)’.

Step 4. In the drop-down list box, select ‘No filtering’.

Step 5. Click on the ‘Apply’ button to threshold the image with the same values as before
(Low = 0; High = 198).

Step 6. You should see a lot of noise in the background and hundreds of tiny holes in the
leaf. Obviously, this image is not clean!

77
Filtered image.
Notice noise reduction, compared to the figure below.

Non-filtered overlay.
Notice isolated pixels in the background and holes in the leaf.

78
Tutorial 3. Working with the ‘Rectangular Area of Interest (AOI)’ tool

Purpose: To familiarize the user with the use of the Area of Interest (AOI). This is useful
when only a portion of the image needs to be analyzed.

Activity: In this tutorial the user will open a file, set threshold levels and select a
rectangular AOI. We will also use the popup menu associated with the ‘Rectangular AOI’
tool to explore the image using some of the on-the-fly options, available with this tool.

Open the file ‘spots.png’ provided in the ‘...\images’ subdirectory.

Keep all the default settings of the Threshold Panel.

‘Leaf/Lesion’ button = ‘Leaf’


Color space = ‘HSI’
Color plane = ‘H’
Filter = ‘Smooth (Median)’

1. Locate the mouse cursor on the image. The cursor should appear as a cross. If the
cursor looks like a pointing hand, click on the ‘Reset AOI’ button on the Toolbar (the
button with a red rectangle): this will hide the Rectangular AOI tool and reset its size to
the full image. The cursor should now turn into a cross, when positioned on the image.

Note: If the cursor appears as an arrow when positioned on the image, the
overlay is off. Click on the ‘Toggle’ button on the Threshold Panel or the
‘Overlay Control’ button on the Toolbar. The caption of the overlay control
button should read ‘Ovl ON’.

2. Press and hold down the left mouse button and drag the mouse. You should see a
rectangle being drawn.

3. Release the mouse button. You have just set the area of interest to the rectangle shown
on the screen. All processing and measurements will now be restricted to this area.

Note: You can do steps 2 and 3 as many times as you wish. Make sure you locate the
mouse cursor outside the Rectangular AOI tool. Each time you repeat these steps you
will be setting a new AOI. There is only one AOI for each image at any given time.

4. Threshold the image. Using the slider thumbs, set the low and high threshold levels to 0
and 198, respectively. You should see the portion of the leaf inside the AOI rectangle
highlighted (covered in white or red, depending on which palette is used). The rest of the
image remains uncovered.

79
5. Optional: Click on the ‘Area’ button on the Threshold Panel to measure the portion of the
leaf inside the AOI.

Thresholding on-the-fly

In the following exercise you will use some of the features of the Rectangular AOI tool.
You will use the image already opened and threshold the area to detect lesions (spots) as
you move or change the size of the AOI. Generally, you will keep the size of the AOI
relatively small to achieve a good speed (the original purpose of this option).

For the sake of this exercise we will consider the spots on the test leaf to be lesions.

1. Set ‘Leaf/Lesion’ button to ‘Lesion’: Click on the ‘Leaf/Lesion’ button on the


Threshold Panel. Make sure the caption on the button reads ‘Lesion’. Set the color space
to ‘HSI’ and the color plane to ‘H’.

2. Set threshold levels for the lesions: Move the lower and upper slider thumbs to,
respectively, 31 and 87. The spots on the leaf should now be highlighted.

3. Set ‘Threshold on-the-fly’ option: The AOI tool must be visible, as shown in the figure
below (the Rectangular AOI tool may have ‘marching ants’). If this tool is hidden, click
on the Rectangular AOI tool on the Toolbar to bring it to the front. Right click inside the
AOI. You should see a popup menu, as shown below.

4. Select ‘Threshold on-the-fly’.

AOI

Popup menu

Popup menu of the rectangular AOI

80
5. Using ‘Threshold on-the-fly’: Now move or resize the AOI tool and see the
results: as you release the mouse button, Assess thresholds the AOI with the
current settings of the Threshold Panel. Since we have selected ‘Lesion’, the
spots on the leaf are highlighted.

Use this feature with a small AOI to see if the threshold levels are good (i.e., all or
most of the objects of interest are highlighted). You can also read the total area of the
spots inside the AOI tool.

6. Select ‘Outline on-the-fly’: Right-click on the rectangular AOI as in steps 3 and 4 and
select ‘Outline on-the-fly’. As you move or resize the AOI selection tool, the detected
objects (inside the AOI) are automatically outlined.

Note: ‘Outline on-the-fly’ is for visualization only. No measurements are


performed or displayed. You can use ‘Outline on-the-fly’ in conjunction with
‘Threshold on-the-fly’ or ‘Percent disease on-the-fly’ to see an outline and perform
measurements, simultaneously.

7. Select ‘Percent disease on-the-fly’: Right-click on the rectangular AOI as in steps 3 and
6 and select ‘Percent disease on-the-fly’. The threshold levels for both the leaf and the
lesions must be set for this option to produce a meaningful result.
If you have not changed the threshold values set earlier in this tutorial, you are ready to
test the ‘Percent disease on-the-fly’. If the values were changed, set them to the following
(in the same order).

‘Leaf/Lesion’ button: ‘Leaf’


Color space: HSI
Color plane: H (hue)
Threshold level: Low = 0 High = 198

‘Leaf/Lesion’ button: ‘Lesion’


Color space: HSI
Color plane: H (hue)
Threshold level: Low = 31 High = 87

Now move or resize the Rectangular AOI tool. The percent area of the spots relative to
the leaf area contained in the AOI is automatically computed and displayed. The lesions
are also shown on the overlay.

81
Tutorial 4. Using the ‘Freehand Area of Interest’ tool
Purpose: To familiarize the user with the use of the ‘Freehand Area of Interest’ tool.
This is useful when a non-rectangular portion of the image is needed for analysis.
Activity: In this tutorial the user will open a file, set threshold levels and draw the outline
of an area of arbitrary shape and size. The outline drawn by the user is converted to a mask
and used as an AOI during thresholding and measurement activity on the overlay.

Open the file ‘spots.png’ in the ‘...\images’ subdirectory.

Step 1. Select ‘Lesion’ from the ‘Leaf/Lesion’ button


Make sure that color space = ‘HSI’ and color plane = ‘H’.
Step 2. Set low and high threshold levels to 31 and 87, respectively. The spots should
appear on the overlay (figure below, left).
Step 3. Click on the ‘Freehand AOI’ button on the Toolbar. This will enable you to
draw a freehand curve of any shape and use it as an area of interest. All subsequent
thresholding, filtering and measurement operations are confined to the closed curve you
have drawn.
Note: The freehand curve you draw does not need to be closed by you. Assess
will automatically close the curve and create a mask.
Step 4. Go to the image and draw a curve of any shape. When you finish drawing,
release the mouse button. You will notice that the curve is automatically closed and filled.
The filled area you see on-screen is your new AOI (figure below, middle). You can repeat
this operation as long as ‘Freehand AOI’ is selected. There are no restrictions on the shape
or size of the curve you draw.
Note: If you cannot draw, make sure that the overlay is ON (use the Toggle button on
Threshold Panel or the overlay control button on the Toolbar to turn the overlay on).
Step 5. Now, threshold the image again using the ‘Apply’ button. You will see that all the
spots detected are within your Freehand AOI (figure below, right). You can hide and
show the contours of the Freehand AOI by successively clicking on the ‘Freehand AOI’
button on the Toolbar.

Freehand Area of Interest: Entire Shape drawn by user Lesions detected within the Freehand AOI.
image as AOI Note that all highlighted objects (spots)
are within the user-drawn curve.

82
Tutorial 5. Using the Leaf Area of Interest (‘Leaf AOI’)

Purpose: There are instances when the background can be difficult to separate from the
objects of interest (lesions). Assess provides a special type of Area of Interest, which will
restrict processing to the leaf. This assumes that we are able to separate the leaf from the
background. This type of problem is frequently encountered in the analysis of images of
foliar diseases taken with a white background. There are several solutions to this problem;
the ‘Leaf AOI’ introduced here is one possible solution and is specific to Assess.

Activity: You will open a test file containing an image of diseased leaves, scanned with a
white background. You will 1) separate the leaf from the background using the HSI color
space and the Saturation color plane, 2) enable the Leaf AOI and 3) threshold the image
to extract the lesions using the Hue color plane, which is very well suited for this type of
analysis.

Open the file ‘tanspot.png’ provided in the ‘...\images’ subdirectory.

Step 1. Click on the ‘Palette’ button on the Toolbar to set a red overlay color,
if you wish.
Step 2. Set the ‘Leaf/Lesion’ button to ‘Leaf’ (we process the leaf first).
Step 3. Set the color space to ‘HSI’ if it is not already set to this value.
Step 4. Set the color plane to ‘S’ (saturation).
Step 5. Move the lower and upper slider thumbs to, respectively, 52 and 163.
Step 6. Click on the ‘Leaf AOI’ button on the Toolbar.

Leaves separated from the background using the


Saturation color plane.

We have now separated the leaf from the background and stored this information to restrict
any future processing of the lesions to the leaf area.

83
Step 7. Set the ‘Leaf/Lesion’ button to ‘Lesion’ (we now threshold the lesions).
Step 8. Set the color space to ‘HSI’ as in step 3 if it is not already set to this value.
Step 9. Set the color plane to ‘H’ (Hue).
Step 10. Move the lower and upper slider thumbs to, respectively, 31 and 103.
Notice that the lesions are detected and kept within the leaf surface.

Compare the results you just obtained with the default rectangular AOI (below)

Step 11. Turn off the ‘Leaf AOI’ option by clicking on the Rectangular AOI
button. This will also set the Rectangular AOI option.

Step 12. Click on the ‘Apply’ button on the Threshold Panel to re-threshold the image
(assuming the ‘Leaf/Lesion’ button is set to ‘Lesion’). The lesions detected extend into the
background and have poorly defined edges (figure below, left).

The figures below illustrate the results of the operations performed in this tutorial.

‘Leaf AOI’ off: Notice lesions extending ‘Leaf AOI’ on: Lesions are correctly
into the background. contained in the leaf area.

Tutorial 6. Converting the background color

Purpose: There are instances when the colors of the background pixels overlap with those
of the objects we want to measure on specific color planes. In the following example, the
objects of interest are colored (i.e., have a saturation well above zero). We will use this
useful property of the HSI color space to separate the colored objects from the white

84
background, which is ‘unsaturated’ by definition (i.e., has a saturation close or equal to
zero). The principle behind the conversion process is the following: in a thresholded image,
the overlay serves as a mask to protect any overlaid pixel. All non overlaid (exposed)
pixels of the image are converted to a default color.

Activity: You will open a file, set threshold levels for the ‘Leaf’, threshold the image and
change the background color.

Open the file ‘coriander.png’ provided in the ‘...\images’ subdirectory.

This image contains a background and coriander seeds. We want to separate the seeds
from the background.
Note: This image was scanned with a white background (the default cover color of flatbed
scanners).
Before you execute the steps outlined below, try to select the seeds without selecting the
background, using the Hue color plane as in the previous tutorials. You may also try to use
the RGB color space.

This particular image is best processed using the HSI color space and the ‘Saturation’
color plane. The rationale, as explained above, is that gray pixels (including white) have
a very low saturation (close or equal to zero). On the other hand, the pixels making up the
coriander seed are colored and have, therefore, a much higher saturation. All we have to
do is set the lower threshold level above the level of the background and the upper
threshold level very high.

Step 1. Set the Threshold Panel:


‘Leaf/Lesion’ = ‘Leaf’ or ‘Lesion’ (does not matter)
‘Color Space’ = ‘HSI’
‘Color Plane’ = ‘S’

Step 2. Click on the ‘Palette’ button on the Toolbar to set a red overlay color
if the current overlay color is white.
Step 3. Set lower thumb to 33 and upper thumb to 185. The seeds are clearly selected,
without the shadow that would have been selected with the Intensity, Red, Green or Blue
color plane. The Hue color plane does not give good results either.
Step 4. Convert background to blue: If the rectangular AOI tool is visible, place the
mouse cursor inside the AOI and right-click (if the AOI is not visible, press the ‘Reset
AOI’ button [the button with a red rectangle] to make it visible). From the popup menu,
select ‘Substitute Background’. This option is also available from ‘Edit|Substitute
Background’. All the areas that are not overlaid in red will be converted to the default
blue color (as shown in the figure below).
Note: In fact you can convert the background to any color. Select ‘Edit|Select
Background color’ to open the Windows color dialog box, pick a color and exit. The

85
color you selected becomes the default substitution color. This feature may be useful for
publication or presentation purposes, if one needed a uniform background of a given color.

Seed selected by threshold operation on saturation plane

White background replaced with blue color

86
Tutorial 7. Disease measurement

Purpose: The purpose of this exercise is to quantify the amount of disease present on the
leaf in the test image. Spatial calibration is not required in this case, as the result
represents a ratio of two areas and is, therefore, ‘unit-less’. For the sake of this exercise,
we will perform ‘Hue’ analysis on both leaf and lesions. Assess will allow mixing of color
spaces and color planes. For instance, we could use the ‘Blue’ component of the RGB
color space to extract the leaf and the ‘Hue’ component from the HSI color space to extract
the lesions.

Activity: In the operations that follow, you will open an image, set the threshold levels for
the leaf and the lesions and measure the percentage of the leaf covered by the lesions (i.e.,
% disease).

Open the file ‘TestLeaf.png’ provided in the ‘...\images’ subdirectory.

Detecting the leaf

Step 1. Set ‘Leaf/Lesion’ value: Select ‘Leaf’ by clicking the ‘Leaf/Lesion’ button
(below the color plane button). The button label should read ‘Leaf’.
.
Step 2. Set the color space: Click on the color space button and set it to ‘HSI’. You may
omit this step if the button label already reads ‘HSI’. Note that this button toggles between
two values (‘HSI’ and ‘RGB’) each time it is pressed.

Step 3. Set the color plane: Click on the ‘H’ radio button in the color plane area, if it is
not already on ‘H’. This will instruct Assess to use the Hue component of the image pixels.

Step 4. Set threshold levels for the leaf:


You will now set the threshold levels by moving the upper and lower thumbs of the slider
(or setting their corresponding edit boxes) to the values indicated in steps 4.1 and 4.2. The
value of the lower thumb represents the low threshold value, and the value of the upper
thumb the high threshold value. Assess will assign any pixel with a value outside the
[low...high] range to background and will highlight all the pixels whose values are within
the [low...high] range.

4.1. Lower thumb: Drag the lower thumb to 31 or


type ‘31' in the lower edit box next to the slider.

4.2. Upper thumb: Drag upper thumb to 191 or


type ‘191' in the upper edit box next to the slider.
At this stage, the leaf should be highlighted (figure
on the left, below).

87
4.3. Outline leaf (optional): Click on the ‘Outline’ button to view the outline of
the leaf. The result of the outline operation is shown below (figure on the right).

Leaf overlay (left) and outline (right)

Detecting the lesions

Step 5. Set ‘Leaf/Lesion’ value: Select ‘Lesion’ by clicking on the ‘Leaf/Lesion’


button. The button label should display ‘Lesion’. Set the color space to ‘HSI’ and
the color plane to ‘H’.

Step 6. Set threshold levels for the lesions:

6.1. Lower thumb: Drag the lower thumb to 31 or type ‘31’ in the lower
edit box next to the slider.

6.2. Upper thumb: Drag the upper thumb to 101 or type ‘101’ in the upper
edit box next to the slider (you should see lesions highlighted as in figure
A, on the next page).

The Threshold Panel should look like the figure below:

88
6.3. Outline lesions (optional): Click on the ‘Outline’ button to view the outline
of the lesions (figure right, below).

Lesions overlay (left) and outline (right)

7. Percent area: The preparation stage is complete. We are ready for measurement.
Click on the ‘% Area’ button to compute the percent disease. The value reported
in the ‘Percent’ box is computed as follows: Percent = (lesion/area)*100. The
value in ‘Area’ represents the area of the entire leaf, lesions included; the value in
‘Lesions’ represents the area of the lesions.

Area: 168619 (pixels) Lesion: 19695 (pixels) Percent: 11.68 (%)

89
Tutorial 8. Spatial calibration

Purpose: To perform a spatial calibration in Assess, using an image taken from a video or
digital camera. Images scanned into Assess are automatically calibrated and the resolution
recorded (generally, there is no need for calibration). The calibration procedure for non
calibrated images is critical if the intent is to measure area or length of objects of interest.
Because of the hardware independence of Assess, there is no way to know in advance
about the particular physical characteristics of the acquisition system. It is, therefore, the
responsibility of the user to provide such information.

Activity: The user will open a file containing a grid of known physical size, select an area
of known x and y dimensions and perform the calibration. The sides of the rectangle will
be used to get the physical size of the width and height of a pixel. A calibration ratio is then
computed for the area of a pixel. Once this is done, Assess automatically converts pixels
into physical units.

Open the file ‘Calibration_grid.png’ provided in the ‘...\images’ subdirectory

Step 1. Draw a rectangle with known length and height. For this exercise, let us use 50
mm for length and 30 mm for height.

90
Step 2. From the Threshold Panel, click on the ‘Calibrate’ button to open the
'Measurment defaults' dialogue box.

Step 3. Enter the horizontal value: Click on the label ‘Horizontal’ (in red). The mouse
cursor moves to the corresponding edit box. Enter ‘50’.

Step 4. Enter the vertical value: Click on the label ‘Vertical’ (in green). Enter ‘30’ in the
corresponding edit box.

Step 5. Select ‘mm’ as the physical unit.

Step 6. Press on the large button labeled ‘Calibrate’.

Your form should look like the figure below. The calibration values may
be slightly off, as the selection rectangle in step 1 is unlikely to be
drawn exactly the same way by different users.

Step 7. The calibration is done. You can save it or simply use it for this session.

Step 8. Press OK to accept the new calibration values.

91
Testing the new calibration values:

Call the ‘Digital Ruler’ from the Toolbar.

Use the ‘Digital Ruler’ to draw rectangles and lines of different sizes on the calibration grid.
The values reported should be very close to the actual size. If they are off by more than 1%,
you may have to redo your calibration and be precise in 1) drawing the area to measure and
2) making sure that you enter the correct values in the edit boxes.

How to use the ‘Digital Ruler’:

1. Select an option (line, rectangle, horizontal line, vertical line, freehand line or freehand
area drawing) by clicking on the appropriate button (the buttons are labeled with figures
representing the options).
2. Go to the image and position the mouse cursor at the start of the object to measure.
3. Drag the mouse to where you want it to be.
4. Look at the edit boxes on the Digital Ruler to read your measurement.
5. Record your measurement (by hand!). It will be erased and replaced by the next
measurement.

Very important:

For proper calibration, the user must provide both horizontal and vertical values for the
rectangle used in the calibration process. However, Assess will allow you to calibrate a single side
(x or y), but makes the assumption that the side for which the physical value is missing is similar
to the one for which the value is provided (i.e., it assigns the same calibration value to both sides).
This is highly discouraged, as only the side for which a physical value was provided will be
calibrated properly.

92
Tutorial 9. Measurement of ground cover

Purpose: To measure ground cover using the hue component of the HSI color space.
Accurate ground cover measurement using black and white images is very difficult, if not
impossible. This is due to the shadow projected by seedlings onto the ground and also due
to the soil color. In black and white, seedlings and soil can have pixels of similar values,
making it cumbersome to separate the two. By contrast, hue represents ‘pure’ color (tint)
and is independent of intensity (the black-and-white component of a pixel). The ‘color’ of
a seedling is generally green, whereas that of the soil is generally brown. As can be seen
in this tutorial, seedlings and ground are easily separated on the hue color plane.

Activity: Using a test file provided with Assess, the user will separate the ground from the
seedlings (plants) using hue and measure the area of the seedlings relative to the total area.

The principle is the same as measuring percent area infected in foliar diseases. In this case
there is no background to worry about, since we will use the entire image or an area of
interest (AOI) as the ‘ground’. All we have to do is isolate the seedlings and measure the
area they occupy relative to the ground. The hue color plane is excellent to use for this type
of analysis.

When you are done with the procedures below, get the Agronomist Panel or the
Automatic Panel and click on ‘%GC-Auto’ or ‘%GC’ and compare!!

Open the file ‘canola2.tif’ provided in the ‘...\images’ subdirectory.

Step 1. Set the ‘Leaf/Lesion’ button to ‘Leaf’.

Step 2. Set the color space to ‘HSI’ (it may already be set).

Step 3. Set the color plane to ‘H’ (it may already be set), to select ‘Hue’.

Step 4. Move the lower thumb to ‘0’ (far left) and the upper thumb to ‘255’ (far right). In
this operation all the pixels in the AOI will be selected and counted as ground. If you are
analyzing multiple images, you do not have to perform this step for the rest of the session.

Step 5. Set the ‘Leaf/Lesion’ button to ‘Lesion’, the color space to ‘HSI’ and the color
plane to ‘H’.

Step 6. Set the lower thumb to ‘93’ and the upper thumb to ‘186’. Notice that the
seedlings are selected.

Step 7. Measure % cover: Simply click on the ‘% Area’ button on the Threshold Panel.
The result reported in the ‘Percent’ edit box should read 53.66% (see the figure below).

93
Measurement of ground cover. Notice that the shadow is excluded.

As was seen in this tutorial, it is much simpler to measure ground cover than to measure
foliar diseases. The main reason for this simplicity is the fact that we only had to isolate
the seedlings from the ground. In the hue color plane shown below, you could see that the
seedlings stand out in green, whereas the ground appears red; all we had to do was pick the
green pixels! To view the hue color plane of the image, go to the Menu Bar and select
‘Image|View HSV|Hue’ (after viewing, make sure to use ‘Edit|Undo’ to get back your
original RGB image, or simply reload the image). It would have been very difficult to
achieve the same result using any of the other color plane and color space combinations.
The user is encouraged to test this assertion.

Additionally you may want to view the image histogram (‘Image|Show Histogram’).
Check the ‘Link to Threshold Panel’ check box on the Histogram dialog box, and select
‘H’ for the color plane in the Threshold Panel. You can see two major peaks, one green,
representing the seedlings, the second red, representing the ground. (Note: if you have
used the ‘Image|View HSV|Hue’ described above, you must undo the operation before
calling the histogram or reload the original image.)

94
Hue plane (8 bits) of ‘canola2.tif’: Notice the clear separation between the green seedlings
and the red-looking ground. The histogram shows two distinct peaks, representing the
ground (red) and the seedlings (green), respectively.

95
Tutorial 10. Measuring root length

Purpose: To become familiar with the process of measuring plant root length.

Activity: The user will open a test file, set threshold levels to select the roots and perform
root length measurement. In this exercise, we will use saturation to separate the root from
the background. The image used is a color image with a white background.

Open the file ‘roots.png’ provided in the ‘...\images’ subdirectory.

Unfortunately, this image is not typical of what one would expect. In a real situation, the
root should be fanned as much as possible and preferably backlit. On a flatbed scanner, this
is not always possible. Notwithstanding the mediocre quality of the image, we will still use
it to illustrate the technique.

Step 1. Click on the ‘Palette’ button on the Toolbar to set a red overlay.
Step 2. Optional. Click on the ‘Freehand AOI’ button on the Toolbar and draw a
curve around the root area to exclude the thick part (unless you want to measure
everything).
Step 3. Set the color space to ‘HSI’.
Step 4. Set the color plane to ‘S’ (Saturation).
Step 5. Set lower and upper thumbs to 18 and 159, respectively.

The root should be overlaid (selected) and ready for measurement.

Step 6. Click on the ‘Root L’ button on the Threshold Panel. That is all there is to it! You
will notice that the overlay of the root segments is reduced to a thickness of 1 pixel
throughout the image. What is shown on screen and measured is the ‘skeleton’. Roots are
measured taking into consideration the orientation of the root pieces.

Note: The measurements are in pixels. Typically, you would calibrate the system
beforehand as shown in Tutorial 8 and also enable the spreadsheet to log the data.

Root length measurement is ideal for unattended batch processing, provided that the
images have good contrast so that the threshold levels (in the Saturation or Intensity color
plane) remain fairly constant.

Black- and-white images: Important note:


If you are to work with black-and-white images, never use hue or saturation to threshold
the image. The saturation is by definition nil (zero), and the hue is undefined. Instead, use
intensity (I) of the HSI color space or the red (R), green (G) or blue (B) components of the
RGB color space. Intensity, R, G and B are by definition equal in a gray pixel. Any one will
work. You can verify this by converting the current image to monochrome
(Image|Monochrome), setting the same threshold levels for I, R, G and B (for example,
low = 2 and high = 191) and performing a root length measurement based on each of the

96
components. You should get identical results for the four components, which will prove
that they are identical, in a typical monochrome image.

Below are figures to illustrate the results of processing we have performed in this tutorial.

Root separated from the background using saturation.

Skeleton of roots produced by the root measurement routine.


Notice that the skeleton consists of a one-pixel-thick middle
outline of the root pieces.

97
Tutorial 11. Counting and measuring lesions

Purpose: To become familiar with the process of counting objects using Assess. Often,
plant pathologists need information about lesion/pustule count and size in quantitative
epidemiology, inheritance and other studies.

Activity: The user will open a file provided with Assess, set threshold levels to isolate
lesions, select the features to measure for each lesion and log the data in the spreadsheet.
The system must be calibrated in order to get physical sizes for the objects we want to size.

Open the file ‘TestLeaf.png’ provided in the ‘...\images’ subdirectory.

Step 1. Set threshold levels for ‘Leaf’ and ‘Lesion’ to the following values (in order):

Set leaf
‘Leaf/Lesion’ button = Leaf
Color space = HSI
Color plane = ‘H’ (hue)
‘Leaf’ threshold levels Low = 31 High = 191

Set lesions
‘Leaf/Lesion’ button = Lesion
Color space = HSI
Color plane = ‘H’ (hue)
‘Lesion’ threshold levels Low = 31 High = 101

Step 2. Check ‘Spreadsheet’ on the Threshold Panel. This step will enable writing to the
spreadsheet.

Step 3. Select the features to extract: Click on ‘Options’ on the Threshold Panel.

Check the following items:


ƒ Origin (checked by default)
ƒ Area without holes (total area)
ƒ Length
ƒ Roundness
ƒ H,S,I Mode
ƒ Exclude objects ‘Less than = 100’ and ‘Larger than = 50000’
ƒ Turn off (deselect) ‘Accept edge-touching objects’: This will reject any object
touching the rectangular AOI (in this case the edge of the image).
ƒ Check ‘Show axis’: The long axis of each lesion will be drawn on the lesion when
it is repainted.
ƒ Keep ‘Label objects’ checked on: After counting, the lesions will be numbered
and labeled on-screen.

98
The ‘Feature extraction options’ tab sheet should look like the one in the figure below:
Click on ‘OK’ to accept these settings and exit the form.

Feature extraction tab sheet.

Step 4. Make sure that the ‘Leaf/Lesion’ button is set to ‘Lesion’ and click on ‘Count’: The
lesions are counted, painted in different colors and displayed as shown on the next
page.

Note: We have excluded some lesions based on size (those less than 100 pixels or larger than
50000 pixels). The sizes reported are all in pixels because we have not calibrated the system.
It is left as an exercise to the user to perform the calibration (Tutorial 8) and redo this tutorial.

99
Step 5. View the data: Click on the ‘Spreadsheet’ button on the Toolbar.
You will need to scroll the spreadsheet to go to the top.

To view a specific lesion, click on the object in the spreadsheet (any cell in the row)
and go to the image. Crosshairs will be positioned at the origin of the lesion (Org.X,
Org.Y).

100
Tutorial 12. Manual separation of touching objects

Purpose: To use a line drawing tool to separate touching objects. The problem of
separating touching objects is not a trivial one in image processing. Sometimes (often!),
we have to do it manually. This operation must be preceded by a selection of the objects
of interest (a threshold operation). After the manual separation is completed, the objects
are generally counted and/or measured.

Activity: You will open a file, set up threshold levels to select the objects of interest,
manually separate touching objects and perform a count operation.

Open the file ‘Testleaf.png’ provided in the ‘...\images’ subdirectory.

Click on the ‘Palette’ button on the Toolbar to use a red overlay. This is optional
(the results are not affected by the palette).

Step 1. Set threshold levels: Set threshold levels as described in Tutorial 11.

Set the ‘Leaf/Lesion’ button to Lesion


Set the color space to: HSI
Set the color plane to: H
Set threshold levels to: Low = 31 and High = 101
You should see the lesions selected on the overlay.

Step 2. Manual separation of objects: Click on the ‘Manual Separate’ button on


the Toolbar.

101
Step 3. Draw separation lines: Go to the image window and draw lines to separate what
you consider to be touching lesions. For the sake of the exercise, just draw lines through
some objects (see the yellow lines in the figure below). As you start drawing, the original
color image becomes invisible. This is normal; the image will become visible when you
release the mouse button.

Lesions ‘cut’ with the manual separation tool: yellow lines.

Step 4. Count lesions: Click on ‘Count’ in the Threshold Panel. You will notice in the
figure on the next page that the yellow lines are not counted as part the lesions. They are
treated as background. The lesions are now ‘separated’.

102
Lesions counted after manual separation. Notice that the yellow
lines are treated as background and ignored.

103
Tutorial 13. Automatic separation of touching objects

Purpose: To familiarize the user with the ‘watershed’ procedure used in automatic
separation of touching objects.

Activity: You will open a file and threshold the image to select objects. After successfully
selecting the objects (coriander seeds), you will notice that some of them are touching.
You will use the watershed operation to automatically separate them.

Open the file ‘coriander.png’ provided in the ‘...\images’ subdirectory.

This image shows coriander seeds against a white background. We want to separate the
background from the seeds, as in Tutorial 5.

This particular image is best processed using the HSI color space and the Saturation
color plane.

Step 1. Set these values in Threshold Panel:

‘Leaf/Lesion’ = ‘Leaf’ or ‘Lesion’ (does not matter)


Color space = ‘HSI’
Color plane = ‘S’ (Saturation)

Step 2. Click on the ‘Palette’ button on the Toolbar to use a red overlay,
since we have a white background (just for visibility).

Step 3. Set the lower thumb to ‘33’and upper thumb to ‘185’ to identify the seeds.

Step 4. Separate the seeds: You will notice that some seeds are touching.
We will apply the watershed operation to automatically separate them.
Click on the ‘Watershed’ button on the Threshold Panel (the button with
the crossed leaf).

Step 4. (Optional) Enable writing to the spreadsheet by checking the ‘Spreadsheet’


check box on the Threshold Panel, and select the features to measure as described in
Tutorial 11.

Step 5. Count the objects. Simply click on ‘Count’.

Note: If you find that some small pieces are counted, increase the size exclusion (under
‘Options’ on the Threshold Panel) to 200 or 300 pixels, to eliminate small unwanted
objects.

Optional: Count the seeds before separating them and compare the results.

104
Overlay after automatic separation of objects (watershed)

Seeds counted and labeled after separation

105
Tutorial 14. Blue versus white background in assessment of foliar diseases

Purpose: To demonstrate the ease with which percent disease is measured in images with
a blue background. Even though you can separate a leaf from a white background,
additional steps are needed to accurately separate the lesions from the leaf. In routine
analysis (hundreds of samples), this could represent a substantial saving of time.

Activity: You will measure percent disease in two test images, the first taken with a white
background (default for scanners) and the second with a blue background.

A) Using a white background

Open the file ‘Tanspot.png’ provided in the ‘...\images’ subdirectory.

Click on the ‘Palette’ button on the Toolbar to use a red overlay (for good visibility, since
we have a white background).

Step 1. Threshold the leaf:

Leaf/lesion Leaf
Color space HSI
Color plane ‘S’ (Saturation)
Threshold levels Low = 31 (anywhere between 28 and 60)
High = 183 (anywhere between 160 and 200)

We are using the Saturation color plane to separate the leaf from the background. This is based on
the fact that white has a very low or zero saturation, whereas the colors of the objects are much
more saturated. The leaf should be highlighted (see the figure below, left)

Step 2. Threshold the lesions: Set the following values in the order given below:

Leaf/Lesion ‘Lesion’
Color space ‘HSI’
Color plane ‘H’
Threshold levels Low = 26
High = 103

You will notice that the lesions appear to extend into the background, which will greatly
overestimate the percent disease (see the figure below, middle).

One solution is to use the leaf (thresholded with the Saturation color plane) as an area of interest
(i.e., use the ‘Leaf AOI’ option).

106
Using the ‘Leaf AOI’:

a) Click on the ‘Leaf/Lesion’ button to select ‘Leaf’ (the button caption should read ‘Leaf’).
Make sure that the color plane is still set on ‘S’ and that the leaves are cleanly separated from the
background as shown below (left).

b) Click on the ‘Leaf AOI’ button on the Toolbar to select the ‘Leaf AOI’
option. The button should remain ‘down’.

c) Click on the ‘Leaf/Lesion’ button again to select ‘Lesion’. Make sure that the color plane is
‘H’ and that the threshold levels are still as you set them earlier (in step 2).

d) Click on the ‘Apply’ button to threshold the image and highlight the lesions (see the figure
below, right). Compare the results shown in the middle and right images below.

Lesions with rectangular Lesions with Leaf AOI option.


AOI (poor threshold) Lesions are confined to the leaf

Step 3. Measure percent disease: Click on the ‘% Area’ button. The ‘Percent’ edit box should
read ‘40.07’ % if the threshold levels are exactly the same as indicated above.

107
B) Using a blue background

Click on the rectangular AOI button to cancel the ‘Leaf AOI’ option.

Close all opened images!

Open the file ‘tanspot_Blue_back.png’ provided in the ‘...\images’ subdirectory.

Step 1. Set the ‘Leaf/Lesion’ button to ‘Lesion’.

Step 2. Keep the default settings of the Threshold Panel.


Color space =‘HSI’
Color plane =‘H’ (Hue)

Step 3. Set the lower thumb to 31 and the upper thumb to 103 (highlight the lesions).

Step 4. Set the ‘Leaf/Lesion’ button to ‘Leaf’, the color space to ‘HSI’ and the color plane to ‘H’
(Hue).

Step 5. Set the lower thumb to 31 and the upper thumb to 191 (highlight the leaf).

Step 6. Click on the ‘%Area’ button. The average for the four leaves is 37.75%.

If you were scanning images of other leaves into the same image window, it is likely that the
threshold levels would remain fairly constant so that the entire process could be reduced to three
mouse clicks: 1) scan, 2) check the threshold levels for the leaf and lesions, using the
‘Leaf/Lesion’ button (adjust if necessary) and 3) measure the percent infection.

Leaves selected using Hue Lesions selected using Hue Outline of lesions

108
Tutorial 15. Using the image histogram

Purpose: To select threshold levels using the image histogram utility provided in Assess.
In most cases, there is no need to view the image histogram to set threshold levels.
However, the use of the image histogram may sometimes speed up the process, by
suggesting cut off points.

Activity: You will open a test file provided with Assess and set threshold levels using
information from the image histogram only.

Open the file ‘tanspot_Blue_back.png’ provided in the ‘...\ images’ subdirectory.

Step 1. Open the image histogram from ‘Image|Show Histogram’.

Step 2. Check the ‘Link to Threshold Panel’ check box. The work done on this form is
transmitted to the Threshold Panel. The histogram shown on the form corresponds to the
color plane on the Threshold Panel.

Step 3. If you have just opened Assess and did not change the settings on the Threshold
Panel, skip to step 4. Otherwise, set the color space to ‘HSI’ and color plane to ‘H’ (Hue).

Step 4. On the image, set the AOI to the left most leaf (the histogram shown represents the
AOI).

Step 5. Check the ‘Smooth’ check box in the Histogram dialog box. This will enable
histogram smoothing.

Step 6. Smooth the histogram: Drag the trackbar thumb slowly until you get clean peaks.
If you have problem reproducing the figure below, type ‘35’ in the edit box next to the
trackbar. Three major peaks, reminiscent of normal distributions, should be apparent. The
contours of the peaks are now smooth and the overall look of the histogram is much more
improved and suggestive of threshold levels.

Step 7. Interpretation: The peaks in the figure above are color-coded and correspond to
the actual hue of the objects.

A) Peak 1 consists mainly of yellow to red pixels and represents the lesions.

B) Peak 2 consists mainly of green pixels and represents the healthy leaf tissue.

C) Peak 3 consists of blue pixels and represents the background.

Step 8. Using the histogram as a thresholding tool: Bring the Threshold Panel to the
front and set the ‘Leaf/Lesion’ button to ‘Lesion’. Make sure the color space is ‘HSI’ and
the color plane is ‘H’.

109
Step 9. Stretch the selection rectangle to the left and/or right (or position it) to cover peak
1 (the right side of the rectangle should be in the valley between peaks 1 and 2). This will
select all the red pixels in the AOI (see the figure below) and highlight the lesions.

Background
AOI Leaf 3
Selection tool
Healthy
2
1
Lesions

Step 10. Go to the Threshold Panel and select ‘Leaf’ on the ‘Leaf/Lesion’ button.
Make sure color space is ‘HSI’ and color plane is ‘H’.

Step 11. Stretch the selection tool to the right to cover peaks 1 and 2 (place the right side
of the rectangle between peaks 2 and 3; leave the left side of the rectangle to the left of peak
1, as shown in the figure above). This should select the entire leaf (lesions included).
Notice that the background remains unselected.

Step 12. Move and/or resize the selection tool to cover peak 3 only. Notice that only the
background is selected.

110
Tutorial 16. Programming a macro

The macro developed in this tutorial is provided with Assess as ‘Tutorial16.mac’.

Purpose: To provide some insights on how to develop a macro in Assess.

Activity: You will open a file and set the threshold levels for the leaf and lesions in the opened
image. You will then make a macro to reflect all the steps taken in analyzing the image.

To keep things simple, we will develop a macro out of the second part of Tutorial 14. We will
assume that the image in the file is fairly typical of a batch of images scanned previously.

Note: Comments (“//xxx”) were inserted at various locations in the macro program developed
below. These are for documentation only. Comments are ignored by the macro interpreter.

Step 1. Open the Macro utility by selecting ‘Macro|Create Macro’ from the Menu Bar.

Step 2. Open the file ‘tanspot_Blue_back.png’ provided in the ‘...\images’ subdirectory.

Step 3. Set the ‘Leaf/Lesion’ button to ‘Leaf’, the color space to ‘HSI’ and the color
plane to ‘H’ (Hue).

Step 4. Set the lower thumb to 31 and the upper thumb to 191 (the leaf should be
overlaid).

Step 5. Set the ‘Leaf/Lesion’ button to ‘Lesion’, the color space to ‘HSI’ and the color
plane ‘H’ (Hue).

Step 6. Set the lower thumb to 31 and the upper thumb to 103 (The lesions should be
overlaid).

Up to here we have set up all the needed values to analyze the image, as we have done in
Tutorial 14. These values are stored in the image window and displayed on the Threshold
Panel.

Step 7. In the ‘Macro source’ dialog box, click on the button with a slider
icon and labeled ‘Settings’. This will ‘download’ all the values we have set in
steps 3 to 6 and convert them into specific calls to Assess.

111
The macro recorder form should look like the form below.

The macro program above sets the Threshold Panel but does not do anything else. The
image is still not thresholded. We need to issue the commands to select the leaf and the
lesions and measure the percent disease.

If we assume that the threshold values are correct and constant (i.e., the same for all
subsequent images) then we can continue the program by appending specific commands to
threshold and measure:

a) Select the leaf: Double-click ‘Select_Leaf’ from the Setup routines (yellow), or drag
this command to the User Macro List.

b) Double-click or drag ‘Ovl_Threshold_Image’ from the Processing routines (orange).


This will extract the leaf and display it on-screen.

c) Measure the leaf: Add the command ‘Get_Leaf_Area’ from the Measurement
routines (blue).

d) Add ‘Select_Lesion’ to process the lesions.

e) add ‘Ovl_Threshold_Image’ to extract the lesions and show them on-screen.

112
f) Add ‘Get_Lesion_Area’ to measure the area of the lesions.

g) Percent disease: Now we are ready to compute percent disease. Add


‘Get_Percent_Disease’ from the Measurement routines (blue).

The program now looks like this:

The program above should perform everything that was done in Tutorial 14.

Test your macro:


1) Go to the Threshold Panel and change all the values on the slider, the color space and/or
the color planes.

2) Execute your macro: Go to the ‘Macro source’ dialog box. Press on the ‘Test Macro’
button and watch the execution. The results should be exactly the same as in Tutorial
14.

113
Important: The program above will be much more useful if we 1) enable the spreadsheet
and 2) provide some means of adjusting the threshold values during execution, so that
we can use it with many other (similar) images.

Spreadsheet:
h) Enable spreadsheet: insert ‘Set_SpreadSheet_ON’ from the Setup routines just
before ‘Get_Percent_Disease’ (drag and drop it or double-click to append it and use the
Up arrow to move it up). Now the spreadsheet is enabled. The next time you play the
macro, you will get data logged into the spreadsheet from all the measurement calls,
because the spreadsheet is on all the time. We have to disable it right after
‘Get_Percent_Disease’.

i) Disable spreadsheet: Add ‘Set_SpreadSheet_OFF’ after ‘Get_Percent_Disease’

Fine-tuning the threshold levels (user intervention): The solution is to insert a ‘Pause’.
At execution time the Macro Player will idle, letting you work on the Threshold Panel (or
any other parts of the program) until you press the ‘Resume’ button on the player (which
should be blinking).

j) Insert ‘Pause’ from the Control routines (aqua) between ‘SetHighThreshold(103)’ and
‘Select_Leaf’. Now the program will execute until ‘Pause’. Typically, you will check
that the threshold levels are correct for a new image and then press on the ‘Resume’ button
on the player. Do not delete the image or perform any operation other than adjusting
the threshold levels.

The program we just developed will work on images opened one by one by the user. This
is not a batch processing macro program! To make it a batch program, we still have to add
two more routines: 1) a flag to signal that it is a batch program and 2) an indication where
the loop for the processing starts.

k) Insert ‘Batch_Process’ from the Control routines (aqua) at the very beginning of the
program (drag and drop it or double-click to append it and use the Up arrow to move it up).

l) Insert ‘Start_Batch_Here’ after ‘Batch_Process’. When Assess reads the next file, it
will jump to ‘Start_Batch_here’ and execute all the commands that come after. This will
be done on each of the files supplied in the Macro Player (see Chapter XIII for more on the
Macro Player).

Now we have a program that is capable of batch processing. The ‘Pause’ command allows
you to make minor adjustments to the threshold levels for each file in the batch.

m) Save your macro by clicking on the ‘Save Macro’ button. Give it a name with a ‘.mac’
extension.

114
n) Drag and drop image files into the Macro Player, using Windows Explorer, and click
‘Play’.

Important: Batch processing of images for measurement is very dangerous and may
lead to erroneous data if not executed correctly. The program developed in this
tutorial is solely meant as an exercise on how to write a macro program in Assess.

File format conversion:


Simple graphic format conversion macros are included under the ‘...\macros’ subdirectory.
They allow you to convert any Assess-supported file format to a specific graphic format
(JPG, PCX, BMP, TGA, EPS, TIF). Just drag files into the Macro Player, set a directory
where you want the output to go and click on the ‘Play’ button on the Macro Player.

115
Tutorial 17. Automatic Panel

Purpose: To measure percent disease using the Automatic Panel.

Open the file “Leaves_Blue_bkg.tif’ provided in the ‘...\images’ subdirectory.

Make the Automatic Panel visible (if it is not on the screen). To select a panel, click on the
slider button on the Main Toolbar and select the desired panel.

Click on the ‘%Auto’ button on the Automatic Panel. You should read ‘52.82%’! There is
nothing else to do.

If you want to know the percent for each leaf, click on the ‘Detail’ button. The results are
shown in the figure below. Notice the change of appearance in the Automatic Threshold
Panel. The percent necrotic areas are 99.70 and 21.26, for the left and right leaves,
respectively.

116
117
Tutorial 18. The Agronomist Panel
Purpose: To measure percent ground cover using the Agronomist panel.

Open the file “fababean_weeds.png” provided in the ‘...\images’ subdirectory.

Make the Agronomist panel visible. To select a panel, click on the slider button on the Main
Toolbar and select the desired panel.

Click on the “GC-Auto” button. The result should be 49.77%, as shown in the figure below.

Note: this operation can also be performed from the Automatic Panel (“%GC” button).

118
Tutorial 19. Macros and the automatic features of Assess
Purpose: to create a “batch” macro to measure plant disease using the automatic features of Assess.
On the Menu bar go to ‘Macro|Create a Macro’.
From the ‘Control’ section of the macro utility, double-click on ‘Batch_Process’ (or drag it to the
user macro list).
From the ‘Control’ section of the macro utility, double-click on ‘Start_Batch_Here’.
Turn on the spreadsheet for writing: drag or double-click on ‘Set_Speadsheet_ON’ from the
‘Setup’ section.
From the ‘Measurement’ section, double-click on ‘Get_Percent_Disease_Auto’

Turn-off the spreadsheet: drag or double-click on ‘Set_Speadsheet_Off’ from the ‘Setup’


section.

The macro is now complete (five lines!).

119
Save the macro (click on ‘Save Macro’on the form).

Now test your macro:

Click on ‘Post macro’ to call the Macro Player.


Provide the Macro Player file names of disease images.
Click on ‘Play’ on the Macro Player.

View the spreadsheet for the results.


Click on the file name (on the spreadsheet) to call the image (and automatically remeasure it!).

120
XVIII. Questions and answers
1. Q. When I load a new image, the threshold level settings are lost.
A. Assess will keep the settings only if you load the image into an existing image
window. Do not close the window when you are done with the analysis; just load
(or acquire) your next image. The new picture will replace the old one, and all the
settings are kept.

2. Q. Can I open more than one image?


A. Yes. Assess supports multiple documents. You can open as many as your
computer resources allow you to. Each image window (document) has its own
settings and memory requirements. It is not recommended to have multiple images
opened concurrently, if your computer does not have sufficient memory.

3. Q. When I try to resize or draw the selection rectangle, the image flickers
extensively.
A. Two factors can cause severe flickering:
a) The image may be in stretch mode. You can reduce or eliminate flickering
by checking off the stretch option in the Menu Bar, under ‘View|Stretch’.
b) The image may be very large. Try to create smaller images out of the
original. Position the mouse cursor on the AOI (selection rectangle),
right-click on the mouse and select ‘Make new bitmap from AOI’. You
may also crop the image to remove all unused areas (right-click on the AOI
and select ‘Crop’).

4. Q. The outline of the blobs on the overlay appears discontinuous.


A. You are likely viewing the image in a reduced size. Check off (uncheck) the stretch
mode from the Menu Bar under ‘View|Stretch’. Regardless of the stretch ratio,
Assess uses the original image, which is not compressed. What you see on the
screen is just a representation of the image or the overlay. Whenever possible, use
non stretched images. This is the only way to make sure that what is shown on
screen is exactly the same as what Assess is processing in memory.

5. Q. I have a frame grabber. Can I use it?


A. Assess supports Twain-compliant devices only. If your frame grabber comes with
a Twain interface, Assess will use it.

6 Q. When using the ‘% Area’ option, can I mix RGB and HSI color spaces (i.e.,
threshold lesions using HSI and leaf using RGB)?
A. Yes. In this version of Assess, you can mix color spaces and color planes for
disease quantification.

7 Q. When I threshold the image, only a portion of the overlay is shown.


A. This occasionally happens with very large images (larger than screen size). To fix
this problem, go to ‘View|Stretch’. Click on ‘Stretch’ to check it on. Go to the

121
Threshold Panel and press ‘Apply’. This will force a resize and redraw of the
overlay. You may go back and turn off the ‘Stretch’ property.

8. Q. I have taken images with a white background. When the images are
thresholded using Hue, some of the background is selected. Is there a way
out?

A. It depends on the object you are measuring. If it has a color (i.e., not a
black-and-white image) and if there is no white in the object (leaf, lesion), you can
substitute the background color with a color that does not occur in the object to be
measured. First, ‘white’ means that the color is undefined (i.e., the saturation is
equal or very close to zero). We can take advantage of this fact and threshold the
image using ‘Saturation’ (‘S’ in the color plane). Once the entire object is selected,
right-click on the Rectangular AOI (bring it to front if it is not visible) to call a
pop-up menu and select ‘Substitute Background’. All the areas which had not
been overlaid (i.e., background) will be converted to a new color (default color is
blue). The default substitution color can be set from the Menu Bar (‘Edit|Select
Background Color’). Once the background color has been changed, the image can
be analyzed using Hue (see Tutorial 14). Alternatively, you can use the
‘Saturation’ color plane to extract the leaf and use the ‘Leaf AOI’ option (Tutorial
5).

9. Q. Every time I position the mouse cursor on the image I see a hand pointer (as
a cursor) and I cannot draw a new AOI.

A. The rectangular AOI tool is active and occupies the entire image. Go to the
Toolbar and reset the AOI (the button is labeled with a red rectangle). This hides
the selection rectangle and gives you the ability to draw a new AOI. The cursor
should now be a cross. Make sure that the overlay is on (check the overlay status
on the Toolbar; it should read ‘Ovl ON’).

122
Appendix

1. Representation of an Image in Assess

Assess works internally with 24-bit images, regardless of the color depth of the original
image. Each pixel has a red, a green and a blue component (shown as three planes in the
figure below). Each plane is one byte (8 bits) deep, meaning that a pixel can have 28 = 256
values in each of the R-G-B planes. The total number of possible values for each pixel is
therefore 256 x 256 x 256 = 16.7 million). The size of an image is computed as follows:

Size (in bytes) = Width (pixels) * Height (pixels) * Color depth (bytes)

(Divide by 1024 to convert to kilobytes or by 1024*1024 to convert to megabytes)

A transparent overlay layer is automatically placed on top of the original RGB image for
drawing (visualizing) pixels of interest. The schematic representation above is what
you see on screen. Three more planes, containing the Hue, Saturation and Intensity planes
are maintained in memory and are not visible.

123
2. Color spaces

A) The ‘RGB cube’


The RGB model is represented by a cube (right).
Colors are defined by their (red, green, blue)
coordinates. The points with equal r, g and b (i.e., R
= G = B) values represent the gray levels
(monochrome) and are shown in the figure (right) as
an axis starting from 0 (black) to the top corner of the
cube (white). Colors specified as 24 bits (16.7 million
colors) have each maximum R,G,B values of 8 bits
(one byte), or 256 possible values. The total number of
possible colors for a 24-bit color system is, therefore,
256 * 256 * 256 = 16,777,216 values (the ‘volume’ of
cube, where each side is equal to 256).

B) The Hue, Saturation and Value [HSV] and related models:


The HSV and HSI models

The HSV and HSI models are similar.


They differ in the way intensity is computed.
In the HSI model I = (R+G+B)/3, whereas in
HSV, V = Max(R, G, B). In Assess, ‘Value’
and ‘Intensity’ are used interchangeably.
Hue and Saturation have similar meanings in
HSV and HSI. This color model is a
mathematical transformation of the RGB cube.
Intensity is represented by the vertical axis
(black = 0 to white =1, scaled to 255 for
practical purposes) and corresponds to the
gray level axis of the RGB cube described
above. Saturation is the value along the
horizontal axis, shown in red and orthogonal
to the intensity axis. Hue is the angle (α)
around the intensity axis, as shown in the
diagram on the right. The HSI model is
intuitive and close to our perception of color,
as opposed to RGB, which is hardware oriented. The H,S,I components are independent and
correspond to the artist’s tint, shade and tone (Foley and Van Dam, 1990). Increasing saturation
makes the color more vivid, decreasing it is analogous to mixing a pure color with white.
Increasing the intensity increases the brightness without changing the color or the saturation. The
conversion from RGB to HSV used in Assess is an adaptation of the implementation of Foley and
Van Dam (1990).

124
Suggested Reading
Baxes, G. A. 1984. Digital Image Processing: A Practical Primer. Prentice-Hall, Engelwood
Cliffs, N.J.

Burdik, H .E. 1997. Digital Imaging: Theory and Application. McGraw-Hill, New York.

Foley, J. D. and Van Dam, A. 1990. Fundamentals of Interactive Computer Graphics, 2nd edition.
Addison Wesley, Reading, Mass.

Pratt, W. K. 1991. Digital Image Processing, 2nd edition. John Wiley & Sons, New York.

Russ, J. C. 1998. Image Processing Handbook. CRC Press, Boca Raton, Fla.

125

You might also like