Documente Academic
Documente Profesional
Documente Cultură
User’s Guide
Revision 5
December 1998
ContextVision AB
Storgatan 24
SE-582 23 Linköping
Sweden
Phone +46 13 35 85 50
Fax +46 13 10 42 82
Email
info@contextvision.se
Website
http://www.contextvision.se
microGOP 2000/S User’s Guide
microGOP 2000/S User’s Guide Table of Contents
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-1
The User’s Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-1
Instructions for reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-2
Conventions used in this User’s Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-2
Pause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5-26
Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5-27
3.6 The Gop function group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6-1
3.7 The Grey function group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-1
Grey operations that use the GOP or MIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-1
Shading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-3
Thresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-4
Stretch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-5
Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-7
Median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-8
Rank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-9
Sobel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-10
Prewitt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-11
Laplace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-12
Conv 3×3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-13
Calculate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-14
Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-15
Or. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-16
Invert. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-17
3.8 The Binary function group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-1
Erode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-3
Dilate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-4
Point Erode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-5
Skeleton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-6
Line Ends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-7
Line Ends 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-8
Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-9
Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-10
Separate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-11
Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-12
Hull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-13
Touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-14
Match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-15
Not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-16
And . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-17
Or. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-18
Exor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-19
Sub. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-20
Chaincode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-21
Distance Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8-22
4: Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.1 Variable types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.2 Definition of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4.3 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
4.4 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4.5 The continuing statement character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4.6 System variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
4.7 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Math functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
The timer function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
String functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
String to value functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
String to vector function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
Vector functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Reading external data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
Image size function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Image Access functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Functions to erase the contents of image buffers. . . . . . . . . . . . . . . . . . . . . . . . 4-25
Functions to get pixel data from image buffers . . . . . . . . . . . . . . . . . . . . . . . . . 4-26
Functions to set pixels in image buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26
Writing external image files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28
If expression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
While expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30
Message Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31
Write and writeln statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
The file() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
Object Measurement Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
Feature Classification function - ObjectKeep . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
Intensity Measurement function - GetIntensity. . . . . . . . . . . . . . . . . . . . . . . . . 4-34
Functions to set the active SID tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
To set the Slice Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-37
To copy the XImage from the SID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-37
Functions that draw graphics in the SID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
4.8 Include files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-45
4.9 Creating User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-46
4.10 Binding variables to function parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-51
Preface
The microGOP 2000/S is a complete application for image processing
and quantitative image analysis. This application will also be referred to
as the microGOP for ease of reading.
1.2 Logging in
Before you can start to work with microGOP you have to identify
yourself to the system. This is done by logging in.
The following instructions assume that the SPARCstation is up and
running. You should have a login: prompt on the display. A prompt is
a text or a symbol showing that the system is ready to take a new
command.
login: my-user-name <Return>
password: <does-not-show-when-typed> <Return>
Now you have logged in. The OpenWindows window system might
now be started by your login file. If you only get a prompt like this:
my-user-name@host-name-51:
you have to start OpenWindows yourself:
my-user-name@host-name-51: openwin <Return>
In subsequent examples your prompt will be symbolized by % for ease
of reading. Also the carriage return key <Return> will not be printed.
If OpenWindows fails to start, contact your System Manager.
If the microGOP does not start or if it issues error messages, see Appendix
B: Starting the microGOP 2000/S or Appendix C: Configuring the microGOP
2000/S for help.
☞ The help text can be very long for some functions in the microGOP
which makes it difficult to find the wanted information in the small help
window. Pressing Help on the same function twice will bring up the
help text in a text editor which makes it easier to find specific
information. The editor will be textedit unless the EDITOR
environment variable specifies another editor (e.g. emacs).
The upper part of the base window contains some buttons and menu
buttons. The rest of the window is used to display different kind of
information, like the current directory, current scale factor, etc. The
small icon in the upper right corner is the drop zone for microGOP
programs.
The File menu
The File menu is used to load and save microGOP programs.
Load >
A submenu is connected with the Load menu choice. The first choice
in this submenu (Load...) pops up a file browser which is used to find
microGOP programs that are stored on file.
The rest of the choices in the submenu are
configured by the microGOP user. The
choices are defined in the file
.microloadprogram on the users home
directory. See the README file on the
release directory or The microloadprogram
file, page C-9. A microGOP program is
loaded and started when one of these user
defined choices is selected.
New
This menu choice deletes the loaded program. The function is useful
when a new program is going to be created.
Insert...
This menu choice pops up a file browser where a microGOP
program can be selected and inserted into the currently loaded
microGOP program. The program is inserted at the position of the
insert arrow in the program area of the Image Processing window.
Save As >
A submenu is connected with the Save
As menu choice. This submenu has two
alternatives:
Save As...
This menu choice pops up a file browser where a file name can
be selected for the program that shall be saved.
Image Processing...
The Image Processing window is the largest and most important
window in microGOP. All interactive image processing and
programming is performed from this window. All programmable
microGOP functions are grouped together into several function
groups. Throughout this manual, a function is referred to by its
name together with its corresponding function group.
Image Tool...
The Image Tool window is used to keep track of the images
currently loaded in the microGOP image buffers.
Image Display...
The Image Display window is used to display images.
Image Overview...
The Image Overview window displays an overview of image files
stored on disk. The image files are displayed as small image icons.
Image Sequence...
The Image Sequence window controls the display of image
sequences.
Image Information...
The Image Information window displays information about the
latest loaded image. Its main purpose is to display information about
radiology images (MR images, CT images, and such).
Defined Variables...
The defined microGOP variables are displayed in this window. The
variables are used when creating microGOP programs. See the
function Variable in section 3.5 - The Program function group and ,
seechapter 4 Variables.
Geometry Tool...
The Geometry Tool window is described together with the
Geometry function, see section 3.3 - The Etc function group.
About microGOP...
The About microGOP window displays information about the
microGOP version as well as the address and telephone numbers to
ContextVision AB.
☞ Old image buffers may become visible when the image size changes.
This happens if the new image size matches the size of any old image
buffer. The rest of the image buffers will be regarded as empty (black).
☞ RGB color images can be displayed by using three 8-bit grey scale
image buffers. See the Image Tool window below, and the function
RGB Display in section 3.2 - The Image function group.
Images can be dragged and dropped into the Image Tool from the
OpenWindows file manager or from the Image Overview window.
When an image file is dropped into the Image Tool the corresponding
image in the image buffer is overwritten.
The first image buffer is called Channel and is often used as the default
input source and the default output destination for all image processing
functions. The other buffers are numbered from 1 to 6. (The name
Channel has historical reasons. There is no difference between the
Channel buffer and the 1-6 buffers.)
The image buffers are used as temporary storage while running image
processing functions. The image processing functions take their input
images from the image buffers and they write back the result images
into the image buffers.
☞ There are some implicit image copy rules that are used when images
are copied between different image formats. These rules are described in
Appendix D: Image copy rules.
☞ Only image files that have the ContextVision imf image format can
be dragged and dropped into the image buffers. Images of other formats
must be loaded with the Load Image function (Image group).
☞ The size of the image icons in the Image Tool window can be
changed. See The command line options to smicro, page C-6 or type
smicro -help in a UNIX terminal window for help.
Insert arrow
Program list
☞ No icons are displayed for images that are not using ContextVision
imf image format.
These two windows display when the Image Overview... menu choice
in the View menu is selected. It is also possible to access the Image
Overview from the Load Image function (Image group).
One image is selected by clicking SELECT on it. A selected image icon is
marked with a border. Several images can be selected by using the
ADJUST button. It is also possible to select a range of images by clicking
SELECT on the first image and then <Shift> key + ADJUST on the last
image. All the images from the first to the last are selected.
The size of the Image Overview window can be changed by using its
resize corners. A larger size makes it possible to show more images at
the same time. The Image Overview splits up the images in pages if
there are too many icons to be displayed in the window at the same time.
The Page menu or the +/- buttons can be used to jump between the
different pages.
The update of the image icons can be slow if there are many or large
images. The update can also be slow if the inspected directory is in a
slow file system (floppy, networking, etc.).
The Stop button can be used to interrupt the update of the image icons.
This is useful if the user does not want to wait for the whole update. The
image file names are displayed instead.
☞ If the <Shift> key is pressed when using the + and - buttons, the
image icons are prevented from being generated.
The Load Sequence... button is used to load a number of selected images
(≥ 2) as an image sequence. The Image Sequence window is displayed
when the images have been loaded.
The Image Overview window can also be used to display images in the
Image Display window. Clicking SELECT on a selected image icon
displays the image in the Image Display window (it is not loaded into
any image buffers). It is also possible to use drag and drop.
It is also possible to drag one or more images to the Image Tool and
hence be loaded into the image buffer(s).
☞ The images are normally resampled to the current image size used
by microGOP when displayed or loaded from the Image Overview
window.
☞ The image icon size can be changed in the Icon Size submenu in the
Page menu.
The sequence of images (≥ 2) are selected and loaded from the Image
Overview window.
The playback of images is started by selecting the forward or backward
Play button. The playback stops when the first/last image has been
displayed unless Autoreverse or Autoreturn has been selected.
The Step buttons are used to jump one image forward or backward.
The Flip button makes it possible to toggle between two adjacent
images.
The slider can be used to quickly scan through the image sequence.
The time delay (in ms) between the display of images can be selected
with Frame Delay. The Faster/Slower buttons can also be used to
increase or decrease the speed of displaying images.
The Max Speed choice disables the update of the Image Sequence
window which increases the speed of the image display.
The Display mapped images checkbox enables the display of pre-
mapped images created from the Save From Display menu in the Image
Display window, or with the SidSaveXImage() function in the Variable
function (Program group). These kind of images can be displayed with
a higher speed than non-mapped images.
☞ The images are resampled to fit the current image size used by
microGOP, unless Display mapped images is used (in this case the
current image size used by microGOP will be reset to the size of the pre-
mapped images, so called adapt mode).
Only image size and type will be displayed for images that does not
contain any image information.
It is possible to change or add the information displayed to the left in the
window.
The Reset button undoes any changes that has been made to the image
information. The Apply changes button applies any changes to the
current image information.
The information can be stored with an image when saving it to file using
the Save Image function in the Image function group.
Tools menu
The Tools submenu can be pinned and contains the SID tools which are
the following:
• Brightness/Contrast Control
• Zoom/Pan
• Zoom (in separate window)
• Pixel Value
• Paint
• Rubber Band Box
• Rubber Band Circle
• Rubber Band Line
• Outline
• Draw
The SID tools have in common that the control of the specific tool is
made interactively with a combination of mouse movements and mouse
buttons.
Zoom/Pan tool
When you select the Zoom/Pan tool, it is possible to enlarge/reduce the
displayed image. An enlarged image will have a zoom factor larger than
100 %. A reduced image will have a zoom factor less than 100 %.
Zoom tool
When you select the Zoom tool, the Zoom window will be displayed.
The image within the rectangular area outlined in the SID, called the
zoom area, is shown enlarged (or reduced) in the Zoom window. An
enlarged image will have a zoom factor larger than 100 %. A reduced
image will have a zoom factor less than 100 %.
The Zoom function can be controlled both from the SID and the Zoom
window (which always has an adjustable size with the use of the resize
corners).
Paint tool
This tool enables you to paint in the image plane or in the overlay planes.
The Active checkbox indicates if the paint tool is active or not. The tool
can be made active by checking the box.
The Paint window gives you the following options for using the Paint
tool:
• You can choose which plane you are going to paint in with the
choice button labelled Plane. it is possible to choose between Image,
BG, or FG.
• The size and shape of the paint brush is adjustable. Move the cursor
inside the square to the right of the text Brush. Drag SELECT: The
size and shape will be adjusted in accordance with the cursor
movements. Release the button when the desired brush size has
been set. The minimum size of the brush is one pixel, and the
maximum size is 32 x 32 pixels. Any combination of length and
width within these limits is allowed (e.g. 1 x 32).
• You can select one of the three functions Paint, Fill, or Erase by
choosing one of the icons in the upper left corner of the Paint pop-
up window.
Paint in a plane
Select Paint and move the cursor to the Image Display. When it enters
the SID or the Zoom window it changes shape to a brush as defined by
the Brush square. Drag SELECT: A line is drawn, following the cursor
movements.
Fill area
Draw a completely closed area in the Image Display. Select Fill and
move the cursor inside the area. Click SELECT: The area will now
automatically be filled. It is important that the border has no gaps.
Erase in a plane
The chosen plane can be erased when Erase is selected. This function is
similar to the Paint function, but when you drag SELECT inside the SID
or the Zoom window, the plane will be erased at that position.
If you erase in the image plane, the erased area will become black.
Overlay Settings
This section describes the options that
are available in the Overlays window.
The BG and FG overlays can either be
enabled or disabled. If an overlay is
enabled, the overlay is thereby visible.
Using the choice button labelled
Enabled you can select if an overlay is
enabled or not.
You can specify a color, either
transparent or solid, for each of the
two overlays. First you have to select
the overlay plane for which you want to specify a color. Select either BG
or FG in the choice button labelled Overlay. The color currently
specified for the chosen overlay is shown in the colored square. The
overlay color is created from the summation of the three color sliders,
labelled R (red), G (green), and B (blue). For example, if all three sliders
are set at maximum then the overlay color will be white. A single slider
at maximum, e.g. red, and the other two sliders at zero will result in the
overlay color being red. Finally, you can select if the color should be
Opaque (solid) or Transparent.
If Transparent is selected, you can also select Map Under which applies
the Map function to the pixels under the set areas of enabled overlays.
You can select the amount of Opacity for the training overlay when
working with image classification and when drawing training areas. If
you check the Map Under checkbox, the Map function is applied to the
training areas and “under” the classified result.
Outline tool
The outline tool can be used to mark the contour of a region or any
irregular structure. The marked region can be automatically closed and
filled. See Tool Properties Menu, page 2-38.
Draw tool
The Draw tool is used to draw
graphics objects and type text
objects in the graphics plane of the
SID.
The objects can be moved and
changed after they have been
created. The objects in the graphics
plane can be copied to the image
plane and to the overlay planes.
Selecting objects
To select graphics or text objects (Draw objects), the Object Selector must
be active. To select a Draw object, click SELECT on it (on the border of
the object). To select additional objects, click ADJUST on them. If you
click ADJUST on a selected object, it is deselected.
You can select one or more objects in a single operation by dragging
(SELECT) a rubberbanding region in the SID to enclose the objects. All
objects completely within the region is selected.
To select all objects, choose Select All from the Edit menu. To deselect
all objects, click SELECT on an area in the SID away from any objects.
☞ Do not resize the text objects. The size of a text object is defined by
the text that is typed in the text object.
☞ If you want to hide objects while moving or resizing them, check the
Hide While Edit checkbox.
Object modifiers
All object modifiers are implemented as abbreviated menu buttons.
They apply to all selected objects and to the objects that are to be created.
However, all modifiers may not affect all types of objects, see the
restrictions for each object modifier.
Line Width
The line width specifies the relative thickness of a line. You can
choose from a range of predefined line widths, or specify a custom
line width (Other: ).
Affects all graphics objects but not any text objects.
Line Style
Lines can be drawn in a variety of styles. Affects all graphics objects
but not any text objects.
Line Arrows
This modifier applies arrowheads to the start, end, or both ends of
Line objects and Irregular Polygon objects. Arrowheads can also be
removed. (The arrow that points to the left in the abbreviated menu
applies an arrowhead to the start of a line-shaped object.)
Line Pattern and Colors
With this modifier, you can set the foreground color, the background
color, and the pattern that will affect the border line of a graphics
object, or the text in a text object. A black pattern will show the line/
text in the foreground color, a white pattern will show the line/text
in the background color, and a transparent pattern will not show the
line/text at all. Another pattern will present a combination of the
foreground and background colors according to the chosen pattern.
The background color can be chosen to be transparent. This modifier
affects all objects, graphics and text.
Markers
A selected object is marked with 2 (Line) or 8 markers. The style (filled/
unfilled rectangles, filled/unfilled circles, crosses), color, and size of
these markers can be specified with the Markers abbreviated menu
buttons.
Options menu
Tool Properties...
In the Draw Tool Properties window, a few properties for some
graphics objects can be set.
Set the Freehand and the Irregular
Polygon objects to be opened or closed.
For a closed object, the starting point and
the last point are connected
automatically with a straight line.
Set the corner roundness for Rounded
Rectangle objects.
Fonts...
In the Font Chooser window, a specific font (typeface) can be
applied to the text in Text objects.
Arrange menu
You can change the relative display order of objects in a stack of
overlapping objects.
To Front
Moves the selected objects to the front of all objects in the graphics
plane.
To Back
Moves the selected objects to the back of all objects in the graphics
plane.
You can copy all objects in the graphics plane to the image plane or to
the overlay planes (foreground and background) of the SID. Only pixels
that are overlapped by the Draw object and foreground patterns (no
background patterns or object markers) are affected by the copy
operation.
Copy To Plane > Image
All objects are copied to the image plane of the SID. The pixel value
for the copied items is defined in the Paint tool.
Copy To Plane > BG / Copy To Plane > FG
All objects are copied to the background/foreground overlay plane
of the SID. Each pixel that is overlapped by the Draw objects is set in
the overlay plane.
microGOP 2000/S User’s Guide 2-37
2 Using the microGOP 2000/S - Image Display
Colors Menu
The Colors menu can be pinned and its menu items
will now be described.
Color Table...
Color tables are loaded automatically when images are displayed but it
is also possible to select color tables manually.
These are the choices:
Grey This is the standard color table for grey scale images.
GOP This is a special color table that should be used together with
GOP images - also called polar, or vector images - in order to
see their color representation properly. GOP images are
created by the GOP image processing operations.
RGB This is the color table for RGB color images, which consist of
three grey scale images, one for each color band (red, green,
and blue).
Red Used together with an RGB image to be able to view the red
band of the image in grey scale.
Green Used together with an RGB image to be able to view the green
band of the image in grey scale.
Blue Used together with an RGB image to be able to view the blue
band of the image in grey scale.
Map...
This window allows you to manipulate the color look-up table.
The axes in the map window represent the true pixel intensity values on
the horizontal axis and the pixel intensity values as seen by the eye on
the vertical axis. The origin of this coordinate system is at the lower left
corner of the map window.
The value range for the axes of the map window is determined by the
abbreviated choice labelled Range:. There are five choices:
• Binary The value range [0,1].
• Grey/Gop The value range [0, 255].
• Grey16 The value range is determined by the Grey16
Range setting in the Etc function group (Dis-
play of 16 bit grey scale images). See also the
Properties menu of the base window, page 2-4.
• Full 16-bit range The value range [0, 32767]
• Total 16-bit range The value range [-32768, 32767]
It is important to know that these contrast functions affect the color look-
up table only and not the pixel values in the image.
The default map window (as defined by the BW color table) has
a width value of 256 and a level value of 128.
The Gamma value indicates what exponent the gamma function has:
Gamma
Y = X
The minimum gamma value is 0.10, and the maximum value is 10.00.
A straight mapping line has a gamma value of 1.00.
You can also enter a numeric value in the Gamma field. The map
window is set to its default condition (Gamma=1) by selecting Clear.
The Stretch function
Histogram stretching is a kind of contrast enhancement of images.
The operation stretches out the image grey scale. In this way it is
possible to obtain maximum dynamic range. Note that the stretch
functions affect the color look-up table only and not the pixel values.
When you select the Stretch button, a histogram stretching is
performed on the displayed image. The Line mapping function will
automatically be selected and the resulting mapping line will be
displayed.
Accumulated mapping
It is possible to apply a new map function on an already mapped
image. When mapping an image and you select Accept, the current
mapping function is remembered and the map line is reset to a
straight line. Further mapping modifications can now be applied on
the mapped image.
Reset resets the current map line to a straight line. Clear sets the map
line to its default condition and the image is shown without any
mapping modifications.
Slicing...
This function is used to identify and indicate
with a color those pixels that have grey levels
or intensities that lie inside or outside a
specified range, called slice. This is done by a
color look-up table manipulation, which
means that the pixel values in the image are
not changed.
The slice is visualized by a colored area
superimposing a grey scale window. The
value range of the grey scale window is
determined by the abbreviated choice
labelled Range:. For a description of the different Range choices, see
Map..., page 2-39.
You can move the slice by placing the cursor on it, and then drag
SELECT.
The numbers below the slice indicate where the limits of the slice are.
For example, Low: 100 and High: 156 indicate that the slice is between
intensities 100 and 156.
The limits of the slice can be changed.
Place the cursor outside the slice, but
inside the grey scale window and then
drag SELECT. With the cursor to the left
of the slice you will move the low slice
limit and to the right of the slice the high
slice limit. Only left and right mouse
movements are possible.
You can also position the slice and change the slice limits by altering the
numeric fields labelled Low and High.
The color of the slice is created from the summation of the three color
sliders, labelled R (red), G (green), and B (blue).
All pixels in the image with intensity values that lie within (select
Inside) or outside (select Outside) the slice limits will be colored with
the color of the slice.
Note that you must have selected the Bands: Mag choice button for the
slicing to have any effect on the displayed image.
☞ This function is not used to create binary images from grey scale or
gop images. The Thresh function in the Grey function group should be
used to do that.
☞ The colors in the image can not always be displayed with the correct
colors when the slice is moved (mouse button pressed down). The
correct colors will always be displayed when the mouse button is
released.
When both Mag and Arg bands are selected, the Logic choice is
available. If OR is chosen, every pixel that has a magnitude value within
the Mag slice limits, or an argument value within the Arg slice limits,
will be colored. If AND is chosen, each pixel must have its two values
within both slice limits. These two examples presumes that Inside is
chosen for both slice settings.
Note that you must at least select one choice in the Bands choice button
for the slicing to have any effect on the displayed image.
Pseudo Colors...
Colormap...
This window displays the current color map used by the SID. This
window is not used by the normal user.
Unmap
Changes to a linear (unmapped) color table. The same thing is
accomplished by using the ADJUST mouse button in the SID when
the map tool is selected.
The rest of the choices are shortcuts to the Color Table window in the
Colors menu.
BW
Change to a black and white color table.
GOP
Change to a GOP color table.
PSEUDO
Change to a pseudo color table.
LABEL
Change to a label color table.
RGB
Change to an RGB color table.
Overlays Menu
This menu is used to enable, disable or clear
overlay planes and graphics.
Clear Graphics & Overlays
Erases the foreground plane, background
plane and the graphics.
Clear Graphics
Erases the graphics.
Clear Background / Clear Foreground
Erases the background or foreground plane.
Background On / Background Off
Switches the background plane on or off.
Foreground On / Foreground Off
Switches the foreground plane on or off.
Overlays...
Brings up the Overlay Window.
☞ Images saved this way can only be displayed correctly with the
same release of the microGOP. Images should only be saved this way
for temporary use with the Image Sequence function as they are
mapped in a way that only the current microGOP knows about.
Properties Menu
This menu is used to control the relative
position of the Image Display Window in
the stack of windows in microGOP.
Image Display always on top
Every time an image is displayed in the Image Display window, this
window is moved to the top of the stacked windows and thus
becomes fully visible.
Not on top
The Image Display window is not moved among the stacked
windows when an image is displayed, and might thus be behind
other windows.
The live video signal coming from the camera can be displayed in a
window if any of the ‘Live’ commands is used. The command to use
depends on the type of framegrabber connected. A SLIC frame grabber
should use the SLICLive command and a SunVideo framegrabber
should use SunVideoLive command.
The grey levels within the slice interval Low to High are now colored
yellow in the image display. Adjust the slice so that it colors some
significant objects or area in the image. Use the SELECT mouse button.
• Dragging inside the slice moves the slice. The slice width is
maintained.
• Dragging outside the slice moves the Low or High limit.
We have the choice of putting the result image in any of the 7 binary
images available but let’s keep Chan as output image.
☞ Note that Image to threshold is the image that the slice is applied to.
Select Perform and then switch to the Measure function in the Measure
function block.
The features listed are defaulted to those measured but you can select
which features to list in the Features... pop-up window.
☞ The functions that are put in to the program are always inserted at
the position of the insert arrow. The arrow can be moved by clicking on
its new position.
Run the program by selecting Run in the microGOP 2000/S base
window. The program execution can be stopped and resumed by means
of the Stop and Continue buttons. The program execution always
continues with the selected program line.
☞ The yellow (not visible here in the manual) border around a function
in the program marks the selected program line.
Save the program
permanently to a file by
selecting Save As... in the
File menu in the microGOP
2000/S base window. Use
the file browser to select a
directory and a file name
for the program.
Press Save Program to save
the program.
Another example
Delete the program again and make a new program. Enter the following
functions:
Basics Define basic statistics for perimeter. Name it perim_basics.
EndLoop
Use the Large/Small Window choice in the View menu above the
program list to enlarge the Image Processing window. The resulting
program should look something like this:
Let us insert our “old” microGOP program into the loop. Place the
insertion point between the lines Variable and EndLoop. Use Insert in
the File menu in the same way as you used Load before.
Before we run the program let us study line 8 in the program (see left
margin). The Basics action is Latest which means that the statistics from
the latest measurement will be printed for each of the 4 loop laps.
Instead we want to accumulate statistics over all 4 images. We need to
edit line 8.
Select the function icon on line 8 by clicking on it until a yellow border
appears around it. Select Edit parameters in the Edit menu. Now the
microGOP 2000/S is in edit mode. The cursor takes a new shape to
indicate that we are editing a function already inserted in a program.
Change the action in the Basics function to Accumulate to. Also change
the Name to perim_basics. Then select Quit edit in the Perform menu.
Now the changes have taken effect in the program. (You can also quit
editing by making a selection anywhere outside the function parameter
area).
Run the new version of the program!
☞ There are two other ways of entering the edit mode. The fastest way
is to double click on the function in the program that shall be edited.
Another way is to drag the icon from the program into the function
parameter area.
☞ Selecting Edit Parameters while in edit mode will open the next
function in the program for edit. This is a convenient way of stepping
through the program to check parameter settings.
Image
These functions handle images. You can display images from the image
buffers in a image display window. Images can be entered from a video
camera or from a file. and they can be stored on file or printed on a
Postscript printer. Images within the image buffers can also be copied
for changing their pixel formats. Functions for image cropping and
hardcopy are also available.
Etc
Under Etc are functions for setting and defining scale factors and for
controlling the measure area. You can set certain characteristics in the
microGOPs behavior and there are also functions for geometric
correction of images.
Program
Contains functions for program flow control, variables and for
interaction during program execution.
Grey
Contains classical linear and non-linear greyscale operations. Some of
these functions use the GOP or MIP in order to make use of large filters.
These operations are not available if you do not have the GOP or MIP.
Binary
The binary operations operate on binary images. The type of operations
found here are erode, dilate, open, close, skeleton, fill and match
operations. The logical operations like not, and, or, exor and subtract are
also located in this group. There are also functions for chain coding and
distance map calculations.
Morpho
This group contains the grey scale morphology functions. The type of
functions found here are: morphological gradient, white and black top
hat, grey scale erosion and dilation, greyscale opening and closing and
the watershed function.
Measure
You can measure objects in a binary image, create a grey level histogram
or measure the area fraction in a greyscale image. The measurement
results can be accumulated, processed and presented by other functions
in the Measure block. They can also be stored in a file.
The Area Fraction function measures the area fraction within greyscale
intervals in one or several greyscale images. The Image Histogram is
measured for one greyscale image at a time.
Many of the functions in this function group that only copy images
between image buffers and image display are usually only used in a
program. It is often more efficient to perform these functions in other
ways when the microGOP is used interactively: Images can be loaded
from the Image Overview or the deskset file manager and mages can be
displayed and copied using the Image Tool.
To Display
This function displays one of the image buffers in the Image Display
window. The images can be displayed in the image plane, foreground
plane or background plane. The necessary conversions are made
automatically.
Copy to
Specifies the destination plane for the image.
From Image
Specifies the image to display.
From Display
The From Display function is used to copy images from the Image
Display window to an image buffer. The image can be saved from the
image plane, the background (BG) or the foreground (FG) in the Image
Display window. The image can be saved in any image buffer.
Save
The plane to copy from.
Save in image
The image buffer to put the image in.
Video
The Video function is used to read images from an image generating
device like a video camera connected to a video frame grabber.
The Video function has built in support for:
• SBus SunVideo™ and Videopix™ frame grabbers from Sun
Microsystems.
• SBus SLIC-Video™ frame grabber from Osprey Technologies, Inc.
• SBus SNAPPER-8, SNAPPER-24, SNAPPER-DIG16 (for digital
video cameras), and PCI SNAPPER-8 frame grabbers from Active
Imaging Ltd.
• Digital cameras Hamamatsu C4742 (B/W, hires, 10-bit) and
Hamamatsu C4742-95 connected to SNAPPER-DIG16.
There is also direct support for the DCP frame grabber from Context
Vision.
☞ Support for additional frame grabbers may have been added since
this manual was printed. The online help for the Video function and the
README file contains information about the supported frame grabbers.
It is possible to use frame grabbers that are not directly supported by
calling an external program that grabs the image and then puts it in the
specified image buffer. See The microvideounit file, page C-13 for further
description of how to use other frame grabbers.
Image
The grey image to store the grabbed image in.
Input command
The command to be executed. This command is usually selected
from the Predefined commands list, after which it can be edited. For
a description of the different command parameters, see The
microvideounit file, page C-13.
Predefined commands:
A list of commands that grabs images from different devices. A
command is selected by clicking on it. The command is then copied
to the Input command textfield where it can be edited. The
commands in the list are read from the microvideounit file. This file
can be edited to add new commands.
☞ Note that the command that is executed is always the one on the
Input command line.
Load Image
Loads an image from an image file to an image buffer. Images of
different types can be loaded. The image can be loaded with or without
resampling.
Image type
Indicates the format for the input image. This determines which
conversion program that should be applied to the image file. See The
microimagetype file, page C-10 for description of how to use different
image formats.
Browse
The menu connected to this button
contains the paths in the
IMGPATH environment variable.
The path is copied to the Directory
field when selected.
The first choice in the menu calls up a file browser which can be used
to find the file to load.
☞ The files shown in the file browser are only those that match the
type selected in Image type.
microGOP 2000/S User’s Guide 3-2-5
3 Functions in microGOP 2000/S - Image Group
Overview
This button calls up an Image Overview of the images in the
directory in the Directory field.
The image name is transferred to the Directory and File fields when
an image is selected in the Image Overview.
☞ Image icons will only be displayed for images of the imf image
type.
See The Image Overview Window, page 2-11 for further description of
the Image Overview.
Directory
The directory where the file to be loaded is located.
File
The name of the file to load.
Append number / Number
This choice button is here of historical reasons. A number can be
added to the File name if this button is pressed in. It is not
recommended to use this function. Instead, use the Variable
function to produce the wanted file name and then bind the variable
to the File parameter of the Load Image function.
Resample / Adapt
The cases where the image to be loaded has a different size than the
current microGOP image size, can be handled in two different ways.
Resample will resample the new image to the current microGOP
image size. This is the normal setting.
Adapt will set the microGOP image size to that of the image to be
loaded. The microGOP will resize all its image buffers and it will
forget about image buffers of the old size.
If the Adapt method is used a confirm message may appear when
the Load Image function is performed. The confirm message does
not appear if the Load Image function is executed from a program.
The confirm message can be switched off by changing in the
microprofile file. See The microprofile file, page C-21.
Save Image
Saves an image from an image buffer to a file. The image can be stored
in different formats.
Image type
Indicates the format for the output image. This determines which
conversion program that should be applied to the image when
saving it. See The microimagetype file, page C-10 for a description of
how to use different image formats.
Browse
This button has a menu connected to it. It works as the Browse
button menu in the Load image function.
Directory
The directory where the file to be saved is located.
File
The name of the file to be saved.
Append number / Number
This choice button is here of historical reasons. A number can be
added to the File name if this button is pressed in. It is not
recommended to use this function. Instead, use the Variable
function to produce the wanted file name and then bind the variable
to the File parameter of the Save Image function.
Display Label
This function displays the current label image. A label image is
produced by the Measure function which can be found in the Measure
group.
This function is not used very often since the Measure function displays
the label image by itself.
RGB Display
The RGB Display function can display three 8-bit grey scale images as an
RGB (color) image.
Red
This parameter specifies the grey scale image to use for the red band
in the color image.
Green
This parameter specifies the grey scale image to use for the green
band in the color image.
Blue
This parameter specifies the grey scale image to use for the blue band
in the color image.
☞ The Image Tool can also be used to display three grey scale images
as a RGB image.
Hardcopy
This function is used to make a hardcopy on a printer of the contents of
an image buffer.
Make hardcopy of
The image buffer to make a hardcopy of.
X center (mm):
Specifies the center of the image in X-direction on the paper. The
value 0 gives an automatic centering in the X-direction.
Y center (mm):
Specifies the center of the image in Y-direction on the paper. The
value 0 gives an automatic centering in the Y-direction.
Width (mm):
Specifies the width of the image on the paper. The value 0 scales the
image automatically to be as large as possible.
Height (mm):
Specifies the height of the image on the paper. The value 0 scales the
image automatically to be as large as possible.
Copy Image
This function is used to copy images between image buffers. The image
is converted to the format of the destination image when the source and
destination images are of different types.
Copy from
The image to copy from.
Copy to
The Image to copy to.
Some additional parameters must sometimes be set depending on the
type of the input and output images. There are a number of different
cases to consider:
Binary to Grey
The grey value in the output image must be specified.The
specified value is used in the grey scale image for the pixels that
are set to 1 in the binary image. The Clear before copy works like
this: Enabled: The result image is erased before the copy.
Disabled: Only pixels where the binary image is 1 are affected.
Binary to Gop
The magnitude and argument pixel values for the Gop image
must be specified. The specified values are used in the Gop
image for the pixels that are set to 1 in the binary image. The Gop
image will be 0,0 elsewhere.
Binary to c32
The real part of the complex image will be set to 1 where the
binary image is 1 and to 0 where the binary image is 0. The
imaginary part of the complex image will be set to 0.
Grey to Binary
The low and high threshold in the grey scale image must be set.
The pixels in this range will be 1 in the binary image and the
others 0. See also the Thresh function, page 3-7-4.
Grey to Gop
The grey scale image can be copied to the magnitude or the
argument of the Gop image. It is also possible to select if the
other part of the Gop image should be zeroed(affected) or kept
intact.
Grey to c32
The real part of the complex image is set to the same values as in
the grey scale image. The imaginary part of the complex image
is set to 0.
Gop to Binary
The low and high thresholds for magnitude and argument in the
Gop image must be set. The pixels in this range will be 1 in the
binary image and the others 0. See also the Thresh function,
page 3-7-4.
Gop to Grey
It is possible to copy the magnitude or the argument to the grey
scale image.
Gop to c32
The polar values in the Gop image are converted to cartesian
values in the c32 images.
c32 to Binary
The pixels in the binary image are set to the absolute value (=
hypot(re, im)) of the real and imaginary part in the c32 image.
Values that become larger than 1 in the binary image are set to 1.
c32 to Grey
The pixels in the grey scale image are set to the absolute value (=
hypot(re, im)) of the real and imaginary part in the c32 image.
Values that become larger than max in the grey scale image are
set to max.
c32 to Gop
The cartesian values in the c32 image are converted to polar
values in the Gop image. Values that become larger than the
max for the magnitud part of the Gop image are set to the max.
☞ The Image Tool window can also be used to copy images between
image buffers.
Crop Image
This functions copies a region of one image buffer to another region of
another image buffer. The source and destination buffers must be of the
same type. The size and position of the source region and the destination
region can differ.
Input
The source image buffer.
Output
The destination image buffer.
Sources
This button has a menu connected to it with a number of predefined
source areas.
The black area in the icons describe
what area will be used as source. The
Get RBBox alternative will get the
current area of the rubber band box in
the image display window. The
description of the area is transferred to
the X, Y, Width, and Height fields
when a choice is made.
Destinations
The menu connected to this button works exactly as the one for
Source except that the choices selects the destination area.
X
The normalized X coordinate of the upper left corner of the source
and destination areas respectively.
Y
The normalized Y coordinate of the upper left corner of the source
and destination areas respectively.
Width
The normalized width of the source and destination areas
respectively.
Height
The normalized height of the source and destination areas
respectively.
Clear Image
Sets all pixels to 0 in an image buffer.
Clear image
Image to be cleared.
Color Convert
This function converts between the RGB colorspace to the IHS
colorspace.
The IHS colorspace is represented with Intensity, Hue and Saturation.
The Intensity image is just an average of the RGB pixel values.
The Hue image is circular color tone image. This means that 0 and 255 in
the image are almost the same color tone. The Hue image can be useful
when a specific color should be thresholded out of a color image.
The Saturation image describes how much of a color we have.
R/G/B
Specifies the Red, Green and Blue bands of a RGB color image.
I/H/S
Specifies the Intensity, Hue and Saturation bands of an IHS image.
Display
This is an old function that was used to display images in an older
version of the Image Display window. The To Display function should
be used instead.
Overlay
The binary image to display in the foreground. An empty image will
be displayed if E is selected.
Image
The image to display in the image plane. An empty image will be
displayed if E is selected.
The Settings function is used to define image size, current directory and
how windows should be updated during program execution.
The scale, measure area and setting functions are usually used in the
beginning of microGOP programs.
The DCP Command functions is is used to perform some DCP related
functions like selecting color table, switching foreground and
background on and off. The DCP Command function is only available
with the DCP option.
Set Scale
The geometric scale factor relates real-world distances to the pixels that
are used to store the image in microGOP. The scale factor tells us “how
long is a pixel”. Scale factors are referenced by name. All presentations
of distances and measurement data will be scaled using the latest set
scale factor.
It is not necessary to rerun Measure to present data with a new scale
factor. The scale factor is always applied to the data before presentation.
Scale factor name
Type in a scale name or select a scale from the list. No spaces are
allowed in scale factor names.
Delete scale factor
Deletes the selected scale factor and updates the scale factor file
.microgeoscale
☞ New scale factors are defined using the Define Scale function
described on next page.
☞ The scale factors are stored in the file .microgeoscale on the users
home directory. See The .microgeoscale file, page C-20.
Define Scale
This function defines a new geometric scale factor. The scale factors are
saved in a file (see The .microgeoscale file, page C-20) and they can be set
using the Set Scale function. A scale factor is automatically set as the
current one when it is defined.
Measure Frame
The measure frame is a rectangular area covering a part of, or the whole
image. The Measure function uses the measure frame in the following
way:
• Objects that fall within the measure frame are measured.
• Objects that fall outside the measure frame are not measured.
• Objects that touch the edge of the measure frame can be excluded or
included in the measurement. For each edge you define if objects
should be excluded or included.
The measure frame makes it possible to reject objects that are at the
borders of the image. These objects are often cut and should not be used
for calculations.
North, South, Height, West, East, Width
Defines the measure frame in terms of its size and its distances from
the image borders. These values are interrelated so if you change one
of them the others may change as well.
The easiest way to specify a measure frame is to use the Rubber
Band Box tool in the Image Display window. This tool is
automatically selected when the Measure Frame function is selected.
The position and size of the Rubber Band Box is automatically
transferred to the appropriate fields.
Include objects on sides
Selects whether objects touching an edge of the measure frame
should be included or excluded.
The default measure frame is set the whole image with all edges
included which means that all objects will be included in the
measurement.
☞ Only one of Measure Frame and Measure Circle can be active at the
time.
Measure Circle
The measure circle is a circle covering a part of the image. The measure
circle is used in the same way as the measure frame. See Measure Frame,
page 3-3-4.
Center X, CenterY, Radius
These parameters define the center and the radius of the measure
circle.
The easiest way to specify a measure circle is to use the Rubber Band
Circle tool in the Image Display window. This tool is automatically
selected when the Measure Circle function is selected. The position
and size of the Rubber Band Circle is automatically transferred to
the appropriate fields.
Objects on borders
The objects that touch the borders can be Included or Excluded from
the measurements when using the Measure function.
☞ Only one of Measure Frame and Measure Circle can be active at the
time.
☞ The measure area will not be visible if something else, like an image,
is displayed in the background plane later. The background plane can
also be obscured by the foreground plane or graphics.
Settings
Settings for some of the microGOP 2000/S’s behavior. These settings can
also be used interactively from the Properties menu in the microGOP
main window.
Automatic image update in
Every time an image in an image buffer is modified it is also updated
in the Image Display window (or DCP) and Image Tool if they have
been selected.
Auto destination (Together with DCP option only)
Specifies if the images should be displayed in the DCP or in the
image display window.
Program execution trace
The program flow can be traced. In the program list the currently
executing microGOP function is highlighted and in the footer of the
Image Processing window the function name is printed.
Image Width / Image Height
Changes the current image size. Images in the microGOP image
buffers that does not match the new size are regarded as empty. The
Image Sizes menu can be used to select predefined sizes. The sizes
are defined in the microimagesize file. See The microimagesize file, page
C-12.
Current Working Directory
The current working directory is set using this field.
Browse
This button brings up a directory browser to make it easier to select
a directory for the Current Working Directory field.
Grey16Range
This function sets the active range in 16-bit grey scale images. Two
different ranges can be set.
Calculations in 16-bit grey scale images:
The pixel values in 16-bit grey scale result images are limited to these
values. Values that become larger than the maximum value are set to
the maximum value and values that become less than the minimum
are set to the minimum value.
Display of 16 bit grey scale images:
The maximum value (and any value larger than maximum) will be
displayed as white and the minimum value (and values less than
minimum) will be displayed as black. The range between minimum
and maximum will be displayed using increasing intensities from
black to white.
Usually the Calculation and Display ranges are set to the same values.
Example 1: 12-bit grey scale images usually use values from 0 to 4095
(=212-1) so mimimum should be set to 0 and maximum should be set to
4095 for both ranges.
Example 2: 10 bit grey scale images usually use values from 0 to 1023
(=210-1) so mimimum should be set to 0 and maximum should be set to
1023 for both ranges.
The ranges are not limited in any way as long as the maximum value is
larger than the minimum value. Negative numbers can also be used.
Affine
The Geometry function can perform the same kind of transformation as
this function.
The Affine transformation consists of scaling, rotation and translation of
the image. If two images differ only in these aspects it is possible to fit
the two images to each other exactly. The transformation is described by
two first order polynomials. It is an output-input transformation hence
the polynomials describe where to pick the value in the input image for
a certain location in the output image.
Bilinear interpolation is used to get pixel values in the input image.
In
The image to be transformed.
Out
The resulting image.
Rotation & Mirroring
Geometry
When we have several images covering the same area or the same object
it is often useful to make the areas or objects overlap. This makes it
possible to combine information from several images in the image
analysis.
The Geometry function can perform geometrical transformations that
can be described by polynomials of degree 1, 2, 3 or 4. If two images
differ only in these aspects it is possible to fit the two images to each
other exactly. The transformation is described by two polynomials. It is
an output-input transformation hence the polynomials describe where
to pick the value in the input image for a certain location in the output
image.
In
The image to be transformed.
Out
The resulting image.
Row polynomial: Y = a + by + cx + ...
The row, Y, coordinate for the location in the In image from which to
fetch a pixel value for the Out image pixel at y,x.
Column polynomial: X = A +By + Cx + ...
The column, X, coordinate for the location in the In image from
which to fetch a pixel value for the Out image pixel at x, y
Geometry Tool...
Pops up the Geometry Tool. This tools make it easy to find the
transformation polynomials.
The reference image should be displayed to the right and the image to
be transformed to the left. Use the Input image and Reference image
choices to select these images.
The number of points that must be marked depends on the order of the
polynomial that should be used for the transformation.
Order Required number of points
1 3
2 6
3 10
4 15
Select the Polynomial order (not present if geometry tool was brought
up from the Affine function) that shall be used when calculating the
polynomials.
The polynomials are calculated when the Calculate polynomials button
is selected.
The coefficients for the polynomials are transferred to the Y and X areas
for the Affine or Geometry function.
A window that displays the residuals for the control points is displayed
when the polynomial coefficients are calculated. This window displays
the distances from real control points in the input image to the points
calculated from the control point in the reference image using the
polynomials. The error should be as small as possible. A large error in
some or all points means that the transformation can not be performed
correctly with the selected polynomial order.
Perspective
This function can perform translation of an image in X and Y directions,
scaling in X and Y and rotation around X, Y and Z axis.
The result image can be displayed using a parallel projection or a
perspective projection.
The origo of the coordinate system is located at the top left of the image.
The X axis is pointing to the right and the Y axis is pointing towards the
bottom of the image. The Z axis is pointing away from the viewer.
The image center is always translated to the origo before the scaling,
rotation, and perspective transformations are performed. The specified
translation is performed after the image has been moved back to its
original position.
In, Out
The input and output images.
Translation X and Y
Specifies the distance that the center of the image shall be moved.
Scale X and Y
Specifies the X and Y scale factors for the transformation.
Rotation X, Y and Z
Specifies the angle (in degrees) in which the image shall be rotated
around an axis.
X axis: A positive angle will tip the top of the image backwards.
Y axis: A positve angle will tip the right side of the image away from
the viewer.
Focal distance
The focal distance is used for the perspective projection. The distance
is measured in pixels. Useful distances are larger than half the image
size. A distance smaller than half the image size might give strange
results.
Rotate
The Rotate function rotates an image -90 or +90 degrees. The current
image size will change if the width and height of the image are not equal.
This function can be used to change from a landscape to a portrait
format and vice versa.
Original Image
The image to rotate.
Rotated Image
The rotated result.
The rotation choice makes it possible to rotate -90 or
+90 degrees.
MDL
Should be followed by a MDL command. See MDL Reference Manual
for description of the Menu Description Language.
CLOAD
Should be followed by the parameters -i, -f or -b and the name of a
color table. The color table is loaded to the specified plane, image,
background or foreground.
Commands that does not match any of these three keywords, like the
last one in the default file, are sent to a shell for execution.
☞ The Scanstage functions will only be visible if the they are enabled
with the -SCAN option when the microGOP is started. See How to enable
microGOP options, page C-7.
Calibrate
This function must be run as the first function in the Scanstage function
group.
The microGOP will open the communication with the scanning stage
controller and the scanning stage will be told to go to its origin (0,0).
☞ The Calibrate function must be called every time the microGOP has
been restarted even if the scanning stage has not been switched off since
the last calibration.
Stage.Device
The name of the serial port that the scanning stage is connected to.
Stage.ZInit: On/Off
The value should normally be On. This might not work on non SSC
controllers. Set the value to Off in these cases.
Define Slide
This function is used to define a scan area. The scan area is called a slide.
Each scan area consist of a number of frames. These frames are positions
where the scanning stage should stop to be able to read an image into the
system.
The scan area can be defined by entering the number of frames to scan
in the X and in the Y direction. The X and Y increments between each
frame can be given in microns or as the size of the measure area.
Measure areas are set with the Measure Frame or Measure Circle
functions in the Etc function group.
It is also possible to set the scan area interactively with the scanning
stage joystick.
Slide to define
The scan area is identified by a number. A maximum of 48 scan areas
can be defined.
Define scan area by
Selects the way the scan area can be defined. The scan area can be
defined interactively with the joystick of the scanning stage
controller or with values.
The parameters below are visible if Define scan area by is set to Values.
Number of frames
Defines the number of frames the scan area should have in X and Y
directions.
Increments between frames
This checkbox specifies if the measure area should be used as
increments between the frames. The increments can be specified in
microns if this box is left unchecked.
☞ The start position of a “Values defined” scan area is set when the Set
Slide function is performed.
Set Slide
This function is used to set the current scan area (or slide). The current
slide must be set in order to perform the Scan function. The current slide
is also used to calculate the number of laps that shall be used in a Frame
Loop in the Program function group, see the function Frame Loop, page
3-5-4.
Set
Current sets the scan area to be scanned to the selected number. A
slide must be defined before it can be set as current. A “Values
defined” slide (see the function Define Slide, page 3-4-3) will use the
current X and Y position of the scan stage as its start position.
This function can also be used to set the number of slides to use in a
Slide Loop. Select Slides in slide loop if this value should be set.
Number
The slide number.
Set Position
Moves the scanning stage to an absolute position in mm (origin is 0,0).
X position
Specifies the X position to go to.
Y position
Specifies the Y position to go to
Get current position
Puts the current scanning stage position into the X and Y position
fields.
The arrow buttons can be used for moving the scan stage interactively.
You can set how many steps the motors should turn for each click on an
arrow.
Steps
The number of steps to move for each click on an arrow button.
Set Z Position
This function is used to set the absolute Z position.
☞ Use this function with extreme care. It is very easy to send values to
the scan stage that will cause it to run the lens into the sample. There are
no end switches on the Z motor so the scan stage will go to the position
it is told to go to.
Z position
Specifies the position to go to.
☞ The position is not an absolute value (in mm) as is the case for
the Set Position function. The value depends on how the Z motor is
connected to the microscope.
Get current Z position
Gets the current position of the Z motor.
Show Position
Prints the current scanning stage position in the status area in the
microGOP main window. This position is relative to the origin of the
scanning stage.
Usually the position of the scanning stage is updated in the status area.
The microGOP is, however, unaware of any changes of the position that
the user has made with the joystick. This function can be used to update
the position after some user interaction with the joystick.
Scan
This function is used to move the scanning stage to the next frame in a
scan area (slide).
Typically the Scan function is put in the beginning of a Frame Loop and
then it is followed by an Autofocus and a Video grab function.
See ☞ below.
Move to next
This function can not only move to the next Frame (usually used) but
also set the next Slide as current slide.
Scan order (only visible if Frame is selected above)
The scan area can be traversed in two different ways, Meander path
or Line by line.
☞ The Set Slide function must be called before the Scan function can
be called.
☞ The Scan function must be performed for the first frame in the scan
area even if the scan stage is correctly positioned at the first frame.
Autofocus
This function is used to control the built-in autofocus function of the SSC
scanning stage controllers.
The autofocus function uses the video signal from the camera to find the
maximum contrast in the image. The autofocus can be executed in
parallel with microGOP functions since it is performed entirely within
the scanning stage controller.
The behavior of the autofocus function can be changed with four
parameters:
Threshold
Tells the autofocus to ignore differences smaller than Threshold. A
normal value is 2-16. Possible values are 1 to 63.
Steps between focus planes
This is a measure of how accurately the focus can be found. A small
value means that the autofocus will move in small steps when trying
to find he best focus. If the microscope is very much out of focus a
small value for Steps will never find the focus. The value must be a
compromise depending on how well we want to focus and how far
out of focus we expect to be which in turn depend upon the
magnification and the depth of field. However, it is possible to make
two calls to Autofocus; one for coarse autofocussing and then one for
fine focusing. This is useful when including Autofocus in a
microGOP program.
☞ Normal values are 10-200 for the SSC02 controller and 1000-
100000 for the SSC03 controller.
Delay factor
This parameter control the time to wait for the scan stage and the
microscope to stabilize after the stage has been moved. This may be
necessary in order to avoid that motion blur disturbs the autofocus.
A high magnification may require a long delay. Delay factor can be
set to 0 to 9. Set 0 for a very stable microscope and to 9 for a very
unstable one.
Run autofocus
If Synchronous is selected the microGOP will wait for the scanning
stage to focus before executing the next command. If Asynchronous
is selected the next microGOP command will be executed
immediately.
Synchronize
This function is used only when the Autofocus function is run in
Asynchronous mode. It simply waits until the auofocussing is ready.
The Variable function is, among other things, used to define variables
and user interfaces. The powerful Variable function is using a special
programming language. The description of this versatile programming
language is found in chapter 4.
You can make a microGOP program without using any of the program
functions but they are useful and necessary if you want to make flexible
and user friendly programs.
Loop
This function starts a loop in a program. The loop should end with a End
Loop function. The functions between the Loop and EndLoop functions
will be repeated the specified number of times.
Laps in loop
The number of laps in the loop. The program lines between the Loop
function and the next End Loop function in the program will be
repeated the number of times that is specified here.
Slide Loop
This function is used together with the Scanstage functions.
The function starts a loop over a number of defined slides. The
maximum number of slides to loop over is set in the Set Slide function.
The Slide Loop should end with an End Loop.
Frame Loop
This function is used together with the Scanstage functions.
It starts a loop over all frames in the current slide. The current slide must
be set with Set Slide before a Frame Loop is used. Use the Scan function
to jump between the frames in the slide.
End Loop
The End Loop marks the end of a loop (Loop, Slide Loop or Frame
Loop).
There has to be an End Loop for every Loop, Slide Loop and Frame
Loop in a program.
Label
A Label indicates a position in the program. The Label function is
inserted into a program to enable functions like Goto, IfExtern,
IfExpression, IfFeature, IfQuery and Subroutine to make jumps to it.
Label to insert
The name of the label. This name is used by other functions to refer
to the label.
List defined labels...
This button draws a window which lists all the labels that are
already used in the program
Goto
This function makes an unconditional jump to a Label in a program. The
execution of the program will continue at the position of the label.
Goto label
The name of the label to jump to.
Labels...
This button draws a window which lists all the labels that are
already used in the program. A selection in the label list will transfer
the label name to the Goto label field.
Stop
The Stop function stops the execution of a program. The Continue
button in the microGOP main window can be used to continue
execution on the program line after the Stop function.
Subroutine
The Subroutine function makes a jump to a Label in a program. This is
very similar to a Goto except that the point from where the subroutine
call was made is stored. The Return function causes the program
execution to jump back to the line immediately after the latest
Subroutine call.
Call Subroutine
The name of the label (subroutine) to jump to.
Labels...
This button draws a window which lists all the labels that are
already used in the program. A selection in the list will transfer the
name of the label to the Call Subroutine field.
☞ The Return function must be called at some time after the Label
which Subroutine made a jump to. Nested calls are allowed but be sure
that there is a call to Return for every call to Subroutine.
The example to the right shows the program
flow of a subroutine call. A jump is made to a
label and a return jump is made to the line after
the subroutine function. The dots in the figure
represents other functions.
Return
This function makes a jump in the program to the line after the last
Subroutine call. See the function Subroutine, page 3-5-9.
If Query
This is a type of If-then-else function. A notice pops up when the If
Query function is executed. The notice contains a question and two
buttons.
The left button is the TRUE button that cause the then action to be
performed. The right button is the FALSE button causing the else action
to be performed. The action can be Goto a label, a Subroutine call to a
label, Continue for just “falling through” to the next program line or
Skip for skipping the next program line. Continue and Skip saves you
the trouble of inserting labels. The question text as well as the button
texts can be specified.
Question
The text to be printed in the notice.
Then
Select the type of action to be taken: Goto, Subroutine, Continue or
Skip.
Then label
Select a label if the action is Goto or Subroutine.
Labels...
This button draws a window which lists all the labels that are used
in the program.
A selection in the list will transfer the name of the label to the Then
label field.
Then button text
The text to be printed in the TRUE button.
Else
Select the type of action to be taken: Goto, Subroutine, Continue or
Skip.
microGOP 2000/S User’s Guide 3-5-11
3 Functions in microGOP 2000/S - Program Group
Else label
Select a label if the action is Goto or Subroutine.
Labels...
This button draws a window which lists all the labels that are used
in the program.
A selection in the list will transfer the name of the label to the Else
label field.
Else button text
The text to be printed in the FALSE button.
If External
This If-then-else function uses the return status from a Unix command
or another external program. If the return status is not equal to 0 the then
branch is performed and if the return status is equal to 0 the else branch
is performed. The actions can be selected as in the If Query function
If external command
The command or program to be invoked.
The rest of the parameters works exactly as the corresponding
parameters in the function If Query.
If Expression
This If-then-else function compares two variables with some relational
operator. The result is TRUE or FALSE and it determines which branch
of the If Expression statement that is performed.
If
This line is used to select the two variables and the relational
operator. The example below will jump in the THEN branch if the
variable total is larger or equal to the variable $NbrObjects:
☞ Do not try to bind variables here, just enter the variable names
directly.
If Feature
☞ This function is here of compatibility reasons. The same
functionality can be achieved with a combination of the Variable
function and If Expression.
This If-then-else function checks if a measured object feature is within a
given range. You can state that all objects or at least one object in the
measurement must fulfill the condition. The result is TRUE or FALSE
and determines which branch of the If Feature statement that is
performed.
If
Select which feature to check.
Any/All
Selects how the condition should apply.
Low
The low limit for the interval.
High
The high limit for the interval.
Shell
This function executes a UNIX command in a Bourne shell. The
execution of a microGOP program stops if the exit status of the program
is not 0.
Shell command
The command to execute.
Notice
This function draws a notice window which the user must confirm
before the program execution continues.
Here follows an example on how to use the Ui() function in the Variable
function instead of Notice :
Fill in the following in the Notice parameters:
The same can be achieved within the Variable function. Fill in the
following lines in the parameter window of the Variable function:
Ui(MESSAGE,"",\
MESSAGE,"Insert the specimen in the microscope !",\
BUTTON_TEXT,"Press when ready","")
Message
The Message function prints a text in the message window. The message
window can be cleared before the message is printed.
Variable
The Variable function is very powerful and is often used to make
powerful and easy to use microGOP programs. The full functionality of
the Variable function is described in chapter 4 of this manual.
The Variable function is, for example, used to define variables, make
calculations, generate user interfaces and call external programs. The
defined variables can be bound to parameters of other functions.
Defined variables...
Displays a window with the defined variables. First, the user defined
variables are listed, then the system variables are listed in
alphabetical order. The object feature vector variables are found at
the end of the list.
Editor...
It can be difficult to get a good overview of the statements that have
been written in to the small Statements window. This button can be
used to bring up the statements in a text editor for editing.
☞ The contents of the text editor must be saved and the editor must
be terminated to be able to continue to work with the microGOP. The
changes made in the text editor are automatically transferred to the
Statements window when the editor is terminated.
☞ This function is the most powerful and also the most complex of all
the functions in the microGOP. It is very well spent time to read all about
it in chapter 4.
Present
This function is used to produce histograms and scattergrams that can
not be produced by functions in the Measure function group. The
function uses data that is accessible in the Variable function. See chapter
4 for a description of statements in the Variable function.
X Vector
The vector for containing the data for the X axis.
X Min
The minimum value for the X axis.
X Max
The maximum value for the X axis.
Xtext1
The first line of X axis text.
Xtext2
The second line of X axis text.
Screen/Laser
Specifies where the diagram is printed.
Width
The width of the produced diagram.
Height
The height of the produced diagram.
☞ It is not necessary to fill in all fields. The required fields are X Vector
and Y vector (for scattergrams). The maximum and minimum values
will be calculated from the vectors if they are not specified.
The following pages show some examples of how to use the Present
function.
Fill in the Present function like below and the diagram to the right
will be produced when the Present function is performed.
Fill in the Present function like below and the diagram to the right will
be produced when the Present function is performed.
Timer
Starts or stops a timer (stop-watch). This is used for checking the
execution time for programs or program sections.
Timer function
Selects if the timer should be reset and started or if it should show
the elapsed time since last reset. The elapsed time is displayed in the
microGOP main window. There is no “Stop timer” function.
Pause
The function pauses the program execution for a number of seconds.
Pause
Number of seconds to pause. The maximum is 30 seconds.
☞ A loop can be put around the Pause function if longer pauses than
30 seconds are required.
Comment
Enters a comment line into the program. This function has no action
associated with it. It is only used to make microGOP program listing
(.lst) files more readable.
Comment
The comment to put in the program.
These functions
are only available
with the GOP or
MIP hardware
option.
Shading
The Shading function is used to remove uneven illumination in images.
The function needs an image that contains only the uneven illumination.
This image is called the shading image.
The shading image is grabbed under the same light conditions as the
input image. The shading image should not contain any objects. It
should only describe how the illumination varies over the image. The
input image is compensated with the shading image as a reference. The
same shading image can be used to correct all images that are grabbed
under the same light conditions.
There are situations when it is not possible to grab a shading image.
Then the image itself can be used as a shading image. There are two
restrictions: The image must contain dark objects on a bright
background and a large fraction of the image pixels must be
“background” i.e. a smooth surface without any objects.
Image to correct
The grey scale image that is unevenly illuminated.
Reference image
A separate shading image or the same image as Image to correct. If
the same image is used as Reference image the restrictions above
must be taken into account
Corrected image
The result image.
Thresh
This function thresholds a grey scale image or a GOP image into a binary
image. Pixels with values within a certain interval (slice) are set to 1 in
the binary image and the rest are set to 0.
When thresholding a grey scale image you set a grey level interval.
When you threshold a GOP image you set intervals for both the
magnitude part and the argument part of the pixel value.
The current slice is applied to the image selected by the Image to
threshold parameter. The slice will be displayed in color in the Image
Display window as soon as a parameter changes or as soon as the cursor
enters any of slice areas in the parameter area.
Image to threshold
A grey scale image or a GOP image.
Binary image
The result image.
Inside/Outside
Select if pixels inside or outside the slice are to be thresholded out.
Magnitude Threshold
Adjusts the slice level. Place the cursor within the slice and drag it to
adjust both Low and High. Place the cursor outside the slice and
drag Low or High.
☞ The slice that is used during the dragging of the slice differs
slightly from the one that is actually used in the thresholding. The
slice that is shown when not dragging is the “true” one.
Argument Threshold
This part of the UI is only visible when a GOP image is used as Image
to threshold. The colored part of the image in the Image Display
shows the combination of the threshold in the magnitude and the
threshold in the argument of the GOP image. See Magnitude
Threshold above for a description of how to adjust the slice.
Stretch
This function stretches the grey scale of an image to increase the
contrast. Images with low contrast that only use a part of the dynamic
range can be improved by this function.
Input image
The image to stretch.
Output image
The result image.
Relative / Absolute
Absolute stretch remaps the pixel values so that values from
minimum to Low are mapped to minimum in the output image and
pixel values from High to maximum are mapped to maximum in the
output image. The rest of the pixel values will be spread evenly over
the minimum-maximum range.
Relative stretch uses the image grey values to determine the Low
and High values. In this case you enter a percentage instead of an
absolute grey value. The image histogram is measured and the Low
and High percentile is determined. I.e. Low % of the darkest pixels
are excluded. The lowest pixel value in the image with these pixels
excluded is used as absolute Low. The same applies for High from
the high end of the pixel values. The reason for excluding pixel
values and not using the lowest or highest value is to reduce the
influence of noise.
Low, High
See Relative / Absolute description above.
☞ Note that Low ≤ High in Absolute mode and Low + High ≤ 100.0
in Relative mode.
☞ A Relative Stretch with Low % and High % set to zero can be used
to make an “automatic” stretch. This will increase the contrast in the
image.The histograms below shows the grey scale distribution before
and after a Stretch operation.
Average
This is a linear filtering operation that computes the local average for
every neighbourhood in the image. The averaging can be flat i.e. each
pixel in the neighbourhood has the same weight or the neighbourhood
can be weighted by a gaussian “bell” function. The weighting function
is called the filter. Larger filters give a higher degree of smoothing.
Input image
The image to filter.
Output image
The result image.
Filter size
The size (width and height ) of the quadratic neighbourhood and the
filter used. Use 3 - 11 for gaussian filters and 3 - 63 for flat filters.
Filter type
Select the filter type, Flat or Gaussian.
Amp
Amplification factor to multiply the output image by. This
parameter is usually 1 when the input and output images are of the
same type.
Off
An offset to be added to the output image.
Median
The Median function can be used to remove “salt and pepper” noise in
the image. For each neighbourhood in the image the median of the grey
scale values is computed. This median value becomes the output pixel
value.
The median filter is often used to remove noise from the image with
minimal degradation of sharp edges. One drawback is that can remove
thin lines and destroy corners of objects.
The Median operation does not use a filter. The Filter size parameter
specifies the size of the neighbourhood.
Input image
The image to filter.
Output image
The result image.
Filter size
The neighbourhood size (width and height). Odd values between 3
and 127 are allowed.
☞ The median for a set of sorted numbers is the value in the middle of
the set.
Rank
The Rank function is a generalization of the Median function. Instead of
picking the middle value of the sorted values the n:th value is selected
and becomes the pixel value for the output image.
Input image
The image to filter.
Output image
The result image.
Filter size
The neighbourhood size (width and height). Use odd values
between 3 and 127.
Rank
The value to pick from the sorted values. Possible values are 1 -
(Filter size x Filter size).
Sobel
The Sobel function is an edge detector. It detects transitions between
dark and bright areas (grey scale edges). Due to the filter size, 3×3, it is
very sensitive to image noise.
Input image
The image to filter.
Output image
The result image.
Amp
Amplification factor to multiply the output image by.
Off
An offset to be added to the output image.
Prewitt
This is a 3×3 neighbourhood edge detecting function like Sobel.
Input image
The image to filter.
Output image
The result image.
Amp
Amplification factor to multiply the output image by.
Off
An offset to be added to the output image.
Laplace
Yet another edge detector. The function is a 3×3 approximation of the
Laplacian operator which is the sum of the second derivatives. This filter
is very sensitive to noise.
Input image
The image to filter.
Output image
The result image.
Amp
Amplification factor to multiply the output image by.
Off
An offset to be added to the output image.
Conv 3×3
This function allows you to design an arbitrary 3×3 filter and apply it to
an image. Depending upon the magnitude of the the coefficients the
resulting image will vary widely in magnitude. The Amp parameter
adjusts the magnitude in the output image.
Calculate
This function is a calculator for grey scale images. It takes one or two
images as input and computes an output image.
Input image #1
The first input image.
Input image #2
The second input image.
Output image
The result image.
Expression
The following calculations can be performed:
#1 and #2 are the two input images. Some of the operations does not
use the second input image and some of the operations does not use
the A parameter. The & and | operators are the bitwise and and
bitwise or operators.
A, B
Values for A and B in Expression.
Mask
The Mask function copies a grey scale image to another grey scale image.
Only pixels that are 1 in the binary mask image are copied. The rest of
the pixels in the output image are set to 0.
Input image
The input image.
Mask image
The binary mask image.
Output image
The result image.
Or
The Or function performs logical bitwise OR for each of the 8 bits in two
grey scale images. This operation can be used for mixing two grey scale
images:
Input image #1
The first input image.
Input image #2
The second input image.
Output image
The result image.
Example
• Use the Mask function to produce a grey image.
• Use the Not to invert the binary mask image.
• Use the inverted binary image and apply the Mask function to
another grey image.
• Now use the Or function to OR the two masked images together.
Invert
Inverts a grey scale image. The new pixel value = 255 - old pixel value.
Input image
The image to invert.
Output image
The result image.
Erode
This operation erodes or “peels off” layers of pixels from the objects. In
each erosion step all inner border pixels become background pixels. The
result is determined by the connectivity rule the operation uses.
Input image
The image to erode.
Output image
The eroded result image.
Connectivity
Select 4- or 8-connectivity for the erosion.
Alternate connectivity
Enables alternating connectivity when running the function more
than 1 step. The use of alternating 4- and 8-connectivity helps to
preserve round shapes that may otherwise degenerate into quadratic
or rhomboid shapes. If Connectivity is set to 4 the function uses 4-,8-
,4-.... connectivity and vice versa.
Number of steps
The number of times to apply the erosion operator. (The number of
layers to peel off).
Dilate
This operation dilates or adds layers of pixels to the objects. In each
dilation step all outer border pixels become object pixels. The result is
determined by the connectivity rule the operation uses.
Input image
The image to dilate.
Output image
The dilated result image.
Connectivity
Select 4- or 8-connectivity for the dilation.
Alternate connectivity
Enables alternating connectivity when running the function more
than 2 steps. The use of alternating 4- and 8-connectivity helps to
preserve round shapes that may otherwise degenerate into quadratic
or rhomboid shapes. If Connectivity is set to 4 the function uses 4-,8-
,4-.... connectivity and vice versa.
Number of steps
The number of times to apply the dilation operator. (The number of
layers to add).
Point Erode
This function erodes objects towards points.
The Keep Objects option should be used if only one point per object
should be created. The Break Objects option can cause objects to break
up into several objects when eroding which will cause several points to
be created.
Objects with holes will be eroded towards rings if Keep Objects is
selected.
Input image
The binary input image.
Output image
The binary result image.
Steps
The number of steps to erode. The erosion will be run this number of
steps towards points. This value should be set to -1 to erode entirely
to points.
Border
The pixels outside the image can be considered to be object pixels
(=1) or background pixels (=0).
Break Objects / Keep Objects
Break Objects will break up objects and create several points per
object. The Keep Objects option will create only one point for each
object.
This function was created by Johan Knol of IDUNA Electronics, The Netherlands.
Skeleton
The skeleton of an object can be defined in many different ways. It
should be a 4- or 8- connected, one pixel thin, network. The skeleton
describes the topology of an object and is preferably used on objects that
consist of thin segments.
Input Image
The image to run skeleton on.
Output Image
The skeletonized image.
Connectivity
The connectivity for the resulting skeleton can be 4- or 8.
Line Ends
This function operates on a binary skeleton. It erodes or dilates the line
ends in one or several directions. The function can be used to close small
gaps in a network of lines.
Input Image
The input image.
Output Image
The result image.
Number of steps
Number of pixels to remove or add to line ends.
Mask
Select directions to erode/dilate in. Only the selected directions are
handled.
Erode
The selected directions are eroded. Objects can disappear.
Erode keep objects
The erosion can be set not to remove any objects i.e. keep at least one
pixel for all objects.
Dilate
The selected directions are dilated.
Dilate until object
The dilation can be set to dilate only until it reaches another object
pixel.
☞ The line ends are detected in a 3x3 neighbourhood. This means that
only line ends that are 8-connected can be handled.
Line Ends 2
This function operates on a binary skeleton. It dilates the line ends
according to the argument in a Gop image. The argument in the Gop
image should describe the angle in which to dilate the line end.
Input Image
The input image.
Gop Image
The Gop image.
Output Image
The result image.
Number of steps
Number of pixels to add to line ends.
Magnitude
Only line ends where the magnitude in the Gop image is above this
value will be dilated.
Open
Open erodes the objects a number of steps and then dilates them the
same number of steps. This can separate objects that are connected by
thinner sections.
☞ Objects that disappear in the erosion are not restored in the dilation.
Input image
The image to open.
Output image
The opened image.
Connectivity
Select 4- or 8-connectivity for the erosion and dilation.
Alternate connectivity
Enables alternating connectivity when running the function more
than 2 steps. The use of alternating 4- and 8-connectivity helps to
preserve round shapes that may otherwise degenerate into quadratic
or rhomboid shapes. If Connectivity is set to 4 the function uses 4-,8-
,4-.... connectivity and vice versa.
Number of steps
The number of steps to erode and dilate.
Close
This is the converse to the Open operation. First it dilates and then
erodes the same number of steps. This closes small gaps between objects.
Input image
The image to close.
Output image
The closed image.
Connectivity
Select 4- or 8-connectivity for the dilation and erosion.
Alternate connectivity
Enables alternating connectivity when running the function more
than 2 steps. The use of alternating 4- and 8-connectivity helps to
preserve round shapes that may otherwise degenerate into quadratic
or rhomboid shapes. If Connectivity is set to 4 the function uses 4-,8-
,4-.... connectivity and vice versa.
Number of steps
The number of steps to dilate and erode.
Separate
The Separate function separates objects that touch each other. The best
result is achieved for objects that are compact or at least convex and have
a limited overlap. The function uses the watershed function on a
distance map of the objects. The watershed is used to cut apart
overlapping objects.
Fill
Fills all holes in objects. A hole is defined as a piece of the background
enclosed by object pixels from one object. The background pixels of the
hole are not connected to the background outside the object.
Input image
The image to fill objects in.
Result
The filled result image.
Hull
The Hull function creates the convex hull of the objects in a binary
image. All objects are transformed into convex objects.
Touch
The Touch function uses a binary image as a mask image. For each
object in the input image is checked how much of the object that is
covered by the mask. The mask is all object pixels in the mask image.
This function is useful when you have somehow determined a few
pixels that you know belong to an interesting object. This image can be
used as a mask on another image which contains the correct shape of the
objects.
A programmer might express the function as:
FOR each object in the Input image
IF ((the object is covered > low %) AND
(the object is covered <= high %)) THEN
keep the object
ELSE
discard the object
Input image
The input image
Mask image
The binary image to use as a mask.
Output image
The result image.
Match
The Match operation uses a 3×3 neighbourhood as a mask or template.
All pixels that match this neighbourhood are treated according to Mode.
Input image
The input image.
Output image
The result image.
Mask
Each location in the mask can be 0, 1 or -. 0 matches background
pixels and 1 matches object pixels. The - character (don’t care)
matches both object pixels and background pixels. You shift through
the values by clicking on them.
Mode
For each neighbourhood that matches the mask you can select three
different actions:
Detect Write object pixels in the output image at matched
positions.
Add Add object pixels to the input image at the matched
positions and write the result in the output image.
Remove Remove object pixels at the matched positions in the
input image and write the result to the output image.
Example
This example will expand the right side of all objects one pixel.
Not
Performs an inversion of the pixels (logical NOT operation) in the input
image. Object pixels become background pixels and vice versa.
Input image
The image to invert.
Output image
The inverted result.
And
Performs a logical AND operation between the pixels in two images. If
the pixel at the same location in both images is 1 the output pixel is 1
otherwise it will be 0.
Image 1
The first input image.
Image 2
The second input image.
Result
The result image.
Or
Performs a logical OR operation between the pixels in two images. If at
least one of the pixels at the same location in two images is 1 then output
image will be 1 otherwise it will be 0.
Image 1
The first input image.
Image 2
The second input image.
Result
The result image.
Exor
Performs a logical XOR between the pixels in the two images. If one and
only one of the pixels at the same location is 1 the output is 1 otherwise
it is 0.
Image 1
The first input image.
Image 2
The second input image.
Result
The result image.
Sub
Subtracts Image 2 from Image 1. If Image 1 is 1 and Image2 is 0 the
Result will be 1 otherwise it will be 0.
Image 1
The first input image.
Image 2
The second input image.
Result
The result image.
Chaincode
This function generates chain code for the objects in the image. The chain
code is stored in a file. There is no other microGOP function that can
operate on this chain code and it can not be imported again. However
the chain code can be used by other programs for analysis of objects and
for generating vector representation of the image. The chain code can be
generated for lines or objects.
Image to chaincode
The binary image to create chain code for.
Chain code filename
The chain code file name.
Coding of: Objects/Lines
Objects or lines can be coded.
The object coding will create a chain around every object.
The line coding must have a skeletonized image as input image.
Every line is coded with a chain from one line end/crossing to
another line end/crossing.
Distance Map
Generates a distance map from a binary image. The distance map is a
grey scale image. Each value of a pixel in the grey scale image is the
minimum distance to the object border for the corresponding pixel in the
binary image.
Input image
The binary input image.
Distance map image
The greyscale distance image.
☞ The grey scale dilations are performed using maximum Rank filters
and grey scale erosions are performed using minimum Rank filters. See
grey scale function Rank, page 3-7-9.
There are a lot of books and papers written about the Watershed
function and mathematical morphology. Here are some examples:
Book:
Title: Mathematical morphology in image processing edited by Edward R.
Dougherty, Marcel Dekker, Inc, 270 Madison Avenue, New York, New
York 10016.
Chapter 12 in this book is of special interest: The Morphological
Approach to Segmentation: The Watershed Transformation by S. Beucher
and F. Meyer, Centre de Morphologie Mathematique Ecole des Mines de
Paris, Fontainebleau, France
Paper:
Morphological Segmentation, F Meyer and S. Beucher, Centre de
Morphologie Mathematique, Paris School of Mines, 35, rue Saint Honore’,
77305 Fontainebleau, France, JOURNAL OF VISUAL
COMMUNICATION AND IMAGE REPRESENTATION, Vol 1, No. 1,
September, pp. 21-46, 1990
Morphological Gradient
The morphological gradient is used to find gradients (edges, lines) in a
gray scale image. The difference between the dilated and the eroded
image is calculated.
Input image
The input image
Output image
The result image.
Filter size
The size of the filters.
Grey Erode
The Grey Erode function erodes the grey scale image. Brighter areas in
the image will shrink and darker areas will expand.
Input image
The input image
Output image
The result image.
Neighbourhood size
The size of the filters.
Steps
The number of times to run the function.
Grey Dilate
The Grey Dilate function dilates the grey scale image. Darker areas in
the image will shrink and brighter areas will expand.
Input image
The input image
Output image
The result image.
Neighbourhood size
The size of the filters.
Steps
The number of times to run the function.
Grey Open
The Grey Open function runs a number of Grey Erodes followed by the
same number of Grey Dilates. Brighter slightly connected areas in the
image will be separated.
Input image
The input image
Output image
The result image.
Neighbourhood size
The size of the filters.
Steps
The number of erosions and dilations to run.
Grey Close
The Grey Close function runs a number of Grey Dilates followed by the
same number of Grey Erodes. Brighter slightly separated areas in the
image will be connected.
Input image
The input image
Output image
The result image.
Neighbourhood size
The size of the filters.
Steps
The number of erosions and dilations to run.
Watershed
The Watershed function runs on a grey scale image and produces a
binary image.
Think of the grey scale image as a landscape where the intensity in the
image is the altitude. The valleys have low intensities and the mountains
have high. If we pierce a hole in every local minima (valley) and lower
the whole surface into water, the water will rise up in the valleys. The
water coming from one hole will eventually merge with water from
another hole. At such places, where water from different holes meet, we
will build dams preventing the water from meeting. These dams are the
result of the operation and they will be put in the binary image.
The big problem with the Watershed function is that it often produces
an image with a huge amount of dams (oversegmentation). This can be
prevented with the use of a marker image. This marker image is a binary
image which contains the positions (markers) where the flooding is
allowed to start.
Input image
The grey scale input image.
Marker image
The binary marker image. Use E (empty) to run without a marker
image.
Output image
The binary result image.
The Measure function is used to calculate object features like area and
perimeter. This function must be run before any object feature data can
be used for object classification or presentation.
The Classify function is used to discard objects that should not be
included in the data presentation.
The object data can be presented with the Histogram, List, Basics or
Scattergram functions.
☞ All object features are scaled with the current scale factor. The scale
factor is set in the Set Scale or Define Scale functions in the Etc function
group.
Measure
The Measure function measures features for objects in a binary image.
The Measure function must be run before any presentation or
classification of object features can be done.
The function creates a label image where pixels belonging to the same
object will have the same label (number). The label image is displayed
when the Measure function is run if Automatic image update is enabled
(see function Settings, page 3-3-8). The label image is displayed in color
where the background is grey and the objects have different bright
colors. The colors are used to make it easier for the user to see the
separate objects.
The current label image can always be displayed using the Display
Label function in the Image function group.
☞ Only the objects that are inside the measure area are put in the label
image. See Use measure area below.
Features to measure...
This button brings up a popup window where the features to
measure are selected. The features are described on next page.
Image
A binary image to measure.
Cent GravX
The x coordinate for the object’s center of gravity. The centre of
gravity is the point on which the object would balance if it was a 2-
dimensional body.
Cent GravY
As above but for the y coordinate.
Moment X
The second moment of inertia along the x axis.
Moment Y
The second moment of inertia along the y axis.
Mom Ang
Moment angle. The angle for the object’s axis of minimum inertia.
Length
The length is computed as Perimeter / 2. Hence it is only significant
for “thin” objects.
D Max
The maximum diameter. It is the maximum distance between any
two points on the object’s circumference.
D Max Ang
The angle for the maximum diameter. The maximum distance in the
object occurs between two points and forms an angle with the x axis.
Width
The width of an object perpendicular to D Max.
Ratio
The ratio between D Max and Width. ( D Max / Width )
☞ All object feature measurements are scaled with the system variable
$ScaleFactor. If for some reason you need to convert these values to
number of pixels (e.g. draw a graphics circle with a diameter of D Max
for each object), just divide the feature values with $ScaleFactor.
Classify
The Classify function discards objects that do not fulfill the conditions
set up in a condition list. Up to 10 conditions can be used at the same
time. Objects that pass all conditions will be kept and the others will be
discarded. The Create Binary function can be used to create a binary
image from the classified label image.
You can edit conditions by first selecting them in the list and then
changing the parameters in the area below the list. One condition at a
time can be edited.
Add Condition
Adds a condition to the end of the condition list.
Point...
Pops up the Point pop-up window. A measurement must have been
performed before Point... can be selected. The Point window is
described on page 3-10-6.
Delete condition
Deletes one or all conditions from the condition list. The first
condition can not be deleted.
Conditions:
Shows the number of conditions currently defined. A maximum of
10 conditions can be defined.
The area below the list is used
for editing the currently
selected condition in the list.
Include/Exclude
Defines if the objects that
fulfill the condition should
be kept (included) or
discarded (excluded).
The feature icon selects the
feature for the condition
and the value fields to the
left and right defines the
range for the selected
feature.
The Point window contains a list and a few buttons. Use the mouse to
click on objects in the image display. The object numbers and the
features for the objects are displayed in the list.
Create Binary
Creates a binary image from the objects currently in the label image. This
is useful if further binary operations are necessary on the objects in the
label image.
Binary image
Select a binary image.
Histogram
Presents one of the features measured with the Measure function. You
can present the latest measurement or you can accumulate over several
measurements. The histogram can be presented on the screen, on a
printer or printed to file.
X axis:
The number of classes (bars) or the class width (bar width) can be set.
Auto can be used to get automatic scaling of the axis. It is also
possible to set the scaling manually by unchecking the Auto
checkbox.
Y axis:
Select automatic or manual scaling of the Y axis.
Differental/Cumulative
The histogram can be printed as a differential or as a cumulative
histogram.
Print on:
Select Screen, Laser printer, EPS file or Bitmap file. The bitmap file
will be in TIFF format. The EPS file and Bitmap file selections
require a file name.
Size...
This button is visible when printing on Laser and EPS file. The
button brings up a window where it is possible to set the position
and size of the histogram on the paper.
Bar Value/Bar %
Enables printing of frequency and percentage in the bars in the
histogram.
Comment
A text string that will be printed at the top of the histogram.
Histogram name:
The name of the histogram. This name is only used to refer to the
histogram in the accumulate and print steps. Up to 20 different
histograms (with different names) can be defined at the same
time.
X axis:
These fields works exactly as described on last page.
The printed histogram will look something like the ones below
depending on the parameter settings.
List
This function prints a list with the feature values for all objects in the
latest measurement. The list can be presented on the screen, on printer
or on a file. Files can be appended which is a way of accumulating over
several measurements.
Features to measure...
This button brings up a popup window where the features to list are
selected.
List last measurement on
The features can be listed on the Screen, Laser, File new, File
append, File append (no header), and File clear.
File new means that the list is printed in an empty file. An existing
file will be overwritten.
File append means that the list is appended to a file. The file is
created if it does not exist.
File append (no header) works just like File append with the
exception that no header information is written for the list of data.
File clear means that an empty file is created. The data in an existing
file will be erased. No list is printed in the file.
Filename:
This field must be filled in for File new, File append, File append
(no header), and File clear.
The following window appears if the Screen is used as destination for
the list.
Basics
The Basics function presents standard statistics for one measurement
feature. You can present statistics for the latest measurement or
accumulate over several measurements. The statistics can be presented
on the screen, on a file or on a laser printer. See Histogram for a
description of the Print latest (page 3-10-8) and define-accumulate-
print procedure (page 3-10-9).
Name
Define, Accumulate to and Print accumulated take a name as
parameter.
Destination
Print on Screen, Laser or File.
Filename
If presented on a file the filename is given here.
Comment
A comment text can be printed with the statistics.
Example of a Basics printout on the Screen.
Scattergram
The Scattergram function presents a 2 dimensional diagram of two
features. Each object corresponds to one dot in the feature space.
Scattergrams can be presented for the latest measurement or they can be
accumulated. The scattergram is accumulated on file. The files may
become very large when many object are accumulated. See Histogram
for a description of the Print latest (page 3-10-8) and
define-accumulate-print procedure (page 3-10-9). The Delete function
is used to delete an old accumulated histogram.
Select Print Latest, Define, Accumulate to, Print accumulated or
Delete.
Select which feature to plot on x- and y- axis.
Min X, MaxX, Min Y, Max Y
The scaling of the X and Y axis can be automatic or manual.
Name
This field is used for Define, Accumulate to, Print accumulated or
Delete.
Comment
A comment text can be printed with the scattergram.
Print on:
Select Screen, Laser printer, EPS file or Bitmap file. The bitmap file
will be in TIFF format. The EPS file and Bitmap file selections
requires a file name.
Size on paper...
This button is visible when printing on Laser and EPS file. The
button brings up a window where it is possible to set the position
and size of the histogram on the paper.
Example of a Scattergram.
Area Fraction
The Area Fraction function measures the area fraction for pixels within
certain grey level intervals. It is possible to measure in one image or
accumulate over several images. Accumulation requires a defined task.
After a number of accumulations over some images it is possible to print
the result on paper, file or the display. Tasks that have been defined can
be listed and loaded again.
Up to 10 phases (grey level intervals) can be defined. Each phase is given
a name for identification in the result list. A grey level interval is
specified for each phase. The grey level interval is displayed in the
image display window.
When adding phases to the list you can select Tile mode which means
that neighbouring phases can not overlap in the grey scale. This mode
can be turned off if desired.
The result is presented in a bar diagram and in a list containing the grey
level intervals for the different phases.
The presentation is done in a pop-up window on the display, on the
laser printer or on an EPS file.
Overlap/Tile
Select if phases should be tiled or overlapped.
Add Phase
A new phase can be added before or after the phase currently
selected or to the top or the end of the phase list.
Delete Phase
Deletes the selected phase or all phases.
The area below the list is used for editing the currently selected phase in
the list.
Phase
The name for the selected phase in the list.
Lo, Hi
The grey value range for the current phase.
Create
Creates a binary image from the current phase if set to other than E.
Bar Value
Print the area for each phase on its bar.
Bar %
Print the area fraction on each bar.
Print on:
Select Screen, Laser printer, EPS file, Bitmap file, or Nothing. The
bitmap file will be in TIFF format. The EPS file and Bitmap file
selections requires a file name. Two files are create when EPS file is
used: The EPS file is created without extension and a text file is
created with the extension afp. Nothing doesn’t produce any
printout when the calculation is made. This is useful if you just want
to use the system variables in the Variable function after an Area
Fraction call.
Size on paper...
This button is visible when printing on Laser and EPS file. The
button brings up a window where it is possible to set the position
and size of the histogram on the paper.
Comment
A comment to be printed with the result.
Dump
This function dumps (writes) a Basics, Histogram or Scattergram to a
file. The dump can be retrieved later and accumulated to further. The
Dump format is binary and is not suited for other programs to work on.
Dump
Indicate the type of statistics to dump: Basics, Histogram or
Scattergram.
Name
The name for the statistics. I.e. the name under which the statistics is
defined in microGOP.
To file
The name of the file to save the dump in.
Retrieve
Retrieve statistics from a previous Dump. A Retrieve replaces any
accumulated data with the same name that might be in use.
Dump
Indicate the type of statistics to retrieve: Basics, Histogram or
Scattergram.
From file
The name of the file to retrieve the dump from.
Grey Histogram
Presents a histogram on the screen or on the laser printer over the grey
levels in a grey scale image.
Grey image
The grey image to measure the histogram for.
Binary mask image
If not E the binary image selected is used as a mask for the histogram.
Only pixels lying under he mask are taken into account by the
histogram.
X axis Min Intensity, Max Intensity
Set the min and max grey level for the X-axis in the histogram.
Y axis
The scaling of the Y-axis can be automatic or manual.
Print on:
Select Screen, Laser printer, EPS file, Bitmap file, or Nothing. The
bitmap file will be in TIFF format. The EPS file and Bitmap file
selections requires a file name. Nothing doesn’t produce any
printout when the calculation is made. This is useful if you just want
to use the system variables in the Variable function after a Grey
Histogram call.
Size on paper...
This button is visible when
printing on Laser and EPS
file. The button brings up a
window where it is possible to
set the position and size of the
histogram on the paper.
Comment
A comment to be printed with
the histogram.
Example of a
Grey Histogram
printout:
float $GreyHistogram[]
This variable contains the latest measured grey scale histogram.
☞ This vector, like all other vectors, start with index 1. The first
entry (entry 1) in the vector contains the number of pixels for
intensity 0. For an 8-bit image, the entries 1-256 will be filled with
values even if the pixel values are between 0 and 255.
float $GreyHistogramMinVal
float $GreyHistogramMaxVal
Minimum/maximum intensity values in the histogram.
float $GreyHistogramMinFreq
float $GreyHistogramMaxFreq
Minimum/maximum frequency values in the histogram.
float $GreyHistogramMean
Mean intensity value in the histogram.
float $GreyHistogramStdDev
Intensity standard deviation in the histogram.
☞ The are a lot of books written about stereology. This book describes
stereology methods used in microscopy:
Computer-assisted microscopy: The measurement and analysis of images by
John C. Russ, Plenum Press, New York, ISBN 0-306-43410-5.
Intercept
This is a function that puts test lines on a binary image and then
calculates the intercepts (chords) between the lines and the objects in the
binary image.
The figure above contains one test line and 4 objects. There are 4
intercepts (chords) between the test line and objects and also 4 intercepts
between the test line and the background. There are 7 intersections
(transitions) between the background and the objects along the test line.
The number of objects along the test line is often considered as the
number of intersections divided by 2 which will give the value 3.5 in this
case.
The output from the function is a number of variables containing the
values described above. These variable values can be used for different
stereological calculations. The variables are described later in this
section. First a description of the parameters to the function.
Image
Specifies the binary image to make measurements in.
Number of test lines
The number of test lines to put on the image.
Test Line Directions
The test lines can be put in the following directions:
Horizontal The test lines will be horizontal.
Vertical The test lines will be vertical.
Random The test lines will be drawn at a random angle.
Specified The test lines will be drawn at a specified angle.
Possible angles are in the range ± 90 degrees.
int $InterceptNBChords[]
This variable contains the number of intercepts (chords) between test
lines and the background in the binary image.
$InterceptNBChords[i] contains the number of intercepts for test
line i.
int $InterceptNIntersections[]
This variable contains the number of intersections (transitions)
between objects and background along the test lines.
$InterceptNIntersection[i] contains the number of intersections
along test line i.
where:
3
l
☞ Only the intercept lengths in objects hit by a sample point inside the
measure frame are counted.
The Vv calculations are described in:
The new stereological tools: Dissector, fractionator; nucleator and point
sampled intercepts and their use in pathological research and diagnosis. by H.J
.G Gundersen et al, APMIS 96: 857-881, 1988.
A coefficient of error, CE, is calculated as:
3 2
CE = ∑ (l ) 1
------------------ – ----
3 2 N
(∑ l )
☞ The Vv and CE are update for each line in the table. They are not
calculated per field !
S v = 2P L
where:
PL
Number of directions
Only sinus weighted directions in the range 0-90 degrees are used for
vertical sections. This value specifies the number of sinus weighted
directions to use. The first direction is selected at random and the
following directions are calculated by adding Direction offset to the
previous direction.
Direction offset
See Number of directions above.
Show Lines/Intercepts:
These check boxes are used to enable the display of test lines and
detected intercepts (transitions object-background). Disabling these
check boxes decreases the time required for the Accumulate step.
Image
The binary image to perform the calculations in.
☞ The Sv is update for each line in the table. It is not calculated per
field !
4
S ⁄ V = ------
L3
where:
L3
☞ Only the intercept lengths in objects hit by a sample point inside the
measure frame are counted.
The S/V calculations are described in:
Computer-assisted microscopy: The measurement and analysis of images by
John C. Russ. Third Printing, page 228. 1990 Plenum Press, New York,
ISBN 0-306-43410-5.
The result of the calculations is presented as a table.
Define/Accumulate/Present Result
The calculations consists of three steps. The first step is to define a
name for the calculations. The second step is to accumulate data
from images to the name. The last step is used to present the
accumulated data.
Number of directions
Only sinus weighted directions in the range 0-90 degrees are used for
vertical sections. This value specifies the number of sinus weighted
directions to use. The first direction is selected at random and the
following directions are calculated by adding Direction offset to the
previous direction.
Direction offset
See Number of directions above.
Show Lines/Points/Intercepts:
These check boxes are used to enable the display of test lines, sample
points and detected intercepts. Disabling these check boxes
decreases the time required for the Accumulate step.
Image
The binary image to perform the calculations in.
☞ The S/V value is update for each line in the table. It is not calculated
per field !
The functions FFT and Inverse FFT are the base functions in this group
and they are used to convert an image to its corresponding Fourier
transform and vice versa.
The Convolution and Correlation function use the FFT routine and
different border modes to perform convolution and correlation
respectively.
The BT PSD (Blackman-Tukey Power Spectral Density) function is used
to estimate the density distribution of the power spectrum of an image.
This can for example be useful when creating a Wiener filter.
The radial and angular distribution of a power spectrum can be viewed
with the Radial PSD function.
The two functions RL Restore (Richardsson-Lucy Restoration) and
Wiener are used to improve a linearly distorted image.
The Normalized Averaging function is used to adapt areas of lost data
to the neighborhood in a least square error way.
☞ All functions in this group only work on image buffers of the type
c32. The Copy Image function in the Image function group can be used
to convert from and to c32. It is also possible to use the Image Tool
window interactively.
☞ This function works on all images with even width and height but
the execution time is extremely long on image sizes that are not a power
of 2 (256x256, 512x512,... etc.). The reason for this is that an ordinary DFT
(Discreet Fourier Transform) must be used on such images.
Inverse FFT
This function calculates the inverse Fourier transform of an image
buffer. See also FFT, page 3-12-3.
FFT image
Input Fourier transform.
Output image
Destination of the inverse transformed Fourier spectrum.
☞ This function works on all images with even width and height but
the execution time is extremely long on image sizes that are not a power
of 2 (256x256, 512x512,... etc.). The reason for this is that an ordinary
inverse DFT (Discreet Fourier Transform) must be used on such images.
Convolution
The convolution function is used to perform a convolution between two
images. The convolution uses a Zero border mode for the Convolution
kernel and the specified Border mode for the Input image. See also
Correlation, page 3-12-6.
Input image
Input image to be filtered.
Convolution kernel
Image containing the filter kernel.
Output image
Destination image for the result.
Border mode
Border mode to use for the Input image. Three different border
modes are implemented:
Copy The image is extended with the values at the image
borders.
Zero The image is extended with zero values.
Circular The image is not extended which implies a circular
image.
☞ This function works on all images with even width and height.
☞ A description of the convolution operation can be found in Digital
Image Processing by Rafel C. Gonzalez, Addison-Wesley Publishing
Company, 1977.
Correlation
The correlation function is used to perform correlation between two
images. The correlation uses a Zero border mode for the Correlation
image and the specified Border mode for the Input image. The
autocorrelation function is performed by selecting the same Input
image and Correlation image and by using the Zero border mode. See
also Convolution, page 3-12-5.
Input image
First image to be correlated.
Correlation image
Second image to be correlated.
Output image
Destination image for the result.
Border mode
Border mode to use for the Input image. Three different border
modes are implemented:
Copy The image is extended with the values at the image
borders.
Zero The image is extended with zero values.
Circular The image is not extended which implies a circular
image.
☞ This function works on all images with even width and height.
☞ A description of the correlation operation can be found in Digital
Image Processing by Rafel C. Gonzalez, Addison-Wesley Publishing
Company, 1977.
Figure 3-1: The procedure of estimating the power spectrum of a sub image.
Input image
Input image.
Output image
Output image for the estimated power spectrum.
Window
One of three window types (Hanning, Parzen, Welch or None)
where None corresponds to a rectangular window.
☞ This function works on all images with even width and height but
the execution time is extremely long on image sizes that are not a power
of 2 (256x256, 512x512,... etc.). The reason for this is that ordinary DFT
(Discreet Fourier Transform) must be used on such images.
☞ This function works on all images with even width and height.
Richardsson-Lucy Restoration
This is an iterative function to deconvolve a linearly distorted image.
The algorithm is based on Bayes rule and solves the deconvolution
problem by using statistical theory.
Before this function is used an estimation of the point spread function
must be made, see Defocus (page 3-12-18) and Motion (page 3-12-19).
The iterative function starts by storing the 1st guess of the distorted
image, for example the Blurred image itself, in the Improved image
buffer (see figure). This image is then blurred once more with the Blur
kernel. The result is then compared with the Blurred image and a image
with scale factors is created. The Improved image buffer is then
multiplied with the scale factor image to compensate for the distortion.
At last, by executing this loop several times the Improved image will
become more and more like the original.
Input image
The distorted image.
Blur kernel
The estimated point spread function.
1st guess
The image where from the iterations should start.
Number of iterations
The number of iterations which should be done before storing the
result.
☞ This function works on all images with even width and height.
☞ A description of the Richardsson-Lucy method can be found in the
astronomical journal, volume 79, number 6, An iterative technique for the
rectification of observed distributions by L.B.Lucy.
Normalized Averaging
This function is used to restore missing data in an image. A certainty
image must be created to assign a certainty value to every pixel. The
areas where the data is lost the certainty should be set to zero and the
error free areas should be assigned a value of one.
A local window function should also be specified. An appropriate
window can be created with the Applicability function.
The method uses the formula below to interpolate the areas with a low
certainty values while the certain areas are kept. The input image is
denoted I, the certainty image c and the applicability window α.
α × cI
N = ---------------
α×c
Input image
The distorted image.
Certainty image
Image with certainty values corresponding to the pixel valued in the
input image.
Applicability
Window function describing the locality of the operation.
Output image
The result image.
☞ This function works on all images with even width and height.
☞ Normalized convolution is described by Carl-Fredrik Westin in A
Tensor Framework for Multidimensional Signal Processing, PhD thesis,
Linköping University, Dissertation No 348, 1994.
Calculate
This function is used to perform pixel wise calculations between two
images, with an image and a constant ... etc. The calculation functions
implemented are described below.
Input image #1
The first input image.
Input image #2
The second input image.
Expression
This parameter describes the calculation operation which should be
performed.
These are the operations that can be performed:
Wiener filter
This function creates an optimal Fourier domain Wiener filter from a
power spectrum estimate, a Fourier domain point spread function and a
noise level. The Wiener filter is returned as a Fourier transform of the
Wiener kernel.
The Wiener filter deconvolution method builds on a model where the
image has been distorted with a linear process whereafter additive noise
has been introduced, see figure. If these two parameters and the
distribution of the power spectrum can be estimated, a optimal inverse
filter (Wiener filter) can be calculated. The distorted image is then
restored by convolving it with the calculated filter.
Input PSS
Power spectrum distribution of the original image.
☞ This function works on all images with even width and height.
☞ The Wiener filter is described by J.S.Lim in Two-dimensional signal
and image processing, Prentice Hall, 1990.
Equalizer filter
This function is used to create a 10 band equalizer filter in the Fourier
domain. The magnitude of the frequency bands are set by the
parameters Band0 to Band9.
A equalizer filter can be created to compensate for distortion in separate
frequency bands. For example suppressing band limited noise or
amplifying high frequencies in blurred images.
Equalizer filter out
The output image for the generated equalizer.
Band0, ..., Band9
Amplification factor for the frequency bands respectively.
☞ This function works on all images with even width and height.
Gauss filter
The Gauss filter function is used to create a Fourier domain Gauss filter.
The standard deviation of the filter is given as a parameter. This is a
locally optimal blur filter meaning that the filter is local in both the
Fourier domain and in the image domain.
Gauss filter out
Output image for the generated filter.
Sigma
Standard deviation of the Gauss filter.
☞ This function works on all images with even width and height.
Exponential filter
The Exp filter function is used to create a Fourier domain exponential
filter. The scaling factor of the filter is given as a parameter.
☞ This function works on all images with even width and height.
☞ A description of the Fourier transform can be found in Digital Image
Processing by Rafel C. Gonzalez, Addison-Wesley Publishing Company,
1977.
Defocus filter
This function generates a Fourier domain defocus filter. The extension in
pixels of the defocus blur is given as a parameter. The defocus filter can
be described in the image domain as a circular area on which each pixel
value is spread out.
This filter can be used with the Wiener filter or the Richardsson-Lucy
method to improve a defocused image.
Defocus filter out
Output image for the defocus filter.
Radius
The extension of the defocus blur function in pixels.
☞ This function works on all images with even width and height but
the execution time is extremely long on image sizes that are not a power
of 2 (256x256, 512x512,... etc.). The reason for this is that an ordinary DFT
(Discreet Fourier Transform) must be used on such images.
Motion filter
This function generates a Fourier domain motion filter. The extension in
pixels and the direction of the motion is given as a parameter. The
motion filter can be described in the image domain as a line in the
direction of the motion on which each pixel value is spread out.
This filter can be used with the Wiener filter or the Richardsson-Lucy
method to improve a motion blurred image.
Motion filter out
Output image for the motion filter.
Radius
The extension of the motion in pixels.
Angle
The direction of the motion in radians.
☞ This function works on all images with even width and height.
Butterworth filter
This function generates a Fourier domain Butterworth filter. The filter
order, radius and end magnitude are given as parameters.
The filter is a low pass filter which also passes a fairly high amount of
high frequencies to preserve some of the edge contents in the image.
Butterworth filter out
Output image for the Butterworth filter.
Order
The order of the Butterworth filter.
Radius
The extension of the filter.
Magnitude
Magnitude of the filter at radius Radius.
☞ This function works on all images with even width and height.
☞ A description of the Butterworth filter can be found in Digital Image
Processing by Rafel C. Gonzalez, Addison-Wesley Publishing Company,
1977.
Applicability
This function generates a applicability window. The filter radius and
shape is given as parameters. This type of window is normally used with
the function Normalized Averaging.
Applicability window out
Output buffer for the applicability window.
Alpha
The scaling factor of the the exponential part.
Beta
The order of the cos2 part.
Radius
Radius of the window function.
☞ This function works on all images with even width and height.
☞ The applicability window function is described by Carl-Fredrik
Westin in A Tensor Framework for Multidimensional Signal Processing, PhD
thesis, Linköping University, Dissertation No 348, 1994.
The user "supervises" the process by initially selecting some pixels from
each possible class, so called training. From this information, the
classification algorithm determines what characterises each class, and
finally assigns each pixel of the image to one of the classes. Thus, for
each pixel in the image a class membership is determined, and the pixel
is assigned a certain color associated with that class.
Some classification examples:
• Segmentation of an MR image of the brain into white and grey
matter, fat, cerebrospinal fluid, etc.
• Segmentation of a remote sensing scene into water, forest, crop
types, urban areas, etc.
§ The image classification is based on statistical and contextual methods described in detail in:
• H V Sæbø, K Bråten, N L Hjort, B Llewellyn, E Mohn: Contextual classification of remotely sensed
data: Statistical methods and development of a system. Report no. 768. Technical report, Norwegian
Computing Center, 1985.
• T M Einarsson: Statistisk klassifikation af billeder. Eksamensprojekt nr.29/92. IMSOR, Technical Uni-
versity of Denmark, Lyngby 1992. (This report is written in danish.)
• K Conradsen, B K Ersbøll: Variable selection in non-linear discriminant analysis. IMSOR, Technical
University of Denmark.
Feature values
To be able to determine a class membership we need to measure a
number of features for every pixel in the input image. With features is
meant values measured from the image, such as intensity values, or
results from image processing operations (local spatial frequency
estimates, local variance values, local orientation estimates, shape
measurement values, etc.). The feature values of a pixel are represented
with a feature vector.
Examples of features in remote sensing
Intensity values in images coming from different spectral bands.
Examples of features in color images
Intensity values from the red, green, and blue color band,
respectively.
Examples of features in MRI
Intensity values from MR images taken with different timing
parameters (same slice position).
Classification rules
Each pixel in the image is classified by taking the pixel’s coordinates in
feature space (i.e. the feature vector for the pixel), and then assigning the
pixel to a certain class according to some decision rule. This is possible
if we have chosen a suitable set of features.
One way to obtain a rule by which points in the feature space are
assigned to a class, is to subdivide the feature space into sub-spaces with
a set of boundaries mathematically defined as (hyper-)planes or other
kinds of surfaces. The class membership can then be determined by
deciding into which sub-space the feature vector falls.
Box classification
There are several ways to make this subdivision. The simplest form
is thresholding in a one-dimensional feature space. This is illustrated
in the left figure below.
The generalization of thresholding is called box classification. Using
this rule, the feature space is subdivided into n-dimensional cubes,
where n is the number of features. See the two-dimensional example
below (the figure to the right).
☞ A word of warning: It is usually not true that the more features are
used, the better the result will be. If, for instance, a feature is added that
is very correlated with an already existing feature, the estimated
covariance matrix will be almost singular causing numerical problems.
Contextual methods
Taking surrounding pixels into account when classifying images can be
done in different ways. The use of contextual feature images (results
from GOP operations) is one way. There are also several contextual
methods (discrimination rules) available and implemented in
microGOP 2000/S.
The models that use contextual classification methods state that when
determining the class for a certain pixel, its neighbouring pixels tend to
belong to the same class. To put it simple, it is unusual to find a patch of
wheat in the middle of a corn field.
Each pixel is thus classified on the basis of the data for itself and its
neighbouring pixels. When classical, non-contextual, classification
methods are used, the spatial dependencies between classes are
overlooked. By using a contextual discrimination rule this simplification
can be avoided. A contextual method is, however, computationally
expensive, so it is only feasible to use a small neighbourhood, e.g. data
from four surrounding pixels.
Owen, Hjort & Mohn (OHM)
This method includes a class configuration model which states that
in most cases all pixels within a cross neighbourhood (the actual
pixel and its 4 neighbours to the north, south, west, and east) will
belong to the same class. In some cases there will be two different
classes within the cross, but the probability of the occurrence of three
or more classes within the cross neighbourhood is assumed to be
zero.
In more detail, the OHM class configuration model states that only 9
different situations within a cross neighbourhood can occur. These 9
situations are divided into 3 groups:
A priori probability
If we pick a pixel in the image at random, its probability of belonging to
a certain class is called the a priori probability. By default, a classification
is performed using equal prior probabilities for all classes.
Mahalanobis distance
The weighted distance from one point in the feature space to the mean
vector value of a certain class is called the Mahalanobis distance. This
distance measure is the answer to the following question; How far from
the class centre - in feature space - is the actual pixel?
Reject class
For every pixel in a classified image, the Mahalanobis distance to the
assigned class is measured. If this distance is too large, you might want
to classify it into a reject class instead of the class suggested by the
classifier. This Mahalanobis distance threshold is specified by a quantile
of the chi2-distribution function for the assigned class. The size of the
quantile can be set by the user.
Result images
Apart from the classification result image, it is also possible to generate
a Mahalanobis distance image that reflects the Mahalanobis distance to the
assigned class centre for every pixel. This can be seen as an inverted
certainty image (i.e. how well did the classifier perform?). Dark areas -
well classified pixels, bright areas - poorly classified pixels.
Autocorrelation models
No correlation
If a model without correlation is used, neighbouring pixels are
assumed to be independent. This is the most common method.
Autocorrelation
If an autocorrelation model is used, correlation between
neighbouring pixels is assumed. This method is very costly
computationally, so the classification is time-consuming.
In the autocorrelation model used in microGOP 2000/S, two
different noise processes are assumed to be present.
1. A noise process having an autocorrelation function
described by a 3x3-pixel neighbourhood.
2. Proportion that belongs to autocorrelated noise.
The autocorrelation model can be used together with the OHM and
the WSH discrimination methods.
Classification Jobs
A classification job is defined by a set of building blocks:
• Train image & background image.
• Definition of class colors and class names.
• A description of the different feature images needed for the
classification.
• Statistics file.
The information regarding a classification job is stored in a Job file having
file extension .cic (context image classifier).
ImClassify
This function classifies an image (scene) according to statistics already
defined in an existing classification job, see page 3-13-9.
This function also acts as a portal to the interactive Train functionality,
where it is possible to produce statistics for use in future classification of
similar scenes using ImClassify, but also to perform classification tests
and one-scene classifications.
Browse...
This button calls up a file browser which can be used to find and load
a specific classification job that is stored on file (file extension .cic). To
be able to create a new classification job, launch the Train window,
see The Train window, page 3-13-12.
Job Name
The full path file name for the current classification job.
Train...
Launches the Train window, see The Train window, page 3-13-12.
Required feature images
This list contains the feature images to be used when running a
classification. Before feature images are selected, the list contains
information about how many feature images are needed and what
image type they must have for the current classification job.
To select a feature image
• First, select a list item. This displays a window that describes
the nature of the feature image in the read-only Feature
image description text field.
• In this pop-up window, select an image buffer to be used as
Feature Image.
• Apply changes, or select another list item.
Classified result
The classification result.
The result image is always an 8-bit grey scale image where pixels
belonging to class 1 have pixel value 1, pixels belonging to class 2
have pixel value 2, and so on. Each class is associated with a specific
class color and a class name, as defined when the train image was
produced.
This result image is best viewed within this function or the
DispClassIm function where the pixel values are visualized with the
correct class colors.
Background Image
A background image that is displayed "under" the classification
result. Normally, this image is one of the feature images, the original
image, or the buffer that holds the Mahanalobis Distance image (see
below).
Mahalanobis Distance Image
A grey scale image where pixel values denote the Mahalanobis
distance to the classified class. See Mahalanobis distance, page 3-13-8.
If E is selected, no such image is generated.
☞ If you invert the Mahalanobis distance image and display this as the
background image "under" the classified result, you will see the
classification with intensity values that indicate the certainty of the
classification. In an area with low intensity values (dark) the
classification is considered to be uncertain, and vice versa.
Classification Method
This is where the classification method (discrimination rule) is
selected.
• Non contextual
• Contextual OHM - Owen, Hjort & Mohn, see page 3-13-6.
• Contextual WSH - Welch, Salter & Haslett, see page 3-13-7.
• Contextual Switzer, see page 3-13-7.
Show Expert Settings ...
Depending on the classification method selected, there may be more
parameters that can be set prior to the classification, see Expert
Settings, page 3-13-16. This button expands the Train window.
Hide Expert Settings ...
Hide the expert settings and make the Train window smaller.
Feature Images list
This list contains the feature images to be used when running a
classification. Up to 16 feature images can be used. A menu is
associated with this list. If the MENU mouse button is clicked within
the list, the same menu items as in the Feature Images menu are
available, see below.
The Feature Images menu
The menu connected to the Feature Images button contains the
following menu items:
Edit...
Edit the selected feature image, see To edit a feature image, page 3-
13-14.
Add before...
Add a new feature image before the selected one.
Add after...
Add a new feature image after the selected one.
Display image
Display the selected feature image.
Remove selected
Remove the selected feature image from the list.
Run Classification
Perform a classification according to the settings of the Train
window.
Done
Dismiss the Train window and automatically save the changes made
in the current classification job.
☞ If the push-pin is pulled out, the Train window is dismissed and the
changes made in the current classification job are automatically saved.
☞ When the current classification job is saved, all feature images used
are copied to image files in the same directory as the rest of the necessary
classifier files, and named according to the following name rule:
jobname_f###.imf
where
• jobname is the name of the current classification job.
• ### is a three-digit image number, i.e. the first feature image gets
the number 001, the second 002, and so on.
For example, the fourth feature image in the classification job yummy is
copied to the file yummy_f004.imf.
The next time the Train window is launched for this classification job,
the icons in the Feature Images list will reflect (with JOB) that the
feature images are saved files from an earlier session.
Expert Settings
Discrimination
Linear
Linear discrimination is used when calculating statistics, i.e. only
one common covariance matrix is used for all classes.
Quadratic
Quadratic discrimination is used when calculating statistics. Class
dependent covariance matrices are used, i.e. one covariance
matrix is calculated for each class.
Auto Correlation
Available for the OHM and WSH contextual methods.
Off
No noise correlation model is used.
Default
Autocorrelation model is used. The default values for rho (0.5)
and theta (0.5) are used. rho is the autocorrelation between first-
order neighbouring pixels, and theta is the proportion of the total
variation due to autocorrelated noise.
Other
Autocorrelation model is used. The values for rho and theta can
be set by the user.
OHM Probabilities
Only available for the OHM contextual method.
Default
The default values for the probability settings p (0.8), q (0.0828),
and r (0.1172) are used for the OHM classification method.
Other
The values for p, q and r can be set by the user.
If the check box labelled Active is marked the Train Tool is active. If
you unmark the check box, the Train Tool becomes inactive (the
training mode is still on) and the SID Brightness/Contrast Control
Tool becomes active.
DisplayClass
This function displays a classified image with correct class colors as
defined by the specified classification job.
Browse...
This button calls up a file browser which can be used to find and load
a specific classification job that is stored on file (file extension .cic).
Job Name
The full path file name for the classification job.
Classified result
The classification result.
Background Image
A background image that is displayed "under" the classification
result.
4 Variables
This chapter describes the programming language used in the Variable
function in the Program function group.
The programming language is an interpreting language that can be used
to define variables, perform calculations, generate graphical user
interfaces, draw graphics and call external programs.
Variables that have been defined can be bound to parameters of almost
any function in the microGOP.
It is, for example, possible to generate a user interface where the user
specifies the number of images that shall be read from the video camera.
This value can then be bound to the Laps parameter of the Loop
function.
Variable names must begin with a character but can contain digits. The
programming language is case sensitive, which means that the
microGOP distinguishes between upper and lower case letters. (The
variables Amp and amp are two different variables.)
☞ Integer variables that are not explicitly assigned a value get the
default value 0.
☞ Float variables that are not explicitly assigned a value get the default
value 0.0
☞ All float and integer expressions are calculated using float. The float
values are truncated when they are assigned to integer variables. It is
possible to mix float and integers in expressions.
The second example defines the variable Date to be assigned the value
of the external program date, which returns the current date and time.
See also the function system(), page 4-17.
The last example defines a variable with the maximum length of 500.
The initial value of it will be "/export/home/Test1".
The vector vec1[] is defined but has the initial length 0. The vector
my_histogram[] gets the length and values from the system variable
vector $GreyHistogram[].
Example of float vector definitions:
float my_vec[] = vinit(10, 7)
float my_feature[] = 5.6 * $Area[]/$Perimeter[]
The first example defines a new float vector with length 10 where all
values are set to 7. See also the function vinit(), page 4-20.
The other example defines a new vector in which each element will have
the value 5.6 multiplied with each objects’ measured area divided by its
perimeter. See system variables $Area[] and $Perimeter[], page 4-11. It is
thus possible to mix scalar values with vectors in a vector expression.
Vectors have a dynamic length which can be changed at any time. New
vector elements can be assigned to a defined vector without redefining
it. The following example will make the vector one element longer by
adding the value 7:
my_vec[] = vcreate( my_vec[], 7)
☞ Vectors are always dynamic. This means that a vector gets its current
length when it is assigned. The space for the vector is allocated
automatically.
Undefining variables
Variables that have been defined can be assigned values throughout the
current microGOP session.
4.3 Operators
The following operators can be used in expressions:
+ Addition of integer variables, float variables, integer vectors,
and float vectors. Strings are concatenated with this operator.
Bitwise operators
& Bitwise AND.
| Bitwise OR.
~ Bitwise NOT. This is a unary operator that inverts all the bits
in its operand. The following example will assign the value
248 to the variable a:
int a = 255 & ~7
^ Bitwise EXOR.
☞ There are also some relational operators that are used in conditions.
These operators are described together with the conditions in the if
expression, page 4-29.
4.4 Comments
Comments can be used to make your Variable code easier to
understand. All lines that start with a \ are comment lines. Example:
\ The variable n is the number
\ of images that shall be processed
int n
\ amp is the amplification
float amp=4.5
Variable Description
float $StageX
float $StageY The current scan stage X and Y position in
mm.
float $StageZ The current scan stage Z position.
☞ This is not an absolute value in mm.
int $StageFrameX
int $StageFrameY The current frame column (X) and row (Y)
in the scan pattern.
int $ImageWidth
int $ImageHeight The current image width and height in
pixels.
int $Grey16CalcMin
int $Grey16CalcMax The minimum and maximum value for
calculations in 16-bit grey scale images.
See the function Grey16Range,
page 3-3-9.
int $Grey16DisplayMin
int $Grey16DisplayMax The minimum and maximum value for
display of 16-bit grey scale images. See
the function Grey16Range, page 3-3-9.
int $RBBoxX1
int $RBBoxY1 The X and Y coordinates of the upper left
corner of the last set rubber-band box.
int $RBBoxX2
int $RBBoxY2 The X and Y coordinates of the lower
right corner of the latest rubber-band box.
int $RBLineX1
int $RBLineY1 The X and Y coordinates of the start point
of the last set rubber-band line.
int $RBLineX2
int $RBLineY2 The X and Y coordinates of the end point
of the latest rubber-band line.
int $RBLineDistance The distance (in pixels) between the end
points of the latest rubber-band line.
int $RBCircleX1
int $RBCircleY1 The X and Y coordinates of the upper left
corner of the last set rubber-band circle.
int $RBCircleX2
int $RBCircleY2 The X and Y coordinates of the lower
right corner of the latest rubber-band
circle.
Variable Description
char $ImageOverviewDirectory
The directory name (full path) of the
directory currently displayed in the
Image Overview window.
int $ImageOverviewNSelected
The number of selected images in the
Image Overview window. See the
Variable string function
ImageOverviewFile(), page 4-17.
float $AreaFraction[] The latest area fractions measured with
the Area Fraction function in the
Measure function group.
float $GreyHistogram[] This variable contains the latest measured
grey scale histogram.
☞ This vector, like all other vectors, start
with index 1. The first entry (entry 1) in
the vector contains the number of pixels
for intensity 0.
For an 8-bit image, the entries 1-256 will
be filled with values even if the pixel
values are between 0 and 255.
float $GreyHistogramMinVal
float $GreyHistogramMaxVal
Minimum/maximum intensity values in
the latest measured grey scale histogram.
float $GreyHistogramMinFreq
float $GreyHistogramMaxFreq
Minimum/maximum frequency values
in the latest measured grey scale
histogram.
float $GreyHistogramMean
Mean intensity value in the latest
measured grey scale histogram.
float $GreyHistogramStdDev
Intensity standard deviation in the latest
measured grey scale histogram.
For the last 7 system variables, see the function GreyHistogram,
page 3-10-22.
Variable Description
☞ The outline is a SID tool, see 2.9 The Image Display window,
page 2-15.
int $X
int $Y The coordinates for the current pixel
value point. See also Pixel Value tool,
page 2-24.
int $PixelValue The pixel value for the current pixel value
point, see Pixel Value tool, page 2-24.
int $MapWidth
int $MapLevel The current width and level used in the
Map tool, see page 2-39.
float $CPInX[]
float $CPInY[]
float $CPRefX[]
float $CPRefY[] These 4 vectors contain the current
control point coordinates. See the
Geometry Tool, page 3-3-12.
Variable Description
int $InterceptNLines
float $InterceptTLineAngle
char $InterceptScaleUnit
float $InterceptTLineLengths[]
float $InterceptOChordLengths[]
float $InterceptBChordLengths[]
int $InterceptNOChords[]
int $InterceptNBChords[]
int $InterceptNIntersections[]
All these variables are defined by the
Intercept function in the Stereology
function group.
char $MeanVolumeUnit
float $MeanVolume
float $MeanVolumeCE These variables contain the values from
the latest Present in the Volume
Weighted Mean Volume function in the
Stereology function group.
char $SurfaceAreaUnit
float $SurfaceArea These variables contain the values from
the latest Present in the Surface Area per
unit Volume function in the Stereology
function group.
char $SurfaceToVolumeRatioUnit
float $SurfaceToVolumeRatio
These variables contain the values from
the latest Present in the Mean Surface to
Volume Ratio function in the Stereology
function group.
float $Area[], $Perimeter[], $MinX[], $MaxX[], $MinY[], $MaxY[],
$FeretX[], $FeretY[], $FeretComp[], $Comp[], $EqCircle[],
$EllComp[], $CgravityX[], $CgravityY[], $MomentX[],
$MomentY[], $MomAng[], $Length[], $Dmax[],
$DmaxAngle[], $Width[], $Ratio[]
These vectors contain the feature values
from the latest object measurement. See
function Measure, page 3-10-2.
Variable Description
There are some extra object features that can be accessed in Variable:
float $DmaxX1[]
float $DmaxY1[]
float $DmaxX2[]
float $DmaxY2[] These variables contain the coordinates
for the two points that has been used to
calculate Dmax.
☞ Dmax must have been calculated by
the Measure function in the function
group Measure.
float $WidthX1[]
float $WidthY1[]
float $WidthX2[]
float $WidthY2[] These variables contain the coordinates
for the two points that has been used to
calculate Width.
☞ Width must have been calculated by
the Measure function in the function
group Measure.
float $MomentXY[] The $MomentXY[] can be accessed in
addition to $MomentX[] and
$MomentY[].
4.7 Functions
Math functions
The following math functions are defined for microGOP expressions.
The functions are the same as those available in the C program
language. See also the UNIX man pages for each function, e.g. % man
sqrt gives you help on the sqrt function.
sqrt(x) square root: √x
hypot(x,y) euclidian distance: √x2+y2
sin(x) sine value of x
cos(x) cosine value of x
tan(x) tangent of x
atan(x) arc tangent of x in the range -π/2 to π/2
atan2(y,x) arc tangent of y/x in the range -π to π
acos(x) arc cosine of x in the range 0 to π
asin(x) arc sine of x in the range -π/2 to π/2
exp(x) exponential function ex
exp2(x) exponential function 2x
exp10(x) exponential function 10x
log(x) natural logarithm of x
log2(x) base-2 logarithm of x
log10(x) base-10 logarithm of x
pow(x,y) x raised to the power of y: xy
rand() returns a random value in the range 0.0 to 1.0. The
standard C function drand48() is called.
☞ See also comment about vrand() below.
abs(x) absolute value of x
All these math functions also exist in vector versions. These vector
versions of the functions are prefixed with a v. Example: vsin(v[])
returns a vector with the sine value of all elements in the vector v[].
String functions
The string functions return character strings.
mktemp(str)
Creates a unique string from str by adding 6 characters. This can be
useful to create temporary files with unique names.
tostring(val)
tostring(val, ndecimals)
Converts the value (float or integer expression) val to a string.
Example: tostring(45.9/9) returns the string "5.1". The
argument ndecimals defines the number of decimals to generate.
Example: tostring(45.9/9, 3) returns the string ”5.100".
tostring(vector, sepstring)
tostring(vector, ndecimals, sepstring)
Converts every value (float or integer) in vector to a substring and
concatenates them to one string. The argument sepstring defines the
separator string to be inserted between each substring, e.g. " ". The
argument ndecimals defines the number of decimals to generate.
tochar(value)
Returns a string containing the character that is represented by the
value in the ASCII character set. Example: tochar(65) returns
"A".
tochar(vector)
Returns a string containing the characters represented by each of the
ASCII values in vector.
strformat(str, expr)
strformat(str, expr, padstr)
Formats a string, left or right adjusted, in a number of positions. A
negative value in the argument expr will left adjust the string, and a
positive value will right adjust the string.
Example:
writeln strformat("hello", -20)
The optional third argument can be used to specify the pad character
(space is default).
Example:
int a=3
writeln strformat( tostring(a), 5, "0")
writeln strformat( "Wait", -10, ".")
strtok(strexpr)
strtok(strexpr, sep)
strtok(0, sep)
strtok()
These functions make it possible to extract substrings, tokens, from a
string by specifying substring separators. The strtok(strexpr...
function stores a string which is modified everytime a strtok(..., sep)
call is made with a specified separator string.
strtok(strexpr) Store a new string. This string is valid
until a new string is stored. The string is
also returned.
strtok(strexpr, sep) Store a new string as above. The first
substring separated by any spans of
characters in the string sep is returned.
strtok(0, sep) Return the next substring in the stored
string. The substrings are separated with
any of the characters in the string sep.
strtok() Return the stored string.
Example:
char *str="Mary had a little lamb."
\ Set the string in strtok()
strtok(str)
\ extract substrings separated by space
writeln strtok(0," ")
writeln strtok(0," ")
writeln strtok(0," ")
writeln strtok(0," ")
\ extract substrings separated by space and '.'
writeln strtok(0," .")
Will print:
Mary
had
a
little
lamb
system(command)
This function is used to call an external program. The string returned
from the external program is returned from the function. Example:
char *date=system("date")
ImageName(type, nbr)
Returns the name of an image buffer file. The type should be GREY,
GREY16, BINARY, GOP, LABEL or C32 and the nbr should be 0-6
(the number must be 1 for LABEL). Example:
char *binreg1name=ImageName(BINARY, 1)
ImageOverview(directory)
ImageOverview(directory, extension)
ImageOverview(directory, iconsize)
ImageOverview(directory, extension, iconsize)
Displays an Image Overview of the image files in the directory
directory. The size of the icons can be specified. The overview will
be made of imf images unless another file extension is specified. See
also separate description of the Image Overview window, page 2-11.
ImageOverview(REMOVE)
Removes the Image Overview window.
ImageOverviewFile(n)
ImageOverviewPath(n)
Returns the name (or the full path name) of the nth selected file in the
Image Overview. See also the system variables
$ImageOverviewDirectory and $ImageOverviewNSelected, page
4-9.
ImageInfoGet(tag)
Returns the image information for tag tag. The tag names (and
values) are defined in the file ImageInfoTags.inc. The following tags
are available:
INFO_TAG_NAME
INFO_TAG_ID
INFO_TAG_DATE
INFO_TAG_YEAR
INFO_TAG_MONTH
INFO_TAG_DAY
INFO_TAG_HOUR
INFO_TAG_MINUTE
INFO_TAG_SHORT_COMMENT
INFO_TAG_LONG_COMMENT
INFO_TAG_IMAGE_DESCRIPTION
INFO_TAG_SYSTEM
INFO_TAG_HOSPITAL
INFO_TAG_SEQUENCE
INFO_TAG_SEQ_TR
INFO_TAG_SEQ_TI
INFO_TAG_SEQ_TE
INFO_TAG_PLANE
INFO_TAG_COIL
INFO_TAG_COIL_POS
INFO_TAG_SLICE_NR
INFO_TAG_SLICE_POSITION
INFO_TAG_SLICE_THICKNESS
INFO_TAG_SLICE_DISTANCE
INFO_TAG_IMAGE_WIDTH_MM
INFO_TAG_IMAGE_HEIGHT_MM
INFO_TAG_MAPPED_PIXELS
INFO_TAG_WINDOW_CENTER
INFO_TAG_WINDOW_WIDTH
INFO_TAG_CONTRAST_SUB
INFO_TAG_PIXEL_WIDTH
INFO_TAG_PIXEL_HEIGHT
toint(str)
Returns the decimal equivalent of the first character in str (according
to ASCII). Example: toint("A") returns 65.
toints(str)
Returns an integer vector with the decimal equivalents (ASCII
values) of all characters in str.
strlen(str)
The function returns the length of the string str.
Vector functions
There are a number of functions that operate on vectors. These functions
are described below.
vinit(length, val)
This function produces a vector with length length where every
element is set to val. Example:
float v[] = vinit(10,5)
Will set the vector v[] to the length 10 and all elements to 5.
The vinit() function can only produce vectors with a maximum
length of 10242 or ($ImageWidth⋅$ImageHeight), whichever is the
largest. Longer vectors can be produced by concatenating two
shorter ones:
float v[] = { vinit(1000000,0), vinit(500000,0) }
{ a,b,c... } or
vcreate(a,b,c....)
This function produces a vector from its arguments. The arguments
can be integers, floats, integer vectors or float vectors. Example:
int a[] = vinit(5,1)
float x=5.67
float b[] = { 1,4,4.5, x, a[], a[2,3] }
or
float b[] = vcreate(1,4,4.5, x, a[], a[2,3])
vec(val)
This example will multiply all pixel values in grey scale image 1 with
1.5 without getting any values larger than 255.
vlut(v[], tab[])
Returns a vector where every element in v[] has been passed through
the lookup table tab[]. ( Element i is set to tab[ v[i] ]. )
vconvolve(vector, wid, hgh, coeffs[], amp, off)
Performs a convolution between the data in vector and the
coefficients in coeff[]. The wid and hgh parameters specifies the
width and height of the data in vector. The coeff[] vector should
have a size equal to n2 where n is odd and larger or equal to 3.
Example: 3x3 average filter on the image in grey buffer 1 and result
in grey buffer 2:
SetPixels(GREY, 2,\
vconvolve(GetPixels(GREY,1),\
$ImageWidth,$ImageHeight,\
{ 1,1,1,\
1,1,1,\
1,1,1 }, \
1/9, 0) )
vmask(vector, maskvector)
Returns a vector with all the elements in vector that have the same
index as non zero elements in maskvector. Example:
int v[] = vmask( { 1,2,3,4,5 }, { 1,1,0,0,1 } )
The vector v[] will get the length 4 (one more than the length of
ranges[]) and will contain the values 1, 2, 2, 2 (One value in v[] is < 1,
two values fall in the interval 1 ≤ x < 2, two values fall in the interval
2 ≤ x < 5, and two values are ≥ 5).
☞ The parameters offset and nitems can not be used together with
GET_ASCII_DATA.
The following example reads 100 short values starting at offset
512 bytes from the file /tmp/values.dat to the integer vector v.
int v[] = GetData("dat", GET_SHORT_DATA,512,100)
☞ The Save Image function in the Image function group can be used
to save image files in any image file format.
☞ You can also save the image in the Image Display window together
with overlays and graphics. What you see is what you get (wysiwyg).
SidSaveXImageAsRGB(filename)
This function saves the contents of the Image Display window as an
external 24-bit RGB color image file. The saved image will contain
overlays and graphics. The image is saved in TIFF format as default.
This can be changed to BMP if the environment variable
SMICRO_SAVEASRGB_FORMAT is set to BMP. Example:
SidSaveXImageAsRGB("/tmp/rgb.tif")
If expression
A simple form of if expression can be used in the Variable function.
The syntax is:
if (condition) statement [, statement]
The statements are only performed if the condition is true.
The following conditions can be used:
expr1 > expr2 true if expr1 is larger than expr2
expr1 >= expr2 true if expr1 is larger or equal to expr2
expr1 < expr2 true if expr1 is less than expr2
expr1 <= expr2 true if expr1 is less than or equal to expr2
expr1 == expr2 true is expr1 is equal to expr2
expr1 != expr2 true if expr1 is not equal to expr2
The conditions can also be more complex:
(condition) && (condition)
true if both conditions are true.
(condition) || (condition)
true if any of the conditions is true.
! (condition) true if condition is false
ifdef( var) true if var is a defined variable.
strcmp(str1, str2) false if the strings are identical.
Examples:
if( ! ifdef( a) ) int a=6
if( a+10 < b) a=a+10, b=b*3
if( (a<b) && (a<c) ) \
writeln "a is less than b and c"
is identical to:
while( (a>b) && (i<100) ) writeln "i=" i, i=i+1
☞ The Ui() function must be the last statement among the if statements
if it is used. This will work (i will be incremented):
if( a> b) i=i+1, Ui(MESSAGE, "Hello World !")
While expression
A simple form of while expression can be used in the Variable function.
The syntax is:
while (condition) statement [, statement]
The statements after the condition will be repeated until the condition
is false.
The syntax of the condition is described on previous page.
Examples:
int i=1
float v[] =vinit(10, rand()*10)
while(i<=vdim(v[])) v[i] = v[i]*v[i], i=i+1
Message Window
The Message window which is used by the write functions on next page
(and also by the Message function in the Program function group) can
be controlled with the MessageWindow() function.
MessageWindow(GEOMETRY, x, y, wid, hgh)
Sets the position and size of the Message window.
MessageWindow(FONT, fontname_str)
Sets the font to use in the Message window. Any font listed by
xlsfonts can be used.
MessageWindow(REMOVE)
Removes the Message window from the screen.
MessageWindow(TYPE, filename_str)
Inserts the contents in the specified file into the Message window.
Example:
Keep objects which have a dmax which is larger than length/1.5:
float keep[] = vtrunc($Dmax[]-$Length[]/1.5,0,1)
ObjectKeep(keep[])
This example calculates the mean intensities from the image buffer
GREY 1 for each object in the latest object measurement. The mean
intensity value for the background is stored in the variable bgvalue.
The example clears all graphics, draws a solid line with the width 5 and
then copies the line to the foreground plane. Finally the graphics is
cleared again. (The line in the foreground plane will not be erased.)
☞ The graphics objects that can be created will always use a number of
attributes like colors and line width. The current value of these attributes
are always kept by the SID. It is very important to set all the attributes
used by an object if you want to be 100 % sure of the appearance of the
created object.
Graphics(GRAPHICS_LINE_BACKGROUND, index)
Sets the background color for lines. This color is used when the
GRAPHICS_LINE_DOUBLEDASH line style is used. The index
should be selected as described for the
GRAPHICS_LINE_FOREGROUND attribute.
Graphics(GRAPHICS_LINE_WIDTH, width)
Sets the line width to width pixels.
Graphics(GRAPHICS_LINE_STYLE, style)
The line style. Possible line styles are:
GRAPHICS_LINE_SOLID
Solid lines drawn with GRAPHICS_LINE_FOREGROUND
color.
GRAPHICS_LINE_TRANSPARENT
Invisible lines. Only useful for rectangle, ellipse and circle
objects.
GRAPHICS_LINE_DASH
Dashed lines drawn with
GRAPHICS_LINE_FOREGROUND color.
GRAPHICS_LINE_DOUBLEDASH
Dashed lines drawn with both
GRAPHICS_LINE_FOREGROUND and
GRAPHICS_LINE_BACKGROUND colors.
Graphics(GRAPHICS_LINE_ARROWS, n)
Sets arrows on line ends, n can be:
0 - No arrows
1 - Arrow at start of line
2 - Arrow at end of line
3 - Arrows at start and end of line
☞ The rectangle, ellipse and circle objects will use the line attributes for
the borders of the objects. They will also use different fill attributes for
the interior of the objects. This is an example that uses all the attributes:
It draws a rectangle with a green and yellow border filled with a blue
and red stippled interior.
Graphics(GRAPHICS_CLEAR,\
GRAPHICS_LINE_FOREGROUND, YELLOW_INDEX,\
GRAPHICS_LINE_BACKGROUND, GREEN_INDEX,\
GRAPHICS_LINE_WIDTH, 20,\
GRAPHICS_LINE_STYLE, GRAPHICS_LINE_DOUBLEDASH,\
GRAPHICS_FILL_FOREGROUND, BLUE_INDEX,\
GRAPHICS_FILL_BACKGROUND, RED_INDEX,\
GRAPHICS_FILL_STYLE, GRAPHICS_FILL_OPAQUE_STIPPLED,10,\
GRAPHICS_RECT, 100, 100, 200, 300)
GRAPHICS_FILL_TRANSPARENT
The entire area will be unfilled.
GRAPHICS_FILL_STIPPLED, n
Stipple means that the area will be filled with the foreground
color where the stipple is set. The areas where the stipple is
not set are transparent. The n should be in the range 0-83. The
order of the stipples is the same as in the stipple menu in the
Draw window in the SID.
GRAPHICS_FILL_STIPPLED, "file.bmp"
Sets the stipple to the contents of the X11 bitmap file file.bmp
GRAPHICS_FILL_OPAQUE_STIPPLED, n
As above but the fill background color will be used where the
stipple is not set.
GRAPHICS_FILL_OPAQUE_STIPPLED, "file.bmp"
Sets the stipple to the contents of the bitmap file file.bmp
This will write Bill at (x[1], y[1]), is at (x[2], y[2]), and rich at
(x[3], y[3]). If the two vectors are longer than 3 elements, the word
rich will be written in the positions (x[4], y[4]), (x[5], y[5]), and so on.
Graphics(GRAPHICS_TEXT, str, "", x[], y[])
The string str is now considered to consist of text tokens only one
character long with no separators.
☞ Any of the fonts listed by the xlsfonts program can be used. Type
xlsfonts at the UNIX prompt to get a list of available fonts.
The microGOP program stops when the popup window has appeared
and it will not continue until the user has pressed the Continue button.
The Cancel button can be used to quit the popup window and stop the
execution of the microGOP program.
MESSAGEGLYPH, "filename.xbm"
The bitmap in the X11 bitmap file filename.xbm is rendered in the
popup window. Such a bitmap file can be generated by saving a
binary image using the xbm image type.
Example: MESSAGEGLYPH, "mylogo.xbm"
EXCLUSIVE, prompt,\
ITEM, itemtext1, value1,\
DEFAULTITEM, itemtext2, value2,\
ITEM, itemtext3, value3,\
variable
The EXCLUSIVE UI element generates a exclusive choice selector
with a number of choices. The variable is assigned the value
specified for the selected choice. The values and the variable can be
of any type.
The tag DEFAULTITEM can be used to set the default choice.
THRESHGREY, prompt, greyimage, lowvariable, highvariable
This UI element draws two sliders and also displays the grey level
image buffer specified by greyimage. The sliders can be used to
adjust the color slice that is displayed together with the grey level
image. The slice values are assigned to the integer variables
lowvariable and highvariable.
This function is useful to use when the threshold level shall be
adjusted by the user. The lowvariable and highvariable variables
can then be bound to the low and high parameter of the Threshold
function.
The SID Pixel Value tool is activated, and then the program
waits for user action. The program continues either when you
click in the SID or when you select a button in the user interface.
UI_TIMEOUT, seconds
A timeout can be set on the Ui function. This means that the
execution of the program will continue when the timer times out
regardless of user interaction. The granularity of the timer is 5
seconds.
Example: UI_TIMEOUT, 20
☞ Note that the value of the variables are displayed in the interface.
The contents of the parameter list in the Variable binding window will
be different for every function since it contains the current function
parameters only. In the example above it is possible to assign variables
to the In,Out and Steps parameters of the function.
The parameter that shall be bound to a variable is selected in the
Parameter list and the variable is selected from the Defined variables
list. The binding is performed by using the Bind button.
Example:
We want to bind the integer variable i to the parameter Steps of the
Close function.
Select the Steps parameter in the parameter list and then the i
variable in the Defined variables list. Press Bind to perform the
binding.
After putting the function in the program list it is possible to see that
the parameter is bound to a variable.
The current bindings for the parameters are also displayed in the
parameter list.
The user interface item for a parameter is greyed out in the parameter
area if the parameter is bound to a variable.
A parameter can be unbound by selecting it in the parameter list and
then using the Unbind button. All the parameters in a function can be
unbound by selecting Unbind all in the Unbind menu.
If a microGOP function parameter is bound to a variable the value of
that variable is used when that function’s program line is executed (at
"run-time").
This manual assumes the use of a right-handed mouse, with the three
mouse buttons defined as follows:
SELECT Button
The left mouse button (called SELECT) selects function buttons,
icons and items in pop-up windows, chooses menu items, and items
in lists (files etc.). When you click SELECT in a list a new item is
selected and the previously selected item is unselected.
ADJUST Button
The middle mouse button is called ADJUST. It adjusts the selection
made by SELECT. When you click ADJUST in a list a new item is
selected but the previously selected items remain selected too.
MENU Button
The right mouse button (called MENU) displays menus, submenus,
and pop-up menus, and chooses items from menus.
A.4 Buttons
The label on a button used for a single command can be text or an icon
image.
To choose a button, click SELECT on the button, i.e. move the pointer
(cursor) to the button, then press and release the left mouse button
quickly.
When you press a button, it is highlighted to provide visual feedback.
When a button has a window mark - three dots (...) - following the label,
choosing the button causes a pop-up window to be displayed.
A.7 Menus
There are different methods to display and choose from a menu:
• If you click MENU on a menu button, the menu displays as
described above. You can choose a menu item by clicking on it with
MENU or SELECT. Click outside the menu to cancel it.
• If you press MENU on a menu button, the menu displays while the
MENU button remains pressed. Drag MENU (i.e. hold the right
menu button down while moving the mouse) to the menu item you
want and release the mouse button to choose it.
• If you press SELECT on a menu button, the default choice for the
menu replaces the label on the menu button. Releasing SELECT at
this point will select the default choice.
• If you click SELECT on a menu button, the default choice for the
menu will be selected.
When items in a menu are dimmed, they are temporarily unavailable.
To make a choice, click SELECT on the check box to display the check
mark.
When a text field cannot display the entire text string, scrolling buttons
are displayed to allow you to scroll the contents of the text field.
A.12 Sliders
Sliders are used to set a numeric value and to give a visual indication of
the setting.
The numbers to the left and to the right of the slider indicate the range
of possible settings. There are different methods to set a numeric value
with the slider:
• If you drag SELECT on the slider button, the numeric value will
change while you move the mouse until you release the mouse
button.
• If you click SELECT to the left of the slider button, the numeric
value will decrease with one.
• If you click SELECT to the right of the slider button, the numeric
value will increase with one.
• If you click SELECT on either of the end boxes, the minimum or the
maximum value will be displayed in the numeric field.
A.13 Scrollbars
Scrollbars allow you to change the view on the data that is displayed in
a scrolling list or a text pane. The figure below shows the parts of the
scrollbar and an example of its use.
You use the SELECT button to scroll through the data. When you scroll
upward, you move the view on the data incrementally toward the
beginning. When you scroll downward, you move the view on the data
incrementally toward the end. The elevator shows you where you are in
the data. The dark area of the cable (the proportion indicator) shows you
how much of the total contents that is displayed.
You can use the scrollbar in the following ways:
• Go to the beginning (click SELECT on the top cable anchor).
• Go to the end (click SELECT on the bottom cable anchor).
• Move one line toward the beginning (click SELECT on the up arrow).
• Move one line toward the end (click SELECT on the down arrow).
• Move to any arbitrary location (press SELECT in the drag area and
drag the elevator).
• Scroll quickly toward the beginning (press SELECT on the up arrow).
• Scroll quickly toward the end (press SELECT on the down arrow).
You can move the pop-up window by dragging SELECT on the header
of the pop-up window.
Each pop-up window has a pop-up window menu, which is displayed
by pressing MENU on the pop-up window header. The menu allows
you to dismiss or refresh the pop-up window, move the window to the
back of the display, or bring forward the associated base window. This
menu is not commonly used.
A.15 Notices
Notices are pop-up windows that displays warnings, messages,
questions, or other information that require an immediate action. When
a notice appears, you cannot continue using the application until you
respond appropriately - such as clicking SELECT on a button in the
notice pop-up window.
The license key must now be typed at the License Key line exactly as
printed on the license key sheet.
☞ The license key can also be setup with -k option as described in The
command line options to smicro, page C-6.
☞ The -k option must be used to set a new license key when the current
is still valid.
The Help... button can be used to get some information about the
different options.
The + button will show some additional settings i.e. the initial image
size.
The main options are also described below.
GOP
Enables the use of the GOP processor. The GOP operations in the
Gop and Grey function groups are enabled. The GOP processor must
be available to be able to run the operations.
MIP
Enables the use of the MIP processor. The GOP operations in the Gop
and Grey function groups are enabled. The MIP processor must be
available to be able to run the operations.
☞ The MIP and GOP operations should usually not be used at the
same time !
DCP
Enables the use of the DCP. The DCP is the old separate image
display processor from ContextVision. The DCP processor must be
available to be able to run the DCP related functions.
SCAN
Enables the use of a scan stage controller. The Scanstage function
group will be enabled. A scan stage controller must be connected to
a serial port to be able to use the functions.
GREY8
Enables the use of 8-bit grey scale image buffers.
GREY16
Enables the use of 16-bit grey scale image buffers.
GOP
Enables the use of GOP image buffers.
STEREO
Enables the Stereology function group.
FFT
Enables the FFT function group and the C32 image buffers.
CLASS
Enables the Image Classification function group.
☞ The Setup Window can be disabled (not displayed) with the smicro
option -nosetup. See The command line options to smicro, page C-6.
We must now read the .cshrc file to set the commands in the current
shell:
% source .cshrc
The syntax of the license key file should be like in this example (the
comment field is optional). Lines that start with a # sign are comment
lines.
#
# microGOP 2000/S License File
#
# hostid hostname key comment
# ------ -------- --------------- -------
8077b60b otto msxHJibZsZJeTMo single user, FFT
807ae8b2 ludde qrxItl4WrW2aXMi single user, FFT
5100786f lufsen kxYN154kdySD0RK single user
5323012e pluto lwCxpnfNNFfSGmg single user, FFT
7235473c molle dpDxLc6pEM7KBhU single user, FFT
727107c2 milou kmxBNh3ytmzP0RO 5 users, FFT
5541f24b pongo mTxO2avtUIeTHjd 2 users
55005a09 idefix pnxOf023BnCObWP 2 users, FFT
807bc36d ultra iyxfd7lddyfD2PL 3 users, FFT
The smicro start script will look in the license file specified by
SMICRO_KEY_FILE for a license for the computer it is running on.
Most of the switches are never used by regular users and some of the
switches can be controlled within the Setup Window.
The -k switch can be used to setup a license key for the microGOP. This
is not used very often since the license key is usually setup using the
license key window described in Setting the license key, page B-2.
This example will enable the functions in the Scanstage, FFT, Stereology,
and Image Classifier function groups and also the GOP operations
running in the MIP processor. The 16-bit grey scale image buffers will
also be enabled.
Savecmd
This program is invoked when Save Image is performed. The
microGOP 2000/S invokes the program with the following
parameters:
Savecmd imf_image image_to_save -f type hgh wid
☞ The “-” as extension indicates that the image files does not have a
specific extension.
☞ The personal file should be located in the user’s home directory and
its name should be .microvideounit. This file, if it exists, will be used
instead of the one in the release directory.
Each line in the microvideounit file should contain a command that grabs
an image or displays live video from a video card. There is built-in
support for a number of video cards. The following frame grabbers
were supported at the time this manual was written:
Sbus SLIC from Multimedia Access Corporation.
Sbus SNAPPER-8, SNAPPER-24, SNAPPER-DIG16 (with support
for Hamamatsu C4742 and C4742-95 digital video cameras),
and PCI SNAPPER-8,
all from Active Imaging.
Sbus SunVideo from Sun Microsystems.
Sbus Videopix from Sun MicroSystems.
DCP frame grabber from ContextVision.
The maximum image size that can be used with the frame grabbers is
768x576 for PAL signals, and 640x480 for NTSC signals.
Video commands
The following video commands are available for the different devices:
SLIC
SLICLive parameterlist Enable live video
SLICGrab parameterlist Grab an image
SLICLiveOff Disable live video
SLICLiveClose Release video device
SNAPPER-8, SNAPPER-24, SNAPPER-DIG16
SnapperLive parameterlist Enable live video
SnapperGrab parameterlist Grab an image
SnapperOff Disable live video
SnapperClose Release video device
Hamamatsu C4742-95 digital video camera
C4742-95_Live parameterlist Enable live video
C4742-95_Grab parameterlist Grab an image
C4742-95_LiveOff Disable live video
C4742-95_Close Release video device
Hamamatsu C4742 digital video camera
C4742_Live parameterlist Enable live video
C4742_Grab parameterlist Grab an image
C4742_LiveOff Disable live video
C4742_Close Release video device
Videopix
VideoPixLive parameterlist Enable live video
VideoPixGrab parameterlist Grab an image
VideoPixLiveOff Disable live video
Sun Video
SunVideoLive parameterlist Enable live video
SunVideoGrab parameterlist Grab an image
SunVideoLiveOff Disable live video
SunVideoClose Release video device
Port=p x x x x
Channel=ch x x x
HQ=hq x x
SX=sx x x x x x
SY=sy x x x x x
CX=cx x x x x x
CY=cy x x x x x
Grab only
Frames=f x x x x x x x
Live only
Size=size x x x x x
Low=low x x x x x x
High1=high1 x x x x x x
High2=high2 x x x x x x
Histogram=hi x x x x x x
Wedge=w x x x x x x
Info=i x x x x x x
Default Description
dcpch Green The color channel.
Use Red, Green, or Blue.
dcpsync Green Selects the sync source.
Use Composite, Green, External, or
Internal.
dcpsx 1.113 Horizontal scaling factor which makes
it possible to adjust the geometry of the
grabbed image. Use the default value to
get square pixels.
The imf_image is the u8 or s16 imf file that shall be created. The width
and height are specified by wid and hgh.
Stage.Resolution: 200
The scan stage motor resolution in steps/mm.
Stage.BaudRate: 2400 [300-38400]
The baudrate for the serial communication. The speed must match
the speed of the scan stage controller.
Stage.Step: 1
The number of steps to move the scanstage motors for each
microGOP 2000/S step. (May be useful for some stage controllers).
Stage.Device: /dev/ttyb
Specifies the terminal port to connect the scanstage controller to.
Stage.AF_Threshold: 16
The default threshold value used in the Autofocus function.
Stage.AF_Delay: 3
The default delay value used in the Autofocus function.
Stage.AF_MaxStep: 10⋅Stage.Resolution
The maximum allowed number of steps in the Autofocus function.
Stage.ZInit: On [Off, On]
Enables the use of the Stage.ZInitValue tag.
Stage.ZInitValue: 500000
The initial Z position, set when calibrating the scan stage.
Stage.ZInit must be On.
Video.SunVideo_Device: /dev/rtvc0
The device name for the SunVideo card that shall be used.
Video.Slic_Device: /dev/slv0
The device name for the SLIC card that shall be used.
Video.Slic_Sync_Count: 2
Video.Snapper_Device_Nbr: 0
The device number for the Snapper 8/24 video cards.
Video.Dig16_Device_Nbr: -1 (= automatic)
The device number for the Snapper DIG16 digital camera frame
grabber.
Video.Dig16_Tty: /dev/ttya
The serial port for serial communication with digital camera.
Video.Dig16_Tty_Baud: 9600
The speed for serial communication with digital camera.
AutoDestination.DCP: Off [ Off, On ]
Defines if the DCP should be used as default destination when
automatic image display is enabled.
AutoUpdate.Window: On [ On, Off ]
Set if the automatic image displayed is enabled or not.
AutoUpdate.WindowWhenClosed: On [ On, Off ]
Set if the automatic image displayed is enabled when the microGOP
is iconified.
AutoUpdate.ImageTool: On [ On, Off ]
Set if the image in Image Tool should be updated whenever the
image content changes.
LoadImage.LoadMode: Adapt [Adapt, Resample]
Specifies if the microGOP should use Adapt or Resample as default
in the Load Image function.
LoadImage.Warning: No [No/Yes]
Specifies if warnings should be given when the image size changes
when a new image is loaded.
Trace.ProgramList: On [ On, Off ]
Trace.Footer: On [ On, Off ]
Select if the program flow should be traced in the Image Processing
window footer or in the program list.
Zoom.Width: 300
Zoom.Height: 300
The default width and height of the Zoom window.
Zoom.X: 545
Zoom.Y: 128
The default x and y coordinates for the top left corner of the zoom
window.
Color.NUntouched: 64
For debugging purposes only.
Sid.FGColor: ff0000
Sid.BGColor: 00ff00
The default foreground and background plane colors for the Image
Display window.
Sid.FGMode: Opaque [Opaque, Transparent]
Sid.BGMode: Opaque [Opaque, Transparent]
Sets the default type of foreground and background plane in the
Image Display window.
ObjHist.XTicks: 15
ObjHist.YTicks: 10
The number of ticks for the x- and y-axes (approximately).
ObjHist.Font:
-adobe-times-bold-r-normal--14-140-75-75-p-77-iso8859-1
The font to be used for the text in the histogram. The UNIX
command xlsfonts displays a list of available fonts. The X server’s
default font is obtained if no ObjHist.Font (or default) is specified.
ObjHist.PmpWidth: 500
ObjHist.PmpHeight: 500
Default size for printing on file.
ObjHist.Ruling: Yes [Yes, No]
The histogram background can be cross-ruled for ease of reading out
the bars.
ObjHist.Rulespace: Dense [ Loose, Dense ]
The ruling can be loose or dense.
ObjHist.RuleColor:
Turquoise [red, yellow, turquoise, black, grey]
The color of the ruling.
Scat.PmpWidth: 500
Scat.PmpHeight: 500
Scat.Ruling: Yes [ Yes, No ]
Scat.Rulespace: Dense [ Loose, Dense ]
Scat.RuleColor:
Turquoise [red, yellow, turquoise, black, grey]
GreyHist.TxtColor:
black [red, yellow, turquoise, black, grey]
GreyHist.AxisColor:
black [red, yellow, turquoise, black, grey]
GreyHist.BarColor:
red [red, yellow, turquoise, black, grey]
GreyHist.Height: 600
GreyHist.Width: 500
GreyHist.Filled: Stippled [Solid, Stippled, None]
GreyHist.XTicks: 15
GreyHist.YTicks: 10
GreyHist.Font:
-adobe-times-bold-r-normal--14-140-75-75-p-77-iso8859-1
GreyHist.PmpWidth: 500
GreyHist.PmpHeight: 500
GreyHist.Ruling: Yes [ Yes, No ]
GreyHist.Rulespace: Dense [ Loose, Dense ]
GreyHist.RuleColor:
Turquoise [red, yellow, turquoise, black, grey]
AreaFract.TxtColor:
black [red, yellow, turquoise, black, grey]
AreaFract.AxisColor:
black [red, yellow, turquoise, black, grey]
AreaFract.BarColor:
red [red, yellow, turquoise, black, grey]
AreaFract.Height: 600
AreaFract.Width: 500
AreaFract.Filled: Stippled [Solid, Stippled, None]
AreaFract.PTicks: 15
Number of ticks (appr.) on the y axis.
AreaFract.Font:
-adobe-times-bold-r-normal--14-140-75-75-p-77-iso8859-1
AreaFract.TextswFont:
-adobe-courier-bold-o-normal--14-140-75-75-m-90-iso8859-1
The font to be used in the text list presented beside the diagram. The
X server’s default font is obtained if no AreaFract.TextswFont (or
default) is specified.
AreaFract.PmpWidth: 500
AreaFract.PmpHeight: 500
AreaFract.Ruling: Yes [ Yes, No ]
AreaFract.Rulespace: Dense [ Loose, Dense ]
AreaFract.RuleColor: Turquoise
Measure.PupStrategy: Keep [Remove, Keep]
The pop-up windows produced by Object Histogram, Scattergram,
Image Histogram and Area Fraction can be removed as soon as a
new function is selected or they can remain on the screen.
Measure.TmpDir: /tmp
The Measure functions create temporary files that may become very
large. /tmp is the correct place to store temporary files. If there is not
enough room on the / partition another directory can be specified
instead.
Temporary files
The following temporary files are created by microGOP 20000/S. They
need not be examined or handled by the user. Some of these file may
become very big and cause disk space problems. Therefore you should
be aware of their existence. They all reside in the directory /tmp unless
otherwise stated in the file .microprofile.
microGOP-<PID>-areafraction
microGOP-<PID>-psobjhistogram
microGOP-<PID>-psscattergram
microGOP-<PID>-psareafraction
microGOP-<PID>-psgreyhistogram
microGOP-<PID>-list_screen
microGOP-<PID>-list_printerpr
microGOP-<PID>-basics_file
microGOP-<PID>-<scattergramname>-scatdata
This file may become very large for large measurements.
<PID> is the process number for the microGOP 20000/S that created the
file. This is so that multiple microGOPs can run on the same host. The
files above are all removed when microGOP 2000/S is exited.
If you run into space problems change the tmp directory to another
partition where there is more space. See the section The microprofile file
above, setting Measure.TmpDir, page C-27.
Postscript files
The Object Histogram, Scattergram, Area Fraction and Image
Histogram are sent to the printer as Postscript™ files. For a scattergram
the size of the Postscript file is proportional to the number of objects.
This may cause problems when many objects are present ( > 100 000).
The file can choke the lp spooler and it will take a long time to print on
the laser printer. ( You can notice the same effect when printing the
scattergram on the screen).
☞ The argument pixel values in the Gop images are 8-bit values in the
range -128 to + 127. These values represent the angle -π to π.
N R
Neighbourhood, 3-8-1 README file, C-1
New program, 2-2 Reject class, 3-13-8
Residuals, 3-3-13
O Rubber Band Box, 2-29
Object features, see also Features, 3-10-3 Rubber Band Circle, 2-30
Object pixel, 3-8-1 Rubber Band Line, 2-30
On-line help, 1-4 Run a program, 2-57
OPEN LOOK, 1-2 Run button, 2-4
OPEN LOOK concepts, A-1
openwin, B-1 S
OpenWindows, 1-3, B-1 Sample session, 2-51
Operating system, 1-5 Save From Display menu, 2-49
Optional hardware, 1-1 Save program, 2-2, 2-57
Options, B-3, C-7 Scale factor, 3-3-2, 3-3-3
Outer border, 3-8-2 Scanstage function group, 3-4-1
Outline Tool, 2-31 Scattergram, 3-5-23, 3-10-15
Overlay planes, 2-15 SELECT button, A-1
Overlay settings, 2-28 Set the active SID tool, 4-35
Overlays menu, 2-48 SID, 2-15
SID menu, 2-16
P SID planes, 2-15
Paint, 2-26 SID Tool Properties, 2-38
Paint color, 2-27 SID Tools
Parameter area, 2-10 Brightness/Contrast Control, 2-17
PATH environment variable, C-2 Draw, 2-31
Pixel Value, 2-24 Outline, 2-31
Point Window, 3-10-6 Paint, 2-26
Postscript files, C-28 Pixel Value, 2-24
Present grey scale data, 3-10-1 Rubber Band Box, 2-29
Present object features, 3-10-1 Rubber Band Circle, 2-30
Program execution trace, 3-3-8 Rubber Band Line, 2-30
Program function group, 3-5-1 Train, 3-13-12, 3-13-18
Program list, 2-10 Zoom, 2-20
Programming language, 4-1 Zoom/Pan, 2-18
Program, how to make, 2-56 SID Tools menu, 2-16
Properties menu, 2-4 Slicing, 2-44
Pseudo colors, 2-46 smicro, B-1
PseudoColor default visual, 1-4, B-1 SMICROHOME environment variable,
C-2
Q SMICROOPTIONS environment
Quadratic discrimination, 3-13-8 variable, C-7
Quit, 2-2 Soft Image Display, 2-15