You are on page 1of 228

Tools for DaVis

Command Language

by

Command Language Manual for DaVis 6.2


September 2002
LaVision GmbH, Anna-Vandenhoeck-Ring 19, D-37081 Gottingen
Produced by LaVision GmbH, Gottingen
Printed in Germany

Table of Contents

Table of Contents
1 Introduction

1.1

About this manual . . . . . . . . . . . . . . . . . . . . . . . . .

1.2

Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 Macro Menu
2.1

11

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

2.1.1

Logging Functions . . . . . . . . . . . . . . . . . . . . .

12

Macro Execution . . . . . . . . . . . . . . . . . . . . . . . . . .

13

2.2.1

Load Macro File . . . . . . . . . . . . . . . . . . . . . .

13

2.2.2

Execute Function . . . . . . . . . . . . . . . . . . . . . .

14

2.2.3

Execute Line . . . . . . . . . . . . . . . . . . . . . . . .

15

2.2.4

Error Dialog . . . . . . . . . . . . . . . . . . . . . . . .

15

2.3

Variables Dialog . . . . . . . . . . . . . . . . . . . . . . . . . .

17

2.4

Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

2.2

3 CL Language
3.1

3.2

3.3

19

Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

3.1.1

General Statement Syntax . . . . . . . . . . . . . . . . .

19

3.1.2

Comments . . . . . . . . . . . . . . . . . . . . . . . . . .

19

3.1.3

IF Statement . . . . . . . . . . . . . . . . . . . . . . . .

20

3.1.4

WHILE Statement . . . . . . . . . . . . . . . . . . . . .

20

3.1.5

DO Statement . . . . . . . . . . . . . . . . . . . . . . .

21

3.1.6

SWITCH Statement . . . . . . . . . . . . . . . . . . . .

21

3.1.7

BREAK Statement . . . . . . . . . . . . . . . . . . . . .

21

3.1.8

RETURN Statement . . . . . . . . . . . . . . . . . . . .

22

3.1.9

FOR Statement . . . . . . . . . . . . . . . . . . . . . . .

22

Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

3.2.1

Constants . . . . . . . . . . . . . . . . . . . . . . . . . .

23

3.2.2

Declared Variables . . . . . . . . . . . . . . . . . . . . .

24

3.2.3

Buffer Variables

. . . . . . . . . . . . . . . . . . . . . .

26

CL Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

3.3.1

Arithmetic operators . . . . . . . . . . . . . . . . . . . .

28

3.3.2

Assignment Operators . . . . . . . . . . . . . . . . . . .

29
3

Table of Contents

3.4

3.3.3
3.3.4
3.3.5
3.3.6
3.3.7
3.3.8
Macro
3.4.1
3.4.2

Comparison Operators
Logical Operators . .
Bit Operators . . . . .
String Operators . . .
Other Operators . . .
Operator Precedence .
Programs . . . . . . .
Macro Definition . . .
Macro Call . . . . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

4 Subroutines
4.1 About Subroutines . . . . . . . . . . . . .
4.2 Keyboard & Screen I/O . . . . . . . . . .
4.3 File Handling . . . . . . . . . . . . . . . .
4.3.1 Loading and storing a file . . . . .
4.3.2 File and directory handling . . . .
4.3.3 Macros for file name access . . . .
4.3.4 Dialogs for file selection . . . . . .
4.4 Text File IO . . . . . . . . . . . . . . . . .
4.5 Strings . . . . . . . . . . . . . . . . . . . .
4.6 Scalar Arithmetic . . . . . . . . . . . . . .
4.6.1 Mathematical Macros . . . . . . .
4.7 Miscellaneous Functions . . . . . . . . . .
4.7.1 Handling Macros and Macro Files
4.7.2 Using Windows Programs . . . . .
4.7.3 Fast User Functions via DLLs . . .
5 Image Buffers
5.1 2D Image Buffers . . . . . . . . . . . .
5.2 RGB Color Buffers . . . . . . . . . . .
5.3 3D Image Buffers . . . . . . . . . . . .
5.3.1 Point Handling . . . . . . . . .
5.3.2 Volume Point Iterator . . . . .
5.4 Buffer Frame Handling . . . . . . . . .
5.5 Buffer Attributes . . . . . . . . . . . .
5.5.1 Buffer Attribute Macros . . . .
5.5.2 Frame Buffer Attribute Macros
5.5.3 Overlays . . . . . . . . . . . . .
5.5.4 Scaling . . . . . . . . . . . . .
5.6 Drawing into a buffer . . . . . . . . . .
4

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

29
29
30
30
30
31
31
32
32

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

35
35
35
38
38
40
42
42
43
45
50
50
51
51
53
54

.
.
.
.
.
.
.
.
.
.
.
.

59
59
60
61
64
65
65
67
70
71
72
74
75

Table of Contents

5.7
5.8
5.9

Buffer Arithmetic . . . . . . .
Line Arithmetic . . . . . . . .
Rectangles . . . . . . . . . . .
5.9.1 Rectangle Macros . . .
5.9.2 Rectangle Subroutines
5.10 Filters . . . . . . . . . . . . .
5.11 PIV / PTV . . . . . . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

6 Image Window
6.1 Creating Image Windows . . . . . . . . . . . . . .
6.2 Modifying the Display . . . . . . . . . . . . . . . .
6.2.1 Window Display Parameter . . . . . . . . .
6.2.2 Exporting window or buffer data . . . . . .
6.3 Coordinate selection by mouse in a window . . . .
6.3.1 Select a line or region with mouse cursor . .
6.3.2 Clicking in an image window . . . . . . . .
6.3.3 Handling mouse events on image windows .
6.3.4 Handling update events on image windows
6.4 Drawing into a window . . . . . . . . . . . . . . . .
6.5 About the Profile Window . . . . . . . . . . . . . .
6.6 About the Palette Window . . . . . . . . . . . . .
7 Hardware
7.1 Data Acquisition . . . . . . . . . . . . . . . . . .
7.1.1 Changing Parameters in the ACQ File . .
7.1.2 Programming Cameras and Acquisition of
7.1.3 Framegrabber Special . . . . . . . . . . .
7.1.4 Fast Data Acquisition and Storage . . . .
7.2 Modify ACQ Files . . . . . . . . . . . . . . . . .
7.2.1 Executing the Acquisition File . . . . . .
7.2.2 General Items . . . . . . . . . . . . . . . .
7.2.3 Readout Camera Items . . . . . . . . . .
7.2.4 Video Cameras Only . . . . . . . . . . . .
7.2.5 CIO-16 Special . . . . . . . . . . . . . . .
7.2.6 Restart Mode . . . . . . . . . . . . . . . .
7.2.7 Example . . . . . . . . . . . . . . . . . . .
7.3 TTL I/O-Board . . . . . . . . . . . . . . . . . . .
7.4 General I/O . . . . . . . . . . . . . . . . . . . . .
7.4.1 Serial Port . . . . . . . . . . . . . . . . .
7.4.2 Special Devices . . . . . . . . . . . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

. . . . .
. . . . .
Images
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

75
83
85
86
86
88
92

.
.
.
.
.
.
.
.
.
.
.
.

99
99
103
103
106
107
108
109
109
110
110
111
112

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

115
115
115
119
122
122
123
124
124
128
131
132
134
134
135
137
138
141
5

Table of Contents

7.4.3

Joystick . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

7.4.4

GPIB and VISA . . . . . . . . . . . . . . . . . . . . . . 143

7.4.5

Remote Control . . . . . . . . . . . . . . . . . . . . . . . 145

8 General Macros
8.1

147

About General Macros . . . . . . . . . . . . . . . . . . . . . . . 147


8.1.1

Temporary Buffers . . . . . . . . . . . . . . . . . . . . . 147

8.1.2

Reserved Buffers . . . . . . . . . . . . . . . . . . . . . . 148

8.1.3

Stop Action and Error Action . . . . . . . . . . . . . . . 148

8.1.4

Busy Text . . . . . . . . . . . . . . . . . . . . . . . . . . 149

8.1.5

Additional Macros for Dialogs . . . . . . . . . . . . . . . 150

8.1.6

Additional Mathematical Macros . . . . . . . . . . . . . 150

8.2

Macros for Simple Parameter Editing . . . . . . . . . . . . . . . 150

8.3

Macros for Image Acquisition . . . . . . . . . . . . . . . . . . . 151

8.4

8.5

8.3.1

Image Acquisition Loop . . . . . . . . . . . . . . . . . . 151

8.3.2

Action String Handler . . . . . . . . . . . . . . . . . . . 152

8.3.3

Masking a buffer . . . . . . . . . . . . . . . . . . . . . . 153

Special Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 153


8.4.1

Macro Execution during Startup . . . . . . . . . . . . . 153

8.4.2

Events on buffer contents changing . . . . . . . . . . . . 155

8.4.3

Macro Timer . . . . . . . . . . . . . . . . . . . . . . . . 155

8.4.4

Macro Thread . . . . . . . . . . . . . . . . . . . . . . . 155

Retired Macros and Subroutines . . . . . . . . . . . . . . . . . 156

9 Dialogs
9.1

159

About Dialogs

. . . . . . . . . . . . . . . . . . . . . . . . . . . 159

9.1.1

Attributes and Modal Dialogs . . . . . . . . . . . . . . . 159

9.1.2

Dialog Event Handler . . . . . . . . . . . . . . . . . . . 161

9.1.3

Example for a simple dialog . . . . . . . . . . . . . . . . 162

9.2

Dialog Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 163

9.3

Dialog Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

9.4

9.3.1

Item Types . . . . . . . . . . . . . . . . . . . . . . . . . 165

9.3.2

Changing Item Attributes . . . . . . . . . . . . . . . . . 184

9.3.3

Additional Item Macros . . . . . . . . . . . . . . . . . . 186

9.3.4

Predefined Item Groups . . . . . . . . . . . . . . . . . . 188

Dialog Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

10 Menus and Toolbars

193

10.1 About Menus and Toolbars . . . . . . . . . . . . . . . . . . . . 193


10.2 Definition of Shortcuts . . . . . . . . . . . . . . . . . . . . . . . 193
6

Table of Contents

10.3 Menu Creation . . . . . . . . . . . . . .


10.3.1 Subroutines concerning menus .
10.3.2 Macros with predefined pulldown
10.4 Subroutines for ToolBar Creation . . . .
A Appendix
A.1 How to write your own help files . .
A.1.1 HTML Style Help . . . . . .
A.1.2 PDF Style Help . . . . . . . .
A.1.3 Help on Dialogs . . . . . . . .
A.2 File Formats . . . . . . . . . . . . .
A.2.1 Image Files of types IMG and
A.2.2 Ascii file format of type TXT
A.3 Supported Buffer Attributes . . . . .
A.4 Supported Window Parameters . . .

. . . .
. . . .
menus
. . . .

. . .
. . .
. . .
. . .
. . .
IMX
. . .
. . .
. . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.

194
194
197
198

.
.
.
.
.
.
.
.
.

201
201
201
202
202
202
202
204
205
211

Table of Contents

1 Introduction
1.1

About this manual

The control structures and data structures of CL together with a large set of
system subroutines offer a great flexibility in adapting the software to individual data acquisition and evaluation applications.
Subroutines are system-defined functions for a variety of purposes (such as
data I/O, data acquisition and data processing). In contrast to macros, subroutines are only declared but not defined. The executable code is embedded
in the main file DAVIS.EXE and is therefore not visible for the user.
This manual includes all new subroutines for DaVis 5.5 and DaVis 6 . Please
read file GuideNews.rtf in your DaVis directory for a list of the new functions. Some functions are available in DaVis 6 only. These are marked in the
description.

1.2

Conventions

Underline
Underlining is used for important words.
Bold
Links to chapters into this manual, names of menu items and names of button
or text items in dialogs are marked in bold letters.
Italic
This style is used for links to other manuals by LaVision .
Courier
All CL-code is printed with the Courier font: subroutine and macro definitions, variable names, and macro code examples.

1 Introduction

10

2 Macro Menu
2.1

Overview

The Macro menu supports the execution


of DaVis functions via statements written
in the Command Language.
Newly written macros have to be loaded
first with the function Load Macro File.
Loaded macros can be executed with
two execution functions.
With
the function Execute Function (hotkey
CTRL+F7) the user selects from all
loaded macro programs and system subroutines and executes that function. Or,
with function Execute Line, it is possible
to enter any CL statement via a command
line (hotkey F7). Up to ten often used CL
statements can be stored in the last sector
of the menu. They can easily be reached
by hotkey CTRL+Shift+Number.
Function Edit opens the Windows editor, in order to add or change macro
files. Very useful while writing macros is the function Variables. It displays
groups of variables, for example used to control a special device. Their present
value is shown and can be changed.
The remaining three functions operate a kind off log-book. While using
DaVis all executions of subroutines and system macros can be stored in it.
Example
Write a new macro and start its execution.
1. Select function Edit ( press CTRL+E ).
2. Enter the filename (e.g. TEST.CL). Click on OK.
3. Now the macro can be written in the Windows editor. Define a sequence
11

2 Macro Menu

of execution functions in the Command language syntax. For example,


take 50 images:

void Take 50Images ()


{
int i;
for(i=1; i=<50; i++)
{
TakeImage(i);
Show(i);
}
}
4. Store the new macro file (select File + Store in the editor).
5. Close the editor.
6. Select function Load Macro File.
7. Choose the new macro file ( TEST.CL ). Click on OK and the new
macro is loaded.
8. It can then be executed via the function Execute Line or Execute
Function.

The execution is stopped by clicking on the STOP sign


, which is visible
right in the middle of the tool bar during the execution, or by pressing the
key ESCAPE.

2.1.1

Logging Functions

The DaVis log-book is a documentation of all executed subroutines and


system macros. The documentation is written to the file LOG.TXT and edited
as shown on the right.
What for?
This is a good starting point to write own macro programs. And it can be
used as a kind of debugger or just to inform about any previous actions.
Show Log / Clear Log / Log Status
With the function Show Log the documentation is shown in a new window.
It is the file LOG.TXT, which can be edited in the Windows editor.
12

2.2 Macro Execution

The log file is cleared with the function Clear Log.


The function Log Status defines whether all executed commands are documented in the log-book or not. Switch the documentation ON or OFF by
clicking on this function.
Example
Example of some Log-book entries.
The lines include statements written in CL:
load an IMX file into buffer 1 (subroutine LoadBuffers)
set buffer 2 as the active buffer (it is automatically displayed)
// DaVis CL log file date:
LoadBuffer(tempstr,1);
Buffer=2;

2.2

12.06.98 time:

11:23:07

Macro Execution

There are three ways to execute a subroutine.


With the dialog Execute Function of the Macro menu (hotkey CTRL+F7)
the user can select one of the system subroutines (or a loaded macro program)
and then execute it. We recommend this way especially in the beginning,
since the user will automatically be guided to enter all necessary parameters.
With the dialog Execute Line of the Macro menu (hotkey F7), it is possible
to enter a subroutine as one statement via a command line. All parameters
have to be entered correctly.
It is also possible to include subroutines in a macro program. This way
sequences of DaVis functions that exactly fit to the users needs are executed
with a single command.

2.2.1

Load Macro File

This function loads a macro file of the users choice. The file can include
various macro programs. Each of them can then be executed via the function
Execute Line or Execute Function. A special function can be executed
automatically after loading (see subroutine LoadMacroFile on page 51).
A macro file can also include global variables, which are used for storing and
retrieving parameters. With the function Save Settings, e.g., the macro files
13

2 Macro Menu

SYS VARS.CL and SYS MACS.CL ( SYS DEVS.CL and SYS FILT.CL ) are stored
with their present contents.

2.2.2

Execute Function

1. Open the list of all subroutines and loaded macros with the function
Execute Function in the Maxcro menu (alternatively click on button
or press CTRL+F7).
2. Select the function Group to restrict the list of displayed subroutines
and macros, or select the first entry in the group list (all) to display the
functions independent of their groups.
3. Enter a search string in the field below Find String, select ignore case
if the difference between upper case and lower case characters does not
matter, then press the Return key or the Refresh button to rebuild the
list. Optional the function list can be sorted.
4. Select a function (subroutine or macro) in the list by clicking on it.
Above the list field the function header (return type, name and parameters) and the source is shown (either a macro file or the text system
subroutine). In the bottom line a short help text appears.
5. Click Help to open your html-browser or pdf-viewer to read further
descriptions. See chapter How to write your own help files for
information about the online help format.
14

2.2 Macro Execution

6. Click Execute (or double-click in the list).


7. Enter one parameter value after the other in a new dialog box. Click
OK.
8. Now the generated CL code is displayed. It is the command to call
the selected function and display the result (if any) in the Info window.
Click OK to execute. The parameters of the function or the text to be
displayed can still be modified.
9. If a function has a return value, it will be displayed in the Info text
window.

2.2.3

Execute Line

Enter and execute a single command line.


1. Open a command line box with function Execute Line (press F7).
2. Enter a command (e.g. B[3]=B[1]+B[2]).
Any Command Language statement can be entered. Also several statements in the same line are possible. They have to be separated by a
semicolon, for example
B[3]=B[1]+B[2]; ExpBuffer(3,4)
3. Click OK to execute.
Note:
Every valid CL-command is possible: for-loops, if-statements or other Ccompound statements.
Upper and lower case characters are distinguished, so that, e.g., varname,
Varname and VarName are three different names.

2.2.4

Error Dialog

If an error occures while running DaVis the following dialog box appeares.
The red text describes the error. Button Close closes the dialog. While the
dialog is open, most functions of DaVis can not be used!

15

2 Macro Menu

The advanced user can get more information, e.g. for developing CL-macros,
when pressing button details. The dialog will resize and present the following:

If the error occures in a macro file, the name of the file, the recent position
(line and column), the name of the macro function and the source text will
be shown. Buttons Up and Down can be used to go through the calling
stack, which can be written into the InfoText window as real text. The below example shows a stack of three functions, where macro GetSingleImage
called macro SetupAcquisition in line 466, SetupAcquisition called macro
SetAllCameraParameter in line 95, and there an error occured in line 127.

The user can call this dialog box from own macros by subroutine
void Error( string message )
16

2.3 Variables Dialog

2.3

Variables Dialog

The Variables dialog displays a list of actually declared variables and their
present values. The list can be sorted by group, name or type.
After a click on the button Set Value, a new value can directly be assigned to
a chosen variable. If the variable is an array, you have to enter the number of
the element you want to change in a small question box. Then another small
box opens to enter the new value of the variable.

Group
The variables are internally organized in groups according to their usage.
(For example, all variables used to control a stepmotor belong to the group
Step Motor.) When choosing a certain group the list is updated
accordingly.
How to Define a Group
In the system files SYS VARS.CL, SYS MACS.CL, SYS DEVS.CL, SYS FILT.CL
and USER.CL (they are automatically loaded at start-up) groups are already
defined by the following statement:
#GROUP NameOfTheGroup
The group includes all following variables up to the next #GROUP statement.
17

2 Macro Menu

View Type
If view type is selected every variable is shown with ist type, which ca be
int, float or string. Additional type static is shown, too:

Find String
Enter a (sub)string to view the variables whose name includes the string. If
you want to ignore the difference between lower- and uppercase letters, please
select ignore case.

2.4

18

Debugger

3 CL Language
3.1

Statements

3.1.1

General Statement Syntax

The syntax for CL statements follows the style of the C programming language
and CL has the same arithmetic and logical operators as C.
Each statement must end with a semicolon character (often forgotten
by beginners!). More than one statement may be placed on a line:
statement1; statement2; statement3;
Text strings are enclosed in quote marks.
"this is a textstring"
Statements are grouped with the help of brace characters ({ and }):
{
statement1;
statement2;
}
In contrast to C , CL does not support pre-processor directives (#define,
#include etc.).

3.1.2

Comments

The beginning of a comment is denoted with // (two consecutive slash


characters). Everything from the // sequence to the end of the line is treated
as a comment. Comments may be on lines by themselves or on the ends of
other statements.
A comment can also be specified by beginning the comment with the /*
character sequence. All following characters are treated as comments up to
the matching */ sequence.
Example to illustrate both types of comments:
// comment line
y = a + b*x; // linear equation
/*
This is a comment.
19

3 CL Language

*/
z = y / 5; /*This is a comment too.*/

3.1.3

IF Statement

The form of the IF statement is:


if (expr) statement1; [else statement2;]
If the expression (expr) is true (not zero) statement1 is executed, if the expression is false (zero) and the ELSE clause is specified, statement2 is executed.
The ELSE clause and the second set of statements are optional.
Example of an IF statement controlling a group of statements by enclosing
them in braces:
if (MaxRect(1,0) > value)
{
Message ("overflow in buffer 1",0);
Show(1);
}

3.1.4

WHILE Statement

The WHILE statement loops until the controlling expression becomes false
(0).
The form of the WHILE statement is:
while (expression)
statement
Proceeding
Each time around the loop the expression is evaluated. If it is true (non zero)
the statements are executed and then the process repeats until the expression
becomes false. If a BREAK statement is executed within the loop, execution
of the loop terminates and control is transferred to the first statement beyond
the end of the loop.
Example of a WHILE statement:
while (x < 5)
{
x += xmove;
y += ymove;
}
20

3.1 Statements

3.1.5

DO Statement

The DO statement is very similar to the WHILE statement, except the control
expression is evaluated at the end of the loop rather than at the beginning.
This causes the loop always to be executed at least once. The form of the DO
statement is:
do
statement;
while (expression);
Proceeding
For each iteration of the loop the statements are executed and then the conditional expression is evaluated. If it is true (non-zero) control transfers to the
first statement at the top of the loop.
Example of a DO statement:
do
{
x += xstep;
y += ystep;
} while (x < limit);

3.1.6

SWITCH Statement

The SWITCH statement is used to execute alternative pieces of code depending on the value of an expression. The alternative cases are separated by case
keywords and ended by the break statement.
A default code section is defined by using the keyword default.
Example of a SWITCH statement:
switch (intvalue) {
case 1: InfoText("one"); break;
case 2: InfoText("two"); break;
case 3: InfoText("three"); break;
default: InfoText("illegal value");
}

3.1.7

BREAK Statement

The BREAK statement can be used in SWITCH statements. It causes control


to go to the statement following the SWITCH statement (see example above).
The BREAK statement is not allowed to use in an IF statement like
case 1:

if (boolvalue) break; // not allowed!


21

3 CL Language

3.1.8

RETURN Statement

The RETURN statement is used in a macro to terminate its execution and


return control to the statement following the macro call. If the macro has a
return value the RETURN statement is used to return it.
The following example is a short macro that returns the square of a float
value:
float square (float par)
{
return par*par;
par = 0;
// The code behind a return statement is unreachable,
// hence par=0 is not executed.
}

3.1.9

FOR Statement

The FOR statement is a looping control statement similar to the WHILE


statement. In addtion the FOR statement allows to specify initialization expressions that are executed once at the beginning of the loop, and loop-end
expressions executed at the end of each loop cycle.
The form of a FOR statement is (expr=expression):
for (expr1; expr2; expr3) { statements }
It is allowed to keep expression 1-3 empty. For example,
for ( ; ; ) {...}
is an endless loop. See below, how expression 1-3 is evaluated when omitted.
Proceeding
The execution of a FOR statement proceeds as follows:
1. Evaluate expression1: If expression1 is omitted, nothing is executed.
Typically this expression will include assignment operators (=) to set
initial values for loop variables.
2. Evaluate expression2: If expression2 is omitted, it is always true.
If its value is false (0) terminate the FOR statement and transfer control
to the statement that follows the controlled statement. If expression2 is
true, proceed to the next step.
3. Execute the statement(s): If more than one statement are to be controlled, enclose them with brace characters { }.
22

3.2 Data Structures

4. Evaluate expression3: If expression3 is omitted, nothing is executed.


This expression will typically contain operators such as ++, +=, -- or -=
to modify the value of a loop variable.
5. Transfer control to step 2, where expression2 is once again evaluated.
Example of a FOR statement:
for (time=start; time<end; time+=step)
{ statements; }

3.2

Data Structures

The data structures which are used and manipulated in the DaVis Command
Language apart from constants belong to two groups of variables:
Declared variables which are declared locally or globally: scalars and onedimensional vectors of the three basic data types (see section 2.2.).
Buffer variables which give access to the global data stored in image buffers:
pixel, row, column and buffer data variables (see section Image Window in
the DaVis Manual ). These need (and can) not be declared.

3.2.1

Constants

There are four kinds of constants.


Numeric Decimal
Numeric decimal constants may be written in
their natural form (1, 0, -1.5, .0003 etc.) or
in exponential form, n.nnnE ppp,
where n.nnn is the base value and ppp is the power of ten by which the
base is multiplied.
Example: the number 1.5E4 is equivalent to 15000.
Hexadecimal
Hexadecimal constants begin with 0x followed by the hexadecimal number.
They are of type integer.
Examples:
0x100 = 256
0xFFFF = 65535
0x7FFFFFFF = 2147483647 = maximal int.
23

3 CL Language

String
String constants must be enclosed in double quotation marks.
Example:

"This is a string constant"

Characters
Characters are enclosed in single quotation marks . They provide a way
to convert characters to integer values according to the ASCII code.
Example:
c - a = 2
Again, the special characters described above may be used. For example: \n
= 10
Special Characters
Some special characters are defined by preceding a backslash \ . They can
be included in strings.
string

ASCII-code

character

34

double quote marks

\r

13

carriage return

\n

10

line feed

\t

tab

\\

92

backslash

\f

12

form-feed

Examples:
"The first line \n the second line"
"file C:\\img\\demo.imx"
"a double quote \" "

3.2.2

Declared Variables

Normal CL variables may be used only after they have been declared. The
declaration assigns a data type and optionally an initial value to a variable
name. The name should reflect the meaning of the data to be stored.
Global / Local Variables
Global variables are valid everywhere after they have been declared. In contrast, local variables are only valid inside the same macro (the one of their
24

3.2 Data Structures

declaration). Both type of variables are declared in the same way. The difference is the place of their definition:
local variables are declared inside a macro
global variables are declared in any macro file but outside the macros.
Specials:
Local variables may be initialized with an expression:
float var1 = 2.3 + 1000 ;
While to global variables only constants may be assigned.
Hint: It is preferable to use local variables. Since the user is always certain
about their type and actual value.
Static Variables
If global variables are declared as static, their actual value is automatically
stored back into the macro file:
static int SaveMe = 3;
This storage will take place when leaving DaVis or by executing the function
Save Settings of the File menu.
The length of static strings is restricted to 4095 characters.
Reserved by CL
Keep in mind that the following keywords are reserved by CL and may not
be used as the names of variables or parameters:
b, c, r, p, f, pix,
(also:

B, C, R, P, F, PIX, Pix)

if, else, while, do, for,


switch, break, return,
static, case, default,
int, void, string, float, word, line.
Basic Data Types
CL has the following three basic data types:
Int: 32 bit signed integral numbers (-2147483648 .. 2147483647)
Float: 24 bit + 8 bit exponent floating point numbers (ca. -1E37...+1E37)
String: arbitrary length of text string ( 32000 characters)
Declarations
Declarations of scalar CL variables are statements of one of the forms:
25

3 CL Language

int var1[=value],var2[=value],...;
float var1[=value],var2[=value],...;
string var1[=value],var2[=value],...;

depending on the desired data type.


As seen before, the name of a variable may be followed by an equal sign and
then a value to which the variable is initialized. If an initial value is not
specified, the variable is initialized to 0 or respectively the empty string.
Examples:
float average; // initially 0
int threshold = 2500;
string ProgramName = "DaVis 5";
string dataPath = "C:/IMX/";
1-dimensional Arrays
CL allows to declare one-dimensional arrays of the three basic variable types
(int, float and string). The size of the array must be at least 2.
Follow the name of the variable square brackets, which enclose the number of
array elements. The following statement declares a 1-dimensional floating
point array (i.e., a vector) with 20 elements:
float xvec[20];
If two-dimensional arrays are needed, use the buffer variables.
Initial values may also be assigned to arrays by following the declaration with
an equal sign and a list of values enclosed in curly braces:
int xvec[5] = {2,5,7,1,0};
When used in expressions the subscript values are 0 based. That is, the first
element of the array is referenced using a subscript value of 0 and the
last element is referenced using a subscript value equal to one less than the
number of elements in the array.
Example:
The following statements would declare an array with 100 elements and initialize it:
float xsq[100], i;
for(i=0; i<100; i++) xsq[i]=i*i;

3.2.3

Buffer Variables

Buffer variables are references to the global data which is stored in image buffers.
There are the following six types of buffer variables:
26

3.2 Data Structures

Whole Image Buffer: B[n] The image buffer number n (0...99). The expression B[n] can be abbreviated to Bn, if n is a constant value between 0 and
99. ( E.g. B5 is the same as B[5]).
Buffer Row: R[n,i] The ith row of buffer n .
Buffer Column: C[n,j] The jth column of buffer n.
Pixel in a Buffer: Pix[n,x,y] The pixel at column x, row y in buffer n.
For RGB buffers use Set/GetColorPixel.
Profile Line: P[i] The profile i. It is the same as R[0,i], since buffer 0 is
the profile buffer.
Profile Point: F[i,j] The jth point in profile i :
It is the same as PIX[0,j,i].
Note:
For convenience, the upper case letters can be written:
either: B, R, C, Pix, P, F
or: b, r, c, pix, p, f
How to use?
Using buffer variables you can read and write buffer data. Before addressing
buffer data, the buffer has to be created. This is done, e.g., with subroutine
SetBufferSize or by copying another already existing buffer.
Some examples will demonstrate the use of buffer variables:
B2 = B1; copy the contents of buffer 1 to buffer 2
b4=4000; set all pixels in b4 to the value 4000
R[1,7]=R[1,1]; copy row 1 of buffer 1 to row 7
B[2]=C[3,0]; set all columns in B2 to C0 of B3
PIX[2,3,4]=99; set a pixel in buffer 2 to value 99
int v=pix[3,2,2]; read a pixel value of buffer 3 into the variable v
Line
There is one more data type not mentioned before which is used only in
subroutine or macro declarations: line.
A formal parameter of type line in a subroutine or macro declaration means
that the actual parameters on a call to the subroutine can be of one of the
following compatible types:
buffer row (R[n,i]) or column (C[n,i])
profile (P[n])
(declared) one-dimensional array.
27

3 CL Language

The called macro can access the elements of the line variable by subscribing it
like a float array. The length of the passed line is determined with the special
CL function sizeof().
Example:
See the following example which calculates the sum of the elements in a line:
float SumOfALine (line theLine)
{
int i;
float sum;
for (i=0; i<sizeof(theLine); i++)
sum += theLine[i];
return sum;
}

3.3

CL Operators

In CL expressions almost everything can be combined with everything.


When the data types of two operands in an expression are not the same, the
type of the second operand is transformed to the type of the first and the
result will be of the first type. See the section on data structures for more
information on the DaVis data types.
Especially when using * or / it might be advantageous to obtain the result in
the data type FLOAT in order not to loose any significant digits of the data.
For example, when dividing two WORD buffers of about the same intensity,
the result of each pixel is usually 0 or 1 if stored as a WORD buffer. Another
advantage of FLOAT buffers is, that they may contain negative numbers (useful for subtractions).

3.3.1

Arithmetic operators

The following arithmetic operators may be used in expressions:

28

operator

function

++

add 1 to a variable

subtract 1 from a variable

addition

subtraction or unary minus

multiplication

division

modulo (e.g., 7%3=1 )

3.3 CL Operators

The ++ and -- operators may be used either immediately before or after a


variable name. If they are used before the name, the increment or decrement
is performed before the value of the variable is used in the expression. If they
are used after the name, the value of the variable before being modified is used
in the expression and then the increment or decrement takes place.
Example:
This sequence assigns the value 4 to x and 3 to y:
a
d
x
y

=
=
=
=

3;
3;
++a;
d++;

At the end of the sequence, both a and b have the value 4.

3.3.2

Assignment Operators

The following assignment operators can be used in expressions (var=variable,


expr=expression):
var

= expr; assign expression to variable

var += expr; add expression to variable


var -= expr; subtract expression from variable
var *= expr; multiply variable by expression
var /= expr; divide variable by expression
var %= expr; calculate the rest of the division

3.3.3

Comparison Operators

The following operators compare two values and produce a value of 1 if the
comparison is true, or 0 if the comparison is false:
operator function
==

equal

!=

not equal

<=

less than or equal

>=

greater than or equal

<

less than

>

greater than

3.3.4

Logical Operators

The following logical operators may be used:


Example:
!1 && 0 = 0 (FALSE)
29

3 CL Language

operator

function

logical NOT (negates TRUE or FALSE)

&&

AND

||

OR

3.3.5

Bit Operators

The following operators work on bits:


operator

function

logical NOT (negates TRUE or FALSE)

&

AND

OR

Example:
0x100 | 0x001 = 0x101
0x111 & 0x010 = 0x010

3.3.6

String Operators

Strings may be added or compared to each other or assigned to a numerical


value:
"aaa" + "bbb" = "aaabbb"
"hallo" == "HALLO"; // = FALSE
float f; f="1.23"; //assigns 1.23 to f
Special case: It is possible to assign a string containing many numbers to a
1-dimensional integer or float array:
int data[3] = {3 4 5};
//data[0] = 3
//data[1] = 4
//data[2] = 5
or:
int data[3];
data = "3 4 5";
Conversely, a numerical value can be converted to a string:
string s; s = "value" + 2.3;
// assigns "value2.3" to s

3.3.7

Other Operators

Operations can be performed with two more operands.


30

3.4 Macro Programs

The conditional operator has the form:


(operand1 ?

operand2 :

operand3)

The value of operand1 is evaluated. If it is TRUE (not zero) then the value
of operand2 is the result of the expression. If the value of operand1 is FALSE
(zero) then operand3 is the result of the expression.
There is another special operator [...] which encloses subscripts on arrays
and buffer variables.

3.3.8

Operator Precedence

The operator precedence, in decreasing order, is as follows:


1. subscript (square brackets)
2. unary minus
3. logical NOT
4. ++ and
5. multiplication, division and modulo
6. addition and subtraction
7. relational (comparison)
8. logical AND
9. logical OR
10. conditional
11. assignment
Parentheses (...) may be used to group terms.

3.4

Macro Programs

Macro files contain an arbitrary number of macros. They are created or


changed using a text editor such as Windows NOTEPAD or MS-DOS EDIT
, or any other ASCII editor or word processor.
31

3 CL Language

3.4.1

Macro Definition

Every CL program code must be inside a macro definition. The code is then
executed by calling the macro and optionally passing parameters to it.
Macro definitions have the following form (the used symbols are explained
below):
return type macroname ([type1[&] par1, type2[&] par2, ...])
{ statements }
The above symbols have the following meanings (terms in square brackets are
optional) :
return type
Data type of the value that is returned by the macro.
If the macro doesnt return a value, the return type must be specified as void.
macro name: The naming rules for macros are the same as for declared
variables.
type: Data type of a formal parameter.
If the type specification is followed by &, the parameter is passed by reference, otherwise it is passed by value. The difference is explained on the
right.
par: A formal parameter. This is a variable which has the specified type and
the value passed when the macro is called.

3.4.2

Macro Call

A call to a macro has the form


macroname ([par1, par2, ...]);
where par1, par2, ... are the actual parameters which are passed to the macro.
Passing a Parameter
There are two mechanisms of passing a parameter to a macro, depending on
the type of the formal parameter:
Pass-by-value: the value of the actual parameter is passed to the macro,
e.g.: macro1(7);
The called macro can use this value but assignments to the parameter inside
the macro cant affect variables outside it.
Pass-by-reference (indicated by & ): a reference to a variable is passed to
a macro, e.g.: macro2(var);
The called macro can read the value of the variable and assign new values to
it. The new value can then be used in the code calling the macro.
32

3.4 Macro Programs

Example:
How to define and call two CL macros.
1. Declaration of two macros:
int macro1(int par) // pass-by-value
{ par*=10; return par;
}
void macro2(int& par) // pass-by-reference
{ par*=10;
}
int var=5, result; // variables used below
2. Calling the macros:
result = macro1(7); // result := 70
result = macro1(var); // result := 50;
// var is unchanged
macro2 (7); // impossible: a variable must be passed rather than a
constant
macro2(var); // var := 50
Macros without parameters
Macros without parameters are defined and called with empty brackets,
e.g. macroname();

33

3 CL Language

34

4 Subroutines
4.1

About Subroutines

Subroutines are system-defined functions for a variety of purposes (such as


data I/O, data acquisition and data processing). In contrast to macros, subroutines are only declared but not defined. The executable code is embedded
in the main file DAVIS.EXE and is therefore not visible for the user.
The subroutines are internally devided into different function groups. This
groups can be found in this section by the name of the section titles. The
groups about buffers and dialogs are described in seperate chapters starting
on page 59 and on page 159.

4.2

Keyboard & Screen I/O

Message
int Message (string message, int mode);
Display a short text in a message box (default mode is 0). The box is opened
in a centered position.
Mode

display message

with OK-button.

-1

with yes/no-button. Return 0 if yes is pressed, 1 if no is pressed.

-2

with OK/abort-button. Return 0 if OK and 1 if abort is pressed.

-3

with yes/no/abort-button. Return 0/1/2 for yes/no/abort.

>0

for mode milliseconds.

Question
int Question (string question);
Display a question in a centered message box and get the answer (yes/no)
from the user. The users input is returned as Yes = 1 or No = 0.
The user has the possibility to stop the execution of the macro by clicking the
STOP button or by pressing the key ESCAPE. The execution of a macro is
not stopped, when No has been entered.
35

4 Subroutines

StatusText
void StatusText (string theText);
Display a message in the status bar on bottom of the task window.
To clear the status line specify an empty string .

StatusProgress
void StatusProgress( int thePercentage );
This macro sets the blue progress bar right of the status text. The value of the
progress should be a percentage value between 0 and 100. Use -1 to disable
the progress display. Add 1000 to paint a blue bar, 2000 for a green bar, 3000
for a yellow bar or 4000 for a red bar.

InfoText
void InfoText (string theText);
Append a line of text to the info window.

ClearInfoText
void ClearInfoText();
Clear the contents of the info window and sets the tabulator width, which is
stored in variable InfoTextTabSize.

GetInfoText
string GetInfoText( int fromLine, int toLine );
Return the given lines from the info window. Negative values are defining the
last lines of the text.
Examples: GetInfoText(0,-1) returns the complete info text,
GetInfoText(-10,-1) returns the last ten lines.
Macro SaveInfoText(string filename) stores the complete info window
text in a file.

Error
void Error (string message);
Open DaVis error dialog box (see page 15) and show message. If message
is empty, the macro is aborted without opening the error dialog.
36

4.2 Keyboard & Screen I/O

UpdateScreen
void UpdateScreen();
Redraw all changed windows (useful in a macro). Clears all overlay drawing
done by subroutines BufferDrawLine and BufferDrawText.
EnterString / Float / Int
int EnterString( string prompt, string& input );
int EnterFloat ( string prompt, float& input );
int EnterInt ( string prompt, int& input );
Display the string prompt in a message box and let the user enter a character
string (or a real (floating point) value or a 32-bit signed integer value).
As always, the user has the possibility to stop the execution of the macro by
clicking the STOP button or by pressing the key ESCAPE. The return value
will be 0 if canceled or 1 if the OK button has been pressed.
CheckKey
int CheckKey();
Get the ASCII code of the keyboard memory (0 if no key has been pressed)
and return immediately.
This function is, for example, used to realize the keyboard control while continuously grabbing images. See file SYS MACS.CLfor more information.
The following table shows some special return codes. Standard character keys
can be checked like:
if (CheckKey()==A) InfoText("pressed key A");
code

key

301

cursor down

302

cursor up

303

cursor right

304

cursor left

305

page up

306

page down

307

home / pos1

308

end

312

insert

127

delete

37

4 Subroutines

Wait
int Wait (int ms);
Wait the specified number of milliseconds. The execution is not interruptable.
If ms is a positive value, the waiting time is very exact in a range of microseconds, but the waiting is active and the CPU usage is high. On negative values
ms the waiting is passive with low CPU usage, but the error is in a range of
milliseconds.
GetTimeMicroSec
int GetTimeMicroSec (int mode);
Makes a micro second timer available. Returns -1 if no timer can be used.
Returns the microsecond time if mode 6= 3. Note: The maximum time which
can be returned is about 35 minutes!
mode

function

returns micro second time (restarts at value 0 all 35 minutes!)

>0

set time mark in mode microseconds from now

-1

wait for time mark set by mode> 0

-2

set difference timer to 0

-3

get time difference in microseconds between the subroutine


calls with mode=-2 and mode=-3

< 3

wait abs(mode) microseconds

Beep
void Beep();
Generate a short beep sound.

4.3
4.3.1

File Handling
Loading and storing a file

Load / StoreBuffer
void LoadBuffer( string filename, int buf );
Load an image from a file on disk into a buffer.
void StoreBuffer( string filename, int buf );
38

4.3 File Handling

Store the contents of a buffer to an image file on disk. For possible file types
see the DaVis Software Manual. If no extension is given in the filename, DaVis
uses the IMX format.
If the buffer number is negative, the buffer is stored in background. Of cause
the macro should not change the buffer contents during the storage until the
buffer is internally unlocked.
Use StoreBuffer("",-1) to start all storage threads before the first file is
stored. This increases the initialization time for the first executed background
storage.
int LoadBufferErr( string filename, int buf );
int StoreBufferErr( string filename, int buf );
Like LoadBuffer and StoreBuffer, but instead of stopping if an error occures
both subroutines will return an error code:
code

Message

no error

-1

buffer locked

-2

out of memory

-3

File not found

-4

error while reading file

-9

Other

StoreBufferFrame
void StoreBufferFrame( string filename, int buf, int frame );
Like StoreBuffer, but saves a single frame of a multi frame buffer. The frames
are numbered from 0 to n-1 for a n-frame buffer. If the buffer contains frame
depending attributes, please note that this attribute names are not corrected
to frame 0 of the resulting single frame file. All attributes are stored as in the
StoreBuffer subroutine. If the correct attributes should be stored, please use
subroutine CopyBufferAttributes to reindex the attribute names.
Load / StoreProfile
void LoadProfile ( int profnum, string filename);
Load a profile from a disk file of the type PRF into the profile number in the
standard profile buffer (buffer 0).
void StoreProfile( int profnum, string filename);
Store a profile from the standard profile buffer to disk as a file of the type
PRF.
39

4 Subroutines

void LoadProfileToBuffer( string theFileName, int theBuffer );


This macro loads a profile file (PRF) into a buffer, set all buffer scales.
LoadAsciiFile / AsciiFile
The ASCII file format is described on page 204.
void LoadAsciiFile ( string filename, int buffer);
Load the intensity values from a text (ASCII) file into a buffer. The header
information (first line of the ASCII file) defines the width and height of the
buffer. As a default, the new buffer will be of type WORD. In order to create
a FLOAT buffer, enter a negative buffer number (e.g. bufnum=-1 for FLOAT
ascii of buffer 1).
void AsciiFile (string filename, int bufnum, int pointsPerLine);
Store a buffers intensity values in a file in readable (ASCII) form. The values
are taken from the buffer row per row. It is started to take the first value of
the first row until the end of the first row and then continued at the beginning
of the second row to the end, then the next row and so on.
The way of data storage in the ASCII file is determined by the parameter
pointsPerLine. It sets how many pixel values are written into one line of the
ASCII file. The storage begins at the beginning of the second line of the file.
When the end of the line is reached, the storage continuous in the next line
and so on.
FileToRow
line FileToRow (string filename, float start, float end, int npoints);
Read file into a row.

4.3.2

File and directory handling

Delete / Rename
void Delete (string filename);
Delete a file from disk. The subroutine does not accept a filename in a subdirectory. You have to ChDir into the subdirectory first and then Delete the
file.
void Rename( string oldname, string newname);
Rename a file. Both names may include a path.
40

4.3 File Handling

CopyFile
int CopyFile ( string source, string dest);
Copy a file and return 0 if no error occured. Otherwise the return value is
the error code: source file not found (1), cant open destination file (2), error
during copy process (3, e.g. harddisc full).
XCopyFile
int XCopyFile (string source, string destpath, int mode);
Copy file(s) and return 0 if no error occured (wildcards are allowed). Set bit
0 of the mode flag to copy subdirectories.
For example, copy complete directory structure: XCopyFile("d:\\data\\*.*",
"e:\\backup", 0x01)
FileExists
int FileExists (string filename);
Check if a disk file with a given name exists. Return TRUE(1) if the file exists,
otherwise FALSE(0). Specify file including complete path.
GetDirectory
string GetDirectory (string thePath, int mode);
Get the list of files (mode=0) or subdirectories (mode=1) in a given directory.
The specified path may contain wildcards, e.g. C:\nIMAGES\nFLAME*.IMX
GetFileDate / Size
string GetFileDate (string filename);
int GetFileSize (string filename);
Get date and time of the last change or size (in byte) of a file. If the file does
not exist, the return values are the empty string or -1.
GetDirName / ChDir / MkDir / RmDir / RmDirTree
string GetDirName ();
Get name of current directory path.
void ChDir (string toDirectory);
Change the current directory path.
It is the default path to which any other function (e.g. GetDirectory, Rename,
...) refers, if no other path is explicitly specified.
void MkDir (string newDirectory);
41

4 Subroutines

Create new subdirectory in the current directory path.


void RmDir (string delDirectory);
Delete empty subdirectory in the current directory path.
void RmDirTree (string delDirectory);
Delete all files in subdirectory and delete subdirectory in the current directory
path.

4.3.3

Macros for file name access

MakeNiceFileName
string MakeNiceFileName( string filename )
This macro replaces all forbidden characters in a filename. Dont include a
path into the filename!

Extract path, filename and extension


string FileGetPath( string pathAndFileName )
Return the path name only and throw away the filename.
string FileGetName( string pathAndFileName )
Return the filename only and throw away the path.
string FileGetExtension( string pathAndFileName )
Return the extension only.
string FileStripExt( string pathAndFileName )
Return the path and filename without extension.
string FileStripPath( string pathAndFileName, string path )
If the path of pathAndFileName is equal to path, then strip the path and
return the filename only.

4.3.4

Dialogs for file selection

FileSelectBoxOpen/Save
string FileSelectBoxOpen ( string boxtitle, string filetypes, int
allowmultiple);
Open a fileselectbox with title boxtitle to open a file(s) of a type of list
filetypes, which is a special string like
Text (TXT, DOC)\nn*.txt;*.doc\nnBitmap (BMP)\nn*.bmp
The string is a list of pairs of a type description and ist type extension. All
elements are devided by a carriage return (\nn).
42

4.4 Text File IO

If allowmultiple=0 only one file can be selected. The function returns the
selected filenames or an empty string. If more than one file is selected, the
returned string has the form "path\nnname1\nnname2\nn...\nnnameN".
Only existing files can be selected.
string FileSelectBoxSave ( string boxtitle, string filetypes, string
filename);
Open a fileselectbox with title boxtitle to save a file with a type of list filetypes.
The function returns the selected/entered filename or an empty string. Is is
possible to enter the name of an unexisting (=new) file.
The subroutines FileSelectionBox and DirSelectionBox have been retired
(see page 156 ).
Note:
All selection box dialogs use string variable DefaultPathFileSelectBox as
default file path (the path which opens first in the fileselectbox). If the user
changes the path in the dialog box, the new path is stored in DefaultPathFileSelectBox.
Standard file selection boxes in menu File Load or Save are using their
own path, which will not be changed by the above defined file selection boxes.
If you want to use a special path in your own macro functions, you have to
declare a string variable to store your special path and use the above defined
subroutines as follows. Otherwise every call to one of the above functions
could change the default path and destroy a combination of load ... action...
store or load ... action ... load from same path.
string yourownpath;
void yourfunctionsave ()
{
string filename;
DefaultPathFileSelectBox = yourownpath;
filename = FileSelectionBox("type","title");
yourownpath = DefaultPathFileSelectBox;
// some code to save filename
}

4.4

Text File IO

Open
int Open (string file, string mode);
Open a text file on disk for reading or writing.
mode can be a character of: r read, w write, a append.
43

4 Subroutines

Open returns a file handle which is used in the functions: ReadLine, ReadInt,
ReadFloat, Write. If the handle is zero, an I/O error has occurred.
Close
void Close (int theHandle);
Close a text file.
ReadLine
void ReadLine (int theHandle, string& theLine);
Read a line from a text file into a string variable. Up to 10 000 characters can
be read at once. Longer rows will be splitted.
ReadInt / ReadFloat
void ReadInt (int theHandle, int& theNumber);
Read an integral number from a text file into an integer variable.
void ReadFloat (int theHandle, float& theNumber);
Read a floating point number from a text file into a float variable.
ReadFile
void ReadFile (int theHandle, string& theText);
Read a whole file into a string variable.
EndOfFile
int EndOfFile (int theHandle);
Determine if the end-of-file is reached when reading (Yes=1, No=0).
Write
void Write (int theHandle, string theText);
Write a character string to a text file.
GrepFiles
string GrepFiles (string path, string search, int flags);
Search for a string in file(s). flags: 1=ignore case, 2=words only, 3=both
Return a list of all files including the search string.
44

4.5 Strings

4.5

Strings

The characters in a string are indexed from 0 to (stringlength-1).


ToUpper / ToLower
string ToUpper (string str);
Convert all characters in a string to upper case.
string ToLower (string str);
Convert all characters in a string to lower case.
StrLen
int StrLen (string str);
Get the length of a string.
CountChar
int CountChar( string str, int ch );
Count the occurences of a character in a string.
Example: CountChar("1221221", 1) = 3
Strip
string Strip (string str, int mode, int char);
Strip leading (mode=1) or trailing (mode=2) characters (typically blanks) or
both (mode=3) off a string.
ExStr
string ExStr(string str, int from, int to);
Extract a substring from a string.
Example:
string s = "LaVision";
string s1 = ExStr(s,2,4)
The string variable s1 includes the string Vis.
PosInStr
int PosInStr(string str, string search, int fromPos);
Search a string in another string; returns the position (0...strlen-1) or -1 if not
found. If fromPos0 the string is searched from right to left.
45

4 Subroutines

ReplaceChar
string ReplaceChar (string str, int ch, int newchar);
Replaces all occurences of a character by another and returns the new string.

Hex / Bin / Decimal / DecimalBin / IsHex / IsBin


string Hex (int decimal, int length);
string Bin (int decimal, int length);
Convert a (non-negativ) decimal number to a hexadecimal or binary string. If
the string is shorter then length, some 0-characters are added in front of the
string.
Examples:
string sh = Hex(12345,4); //-> "3039"
string sb = Bin(19,6); //-> "010011"
int Decimal (string hex);
int DecimalBin (string bin);
Convert a hexadecimal or binary string into a decimal (integer) number.
int IsHex (string hex);
int IsBin (string bin);
Return 1, if the string has a hexadecimal or binary format, or 0 for a wrong
format.

FormatNumber
string FormatNumber (string format, float number);
Convert a number to a formatted string for output. The format string is like
in the C function printf.
Examples:
FormatNumber("e", exp(1))
2.718282e+00 exponential form
FormatNumber("10g", exp(1))
2.71828 10 characters, leading blanks
FormatNumber("10.5g", exp(1))
2.7183 10 characters, 5 significant digits
FormatNumber("10.2f", exp(1))
2.72 10 characters, 2 digits after .
FormatNumber("010.2f",exp(1))
0000002.72 like above, with leading zeroes
46

4.5 Strings

Get / SetChar
int GetChar (string str, int pos);
Get the character at a specified position in a string.
void SetChar (string& str, int pos, int newchar);
Set (replace) the character at a specified position within a string.
Example:
string str = "LaVision"
int t = GetChar(str,2);
The integer variable t includes the ASCII code 86 for the letter V.
GetTokenN
string GetTokenN(string str, string delim, int n);
Get the n-th token from str (n = 1-...). The substrings are devided by the
delimiter delim. If the n-th token does not exist, an empty string is returned.
Example:
str = "Token 1\nnToken 2\nnToken 3\nnToken 4";
GetTokenN(str,"\nn",2) "Token 2"
FindToken
int FindToken( string theString, string theToken, string delim )
The reverse function to GetTokenN returns the token number (1..n) of theToken
in string theString with delim as delimiter. If the token could not be found,
value -1 is returned.
Example:
str = "Token 1\nnToken 2\nnToken 3\nnToken 4";
FindToken (str,Token 2,"\nn") 2
FilesInString
int FilesInString( string filelist, string filenamebase, int& nMin,
int& nMax );
Analyse string to count number of files, returns number of files in string:
nMin = minimum file index number found
nMax = maximum file index number found
filelist is a string as e.g. returned by GetDirectory (see page 41), where
the files are seperated by \nn.
filenamebase is the base of the file name before the running digits.
Valid files have the format
47

4 Subroutines

<base>n(=description).ext
where =description is optionally and n is a valid number optionally preceeded by zeros (1, 0013, ...)
Example: base = "B" as for standard DaVis sets, valid files are e.g.
B1.imx B0004.imx B12=buffer name.imx etc...
string setname = "sets/myset.set";
string extension = "IMX";
string FilesInSet =
GetDirectory( setname + "/B*." + extension, 0 );
if ( FilesInSet == "" ) return;
// no files in subdirectory
int nfiles, nMin, nMax;
nfiles = FilesInString( FilesInSet, "B", nMin, nMax );
InfoText( "number of files in set: " + nfiles + "
running from " + nMin + " to " + nMax );

SortString / SortStringByIndex

string SortString (string theInputString, int theDelimiter, line& oldIndexList);


Sort the string list, return the sorted list and the index table of the old list.
string SortStringByIndex (string theInputString, int theDelimiter,
line theIndexList);
Sort the string list by the index list, return the sorted list.
Example:
string sort = GetDirectory("c:/davis/*.*",0);
int oldlist[1000];
InfoText(sort);
InfoText("");
InfoText(SortString(sort,\nn,oldlist));

Time
string Time (int format);
Get the recent time in a desired format. The formats character has to be
enclosed in single quote marks.
Example: string day = Time(A);
48

4.5 Strings

format

result

(default) date, year and time

abbreviated week-day

complete week-day

abbreviated month

complete month

date, time and year

century (19 or 20)

two digits for the months day (01 - 31)

date in the format MM/DD/YY

date in the format DD.MM.YYYY

date in the format DD.MM.YY

two digits for the hour (00 - 23)

two digits for the hour (01 - 12)

two digits for the month (01 - 12)

two digits for the minute (00 - 59)

AM or PM

two digits for the second (00 - 59)

week-day, starting with Sunday: 0 (0 - 6)

date (e.g. Thu Sep 03, 1998)

time (HH:MM:SS)

four digits for the year (e.g. 1998)

two digits for the year (00 - 99)

49

4 Subroutines

4.6

Scalar Arithmetic

float sin (float arg); the sine function.


float cos (float arg); the cosine function.
float tan (float arg); the tangent function.
float atan(float arg); the arcus tangent function.
All trigonometric functions take the argument as a value in radiant (RAD).
float atan2(float y, float x);
The arcus tangent function calculates atan(x/y), but takes quadrants into
account (no division by 0).
Example:
float arg = 1, result;
result = sin(arg); // the result is 0.841
float abs(float arg); absolute value of arg
float exp (float arg); exponential function
float log(float arg); natural logarithm functn
float sqrt (float arg); the square root.
float power(float arg, float exponent);
Raise a number arg to a power exponent.
float random();
Random number between 0.0 and 0.99999.
void randomize();
Initialize the random number generator.
int min (int i1, int i2);
int max (int i1, int i2);
Get the minimum (maximum) of two integer numbers.
float fmin (float i1, float i2);
float fmax (float i1, float i2);
Get the minimum (maximum) of two float numbers.
int floor(float x);
Returns the highest integer number, that is smaller or equal to x: Returns
n modulowithn modulo <= x < (n + 1) modulo with n as integer.
int ceil(float x);
Returns the smallest integer number, that is higher or equal to x

4.6.1

Mathematical Macros

The following macros are defines in file SYS MATH.CL.


float acos( float x );
float acosd( float x ); arcus cosinus in degrees
50

4.7 Miscellaneous Functions

float asin( float x );


float asind( float x ); arcus sinus in degrees
int sgn( float x ); signum function: -1 for negative x, +1 for positive x
float fmod1( float x ); Returns x mod 1.0
int range(int theMin, int theValue, int theMax); Returns theValue between theMin and theMax.
int frange(float theMin, float theValue, float theMax); Returns theValue between theMin and theMax.

4.7

Miscellaneous Functions

4.7.1

Handling Macros and Macro Files

CL command
void CL command (string theCmdLine);
Interpret string as command language code and execute.
LoadMacroFile
int LoadMacroFile (string theFileName);
Install a CL macro file which contains user written macros. After the macro
file has been installed, the value 0 is returned and the macros of that file can
be called. Some returned error codes are:
error code

message

macro file loaded without errors

syntax error

unable to open file, e.g. file not found

It is only necessary to install a macro file once per session, even if it is


edited, changed and saved. The user will get a message when he wants to
execute any previously changed macro. It then can be updated and executed.
If there is a function with a special name it will be called immediately. The
name is theFileName in uppercase letters. All characters of theFileName
which are not in 0..9 or A..Z will be changed to the underscore .
The function gets no parameters and returns no value:
void THEFILENAME ()
Example:
theFileName = Camera 01-a.cl
theFunctionName = CAMERA 01 A
51

4 Subroutines

Note: The following macros should be used to load system macros in the
DaVis directory or subdirectory CL. The first macro appends the string .CL
to the filename and shows a message in the status line, the second macro only
loads the macro file, if it has not been loaded successfull before.
void LoadCLFile (string theFileName);
void CheckLoadCLFile (string theFileName);

UnloadMacroFile
int UnloadMacroFile (string theFileName);
Remove macro file from memory. All variables and macros, which are included
in this file, will be removed! Returns 0 if no error occured.

StoreMacroFile
int StoreMacroFile(string theFileName);
Save the static variables of a loaded CL macro file. If theFileName is the
empty string, all macro files will be saved.

Load / StoreSet
void StoreSet( string filename, string grouplist );
Store parameter set (without buffer storage). The grouplist is a list of all
group names which should be included. The single names must be devided by
a \nn. The default value can be found as variable CustomerGroups in file
SYS STARTUP.CL:
CustomerGroups = Software Modules\nn
Hardware (ports, addresses, etc.)
string LoadSet( string filename );
Load parameter set (without buffer loading). This macro returns a list of all
loaded groups and internally calls LoadSetGroup.
void LoadSetGroup( string theFilename, string theGroupList );
Load only the given group(s) of the set. The group list must be devided by
\nn. If theGroupList="", all groups will be loaded from the file. A list of
all loaded groups is returned.
void LoadSetInfo( string filename );
Load only set info (without parameters or buffers). This macro calls LoadSetGroup.
52

4.7 Miscellaneous Functions

ReadSetVariable
line ReadSetVariable( string filename, string theVariableToRead );
Read a variable from the setfile and return the value. The global variable
theVariableToRead is not touched by this function!
If theVariableToRead is the empty string, a string list of all groups in the
set file is returned.
Examples:
InfoText(LoadSetVariable("sets\\test.set","SetTime"));
float camicpar[1000];
camicpar = LoadSetVariable("calibration.set", "CamIcPar");
InfoText(""+camicpar[0]+" "+camicpar[1]+" "+camicpar[2]);
TestSetVariable
int TestSetVariable( string filename, string theVariableToTest );
Test if the variable exists in the setfile and return 0, if the variable is not stored
in the set, or return the type: int (2), float (3), string (4), array (10+x). The
type depends on the existing variable in DaVis and not on the stored value in
the set file!
IsValidSymbol
int IsValidSymbol (string theSymbolName);
Returns the type of a symbol: 0=not existing, 1=macro function, 2=subroutine, -1=variable.
If theSymbolName = " [groupname]", the return value is TRUE if the group
includes static variables.
GetVariableType
int GetVariableType (string theVariableName,
int& theDimension);
Returns the type and dimension (size of an array) of a variable: 0=not existing,
1=int, 2=float, 3=string

4.7.2

Using Windows Programs

GetEnvironmentVariable
string GetEnvironmentVariable (string varname);
53

4 Subroutines

Get the value of an environment variable.


E.g. this is used by DaVis on WindowsNT systems to get information about
the number of processors:
GetEnvironmentVariable(NUMBER OF PROCESSORS)
ExecuteProgram
ExecuteProgram ( string theFileName, int WaitForEnd);
Let the operating system (Windows) execute a file with extension EXE or PIF
or BAT. A new process is started, that runs independently from DaVis .
WaitForEnd
0

DaVis and the new process in the operating system


keep on running parallel.

DaVis waits until the independent process in the operating system is completed. Afterwards, new DaVis
actions can be made.

If theFileName has the extension .htm or .html the preferred browser


is called which shows theFileName. Note: theFileName has to be a relative path to the DaVis -path, e.g. help\\user.htm will load the file
C:\nDaVis\nhelp\nuser.htm. The second parameter has no effect for
browser-calls (WaitForEnd=0).
In DaVis 6 the default editor is opened for a file name with extension .cl.
It is possible to execute a command line instruction by a call like the following,
which creates a list of all PCs in a network domain:
ExecuteProgram("cmd.exe /c net view > "
+ProgramPath+"NetComputer.txt",1);
This command opens a PDF file in the standard viewer:
ExecuteProgram ("cmd.exe /c start "+ ProgramPath+
"Macros\Doku\nMultiCalc.pdf",0);

4.7.3

Fast User Functions via DLLs

A user macro with pixel access is running very slow. A loop about all pixels
of a buffer should be programmed in a programming language like C or C++,
compiled for fast execution as a Dynamic Link Library (DLL). DaVis is able
to call functions of DLLs via subroutine CallDll.
An small C-code DemoDll.cpp for a DLL can be found in subdirectory DemoDll
r
of the DaVis directory. Two projects are included for the Borland C++
com54

4.7 Miscellaneous Functions

r
piler and for the Microsoft Visual
C++ compiler. The compilation should
work immediately without problems.
The main part of file DemoDll.cpp handles the connection to the DaVis software, so the programmer can execute a number of important DaVis functions
from the C-code.
File DemoDll.cl shows some examples about calling functions of a DLL.
CallDll
int CallDll ( string dll name, string function name,
line& parameter);
Call an external user-defined function in a Dynamic Link Library (DLL).
Purpose: enable user to write his own DLL-functions for:
implementing fast image processing with C-level speed
writing native drivers, execute native windows functions
do special action not supported by CL-functions
The DLL has to be in a certain format. See file DEMODLL.CPP as an example
of how to write your own library.
UnloadDll
void UnloadDll (string theDllName);
This macro can be used during the debugging stage of the DLL, in order to
compile a modified DLL and reload it into DaVis . Otherwise one would have
to close DaVis and restart it to be able to access the modified library.
If the function name is empty (), subroutine CallDll unloaded the library
from DaVis .
How DaVis works with Dynamic Link Libraries
When the library is loaded the first time, a function
InitDll( void(*)() )
is automatically called. This function has as a parameter a function pointer,
with which it is possible to access many low-level data structures and functions
inside DaVis . This is necessary for manipulating e.g. buffer data. For more
details see file DEMODLL.CPP.
Next the DLL-function function name is executed.
It must be of a format
extern "C" int export <function name>
( int* parameter );
// (Borland C++ notation)
55

4 Subroutines

or
extern "C" int export <function name>
( float* parameter );
The parameters in the integer or float array can be used to transfer data to
the DLL-function or to return values.
Example for DLL-function parameters
Function AddTwoNumbers() in DEMODLL.DLL can be called by the following CLcode (see file DEMODLL.CL). This example gets two float numbers as parameters,
add both numbers and returns the sum in the third item of the float array.
Additionally a text is written into the InfoWindow and a Message box appears
on screen.
float pars[3] = { 1.2, 2.4, 0 };
CallDll("demodll.dll", "AddTwoNumbers", pars );
InfoText("Dll-function returns as a third
parameter: " + pars[2] );
If the DLL-function has an integer array for the parameters instead, you must
set up an CL-integer array correspondingly.
extern "C" int EXPORT AddTwoNumbers( float* thePars )
{
thePars[2] = thePars[0] + thePars[1];
char str[80];
sprintf( str,
"InfoText(\n"parameter: %g + %g = %g\n")",
thePars[0], thePars[1], thePars[2] );
ExecuteCommand( str ); // display in info window
sprintf( str, "parameter: %g + %g = %g",
thePars[0], thePars[1], thePars[2] );
return Message( str, 0 ); // display as message
}
Example for a DLL-function with buffer access
The most important (and most critical) function for the acces to buffer raw
data during a DLL execution is the function GetBufferRowPtr. This function
executes some code in the DaVis.exe and returns a void-pointer to a line
of Word- or float-values, which depends on the buffer type. Use function
IsFloat() to determine the type.
There are two critical sections in this function: At first you have to program
56

4.7 Miscellaneous Functions

the correct type cast. In the example below the buffer type is known as Word,
so the pointer returned by GetBufferRowPtr is casted to a Word pointer. A
cast to a float pointer would cause wrong values during a read access to the
array, and it could cause a crash of DaVis during a write access because of the
different item sizes of 2 byte for one Word item and 4 byte for one float item.
At second a writing or reading access with negative indexes or with indexes
above the line length could crash DaVis.
extern "C" int EXPORT SetBufferToValue( int* pars )
{
int theBufferNumber = pars[0],
theNx = pars[1],
theNy = pars[2];
Word theValue = (Word)pars[3];
// create buffer of type Word with theNX columns
// and theNY rows
if ( SetBufferSize( theBufferNumber, theNx, theNy, 0 ) )
return -1; // error, maybe out of memory
int row, col;
for ( row = 0; row < theNy; row++ )
{
Word* rowPtr =
(Word*)GetBufferRowPtr( theBufferNumber, row );
for ( col = 0; col < theNx; col++ )
rowPtr[col] = theValue;
}
char str[80];
sprintf( str,
"BufferName(%d,\n"value = %d\n")",
theBufferNumber, theValue );
ExecuteCommand( str ); // set buffer name
Show( theBufferNumber );
return 0;
}

57

4 Subroutines

58

5 Image Buffers
5.1

2D Image Buffers

Up to DaVis 5.4 the program supported 2-dimensional buffers only. For the
new buffer types see the next chapters. The 2D buffers can either hold image
data (a 2D pixel field of type Word or float) or a two-dimensional vector field.

Get / SetBufferSize
void GetBufferSize (int bufnum, int& width, int& height, int& isfloat);
void SetBufferSize (int bufnum, int width, int height, int isfloat);
Get (or set) the size (width and height) and the type of a simple 2D buffer. For
WORD buffers the parameter isfloat=0 and for FLOAT buffers isfloat=1.
Warning: If SetBufferSize is executed with width = 0 or with height =
0 the buffer will be destroyed (together with comments, scales, etc.).
Note: Settings the buffer size always changes the image format to type 0!

Get / SetImageFormat
int GetImageFormat (int bufnum);
void SetImageFormat (int bufnum, int format);
Get (or set) the format of the buffer. If the format of an existing buffer is
changed, some data may be lost, e.g. the peak ratio value. See table 5.1 for a
detailed format list.

Show
void Show (int bufnum);
Show the contents of a buffer in an image window. If the buffer has a small
height, it is shown as a profile. This functions does not open a new window if
a window of any type is open.
59

5 Image Buffers

Format

Buffer Type

Standard image format f(x,y)

Extended (PIV) vector format Vx(x,y) and Vy(x,y) = twodimensional 2D-vector field, additional information for four
stored vectores at each position and for the selection of the
used vector choice

Simple vector format Vx(x,y) and Vy(x,y) = twodimensional 2D-vector field.

Same as 1, but additional information for correlation peak


ratio = corr.height(1) / corr.height(2).

Same as 2 with extra Vz component.

Same as 3 with extra Vz component, extended vector format


Vx(x,y), Vy(x,y) and Vz(x,y) = two-dimensional 3D-vector
field.

-2

Packed word buffer, which is in fact a byte buffer in memory


(8 bit instead of 16 bit per pixel). This buffer type is created by some 8-bit-cameras for faster acquisition rates. The
buffer will be enlarged to 16 bit at the first writing access,
so it is impossible to create and fill this buffer type by CL.

-11

32 bit RGB buffer to be used with SetColorPixel,


GetColorPixel, RGBFilter and RGBCombine, see section below.

Tab. 5.1: Buffer types to be used by subroutines Get/SetImageFormat and


SetVolumeBufferSize.

5.2

RGB Color Buffers

Set / GetColorPixel

void GetColorPixel (int bufnum, int mode, int x, int y, float& par1,
float& par2, float& par3);
void SetColorPixel (int bufnum, int mode, int x, int y, float par1,
float par2, float par3);
Get or set color information of a pixel in a color buffer (mode 0=RGB,
1=HLS). Set HLS is not implemented yet. See subroutine ConvertRGBImage
on page 81 for likewise function.
60

5.3 3D Image Buffers

RGBFilter
void RGBFilter (int bin, int bout, float factorRed, float factorGreen,
float factorBlue, int normalizeToOne);
Create a float buffer with
pixel = red*factorRed + green*factorGreen + blue*factorBlue.
This subroutine can be used to filter colors from the RGB buffer, e.g.
RGBFilter(1,2,0,1,1,1) creates a buffer with the yellow color component.
RGBCombine
void RGBCombine (int binRed, int binGreen, int binBlue, int bout);
Create a RGB buffer from three color component buffers.

5.3

3D Image Buffers

Since DaVis 5.5 two new buffer types with an additional z-dimension and
multiple frames are supported. The first type can be used like a 2D buffer.
Most subroutines of DaVis are refering a pixel with two coordinates x and
y. This 2D-buffer subroutines are using a 3D buffer as a large 2D buffer with
NY * NZ * NFrames rows. Pixel function Pix[buf,x,y] is working with 3D
buffers.
The second type is a sparse volume buffer which needs special subroutines.
Most points in the volume are holding no data and so dont need memory.
Only the points with defined values (by SetVolumePointVector or other subroutines) are stored in the buffer. Most 2D-subroutines are unable to use this
sparse buffer type. A sparse volume buffer stores the 3D(float)-coordinates of
every point, while a full plane volume buffer uses integer coordinates.
See the DaVis Software Manual for further descriptions. Please use macro
ResizeBuffer to change the size of an existing buffer.
SetVolumeBufferSize
void SetVolumeBufferSize (int bufnum, int width, int height,
int depth, int frames, int subtype, int isfloat );
Create a volume buffer with full planes (not sparse). See table 5.1 for a list of
all defined subtypes. This subroutine should not be used to resize an existing
buffer, because the data may loose its frame order. Call ResizeBuffer instead
to hold every pixel at its correct position.
61

5 Image Buffers

CreateVolumeBuffer
void CreateVolumeBuffer (int bufnum, int width, int height, int depth,
int frames, int subtype, int isfloat, int scalars );
Create a volume buffer with full planes (not sparse) and additional components. For simple 2D-buffers the first component is the image data itself.
Some information about the components can be stored in buffer attributes,
e.g. ComponentName0 for the first component.
The components of single pixels can be accessed via subroutines SetVolumePointFloat,
GetVolumePointFloat, SetVolumePointWord and GetVolumePointWord. Even
the complete extra component plane can be accessed by CopyBufferScalarComponent
(see page 67). This subroutine copies either a simple 2D-buffer into the component plane or the complete component plane into a simple 2D-buffer of type
word or float.
Example: This macro creates a 2-dimensional buffer with 10 rows of 20 pixel
width. Each pixel includes two scalar components. The first component (index
0) is used as image data, the second component is invisible in the standard
image display. If the buffer type would be a vector buffer, every additional
scalar component could be displayed as background image.
The last lines of this macro copy both scalar component planes into the buffers
2 and 3. As you can see, the display of the first component is equal to the
display of buffer 1 (two scalar components).
void TestVectorComponent()
{
CreateVolumeBuffer( 1, 20, 10, 1, 1, 0, TRUE, 2 );
SetBufferAttribute( 1, "ComponentName0", "test 0" );
SetBufferAttribute( 1, "ComponentName1", "test 1" );
int y,x;
for (y=0; y<10; y++)
for (x=0; x<20; x++) {
SetVolumePointFloat( 1, x, y, 0, 0, 0, x+y );
SetVolumePointFloat( 1, x, y, 0, 0, 1, x*y );
}
Show(1);
CopyBufferScalarComponent(1,0,2,-1); Show(2);
CopyBufferScalarComponent(1,1,3,-1); Show(3);
}

62

5.3 3D Image Buffers

SetSparseBufferSize
void SetSparseBufferSize (int bufnum, int width, int height, int depth,
int frames, int subtype, int isfloat, int nScalars );
Create a sparse volume buffer. Every point includes a number of 3D-vectors
and scalars of the type float or word.
GetVolumeBufferInfo
void GetVolumeBufferInfo (int bufnum, int& width, int& height, int&
depth, int& frames, int& issparse, int& subtype, int& nComponents,
int& nVectors, int& nScalars );
Get the information of a volume buffer, return depth=1 and frames=1 for 2D
buffers. Use IsFloat() to receive information about the data type.
GetVolumeBufferSize
void GetVolumeBufferSize( int buf, int& nx, int& ny, int& nz, int& nf )
Return the size of the four volume buffer dimensions. This function is implemented as a macro which calls GetVolumeBufferInfo.
GetBufferNX/Y/Z
int GetBufferNX(
int GetBufferNY(
int GetBufferNZ(
This macros return

int theBuffer );
int theBuffer );
int theBuffer );
the width, height or depth of a buffer.

CreateImage/VectorBuffer
void CreateImageBuffer( int buf, int nx, int ny, int nf, int isFloat );
void CreateVectorBuffer( int buf, int nx, int ny, int nf, int theVectorType );
This macros are shortcuts for subroutine SetVolumeBufferSize.
63

5 Image Buffers

ResizeBuffer
void ResizeBuffer( int theBuffer, int theNX, int theNY, int theNZ,
int theNF )
The subroutines SetBufferSize and SetVolumeBufferSize are changing the
size of a buffer without looking for frames or Z-position of every pixel. This
macro on the other hand holds every pixels at its 4D-position. This macro is
working for vector buffers, too.

5.3.1

Point Handling

The following subroutines give the user a direct access to the vectors and scalar
values of volume buffers. Note that the frames numbers are starting with 0.
Get / SetVolumePointVector
int GetVolumePointVector (int bufnum, float xpos, float ypos, float
zpos, int fpos, int nVector, float& Vx, float& Vy, float& Vz);
Get the n-th vector of the volume point (xpos,ypos,zpos). Return 0 if point
or vector does not exist.
int SetVolumePointVector (int bufnum, float xpos, float ypos, float
zpos, int fpos, int nVector, float Vx, float Vy, float Vz );
Set the n-th vector of the volume point (xpos,ypos,zpos) in frame number
fpos. Return 1 for success.
Get / SetVolumePointFloat
int GetVolumePointFloat (int bufnum, float xpos, float ypos, float
zpos, int fpos, int scalarN, float& value);
Get n-th float scalar. Return 0 if scalar or point does not exist.
int SetVolumePointFloat (int bufnum, float xpos, float ypos, float
zpos, int fpos, int scalarN, float value);
Set n-th float scalar. Return 1 for success.
Get / SetVolumePointWord
SetVolumePointWord
int GetVolumePointWord (int bufnum, float xpos, float ypos, float
zpos, int pos, int scalarN, int& value);
Get n-th word scalar. Return 0 if scalar or point does not exist.
int SetVolumePointWord (int bufnum, float xpos, float ypos, float
zpos, int fpos, int scalarN, int value);
64

5.4 Buffer Frame Handling

Set n-th word scalar. Return 1 for success.

5.3.2

Volume Point Iterator

The volume point iteration must be used for sparse buffer, which can be created with a very large number of possible coordinates (NX*NY*NZ*NFrames),
but only a little number of voxels (volume points) is really used (up to some
thousands in a volume of millions of voxels). So it would be very time wasting
to check every voxel e.g. when calculating statstics.
Therefore the following subroutines can be called like in this example. Note
that the frames are numbered starting with frame 0.
// count the number of defined voxels in a buffer
int nVoxel = 0;
float posX,posY,posZ;
int next = GetFirstVolumePoint( bufnum, 0, posX,posY,posZ );
while (next) {
nVoxel++;
next = GetNextVolumePoint(posX,posY,posZ);
}
InfoText(+nVoxel+ exist in first frame of buffer +bufnum);

GetFirstVolumePoint
int GetFirstVolumePoint (int bufnum, int frame, float& posX, float&
posY, float& posZ);
Initialize volume point iterator. Return 1 if a point has been found. Return
position of this point.

GetNextVolumePoint
int GetNextVolumePoint (float& posX, float& posY, float& posZ);
Search for next volume point. Return 1 if a point has been found. Return
position for usage of Get/SetVolumePointX

5.4

Buffer Frame Handling

The following macros are implemented in macro file SYS MACS.CLand can be
used easily to handle frames.
65

5 Image Buffers

GetBufferFrames
int GetBufferFrames(int bufnum);
Get the number of frames in an image buffer. This function calls subroutine
GetVolumeBufferInfo.
CopyFrameToBuffer

void CopyFrameToBuffer( int theSourceBuffer, int theSourceFrame, int theDestBuff


Copy frame number theSourceFrame (0,..,n-1) of buffer theSourceBuffer
into buffer theDestBuffer.
CopyBufferToFrame

void CopyBufferToFrame( int theSourceBuffer, int theDestBuffer, int theDestFrame


Copy buffer theSourceBuffer into a frame (theDestFrame= 0,...,n-1) of
theDestBuffer. Buffer theDestBuffer may be resized to hold a larger number of frames. If the frame size of the source buffer is larger than the destination frame size, the upper left rectangle is copied out of the source buffer. For
smaller frames the outer region is filled with 0-values.
AppendFrameToBuffer
void AppendFrameToBuffer( int theSourceBuffer, int theDestBuffer )
Append buffer theSourceBuffer as a new frame to buffer theDestBuffer,
which may be empty before this operation. The destination buffer will be
resized by this function. Note the same restrictions for different frame sizes as
in macro CopyBufferToFrame.
CopyBufferPlane
void CopyBufferPlane( int inputbuf, int inZ, int inF, int outputbuf,
int outZ, int outF );
Copy plane of inputbuf into outputbuf. This subroutine is internally used
by the above described macros. The complete plane data is copied, including
the plane- and frame-depending buffer attributes.
If inZ< 0, the complete frame is copied, otherwise the given plane.
Value outZ defines the first output frame if inZ0.
66

5.5 Buffer Attributes

CopyBufferScalarComponent
void CopyBufferScalarComponent( int inputbuf, int componentIn, int
outputbuf, int componentOut );
Copy a scalar component of inputbuf into outputbuf. This subroutine can
easily be used to work on all pixels scalar components at the same time.
If componentIn< 0, the buffers image data is used. Same for componentOut.
If componentIn>=0, the scalar component is used. Same for componentOut.
If componentOut>=0, the components name is used as the name of buffer
bout. The name itself is stores as buffer attribute ComponentNameX with X as
index.
Example:
// copy the first scalar component of all pixels in buffer 1
// to buffer 2
CopyBufferScalarComponent(1,0,2,-1);
// work on the pixels
B[2] *= 2; // e.g. double the values
// now write the changed values back to first scalar component
// of buffer 1
CopyBufferScalarComponent(2,-1,0,1);

5.5

Buffer Attributes

DaVis supports special attributes for every buffer, which can be saved together
with the raw buffer data in the file formats IMG, IMX and VEC. All DaVis
versions up to 5.4.2 can be used with unnamed (standard) attributes only, e.g.
the buffer name, a comment or scaling information. Newer versions of DaVis
are able to store additional named attributes (strings and arrays of the types
float, int or Word-buffer). These are used for different purpose like the Overlay
definition or Energy information. A complete table of predefined Supported
Buffer Attributes is given on page 205.
All attributes are copied, too, when copying a buffer into another buffer, e.g.
the command B7=B2 copies the raw data, the scaling information and all attributes from buffer 2 into buffer 7.
GetBufferName / BufferName
string GetBufferName (int bufnum);
void BufferName (int bufnum, string NewName);
Get (or set) the name (title) of a buffer.
67

5 Image Buffers

Get / SetVectorGrid
int GetVectorGrid (int bufnum);
void SetVectorGrid (int bufnum, int gridsize);
Get or set the grid size of a vector buffer.

Get / SetComment
string GetComment ( int bufnum);
void SetComment ( int bufnum, string comment);
Get (or set) the comment string (max. 80 characters) of a buffer. Since the
comment is stored in two lines, use \n to specify the separation of the lines.

GetBufferAttributeType
int GetBufferAttributeType ( int bufnum, string attr name);
Return 0 if the attribute with name attr name is not existing, 1 for a string
type attribute and 2 for a float-array, 3 for a integer-array (32 bit) and 4 for
Word arrays (16 bit).

Get / SetBufferAttribute
string GetBufferAttribute( int bufnum, string attr name);
string SetBufferAttribute( int bufnum, string attr name, string value );
Get or set a string type attribute of a buffer.

Get / SetBufferAttributeArray
line GetBufferAttributeArray (int bufnum, string attr name );
void SetBufferAttributeArray (int bufnum, string attr name, line& theArray);
Get or set an array-attribute of a buffer. Example:
int array[5] = {5,4,1,2,3};
SetBufferAttributeArray(1,"testInt",array);
int array[10];
array = GetBufferAttributeArray(Buffer,testInt);
// copy into row 10 of buffer 1, which type can be
// float or Word:
R[1,10] = GetBufferAttributeArray(Buffer,testInt);
68

5.5 Buffer Attributes

DeleteBufferAttribute
void DeleteBufferAttribute (int bufnum, string attr name);
Delete an attribute of the buffer. You can delete all attributes with attr name=.

CopyBufferAttributes
int CopyBufferAttributes( int srcBuf, int srcFrame, int destBuf,
int destFrame );
Append all attributes from srcBuf to destBuf. If srcFrame>=0 only the
frame-depending attributes are copied to destFrame, but the frame indizes
of the attribute names will be changed from srcFrame to destFrame. For
example the attribute FrameName2 includes the name of frame number two.
When this frame is copied to a single frame buffer, this subroutine can be
used to copy this attribute value into attribute FrameName0 of the single frame
buffer.
Use macro TransferAllAttributes to copy the comment and the scaling
information together with the attributes.

GetAcqTime
string GetAcqTime (int bufnum);
Get the acquisition time of a buffer in the follwoing style. The millisecond
value is available since DaVis 5.5.2.
DD.MM.YY HH:MM:SS.mmm

LockBuffer / UnlockBuffer / IsLocked


void LockBuffer (int bufnum);
void UnlockBuffer (int bufnum);
Lock a buffer to prevent it from being altered or unlock a buffer so that it can
be altered.
int IsLocked (int bufnum);
Determine if a buffer is locked (1= yes).

IsEmpty
int IsEmpty (int bufnum);
Return 1 if the buffer is empty i.e. its size is zero.
69

5 Image Buffers

IsFloat
int IsFloat (int bufnum);
Get the type of a buffer: 0 for WORD buffer or 1 for FLOAT buffer
IsVector / Is3DVector
int IsVector (int bufnum);
int Is3DVector (int bufnum);
Return 1 if the buffer is a vector buffer (2 dimensions with 2 or 3 components).

5.5.1

Buffer Attribute Macros

The following macro functions resist in file SYS MATH.CL and can be used
for easier buffer attribute handling:
Get / SetBufferAttributeScale
int GetBufferAttributeScale( int theBuffer, string theScaleName, float&
aa, float& bb, string& unit, string& label);
void SetBufferAttributeScale( int theBuffer, string theScaleName,
float aa, float bb, string unit, string label);
The format of scaling information stores in buffer attributes is a string like aa
\n bb \n unit \n label. This is used to describe values in array attributes.
GetBufferAttributeValue
float GetBufferAttributeValue( int theBuffer, string theAttribute,
int theElement )
Return a single value of a buffer array attribute. For single value attributes
(like string attributes) the value will be returned if theElement is 0.
CopyAttributeArrayToProfileItem
void CopyAttributeArrayToProfileItem( int theDialogId, int theItemId,
int theBufNum, string traceName, int theItemWinHandle, int offset,
int width )
Copy a range of an array attribute into a profile dialog item. The range is defined by offset and width, where width=0 defines the whole array. The values
theBufNum and traceName describe the buffer attribute, while theDialogId,
theItemId and theItemWinHandle (the handle to use a dialog item like a
window e.g. by subroutine GetWinPar) must be given for the dialog and item.
70

5.5 Buffer Attributes

TransferAllAttributes
void TransferAllAttributes( int fromBuffer, int toBuffer )
This macro (in file SYS SCALE.CL) copies all attributes, scaling information
and the comment from one buffer to another.

5.5.2

Frame Buffer Attribute Macros

When a buffer has been aquired via a multi camera readout item and more
than one camera has been used, all the camera frames are combined in a single
buffer with one frame for every camera image (e.g. double exposure cameras
store both images in two frames of the buffer). It is possible to readout different
cameras with different image sizes. In this case, the final buffer has a frame
size of the maximum width and maximum height of every single images. It
is possible to receive the original images from this large buffer later with the
help of the following macros and the fact, that the real original image size
is stored in buffer attribute RealFrameSizeX for every frame.
GetRealFrameSize
void GetRealFrameSize( int theBuffer, int theFrame, int& theRealWidth,
int& theRealHeight )
This macro returns the real size of a frame, which can be smaller than the
buffer size for multi-camera-readouts.
CopyRealFrameToBuffer
void CopyRealFrameToBuffer( int theBuffer, int theFrame, int theDestBuffer )
Copies a frame (single image) with its original camera size into another buffer.
Now the buffer can be used as it had been readout by a single camera and
stored with its original and correct size.
IsProcessedBuffer
int IsProcessedBuffer( int theBuffer, int theFrame, int theFlag )
Returns TRUE if all processing steps defined by theFlag have been executed
on this buffer frame. Some flags are defined as constants in file SYS CONST.CLand
can be or-ed (in fact this are bit-flags): FRAMEPROC BACKGROUNDSUB, FRAMEPROC ROTATION
and FRAMEPROC CORRECTION.
71

5 Image Buffers

5.5.3

Overlays

Overlays are user defined painting structures (lines, polygons, circles, texts),
which are connected to buffers or cameras and automatically painted above the
2D-image display of a buffer. The overlay display can be enabled or disabled
in the Image Display Attributes dialog. The definition of overlays can be
done in the Overlay dialog (see menu Buffer).
Overlays are connected to a buffer as buffer attributes, and of cause they are
stored together with the buffer raw data in file types IMG, IMX and VEC. The
names of this attributes are Overlay for a standard overlay and Overlay0,
Overlay1, Overlay2 and so on for frame overlays. In multi frame buffers the
overlay of a single frame display is the sum of the standard overlay (displayed
in all frames) and the overlay with the same postfix number as the frame
number itself.
The overlay attributes use strings to store the complete overlay definition in
a simple list syntax. This syntax is not described in this manual, because the
easier way to create an overlay in own macro code is the usage of functions in
file SYS OVERLAY.CL (see below).
Camera overlays are stores in string variables CamOverlay[camN] with camN=0,...,5.
The TakeImage command copies this overlay strings into the frame overlay attributes corresponding to the used cameras. On this way an overlay can be
defined for a camera, e.g. painting of background structures in the image, and
then automatically copied into the resulting image buffer during the image
acquisition.
More special overlays handle the automatically display of buffer attributes as
overlays. In this case the value of a buffer attribute is painted into the 2D
image at a defined position with a defined color and size. Again some macros
can be used to define this display, but there is no dialog available yet.
Macros for overlay definition
The OvGAddx macros need as parameters the number of a buffer (bin), the
number of the frame (or -1 for the standard overlay), and an unique name for
the overlay item. The coordinates (one or more x and y parameters) must be
given in pixel coordinates. The pencolor if a RGB value. All other parameters
are depending on the item type.
void OvGAddLine(int bin, int frame, string name, int pencolor, int
x0, int y0, int x1, int y1)
Add a line overlay graphic in frame 0 to a buffer. The coordinates are the
72

5.5 Buffer Attributes

starting point and the ending point.


void OvGAddRect(int bin, int frame, string name, int pencolor, int
x0, int y0, int x1, int y1)
Add a rectangle overlay graphic to a buffer. The coordinates define the upper
left and lower right point of the rectangle.
void OvGAddEllipse(int bin, int frame, string name, int pencolor,
int x0, int y0, int x1, int y1)
Add an ellipse overlay graphic to a buffer. The coordinates define the points
of the surrounding rectangle.
void OvGAddText(int bin, int frame, string name, int pencolor, int
size, int x0, int y0, string textStr)
Add a text overlay graphic to a buffer. The position is the lower left corner of
the text rectangle.
void OvGAddPolygon(int bin, int frame, string name, int pencolor,
line points)
Add a polygon overlay graphic to a buffer. The polygon points are given in
an array of format: [x0,y0,x1,y1,x2,y2,.....].
void OvGDeleteItems(int buf, int frame, string prefix)
Delete all overlay items which name starts with the given prefix.
Macros for attribute display
All this macros work on a buffer number buf and handle the display of the
attribute with name theAttrName.
void OvGShowAttribute( int buf, string theAttrName, int posX, int
posY, int color, int textSize, int absPos )
Display the value of an attribute as overlay at a pixel position (absPos=0)
or absolute windows position (absPos=1). For absPos<0 the attribute is not
displayed. This value can be used to hide the attribute but not delete the
display information. For color<0 the standard vector color palette (see table
6.7) is used instead of a RGB value.
void OvGShowAttributeFormat( int buf, string theAttrName, int posX,
73

5 Image Buffers

int posY, int color, int textSize, int absPos, string theFormatString )
Same as OvGShowAttribute but use a format string. The attributes value is
inserted at placeholder %%.
void OvGRemoveAttribute( int buf, string theAttrName )
Delete the display definition: Not only hide the attributes display but remove
it!
void OvGSetVisibleAttributes( int buf, int visible )
Enable or disable (visible=1 or visible=0) the display of all attributes, but
dont delete the definitions.

5.5.4

Scaling

Scales map x/y/z/I/F using equation: scale = a * x + b


Only buffer scales can be handled with these subroutines. Camera scales are
not affected (the difference is explained in the DaVis Software Manual about
Scales).
void GetXScale ( int bufnum, float& aa, float& bb, string& units,
string& label);
void GetYScale ( same as above );
void GetZScale ( same as above );
void GetIScale ( same as above );
void GetFScale ( same as above );
void SetXScale ( same as above );
void SetYScale ( same as above );
void SetZScale ( same as above );
void SetIScale ( same as above );
void SetFScale ( same as above );
Get (or set) X -, Y-or Z-axis or Intensity or Frame scale of a buffer or camera.
The Z- and Frame-scale is supported for buffers since DaVis 5.5 only.
bufnum must be > 0 for an image buffer, =0 for the profile buffer and -1,..,-6
for camera 1 to 6. The value can be the handle of a profile dialog item (see
page 181).
Use the following macro to copy all scales from a buffer or camera to another
buffer or camera. The values of source scale and dest scale are equal to
bufnum above.
TransferScales ( int source scale, int dest buffer )
74

5.6 Drawing into a buffer

Use macro TransferAllAttributes to copy the comment, attributes and the


scaling information.

5.6

Drawing into a buffer

BufferDrawLine / Circle
void BufferDrawLine (int bufnum, int x1, int y1, int x2, int y2, float
value);
void BufferDrawCircle ( int bufnum, int xcenter, int ycenter, int
xradius, int yradius, float value);
Draw line or circle/ellipse in a buffer. Use intensity value as drawing color
(intensity).
BufferDrawText
void BufferDrawText (int bufnum, int xpos, int ypos, int size, int
color, int attrib, string text);
Draw a text into a buffer at position xpos,ypos. The textsize is given in pixel,
parameter color is used as intensity. The text can be a multiline string with
lines devided by \n;
Add the following values to get the wanted attribute (parameter attrib):
value
bits
attribute
0-3

0..1

text direction 0 , 90 , 180 ,


270

opaque

invers

8..23

background color

24..26

font:
0=times, 1=helvetica,
2=courier, 3=fixed, 4=system

5.7

Buffer Arithmetic

Exp / Log / Sqrt / AbsBuffer


void ExpBuffer(int inputb, int outputb);
void LogBuffer(int inputb, int outputb);
void SqrtBuffer(int inputb,int outputb);
void AbsBuffer(int inputb, int outputb);
Exponentiate every point in a buffer, calculate the natural logarithm, squareroot or absolute value of every point in a buffer. inputb and outputb may be
75

5 Image Buffers

equal.

IntensityHistogram
void IntensityHistogram (int buffer, int rectangle, int profile, int
theHistoLength);
Calculate an intensity histogram.
The number of pixels with a certain intensity is plotted versus intensity. The
result is ready to be examined in the Profile window. The active I-scale is
set properly to define the count-scale. The active X-scale relates to intensities.
If theHistoLength=0, the histogram is created for the standard profile length
(default: 2048) with a stepwidth of 1 count in the range between minimum and
maximum intensity. If theHistoLength > 0 the intensity range is devided
into the given number of steps. This is very useful for float buffers with a
small intensity range.

ContourPlot
void ContourPlot(int inputbuf, int minI, int dI, int nlines, int outputbuf);
Calculate contours of a buffer, i.e. closed lines which represent equal intensities.
Generate contour plot of input buffer with nlines intensity lines starting at
count minI with spacing dI.
The result is stored in the output buffer, which is twice as large as the input
buffer.

Mirror / Rotate / FlipBuffer


void MirrorLeftRight (int buffer);
void MirrorTopBottom (int buffer);
Mirror a buffer: swap left and right or swap top and bottom. In multi frame
buffers all frames are mirrored.
void RotateBuffer ( int inputbuf, int outputbuf, int center x, int
center y, float angle);
Rotate a single frame buffer by an arbitrary angle.
void FlipBuffer (int buffer, int mode);
Flip/rotate a buffer. In multi frame buffers all frames are flipped.
76

5.7 Buffer Arithmetic

mode
0

(no change)

flipping x y axis

rotation by 90 to the left

rotation by 90 to the right

vertical mirror (same as MirrorTopBottom)

horizontal
mirror
MirrorLeftRight)

+0x40

same operations as before for double frame


images (e.g. vector buffers)

(same

as

MoveBuffer
void MoveBuffer (int inputbuf, int outputbuf, float dx, float dy);
Copy the contents of inputbuf to outputbuf shifting its points by a specified (x,y)-offset. Fractional shift values are allowed (interpolation among the
closest 4 pixels).

Expand / CompressBuffer
void ExpandBuffer (int buffer, int x factor, int y factor);
Expand a buffer by a specified x and y factor: 1 factor 16. Every grid
rectangle with size x factor * y factor will be filled with the contant source
pixel value.
void CompressBuffer (int buffer, int x factor, int y factor);
Compress a buffer by a specified x- and y- factor. The average intensity of
every source grid rectangle is copied into the destination pixel.

SetAbove/BelowIntConstant
void SetAboveIntConstant ( int inputbuf, int outputbuf, float refInt,
float value);
void SetBelowIntConstant ( int inputbuf, int outputbuf, float refInt,
float value);
Set all pixels of the inputbuf with intensities higher (or lower) than a reference value refInt to a new value. Store the result in the outputbuf.
77

5 Image Buffers

ExtractChannel
void ExtractChannel (int buffer, int Nchannels, int channel, int outb);
Analyze data read in via Cio16-ADC-board. Extracts all columns of the specified channel (e.g. with Nchannel=2 every second column) and stores them
in the outputbuffer outb. This function is similar to CompressBuffer horizontally, but no averaging.
PeakDetection
void PeakDetection ( int inputbuf, int outputbuf, int row, int threshold,
int mode);
Compute peaks in an image buffer inputbuf and store them compactly in
outputbuf.
A peak is found when the following two conditions are met:
the pixel intensity must be threshold
all surrounding pixels must be of lower intensity
Depending on the parameter mode, the exact location of the peak is determined in different ways. But for all modes the x and y location is multiplied
by a factor of 2 to increase the accuracy of peak location ( e.g. a peak location
of 201 corresponds to an original pixel location 100.5).
mode
0

No sub-pixel computation, simply store 2*x/2*y and the


intensity of the center pixel with the highest intensity.
Note: this is the fastest and simplest way.

Check the 3 x 3 pixels around the center peak and compute


the center-of-mass. Store the summed intensity of those 9
pixels.

2/3

Check along the x- and y-axis going through the center


pixel to determine the peak location more accurately. This
is done for 2 (mode=2) or 3 (mode=3) pixels in all 4
directions. Stored is the sum of all pixels checked.

11

Same as 1, but store the intensity of the center peak (no


sum).

12/13

Same as 2/3, but store only the intensity of the center peak.

The resulting pixel-locations are stored in the specified row of the output buffer
in the following storage format:
Pix[outputbuf,row,0]= number of peaks found
78

5.7 Buffer Arithmetic

Pix[outputbuf,row,1]= x-position of first peak


Pix[outputbuf,row,2]= y-position of first peak
Pix[outputbuf,row,3]= intensity of first peak
Pix[outputbuf,row,4]= x-position of second peak
Pix[outputbuf,row,5]= y-position of second peak
Pix[outputbuf,row,6]= intensity of second peak
...
Note that the output-buffer must exist already and must be large enough.
Examples:
int n=100; // 100 images checked
int maxN=200; // maximal 200 peaks per image
SetBufferSize(2, maxN*3+1, n, 0);
// peak buffer, each row fits maximal 200 peaks
int threshold = 30; // threshold of 30 counts
int i;
for(i=0; i<n; i++) {
TakeImage(1);
PeakDetection(1,2,i,threshold,3);
// store peaks in row i
}
int nx, ny, type;
GetBufferSize (1, nx, nx, type); // get original image size
ConvertPeakBuffer(2, 3, nx*2, ny*2);
ConvertPeakBuffer
void ConvertPeakBuffer(int inputpeakbuf, int outputbuf, int nx, int
ny, int SizeMode, int IntMode);
Convert the compact data generated by PeakDetection back to an image. The
size of the image buffer is nx times ny pixels.
SizeMode: Be aware: the x/y pixel position of the peak buffer is twice the
original pixel location!
0: (DOUBLE) the x/y pixel position of the peak buffer is used to store values
in the image buffer. The final buffer is twice the size of the original to provide
sub-pixel accuracy.
1: (SAME) the x/y pixel position of the peak buffer is divided by two and this
is used to store values in the image buffer. Therefore, the final image buffer
has the same size as the original; subpixel information is lost.
79

5 Image Buffers

IntMode: At the location x/y of a peak (with twice the resolution) a certain
intensity will be added:
0: 1 count
1: the corresponding intensity of that pixel.
RandomParticleImage
void RandomParticleImage (int buffer, int nx, int ny, int noise, float
density, float size, int intensity, float a1, float a2, float a3,
float a4, int mode);
Generate an image with randomly distributed particles. A new buffer of size
nx and ny is created and first the background if filled with some noise. Then
particles of specified size and total summed intensity are added.
The total number of particles is: N = nx * ny * density.
Parameter
nx / ny

size of buffer

noise

background noise level

density

particle density

size

size of particle

intensity

summed intensity of each particle

a1...a4

flow field parameters

mode

mode of operation:
-2 only generation of noise, no peaks
-1 single particles (a1-a4 ignored)
double exposure:
dvx=a1+a3*sin(2*PI*x/a4)*sin(2*PI*y/a4)
dvy=a2+a3*cos(2*PI*x/a4)*cos(2*PI*y/a4)
10 triple exposure according to flow field
For 0.1 mode/100 = 0.9, it is the ratio between first
and total separation.

LUT
int LUT ( int inputbuf, line lut, int outputbuf);
All pixel intensities of the inputbuf are changed by:
I(bout) = LUT( I(bin) )
The result is stored in outputbuf . The LookUp-Table (only for WORD-buffer)
is stored in a LUT-line.
Example:
80

5.7 Buffer Arithmetic

LUT ( 1, P[1], 2 )
(input=buffer1,output=buffer2,LUT=P[1])
In Profile 1 a set of points is stored, from which the LUT is calculated by
interpolation:
F[1,0] = n = number of points (e.g. 4)
F[1,1] = first point: pixel-intensity (e.g. 0)
F[1,2] = first point: new intensity (e.g. 100)
F[1,3] = 2. point: pixel-intensity (e.g. 10)
F[1,4] = 2. point: new intensity (e.g. 120)
. . .
If the pixel has a count-value of 0, it is set to 100.
If the pixel has a count-value of 10, it is set to 120.
Intermediate values are interpolated: e.g. I(5) = 110.
Note:
All intensities must increase with increasing points.
ConvertRGBImage
void ConvertRGBImage (int bin, int bout, int mode, float par);
Convert image data from a (Imager3) RGB camera
mode 0: convert to a greyscale image
mode 1: compute red/green ratio. Each pixel = red*par/green
Segmentation
void Segmentation( int bin, int bout, int threshold, int mode, int&
nSegments, line& Xpos, line& Ypos, line& Npixel, line& Xsize, line&
Ysize, line& MaxInt, line& SumInt );
Compute segmentation regions of the input buffer bin, which has to be a Word
buffer. The detected segments are marked with intensities 10,20,30,... in the
output buffer bout. The threshold defines a segment as a region of pixels all
above this intensity.
The following modes are supported:
0 = normal mode
1 = get the 2 largest segments with respect to max. x-size, get left-most point
of segment. Xpos is the left-most point of the segment, Ypos is the y-center
of mass of the segment
2 = like 0 but a segment is defined as all adajcent pixels which are lower than
the highest pixel or pixels already belonging to the segment. In addition only
those pixels are taken, which are above 10% of the highest pixel.
81

5 Image Buffers

3 = like 0, but restricted to range defined by Xpos[0],Ypos[0] +- Xsize[0],Ysize[0]


4 = like 1, but restricted to range defined by Xpos[0],Ypos[0] +- Xsize[0],Ysize[0]
The return values give all information about the detected segments. The
arrays have to be defined with a large number of items to store all data. If
unsure about the number, you can call this subroutine twice, because value
nSegments gives the real number of detected segments always.
nSegments: number of segments detected
Xpos: array of integers, center x-position of seg.
Ypos: array of integers, center y-position of seg.
Npixel: array of int, number of pixels in each seg.
Xsize: array of int., horizontal segment diameter
Ysize: array of int., vertical segment diameter
MaxInt: array of int., maximum intensity of segment
SumInt: array of in.s, integral intensity of segment
This function can easily be tested by executing SetupDialogSegmentation(0).
Example:
int n;
int Xpos[100], Ypos[100], Xsize[100], Ysize[100],
MaxInt[100],SumInt[100], Npixel[100];
Segmentation( 1, 2, 100, 0, n, Xpos, Ypos, Npixel,
Xsize, Ysize, MaxInt, SumInt );
InfoText( n + " segments found:" );
ImageCorrection
void ImageCorrection( int bin, int bout, line parameter, line mode );
Apply general image distortion function.
mode is an int-array:
mode[0]

function

apply distortion (bin -bout)

correct distortion (inverse function) (bin -bout)

show distortion in input buffer bin (bout not used)

show correction in input buffer bin (bout not used)

compute maximum range of corrected image, store


back in variables IcXmin, IcXmax, IcYmin and
IcYmin

only for mode[0] = 0 or 1:


82

5.8 Line Arithmetic

mode[1] = constant total intensity (0) or constant local intensity (1)


mode[2] = same size as original image? 0 = yes, 1 = no
mode[3] = new size nx
mode[4] = new size ny
only for mode[0] = 2 or 3:
mode[2] = show x-grid (0=off,1=on)
mode[3] = show y-grid (0=off,1=on)
mode[4] = x-grid spacing
mode[5] = y-grid spacing
mode[6] = show reference undisturbed grid(0=off,1=on)
parameter is a float-array:
parameter[x]
0-3

x0, nx, y0, ny

4 - 13

x c, dx x, dx x2, dx x3, dx y, dx y2, dx y3, dx x2y,


dx y2x, dx xy

14 - 23

dy c, dy x, dy x2, dy x3, dy y, dy y2, dy y3,


dy x2y, dy y2x, dy xy

for displacement function:


x = 2 * (x - x0) / nx, y = 2 * (y - y0) / ny
dx = dx c + dx x*x + dx x2*x*x + dx x3*x*x*x
+ dx y*y + dx y2*y*y + dx y3*y*y*y
+ dx xy*x*y + dx x2y*x*x*y + dx y2x*y*y*x
dy = dy c + dy x*x + dy x2*x*x + dy x3*x*x*x
+ dy y*y + dy y2*y*y + dy y3*y*y*y
+ dy xy*x*y + dy x2y*x*x*y + dy y2x*y*y*x

5.8

Line Arithmetic

All line functions operate on lines of the same buffer, either on columns
C[] or on rows R[].
Sum / AvgLine
line SumLine(line line a, line line b);
line AvgLine(line line a, line line b);
Calculate a sum (average) profile of a range of lines in one buffer.
Examples:
P[0] = SumLine(R[5,0],R[5,19])
83

5 Image Buffers

P[0] = AvgLine(R[5,0],R[5,19])
Profile 0 includes the sum (average) of rows 0 to 19 from the buffer 5.
Min / MaxLine
line MinLine(line line a, line line b);
line MaxLine(line line a, line line b);
Calculate a minimum (maximum) profile of a range of buffer lines.
Examples:
P[0] = MinLine(R[5,0],R[5,19])
P[0] = MaxLine(R[5,0],R[5,19])
Profile 0 includes the minimum (maximum) of rows 0 to 19 from the buffer
5. The minimum (maximum) is calculated for each point x in profile 0 by
taking into account the points (columns) x of all 20 rows, then going to the
next point (column) x+1 and so on.
Exp / LogLine
line ExpLine (line aline);
line LogLine (line aline);
Calculate the exponential (logarithm) values of a line.
Examples:
P[0] = ExpLine(R[5,10])
P[0] = LogLine(R[5,10])
Profile 0 includes the exponential (natural logarithm) values of row 10 from
buffer 5 (exp[row10], ln[row10]).
GetLine
line GetLine(int bufnum, int x1, int y1, int x2, int y2, int npoints);
Get a line from x1/y1 to x2/y2.
Compose a line from specified buffer along the line from x1/y1 to x2/y2 with
specified number npoints of data points. If npoints=0, the number of data
points is automatically computed from the length between x1/y1 and x2/y2
(in pixels).
Example:
P[1]=GetLine(1,100,100,200,200,384);
Line 100/100-200/200 (normal length 141 pixels) is expanded to 384 pixels and
stored in Profile 1. The pixel intensities of the output line are interpolated in84

5.9 Rectangles

between the four closest surrounding pixels (not just simply the closest pixel
taken).
GetCircle
line GetCircle (int bufnum, int xcenter, int ycenter, int radius,
int npoints);
Compose a circle around xcenter/ycenter with radius and store the pixel
intensities on this circle in a line (array variable, row or column of a buffer or
profile). The pixel intensities of the output line are interpolated in-between
the four closest surrounding pixels (not just simply the closest pixel taken).
If npoints=0, the number of data points is automatically computed from the
radius.
PlotXY
void PlotXY ( int profnr, line xvalues, string xdescr, string xunits,
line zvalues, string zdescr, string zunits, int autoscale);
Plot a profile from an array of (x,z) value pairs.
autoscale = 0: use the x-scale that is already set for the profile buffer
autoscale = 1: set the x-scale optimally
SortLine
line SortLine (line theInputLine, line& oldIndexList);
Sort the input array (float, word or string), return the sorted list and the index
table of the old list.
Example:
int oldlist[1000];
R[1,1] = SortLine(R[1,0],oldlist);
R[1,2] = oldlist;
This example sorts all values of row 0 in buffer 1, stores the sorted list in row
1 and the index of the original order in row 2.

5.9

Rectangles

DaVis uses eight rectangular areas, which are free for the user. The coordinates of this rectangles are stored in the CL-variable int Rectangles[4*(NumRect+1)].
The active rectangle is defined by variable int ActiveRect, the last available
rectangle, which should be used by macros only, is stored as int NumRect =
9 by default. This value can be increased if wanted, but remember to increase
85

5 Image Buffers

the size of array Rectangles! There is no definition for rectangle 0, which is


used to describe the complete buffer.

5.9.1

Rectangle Macros

Please use the following macros, included in macro file SYS MACS.CL, for rectangle handling:
Get / SetRect
int SetRect( int RectNum, int x1, int y1, int x2, int y2);
int GetRect( int RectNum, int& x1, int& y1, int& x2, int& y2);
Both macros return the size of the rectangular region (= width x height).
SelectRect
int SelectRect (int RectNum);
Select a rectangle in a window by pressing the left mouse key at the first
corner, than holding the key and moving the mouse to the second corner. If
the selection has been succesfull, the return value will be 1, or 0 for error or
abortion.
The window is defined by variable Buffer, which includes the number of the
active buffer. This buffer must be visible on screen before SelectRect() is
called.
CutoutRectangleShift
void CutoutRectangleShift( int bin, int rectangle, int bout, int dx,
int dy );
Cut-out specified rectangle from input buffer and store as seperate buffer. The
size of bout is given by the rectangle size (no matter what the extra dx and
dy is. The location of rectangle is shifted by dx and dy, which means that if
the shifted location of the rectangle is partly outside bin, the missing rim is
set to 0.

5.9.2

Rectangle Subroutines

MoveRectangle
int MoveRectangle( int sourcebuffer, int rectangle, int destbuf, int
destRow, int destCol);
86

5.9 Rectangles

Copy a rectangular region from the source buffer to the destination buffer.
The upper left corner of the rectangle is placed at the specified coordinates
destRow / destCol (x/y).
CompressRectangle
int CompressRectangle( int sourcebuffer, int rectangle, int x factor,
int y factor, int destbuf, int destRow, int destCol);
Transfer a rectangular region from one buffer to another buffer, compressing
it in each direction.
RectStatistics
void RectStatistics ( int buf, int rect, float& avg, float& rms, float&
min, float& max);
void RectStatisticsScaled ( int buf, int rect, float& avg, float&
rms, float& min, float& max);
Get the sum, average, minimum and maximum of the intensities of all points
in a rectangular buffer region. The location of the maximum is stored in
variables XPos and YPos. The resulting intensities are in user scales.
Sum / Avg / Rms / Max / MinRect
All statistic properties can be obtained by single functions also. Use rect=0
for the whole image.
float SumRect (int buf, int rect);
float AvgRect (int buf, int rect);
float RmsRect (int buf, int rect);
float MaxRect (int buf, int rect);
float MinRect (int buf, int rect);
Get the sum, average, root mean square, maximum or minimum of the intensities of all points in a rectangular buffer region.
The location of the maximum or minimum is stored in the global variables
XPos and YPos.
SetInside/OutsideRectConstant
void SetInsideRectConstant ( int inputbuf, int outputbuf, int rectangle,
float value);
void SetOutsideRectConstant ( int inputbuf, int outputbuf, int rectangle,
float value);
Set all pixels inside (or outside) a rectangle to a specified value.
87

5 Image Buffers

BinarizeRectLevel
void BinarizeRectLevel (int inputbuf, int outputbuf, int rectangle,
float minvalue, float maxvalue, int setvalue)
Set all pixels inside the rectangle to color setvalue, if minvalue <= Pix <
maxvalue. Otherwise the pixel is set to 0. All pixels outside the rectangle are
set to 0, too.
CountInsideRectPixel
int CountInsideRectPixel (int buf, int rect, float minvalue, float
maxvalue);
Get the number of pixels in a rectangular buffer region with an intensity
between minvalue and maxvalue.
Contrast
float Contrast( int buffer, int rectangle, int mode );
Computes a contrast function of part of a buffer.
mode = 0: use absolute value of first derivate
= sum( abs(f(x) - f(x-1)) ) / (average intensity)
mode = 1: use absolute value of second derivate
= sum( abs(-f(x-1) + 2*f(x) - f(x+1)) ) / (average intensity)
Both modes compute the contrast only in the horizontal direction for fast
speed.
Use rectangle = 0 for complete buffer.

5.10

Filters

LinearFilter
void LinearFilter( int source buffer, int dest buffer, int to float,
int filter type, string coeffs, int divide, int rim );
Apply a linear filter of type filter type to the source buffer. See table 5.2 for
a detailed description of the parameters. The coeficients are given linewise:
a1 a2 a3 b1 b2 b3 c1 c2 c3 for matrix

a1 a2 a3

b1 b2 b3 /divisor

c1 c2 c3
Vector coefficients are given from top to bottom for vertical vectors and from
left to right for horizontal vectors.
88

5.10 Filters

A list of predefined coeficients for linear filters is available in macro file SYS FILT.CL.
To execute those filters please check the index of the wanted filter in the array
FilterNames[]. Then set theActiveFilter to the correct index and call the
subroutine
LinearFilter( theSourceBuffer, theDestBuffer,
FilterFloat[theActiveFilter], FilterType[theActiveFilter],
FilterFactors[theActiveFilter], FilterDivide[theActiveFilter],
FilterRim[theActiveFilter] );
Paramater

Value

source buffer

source buffer

dest buffer

destination buffer

to float

0
1

destination buffer is of the same type as the


source buffer
allwayscreate FLOAT-buffer as output

filter type

0/1/2/3
4/5/6/7

3x3 / 5x5 / 7x7 / 9x9 matrix


3Hx3V / 5Hx5V / 7Hx7V / 9Hx9V separable
filter
3H / 5H / 7H / 9H vector
3V / 5V / 7V / 9V vector

8-11
12-15
coeffs

contains coefficients, e.g. 1 1 1 1 1 1 1 1 1

divide

divide resulting sum by this value

rim

0
1

set outer rim to 0


do not change outer rim

Tab. 5.2: Parameters of subroutine LinearFilter


Examples:
LinearFilter( 1, 2, 0, 5, "1 2 4 2 1 1 2 4 2 1", 100, 1);
LinearFilter( 1, 2, 0, 0, "1 2 1 2 4 2 1 2 1", 100, 1); // 3x3 Gauss
NonlinearFilter
void NonlinearFilter(int source buffer, int dest buffer, int mode,
int value);
Execute 2D-nonlinear filter. See table 5.3 for the available modes. value =
noise level = 0,1,... with automatically calculated background.
FFT
void FFT (int inputbuf, int rectangle, int outputbuf, int mode );

89

5 Image Buffers

mode

filter

median filter: take of all value pixels the middle one

erosion filter

dilatation filter

concentration filter: moving all counts of the surrounding pixels which are above the (background + noise level)
to the center pixel, if it is the one with the highest intensity.

5-14

see Pro Package Manual by LaVision


Tab. 5.3: Modes of subroutine NonlinearFilter

Fast Fourier Transformation (FFT) of a rectangular buffer region of a specified


rectangle in bin.The result is stored in bout, always a FLOAT buffer with
the size of the rectangle.
mode: 0=horizontal, 1=vertical, 2=2D
The input ranges for the FFT must be of even length. the function will discard
the last pixel, if the range is odd.
IFFT
void IFFT(int FFTbuf, int outputbuf, int mode );
Inverse Fast Fourier Transformation (FFT). The complete buffer bin is transformed back into bout, which has the same size as buffer bin.
mode: 0=horizontal 1=vertical 2=2D
Example:
// get size of buffer 1:
GetBufferSize( 1, nx, ny, type );
// 2D-FFT of complete buffer 1:
FFT( 1, 0, 0, nx-1, ny-1, 2, 2 );
// inverse FFT, buffer 3 must be = buffer 1 now:
IFFT( 2, 3, 2 );

MultiplyFFT
void MultiplyFFT ( int FFTbuf1, int FFTbuf2, int outputbuf, int mode );
Complex multiplication of two FFT buffers.
Examples:
1) Autocorrelation:
// source image in B(1)
90

5.10 Filters

mode
0, 1, 2

normal complex multiplication (0=hor.,1=vert.,2=2D)

3, 4, 5

B(bin1) * complex-conjugate-of(B(bin2)) ;
(3=hor.,...)

GetBufferSize( 1, nx, ny, type );


// get size of buffer 1
FFT( 1, 0, 0, nx-1, ny-1, 2, 2 );
// 2D-FFT of complete buffer 1
MultiplyFFT( 2, 2, 3, 5 );
// 2D-multiplication of
// B2 * (B2*) (compl.conjug.)
IFFT( 3, 4, 2 ); // B4 = autocorrelation
2) Convolution of two images in B(1) and B(2)
GetBufferSize( 1, nx, ny, type );
// get size of buffer 1
FFT( 1, 0, 0, nx-1, ny-1, 3, 2 );
// 2D-FFT of complete buffer 1
GetBufferSize( 2, nx, ny, type );
// get size of buffer 2
FFT( 2, 0, 0, nx-1, ny-1, 4, 2 );
// 2D-FFT of complete buffer 2
MultiplyFFT( 3, 4, 5, 2 );
// 2D-multiplication of B3 * B4
IFFT( 5, 6, 2 ); // B6 = convolution
Amplitude / Phase
void Amplitude( int FFTbuf, int outputbuf, int mode );
Amplitude part of an FFT image.
void Phase ( int FFTbuf, int outputbuf, int mode );
Phase part of an FFT image.
Calculation of amplitude part and the phase of an FFT-image:
Each location of the fourier-transformed image is actually a complex number,
which can be seperated into an amplitude factor and a phase factor.
Subroutine Amplitude() calculates the amplitude part while subroutine Phase()
calculates the phase factor. Note that the amplitude image is symmetric and
the phase image is anti-symmetric, because the original image consists of real
numbers (not complex). This fact is used in storing the FFT-image (which in
91

5 Image Buffers

general is complex) in a single FLOAT-buffer.


mode: 0=horizontal, 1=vertical, 2=2D
Example:
GetBufferSize( 1, nx, ny, type); // get size of buffer 1
FFT( 1, 0, 0, nx-1, ny-1, 2, 2 );
// 2D-FFT of complete buffer 1
Amplitude( 2, 3, 2 ); // calculate
2D-amplitude image
Phase( 2, 4, 2 ); // calculate 2D-phase image

CombineAmplitudePhase
void CombineAmplitudePhase ( int amplitudebuf, int phasebuf,
int outputbuf, int mode );
Synthesize the FFT image back from the amplitude and phase images.
bin1 = amplitude image
bin2 = phase image
bout = output: FFT image
mode: 0=horizontal, 1=vertical, 2=2D
Example:
GetBufferSize( 1, nx, ny, type );
// get size of buffer 1
FFT( 1, 0, 0, nx-1, ny-1, 2, 2 );
// 2D-FFT of complete buffer 1

5.11

PIV / PTV

Piv / PtvCalculateVectorField
void PivCalculateVectorField (int inbuf, int outbuf, int rectangle );
void PtvCalculateVectorField (int inbuf, int outbuf, int rectangle );
Calculation of a vector field (Particle Image Velocimetry or Particle Tracking
Velocimetry).
inbuf = source buffer
outbuf = buffer with calculated vector field
rectangle = region of interest
Notice: There are some global arguments to set first !!
92

5.11 PIV / PTV

VectorOperation
int VectorOperation ( int inbuf, int outbuf, int mode, int grid );
Operations on complete vector fields. See table 5.4 for descriptions of the mode
parameter.
VectorProcessing
void VectorProcessing( int inbuf, int outbuf, int mode, float value );
Vector buffer processing. Post processing routines on vectorfields, normally
used after PIV or PTV evaluations. See table 5.5 for the mode parameter.
GetVector
int GetVector( int buffer, int x, int y, float& vx, float& vy, int header );
Get vector at position x/y. The vector length is stored in vx and vy. Returns
0 if the vector is disabled, 1 to 4 for the number of the best vector, 5 if the
vector is preprocessed or 6 if the vector is smoothed.
If the vector field format is extended (as used for PIV evaluations) you can
get different vectors of one position (x/y) selected by header (see table 5.6).
Add 0x8000 to the header to return differential values in percent. All actions,
which calculate a single value only, return this value in parameter vx.
The definition can be found in file CL\PIVPTV.CL.
header Action
0

Getting the best vector, returnes the position where


the vector is stored.

1-4

Getting a vector depending on the header number

10

Use constants V OP *

99

Get correlation peak ratio (if the buffer contains one),


return value in vx

98

Return vector length (2D/3D) in vx

97

Vx

96

Vy

95

Vz

94

Local deviation from average of 4 next neighbours

93

Local deviation from average of 8 next neighbours


continued on next page

93

5 Image Buffers

mode

VectorOperation

No action

Calculates the divergence of the vector field.


Dw/dz = -(du/dx + dv/dy)
Dw/dz is stored in a float buffer.
Inbuf and outbuf must be different.

Calculates the rotation of the vector field.


Rot(z) = du/dy - dv/dx
Rot(z) is stored in a float buffer.
Inbuf and outbuf must be different.

Calculates the vector length= sqrt( vx*vx + vy*vy)

Gives the x-vector component

Gives the y-vector component

Converts the standard 2D-vector format to the extended 2Dvector format (as used for the PIV evaluation)

Converts the extended 2D- or 3D-vector format to the standard 2D- or 3D-vector format

Convertion of a PTV evaluated image to a grid. The parameter grid is the new gridsize.

Apply mask (=image buffer or vector buffer) to input vector


buffer. Variable grid defines the buffer number with the
mask buffer. Where the mask buffer is 0 or vector disabled,
the vectors are deleted.
Return value: number of vectors inside mask

10

Gives the z-vector component (only for 3D-vector fields)

> 10

See subroutine GetVector (use the header of GetVector as


mode of VectorOperation)

Tab. 5.4: Parameter mode of subroutine VectorOperation. (u,v,w) is the


length of vector component (Vx,Vy,Vz) and (x,y,z) is the position. The parameter mode selects the different operations. For mode 1 to 5 the result is
a simple 1-D float buffer (image). Hint: Use variables V OP * when using
mode inside your macro. The definition can be found in file CL\PIVPTV.CL.

94

5.11 PIV / PTV

mode

Action

no action

Local Median Test.


Comparison between a vector and its surrounding using
the RMS. The parameter value specifies the allowed RMS
range (intern: value * RMS)
If the vector field format is extended the routine searches for
another calculated vector corresponding to the condition. If
no vector is found the vector will be disabled (the header
entry of the vector buffer is set to 0). Vector data stays
untouched

Fills the empty spaces in a vector field with the mean of the
surrounding. If the vector field format is extended the new
vector is written to position 4 and the header entry is set to
5.

Smoothes the complete vector field by a 3x3 mean filter.


If the vector field format is extended the new vectors are
written to position 4 and the header entry is set to 6.
Tab. 5.5: Parameter mode of subroutine VectorProcessing.

header

Action

89

Xy-2D-vorticity = Rot-z = Eyx - Exy

88

Xy-2D-vorticity = Rot-z = Eyx - Exy

87

Rot-y = Exz - Ezx

86

Rot-x = Ezy - Eyz

85

(rot-x,rot-y,rot-z) as vector

84

Xy-divergence -( Exx + Eyy )

83

-( Exx + Ezz )

82

-( Eyy + Ezz )

81

-( Exx + Eyy + Ezz ) (dual frame vector buffer)

79

- xy-divergence

78

abs(xy-divergence)

77

Exx - Eyy

76

abs(Exx - Eyy)

75

shear strength

74

swirling strength
continued on next page

95

5 Image Buffers

header

Action

73

swirl + shear

69

Exx

68

Exy

67

Exz (dual frame vector buffer)

66

Eyx

65

Eyy

64

Eyz (dual frame vector buffer)

63

Ezx (dual frame vector buffer)

62

Ezx (dual frame vector buffer)

61

Ezz (dual frame vector buffer)

59

interpolate vector field and set new grid size

58

calculate acceleration, parameter = dt between frames


Tab. 5.6: Modes of subroutine GetVector

SetVector
void SetVector( int buffer, int x, int y, float vx, float vy, int header );
Set vector at (x,y) to (vx,vy). If the vector field format is extended (as used
for PIV evaluations) the parameter header (see table 5.7) selects the position
of the vector.
header
<0
0
>0

Description
Set the header entry to abs(header). The vector is
untouched.
Vector is disabled.
Set the header entry and the vector.

Vector is preprocessed, the components are stored in


vector entry 4.

Vector is smoothed, the components are stored in


vector entry 4.

99

Set correlation peak ratio to value of vx, or return


peak ratio in vx.

Tab. 5.7: Modes for parameter header of subroutines SetVector and


Set4DVector.

96

5.11 PIV / PTV

Get / Set4DVector
int Get4DVector( int buffer, int x, int y, int z, int frame, float&
vx, float& vy, float& vz, int header );
Get vector at position x/y/z in a frame. The vector length is stored in vx, vy
and vz. Only for vector fields with out-of-plane component, otherwise same
as GetVector().
void Set4DVector( int buffer, int x, int y, float vx, float vy, float
vz, int header );
Set vector at (x,y,z,frame) to (vx,vy,vz). Only for vector fields with out-ofplane component, otherwise same as SetVector(). For parameter header see
table 5.7.
Get / Set3DVector
int Get3DVector( int buffer, int x, int y, float& vx, float& vy, float&
vz, int header );
void Set3DVector( int buffer, int x, int y, float vx, float vy, float
vz, int header );
Get or set a vector at position x/y. The vector length is stored in vx, vy and
vz. This function are implemented as macros and internally call subroutines
Get4DVector and Set4DVector.
GetInterpolated3DVector
void GetInterpolated3DVector( int buffer, float x, float y, int frame,
float& vx, float& vy, float& vz);
Get vector at (float) pixel position x/y from selected frame.
Vector components are stored in vx, vy and vz. The header is automatically
currently used for vector fields with no out-of-plane component vz=0.
SmoothSingleVector
void SmoothSingleVector( int bin, int x, int y, int area );
Sets a single vector to the mean value of its neighbours. See table 5.8 for
descriptions of the area parameter.
VectorMinMax / AvgRms
void VectorMinMax( int buffer, float& minX, float& minY, float& minL,
float& maxX, float& maxY, float& maxL )
97

5 Image Buffers

area
0

no action

-1

calculates the mean of a 3x3 area

-2

calculates the mean of a 5x5 area

< 2

calculates the mean of a 7x7(9x9,...)


area

>0

the vector at x/y is respected


Tab. 5.8: Parameter area for subroutine SmoothSingleVector.

Compute length of minimum and maximum vector (minL and maxL). Compute minimum and maximum of vector-components (minX, minY and maxX,
maxY).
void VectorAvgRms( int buffer, float& avgX, float& rmsX, float& avgY,
float& rmsY );
Compute average and r.m.s. of vector field.
Vector3DStatistics
void Vector3DStatistics( int buffer, float& avgZ, float& rmsZ, float&
minZ, float& maxZ, float& minL, float& maxL );
Compute statistics for 3D-vector field as addition to VectorMinMax() and
VectorAvgRms().

98

6 Image Window
6.1

Creating Image Windows

The first parameter win of the following subroutines is the number of the
buffer that is shown by the image window or the window handle returned by
CreateDataWindow.
CreateDataWindow
int CreateDataWindow (int buffer, int wintype);
Create an image window of the defined wintype. The list of available types is
given in table 6.1.
A call to CreateDataWindow(theBuffer,-1) copies a rectangular region, defined by the active rectangle number ActiveRect, of the buffer as a table into
the clipboard.
wintype

Constant

Description

WINTYPE IMAGE

simple 2D image window

WINTYPE PROFILE

profile window

WINTYPE 3DPROFILE

simple 3D profile window

WINTYPE SPREADSHEET

spreadsheet window

WINTYPE 3D

open OpenGL 3D window of default type

WINTYPE FRAMEOVERVIEW

multi frame overview window

WINTYPE PROPERTIES

properties dialog

10

WINTYPE 3D VECTOR = 10

3D vector display

11

WINTYPE 3D PEAK

3D peak display

12

WINTYPE 3D IMAGE

3D image display

13

WINTYPE 3D SLICE

3D image slices display

Tab. 6.1: List of window types.

ShowDataWindow
void ShowDataWindow (int win);
99

6 Image Window

Show the initially invisible window created by CreateDataWindow. See table


6.2 for some special functions, which are available via negative values for the
parameter win.
Handle

Window

-1

task window

-2

info window

-3

buffer list window

-4

execute function window

-5

view variables window

-6

statusbar

-7

toolbar

-8

CLUT window

-97

print the active window without displaying the system printing dialog box

-98

print active window after displaying the system printing dialog

-99

help on active window: open standard html-browser


or pdf-viewer to display the description of the active
window

Tab. 6.2: Special window handles for internal windows or dialogs of DaVis .

GetBufferFromHandle
int GetBufferFromHandle( int theWindow )
This macro function returns the number of the buffer, which belongs to the
given window handle.
CreateHandleFromBuffer
int CreateHandleFromBuffer( int theBuffer, int theViewN )
This macro function returns the window handle for the n-th view of the given
buffer.
GetWindowType
int GetWindowType (int win);
Get the type of a data window. The value is negative for an invalid handle,
or equal to parameter wintype of subroutine CreateDataWindow.
100

6.1 Creating Image Windows

For negative handles of special windows the return value is 0 if the window is
visible or -1 if invisible.
MinimizeWindow
int MinimizeWindow (int win);
The window will be minimized, only a small title bar of this window is shown
at the bottom of DaVis main window.
CloseWindow
int CloseWindow (int win);
Close a data window. Parameter -1000 closes all open windows (incl. dialogs).
Parameter -1001 closes the image windows only (in DaVis 6 ). Parameter -1
exits DaVis .
Get / SetWindowSize
int GetWindowSize (int win, int& x1, int& y1, int& x2, int& y2);
int SetWindowSize (int win, int x1, int y1, int x2, int y2);
Get (or set) the position and size of a screen window. win=-1 is the task
window.
Optimal Size:
For x2=0,y2=0, the window is set to its optimal size. Like this all buffer
contents fit into it. The left upper corner of the window is positioned at
x1/y1.
SaveWindowAsBitmap
int SaveWindowAsBitmap (int win, string theFileName);
Copy, save or print window data. If the extension of theFileName is not given
or the extension is BMP, the window is saved as a bitmap file. If the extension
is PS, the window is stored in postscript format. Extension JPG stores the lossy
JPEG format. This subroutine returns FALSE on errors.
The postscript storage is available for simple 2D image windows only, not for
dialogs or other view types. Variable DefaultWindowExportMode defines, if
the postscript file should include the complete buffer (value 1) or the visible
information (e.g. the zoomed image, value 0). The line width and type of the
arrow head can be defined in the Postscript Vector Options dialog (to be
opened via the Global Options dialog).
101

6 Image Window

Both bitmap types can be stored as a screenshot (DefaultEnlargedBitmaps


= 0) or as enlarged bitmaps (DefaultEnlargedBitmaps defines the factor) to
get a better resolution of the scaling information and vectors.
If theFileName is empty, the window data is copied into the clipboard.
If theFileName="LPT1", the window is printer after showing the printer setup
dialog. If theFileName="LPT0", the printer setup dialog is not shown before
printing.
If called with parameter win=-1000 the subroutine saves the client area of the
active window into a bitmap file, win=-1001 includes the title bar and the
window border when saving the bitmap file.

EditWindowMenu
int EditWindowMenu( int wintype, int mode, int itemId, string itemTitle,
string itemCommand );
Define popup menus (opens on a click with the right mouse button) for the image windows. Parameter wintype is equal to subroutine CreateDataWindow().
Use wintype=-1 to define the parts of the popup menu which should be visible for all window types. The different modes to change a window menu are
described in table 6.3.
For further descriptions on menues see chapter Menus and Toolbars on
page 193.
mode

function

reset (delete) all menu entries for the selected window type

adds a new item with the unique itemId, the item name
itemTitle and the itemCommand, which is executed as a CL-macro
when the item is selected

delete item number

enable item

disable item, so it cannot be selected

auto-enable item, if the window buffer is an image buffer; otherwise


disable the item, e.g. vor a vector buffer

auto-enable item if the window displays a vector buffer

display item in a block before the WINTYPE ALL (wintype=-1)


items
Tab. 6.3: Parameter mode for subroutine EditWindowMenu-mode.

102

6.2 Modifying the Display

6.2
6.2.1

Modifying the Display


Window Display Parameter

Most window display parameters can be set or get by the subroutines SetWinPar
and GetWinPar. To copy the complete display settings from one window
to another the macro function CopyIMDIAWin2Win can be used. Function
SetWindow2DefaultIMDIA makes the parameters of the given window to the
window default values, which are set to every new opened window.
Get / SetWindowDisplay
int GetWindowDisplay (int win);
int SetWindowDisplay (int win, int attributes);
Get or set display attributes of an image window. The result is a binary
value of ored DISP x flags. To detect the available flags for the window, call
GetWinPar (win,WINPAR ATTR SUPPORT). The return value has all available
flags enabled. Use WINPAR ATTR SUPPORT2 to receive information about other
available window functions, see constants DISP2 x.
Specials for Profile Windows
For profile windows some special flags can be used to select the display of lines
(mode=0), dots (mode=1), filled areas (mode=2) or bars (mode=3):
SetWindowDisplay(win, (mode << 24) )
Specials for the Task Window
The execution of SetWindowDisplay(-1,1) defines the new default font and
therefore uses the global variables FontSize and FontName.
A call to SetWindowDisplay(-1,2) defines a macro timer and internally reads
the global variable MacroTimerSeconds and MacroTimerCommand. For more
information see page 155.
A call to SetWindowDisplay(-1,3) defines a macro thread and executes
MacroTimerCommand. For more information see page 155.
Get / SetWindowResolution
int GetWindowResolution (int win);
int SetWindowResolution (int win, int resolution);
Get (or set) the color resolution of an image window. Possible values are 64,
128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 and 65536. Other values
will be rounded to the next lower resolution.
103

6 Image Window

Constant

Attribut

DISP DATE

Date in the title bar

DISP TIME

Time in the titlebar

DISP RESO

Resolution in the titlebar

DISP COLORBAR

Show image colorbar

DISP INTENSITY

Intensity scale for image colors

DISP COLORBAR2

Show vector colorbar

DISP INTENSITY2

Intensity scale of the vector colors

DISP PROFILE X

Profile of the row at mouse position

DISP PROFILE Y

Profile of the column at mouse position

DISP SCALE X

Horizontal scale

DISP SCALE Y

Vertical scale

DISP PROFILE Z

For multiframe buffers: display depth profile at mouse position

DISP OVERLAY

Draw overlay of image buffer

DISP SHOWINFO

Display additional information in profile


window

DISP LOG X

Profile with logarithm x-scale

DISP LOG Y

Profile with logarithm y-scale

DISP CONTROLS

Display control buttons in profile window

DISP2 CLUTWIDTH

Clutwidth can be changed

DISP2 ZOOMWIN

Window can show a zoom at mouse position

Tab. 6.4: Attributes for subroutines Get/SetWindowDisplay


A call to SetWindowResolution(x,0) will set the optimal window resolution.
If parameter is between 1 and 11, it will index the resolution values: 1 sets
the resolution to 64, 2 to 128, 3 to 256, ..., 11 to 65536.
I.e. the number of intensity counts mapped to the CLUT which has 256 colors.
Dont mix this functions with Get/SetWinPar and parameter WINPAR RESOLUTION,
because of the different resolution values (historical reasons, sic)!
Get / SetWindowGamma
float GetWindowGamma (int win);
int SetWindowGamma (int win, float gamma);
Get or set the image correction exponent gamma of an image window:
104

6.2 Modifying the Display

(k*Pix[x,y])

(1/gamma)

This subroutine is retired and implemented as macro now. Internally the


macro executes the subroutines Set/GetWinPar with mode WINPAR GAMMA.
Get / SetWindowZoom
int GetWindowZoom (int win);
int SetWindowZoom (int win, int zoom);
Get (or set) the zoom percent value of an image window.
Get / SetWindowViewpoint
int GetWindowViewpoint (int win, int& x, int& y);
Get the buffer coordinates (x,y) which are shown in the window center.
int SetWindowViewpoint (int win, int x, int y);
Let the buffer coordinates (x,y) be shown in the window center.
Get / SetWinPar
float GetWinPar (int win, int type);
void SetWinPar (int win, int type, float value);
Get or set a parameter of the window. Possible types are defined as constants
in macro file SYS CONST.CLand are named as WINPAR x. The table on page
211 gives some descriptions about important parameter types.
Special functionality is implemented for the main (task) window, defined by
win=-1. With type=WINPAR RESO PERCENT the progress bar in the status line
of the main window can be defined. For easier access please execute macro
StatusProgress. See page 36 for more information about the progress bar.
Get / SetWinParStr
string GetWinParStr (int win, int type);
void SetWinParStr (int win, int type, string value);
Get or set a string parameter of the window. Possible types are defines in
macro file SYS CONST.CLand are named as WINPAR STR x. The table on page
211 gives some descriptions about important parameter types.
Get / SetWindowFrame
int GetWindowFrame (int win);
Get the number of the frame(s) displayed in a data window
int SetWindowFrame (int win, int theFrameNum);
105

6 Image Window

Set the number of the frame(s) displayed in a data window.


Both subroutines may be replaced in future versions by GetWinPar/ SetWinPar
with parameter WINPAR FRAME.
theFrameNum
0

display function
single frame n

-1

all frames

-2

frames 0 and 1 overanother

-3

sum of frames 0 and 1

-4

frames 2 and 3 overanother

-5

sum of frames 2 and 3

-6

frames 4 and 5 overanother

-7

frames 6 and 7 overanother

Tab. 6.5: Special frame numbers for subroutine SetWindowFrame

6.2.2

Exporting window or buffer data

Most exporting functions are realized by hidden parameters of some subroutines. This section gives an overview about the available functions.
An export of a window is used to copy the view of buffer data into the
clipboard or into a bitmap file. The bitmap can be included in articles or
presentations later.
The export of buffer data itself is done by the StoreBuffer subroutine in
most cases. The best way to use the data in other programs is the storage of
a TXT-file, which includes the data as raw text. A special case is the export of
the raw text data as a table into the clipboard, because this functions exports
the data inside the active rectangle!
The following subroutine calls execute some export functions. Some functions
use a window handle win as parameter. Use variable ActiveWindow instead
of win to export the last activated window.
Export the active window (or dialog) as bitmap in the clipboard:
SaveWindowAsBitmap( -1000, "" )
Export the active window (or dialog) as bitmap in the clipboard, including the window frame and title bar:
SaveWindowAsBitmap( -1001, "" )
Save a buffer view like it can be seen in the window win in bitmap
format:
SaveWindowAsBitmap( win, "MyFileName.bmp" )
106

6.3 Coordinate selection by mouse in a window

Save a buffer view like it can be seen in the window win in postscript
format (should be used for vector buffers):
SaveWindowAsBitmap( win, "MyFileName.ps" )
Print active window after displaying the printer setup dialog (use parameter -97 to print with default printer settings):
ShowDataWindow( -98 )

6.3

Coordinate selection by mouse in a window

WindowSelection
void WindowSelection (int win, int cursormode);
Prepare the selection of a point or rectangle or line in a window. See table 6.6
for the available cursormodes.
cursormode

Function

switch off

point

row

column

rectangle

row range

column range

arbitrary line

arbitrary line with first point defined by XPos,YPos

circle

<0

dont redraw (clear) window

Tab. 6.6: Available cursormodes for subroutine WindowSelection.

GetSelectedRegion
int GetSelectedRegion(int& x1, int& y1, int& x2, int& y2);
Get the coordinates of the point or region selected by the user. Returns 1
(TRUE) if the user has selected something, otherwise 0 (FALSE). If the user
closes the image window before the selection finishes, value -1 is returned.
107

6 Image Window

6.3.1

Select a line or region with mouse cursor

Select a line
int WinSelectPos (int win, int& x, int& y, int cursormode)
This function is defined in SYS MACS.CLand can be used to select a line in a
window with the mouse cursor. The function returns TRUE (1) if ok or 0
(FALSE) if the user has interrupted by pressing a key. win is the number
of the image buffer, cursormode=1 shows the cursor as cross, horizontal line
(2) or vertical line (3). If cursormode< 0 the window will not be redrawn
(cleared).
Select a region
int WinSelectRegion (int win, int& x1, int& y1, int& x2, int& y2,
int mode)
Parameters are mode=4 for a rectangle, horizontal range (5), vertical range
(6) or arbitrary line (7). The mode of a range or rectangle selection can be
switched by the global variable WindowDragRange. If set to 0 (default) the
user has to click on both borders/corners, if set to 1 the user clicks on the
first position, holds the mouse button pressed and releases the button on the
second position.
Example:
Marking a line in the active buffer and taking the profile of this line.
void G5 LineProfile()
{
Message("Please mark the profile line!",0);
// bring active buffer to front:
Show(Buffer);
// mark a line:
int x1,y1,x2,y2;
int ok = WinSelectRegion( Buffer, x1,y1,x2,y2, 7 );
if (ok) {
// create profile in the following buffer:
SetBufferSize( Buffer+1,
sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)), 1,0);
R[Buffer+1,0] =
GetLine( Buffer, x1,y1,x2,y2, 0 );
Show(Buffer+1);
}
}
108

6.3 Coordinate selection by mouse in a window

6.3.2

Clicking in an image window

When clicking in an image window with the right mouse button, a pulldown
menu opens.
The macro developer can define an own event handler for clicks with the left
mouse button. All to do is copy a macro call into the global string variable
ClExecWinMouseLeft for image windows or ClExecWinMouseLeftProfile for
profile windows.
When the left mouse button is pressed, DaVis executes this string as a macro
command after storing the unscaled mouse pixel position in the variables XPos
(horizontal), YPos (vertical), ZPos (depth) and FPos (frame index).
Example:
ClExecWinMouseLeft =
"InfoText(\"mouse pressed at \"+XPos+\",\"+YPos)";
Hint:
It is possible to use this macro from a modal dialog. The modal dialog can
open an image window by a button click and set this command at the same
time. The first character in the command string has to be an ! to execute
the command while another macro is running (the running macro in this case
is the macro which opens the modal dialog).

6.3.3

Handling mouse events on image windows

Sometimes the user wants to react on all mouse events in an image window:
Moving the mouse, clicking on a position, and maybe create different actions
for the state of the CTRL and SHIFT keys and in the left mouse button.
Since DaVis 6.3 a window parameter is used to define a callback macro for
this mouse events:
SetWinParStr(ActiveWindow,WINPAR STR EVENTONMOUSE,"TestWinEvent");
The callback function receives a mode parameter with bit flagged key states
(1= pressed SHIFT key, 2= pressed CTRL key, 4= pressed left mouse button,
8= left mouse button down, 16= left mouse button up) and four parameters
for the mouse position (x, y, z-plane and frame) in the displayed buffer.
void TestWinEvent( int mode, int px, int py, int pz, int pf )
{
InfoText(""+mode+": "+px+","+py+","+pz+","+pf);
}

109

6 Image Window

6.3.4

Handling update events on image windows

Sometimes the programmer wants to update a dialog when the user changes
some display parameters of an image window. Therefore string variable ExecOnActiveWindow
can be filled with own macro commands. The window handle of the updated
window is stored in variable ActiveWindow.

6.4

Drawing into a window

The WinDrawX subroutines draw overlays and dont change the buffer. All
overlay drawings are deleted when the window is repainted, e.g. by subroutine
UpdateScreen (see page 37) or when another window is moved above the
overlay.
The buffer attribute Overlay is used to store a list of overlayed objects, which
can be drawn with the help of a macro call or (in DaVis 6 ) automatically
whenever the window has to be repainted.
WinDrawRect / Line / Circle / Text
The predefined colorindexes of the color parameter are listed in table 6.7.
Lines and circles can be drawn in the inverting color modus with color=-1.
A RGB color can be set by color=-RGB with RGB as the color value.
The following (positive) RGB-colors are defined as constants: COLOR BLACK,
COLOR BLUE, COLOR CYAN, COLOR GREEN, COLOR MAGENTA, COLOR RED,
COLOR WHITE, COLOR YELLOW.
The functions can paint permanent overlays when using a negative width for
rectangles and lines, a negative radius for circles or a negative size for a text.
This permanent overlays are not stored in buffer attribute Overlay, so they
are lost when the windows is closed!
int WinDrawRect( int win, int x1, int y1, int x2, int y2,
int color );
int WinDrawLine( int win, int x1, int y1, int x2, int y2,
int color );
int WinDrawCircle( int win, int xcenter, int ycenter, int xradius,
int yradius, int color )
Draw a rectangle, a line or a circle into an image window.
int WinDrawText( int win, int x1, int y1, int size,
int color, string text );
Draw a text into an image window. Use subroutine BufferDrawText to draw
into the buffer.
110

6.5 About the Profile Window

Value
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Color
blue
green
yellow
orange
red
purple
cyan
magenta
rose
light blue
black
dark gray
gray
light gray
very light gray
white

Tab. 6.7: The predefined list of colors for vector display and some painting
functions.

Macros for permanent overlay creation


void OvGViewAllString (string anOverlayStr, int aWin)
Execute this macro to draw a overlay stored in the string anOverlayStr into
the window defined by handle aWin.

6.5

About the Profile Window

In most cases the profile buffer (buffer number 0) is used for profile display.
Additionally a normal buffer can be displayed as a profile, either with a call to
CreateDataWindow(bufnum,1) or by displaying a buffer with a small number
of lines (ny < DefaultMinImageHeight).
To get or set the data range which is shown in a profile view of a buffer, please
call subroutines GetWinPar or SetWinPar with modes WINPAR PROFILE x. Both
functions GetProfileParameter and SetProfileParameter are retired now
but can be used for most profiles without the arbitrary line and circle mode.
See the table on page 213 for a list of the available parameters.
111

6 Image Window

ProfileSelection
void ProfileSelection (int win, int cursormode);
Prepare the selection x- or z- coordinate in a profile window.
cursormode: 0=switch off, 1=point , 2=row, 3=column, 4=Rectangle, 5=row
range, 6=column range, 7=arbitrary line, 0 = dont redraw (clear) window
GetProfileCoordinate
int GetProfileCoordinate (float& coordinate);
Get the coordinate which has been selected by the user and return 1 (TRUE)
if the user has selected something, otherwise 0 (FALSE).
Get / SetProfileDisplay
void GetProfileDisplay (int win, float& x1, float& x2, float& z1,
float& z2);
void SetProfileDisplay (int win, float x1, float x2, float z1, float z2);
Set the horizontal and vertical display ranges of a profile window. Note: The
values are unscaled. If your buffer has a scaling factor of value 1, you can
set the range directly. Otherwise you have to calculate the (pixel) range from
your scaled range.
TakeProfile
void TakeProfile (int ProfNum, int SrcBuf, int Mode, int From, int
To);
This macro copies data from a source buffer into line ProfNum of the profile
buffer. Set variables NumProfiles > ProfNum and ActiveProfile = ProfNum
to activate your profile. Table 6.8 shows the available modes.

6.6

About the Palette Window

The palette window is by default displayed at the left border of the DaVis
main window. It displays the active palettes (color lookup tables, CLUT) for
images, vectors and background images of vector displays.
Get / SetCLUT
int GetCLUT (int thePalette);
void SetCLUT (int thePalette, int theCLUTnum);
112

6.6 About the Palette Window

Mode

Profile

horizontal; copy row number From from the source buffer


into the profile

horizontal range average; calculate the average row from all


rows in the range From to To and copy the average values
into the profile

horizontal range sum; like mode 1 but calculate the sum

vertical; copy column number From

vertical range average

vertical range sum

arbitrary line; the start and end positions must be defined in


rectangle number 9, e.g. by a call to SetRect(9,x0,y0,x1,y1)

circle; center in x0 and y0 of rectangle number 9, radius in


x1
Tab. 6.8: Modes for subroutine TakeProfile.

Get (or set) the number of the active CLUT for images (thePalette=0), vectors (thePalette=1) or background images of vector fields (thePalette=2).
SetCLUT2RGB
void SetCLUT2RGB (int thePalette, line theRGBArray);
Change a palette to the new rgb-values (line is RGBRGBRGB... for all 256
colors). The palette is activated as default image palette by this subroutine.

113

6 Image Window

114

7 Hardware
7.1

Data Acquisition

In this section the data acquisition subroutines are described. For more information about the usage of this subroutines see page 151 about Macros for
Image Acquisition.
The first subroutines are working with the acquisition setup file(s) *.ACQ, then
some subroutines for programming the camera(s) are following. At the end
some special programming modes for very fast data acquisition and online
storage on the harddisc are described.

7.1.1

Changing Parameters in the ACQ File

Get / SetAcqPar
int GetAcqPar ( int type, int nth time, int npar, float& value, string&
command);
int SetAcqPar ( int type, int nth time, int npar, float value, string
command);
Get or set a parameter value of an acquisition item. Same parameters for
both subroutines, except that for GetAcqPar value or command are returned
(read), while for SetAcqPar they are set (written). Both functions return 0 if
the specified item was not found and 1 if the value could be set or get.
type: see table 7.1 below
nth time: 1: first occurrence of item with specified type (normal case)
2,3,...: second, third,... occurrence of item
In case, e.g., a TTL-I/O-item box occurs twice, it is necessary to specify,
which one is meant. So place 1 here, if the item meant is the first
occurrence of its type, otherwise put 2 or 3,... here.
npar: 1,2,3,... which of the different parameters in an item (type=2 the
burst item, e.g., has four parameters 1 to 4). See the table below.
value: parameter value, see table below.
command: string for type=5 execute command
115

7 Hardware

type

Item

npar

value (command)

start

1
2

initial status of port A,B,C


bits used (1) or disabled(0) of port A,B,C

delay

delay time

burst

1
2
3
4

port: 0=off, 1=OUT-1,...


mode: 0=normal, 1=inverted
n: number of pulses
dt: time between pulses [msec]

TTL-I/O

1-8
9-16

action for port A, output 1 to 8


action for port B, output 1 to 8
mode: 0 = no action
1 = set HIGH
2 = set LOW
3 = normal pulse L H L
4 = inverted pulse H L H

wait for N-trigger

1
2
3

port: 1=IN-1, 2=IN-2,...


mode: 0=normal, 1= detect inverted
pulse
n: number of triggers counted

execute command

command

framegrabber action

mode: 0 = no action
1 = wait for V-sync
2 = wait for start of V-sync
3 = wait for end of V-sync
4 = wait for not-V-sync
5 = wait for even field
6 = snap(digitize), return immediately
7 = snap + wait
8 = start continuous snapping
9 = stop snap
continued on next page

116

7.1 Data Acquisition

type

Item

npar

value (command)

interrupts

mode: 0 = no action
1 = enable irqs
2 = disable irqs
3 = normal priority
4 = high priority
5 = realtime priority
Note: for Windows 95/98 this command
disables the interrupts, under Windows
NT the program uses the priority levels.

10

readout camera

1
2

number of camera
Disable or enable the automatically storage of the acquired buffer. Please see page
122 for more information about the fast
data storage and a description of the parameters.
Return the buffer number of the last or
active TakeImage destination.

-1
11

camera action

1
2

N number of camera
mode: 0 = <no action>
1 = start exposure
2 = clear image memory

12

energy

mode: 0=before readout,


1=during readout,
2=after readout
device: see constants ENDEV x in macro
file SYS ENERGY.CL

2
13

multi-readout
camera

0x01 = camera 1, 0x02 = camera 2, etc...

Disable or enable the automatically storage of the acquired buffer. Please see page
122 for more information about the fast
data storage and a description of the parameters.
continued on next page

117

7 Hardware

type

20-21

Item

CIO boards
20 = CIO16 / 330
21 = CIO16 / M1

npar

value (command)

-1

Return the buffer number of the last or


active TakeImage destination.

1
2
3
4
5
6
7

start / line trigger port


start / line trigger mode
storage buffer
number of lines
points per line
Out-A4 N (only CIO16 / 330)
Out-A4 mode (only CIO16 / 330)
mode: 0 = off, 1 = once, 2 = burst
returns the number of the correct CIO
buffer during TakeImage, e.g. when executing Action-macros

10

Tab. 7.1: Parameters of SetAcqPar and GetAcqPar


Examples:
float delay;
// read delay time of first delay item:
GetAcqPar(1, 1, 1, delay);
// increase delay by 10 msec:
SetAcqPar(1, 1, 1, delay+10.0, "");
// set Out-A4 HIGH:
SetAcqPar(3, 1, 4, 1, "");
Load / SaveAcqFile
int LoadAcqFile( string file name );
Load an Camera Parameter file (*.ACQ). If file name is the empty string,
the currently active file will be reloaded.
Return 0 if ok. If the file does not exist, then file acq/standard.acq is loaded
instead and the function returns -1.
void SaveAcqFile( string file name );
Save currently active acquisition parameter to file. If file name is empty, the
name of the active file is used.
GetNumberOfImages
int GetNumberOfImages();
Get the number of cameras/buffers readout during TakeImage.
Some initializing for the following TakeImage is also performed !
118

7.1 Data Acquisition

7.1.2

Programming Cameras and Acquisition of Images

For some additionally descriptions and an example see page 151 about Macros
for Image Acquisition.
TakeImage
void TakeImage (int bufnum);
Acquire one image (per camera) using the current Camera Parameters. Some
postprocessings are executed during this function, e.g. software binning, image
rotation and background subtraction.
The background subtraction can be defined in dialog Background (see menu
AcqSetup Background Settings). The corresponding variables are:
Variable
Function
BackgroundSub

Disable (0) or enable (1) background subtraction

BackgroundSubCam[6]

Disable or enable subtraction for the cameras

BackgroundBuffer

First of six background buffers (for up to six


cameras). The buffers are reserved buffers, the
number should not be changed by own macros.

BackgroundOffset

Offset to be subtracted from the background image.

Get / SetCamPar
void SetCamPar (int CamNum, int ParCode, float Value);
float GetCamPar(int CamNum,int ParCode);
Set or get special camera exposure parameters for camera CamNum (1 to 6).
Note: Not all parameters can be set for all cameras!
ParCode
value
1

0
1
2

camera trigger mode:


internal trigger
external trigger, rising edge
external trigger, falling edge

0.2 - ...

exposure time in msec or sec

0
1

exposure modes:
single,
double (PIV cross correlation) normal with antiblooming,

continued on next page

119

7 Hardware

ParCode

value
2
3

double long (take 2 single images),


double (PIV cross correlation) fast ( 1 us) without anti-blooming

get: max. X-size (width) of the CCD

get: max. Y-size (width) of the CCD

0...

camera operation mode (camera dependant)

get: number of frames

timeout in seconds

100

get: status byte; -1 = camera is not initialized

101

get: temperature of the electonic

102

get: temperature of the CCD

103

get: temperature warning level (0=off, 1=no


warning, 2=gray, 3=green, 4=yellow, 5=red)

104

get: bits per pixel (8 or 16)

122

0,1

scale of exposure time: 0=msec, 1= sec

130

0,1

disable or enable the image defects


correction,
which is defined in file
Setting/CamDefAreaN.txt with N as the
camera index (0-5)

900

0..4

Disable or enable the automatically storage of


the acquired image of this camera. Please see
page 122 for more information about the fast
data storage and a description of the parameters.

Imager-3,FlowMaster-3 only:
4
-1
0
-2
-3

program multiple exposures (delay/gate sequence):


start exposure list
add delay/gate to list
end-of-list, program camera
start triggered multi-exposure list (numExposures, delay, gate)

Kodak camera only:


10

1 - 255

transfer pulse delay TPD, dual frame mode

11

1-5

transfer pulse width TPW, dual frame mode


continued on next page

120

7.1 Data Acquisition

ParCode

value

NanoStar only:
20

set COC, program parameters into CCD

21

0-999999

I/I-delay

22

0-999999

I/I-width

23

0-999

I/I-gain

24

0-...

loop count

25

[msec]

phosphor decay time

DynaMight only:
50

get: current temperature; set: temp. setpoint in


degrees/100

51

number of clear cycles

52

0-5

clearing mode:
3=post exposure

0=never, 1=pre exposure,

53

1 - 16

ADC gain (has no effect)

PixelVision only:
1

0, 1

exposure mode: 0= software/internal, 1= external trigger

66

0, 1

interrupt mode: 0= line, 1= frame

67

-2,..,8

gain page: -2= low, -1= high

68

1, 4

number of channels

69

0, 1

use analog balancing off/on

70-72

fast acquisition mode

102

set: CCD-temperature (Kelvin)

Remote Cameras only:


-1000

-1, 0

-1001

-1,
1

Get: number of the remote server, returns -1 for


local cameras
0,

Mode of the remote TakeImage: in normal cases


the remote camera acquires its image and sends
it to the master (mode 0); if mode is -1, the remote DaVis stores the file automatically in the
file defined by variable remoteDestFile during
the call to SetCamPar; if mode is a positive integer number, it defines the buffer number on the
local DaVis to hold the acquired image; if mode
is not 0, the acquired image is not send to the
master PC
continued on next page

121

7 Hardware

ParCode

value
Tab. 7.2: Parameters of SetCamPar and GetCamPar

Get / SetReadoutParameter
void GetReadoutParameter ( int CamNum, int& x1, int& y1, int& x2,
int& y2, int& xbin, int& ybin, int& binmode, int& correction );
void SetReadoutParameter ( int CamNum, int x1, int y1, int x2, int
y2, int xbin, int ybin, int binmode, int correction );
Get or set the camera readout parameters for camera number CamNum: AOI
(x1, y1, x2, y2), binning (xbin, ybin, binmode) and correction (rotation
or correction). See subroutines Mirror, Rotate, FlipBuffer on page 76 for
more information about the last parameter.

7.1.3

Framegrabber Special

Get / SetFramegrabberADC
void GetFramegrabberADC (int channel, int& offset, int& gain);
void SetFramegrabberADC (int channel, int offset, int gain);
Get (or set) the framegrabbers offset (0..4095, default value 2047) and gain
(1536..4095, default 2048). Specify the input channel 1..4 or 0 for all channels.
For framegrabber GVS parameter reference (0..63) instead of gain.

7.1.4

Fast Data Acquisition and Storage

A special mode can be enabled to acquire images with the maximum frame
rate of a camera and store the images online on harddisc. In this mode the
number of images to acquire is only restricted by the size of the harddisc and
not by the much lower size of the PCs memory.
Note: Some special hardware may be needed to realize the maximum rate.
Please contact LaVision for more information about the possibility of reaching
the maximum rate with your camera and your hardware. For example a PC
mainboard with two CPUs and a RAID controller for fast harddisc access may
be needed.
The fast storage is executed at the end of the image acquisition in subroutine
TakeImage and not by an additional StoreBuffer command. To enable the
mode either the readout acquisition item or the camera itself can be used: Ei122

7.2 Modify ACQ Files

ther
SetAcqPar(readout/multireadout,n,2,mode,"")
or SetCamPar(camN,900,mode).
Before calling this subroutines, the name of the file must be set to variable
tempstr as an indirect parameter. Both subroutines itself copy the value
of tempstr, so this global variable can be used without problems for other
purposes.
To get information about the storage mode please use the subroutines
GetAcqPar(readout/multireadout,n,2,...)
or GetCamPar(camN,900), which will return the mode and the filename in
variable tempstr.
The main difference between the usage of SetAcqPar and SetCamPar is, in
the first case the complete buffer acquired from all cameras is stored by the
multireadout item, in the second case every single camera stored its own frames
in different files.
The following modes are available. For modes 2, 3 and 4 the filetype should be
IMX, and the subroutine returns immediately without waiting for the storage
to complete.
Mode Function
0

Disable storage

Simple storage,
StoreBuffer

Fastest mode: some threads are started during the first


TakeImage to compress the buffer data in memory (filetype
IMX) and then store on harddisc. The buffer will be locked
until the compressing has finished.

Compress the buffer data and return, but store the file in background mode. Slower than mode 2.

Return immediately. Compression and storage are executed in


a single thread. The buffer will be locked until the storage has
finished. This mode is slower then mode 2.

7.2

same as additional call to subroutine

Modify ACQ Files

It is possible to modify the Acquisition Timing ACQ files with a text editor,
e.g., delays are inserted or more cameras added.
Again, we advise the user to store the acquisition file under a new file name.
Both first lines of every ACQ file have to follow the syntax
#AcquisitionParameterFile
123

7 Hardware

description
The DaVis acquisition items are divided into some groups, which are described
on the following pages.
At the end of this chapter the complete FS2 INT.ACQ is described.

7.2.1

Executing the Acquisition File

Subroutine TakeImage internally executes the active ACQ file to acquire images from the enabled cameras: One image per camera, some cameras may
acquire a multi frame image.
Every item of the ACQ file is executed three times during the TakeImage:
Starting with the first item, for every item an initialization function is called
e.g. to activate a camera. During the second loop, all items are executed,
e.g. to transfer the image from the camera into a buffer. During the third
loop some final actions are executed, e.g. to deactivate the device and to
postprocess the image.

7.2.2

General Items

These general items are identical for different cameras. Only the read-out
item is updated according to the camera in use.
Item Start

The TTL-I/O board is initialized. See TTL-output below.


Syntax:
#Start
init pio state = 0x1 0x40 0x0 0xff 0xff 0x0
The first three values describe the initial state of Port A, Port B and Port C
with each eight bit. The last three values define which bits should be used.
Their state will stay unchanged by DaVis .
Item End

124

7.2 Modify ACQ Files

End of the sequence. The TTL-I/O-board is automatically reset to the startsettings.


Syntax:
#End
Item Interrupts

At the beginning of the acquisition sequence interrupts of the computer can be


disabled. This ensures, that there are no timing problems with other computer
actions during image acquisition (especially useful for FlameStar-II or III). At
the end of the sequence the interrupts have to be enabled again.
Note: For Windows 95/98 this command disables the interrupts. Under
Windows NT the program version DaVis 5.5.2 gets a realtime priority. Since
DaVis 6 the list includes three additional items: normal priority, high priority
and realtime priority. The last item must be handled with care, because in
realtime priority it is impossible to move the mouse or press a key!
Syntax:
#Interrupts
mode = 2
Use the modes 0 = no-action, 1 = enabled, 2 = disabled, 3 = normal, 4 =
high and 5 = realtime priority.
Item Wait N-Trigger

Wait until a specified number N of external events has occurred. On the left
the input line of the TTL-I/O board is specified (where to wait for the external
trigger: IN-1 to IN-4). The event to react on is the raising LH or falling
edge HL of the pulse(s).
Syntax:
#WaitNTrigger
port = 0 (IN-1 to IN-4)
mode = 0 (0=L->H, 1=H->L)
N = 1 (number of triggers)
125

7 Hardware

Item TTL-output

Control of the TTL-Input/Output board output lines.


A and B are the two output ports of the 8255-chip, while the bits are numbered
from 1 to 8, corresponding to the output lines. The lines can be set (high/low)
or short needle pulses can be generated, and that is symbolized by:
set low
set high
(x) not changed
(P) generate needle pulse low/high/low (normal)
(p) generate needle pulse high/low/high (inverted)
Syntax:
#SetTTLOutput
action port A/B = 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 (0=no action,
1=set high, 2=set low, 3=trigger high, 4=trigger low)
Item Delay

Wait a specified number of milliseconds (here 0.5 msec) before performing the
next item.
Syntax:
#Delay
time = 5 msec
Item Burst

126

7.2 Modify ACQ Files

The burst item is most of the times used to trigger the image intensifier (and
laser). This item uses the modes N-pulses (0), N-inverted-pulses (1), 1-gate
(2) or 1-inverted gate (3).
Syntax:
#Burst
port = 4 (0=off, 1=OUT-1, 2=OUT-2, ...
mode = 0
N = 1 (number of triggers)
dt = 1 msec

Item N-pulses
In the mode N-pulses a burst of N short pulses is send out. Wait for a
specified time dt after each pulse.

1 gate:
The mode 1 gate sends a gate of the length dt in milliseconds. The
gate is normal (Low-High-Low) or inverted (High-Low-High).

Choose the output line OUT-A1 to OUT-A4 or switch Off. In most


Camera Parameter setups, OUT-A4 is used to trigger the image intensifier. So take Background, which is defined by not triggering OUT-A4,
is performed correctly (without opening the image intensifier).
Item Energy

Readout energy values from an analog device (CIO16 ADC, image area, sample
c or laser) and store the values as buffer attributes.
& hold board, FieldMaster
Press button Setup Device to open a dialog where detailed settings for all
127

7 Hardware

devices can be done. In chapter Analog and Energy Data in the DaVis
Manual more information about setting up parameters, about an automatically image correction and about viewing the data in a dialog on screen are
given.
Syntax:
#Energy
mode = 2
device = 1
Item Execute Command

Execute arbitrary CL macro commands. In the above example, the function


ComputeVectors is called to calculate a vector field of the acquired image
buffer.
In default mode the CL macro is executed during the second loop of the acq
file processing. Sometimes it is useful, e.g. for additional postprocessing jobs,
to execute the command after the default image postprocessing (background
subtraction, image rotation and other). For this case, the command string has
to start with letter ~.
Syntax:
#ExecuteCommand
ComputeVectors(Buffer);

7.2.3

Readout Camera Items

A readout camera item is needed to receive an image from a installed camera.


For each installed and used camera there must be one readout item in the
acquisition file. It is possible to install more than one camera but use an
acquisition file which only reads out one of this devices.
Since DaVis 5.5.2 the software supports the new multi camera readout item.
Item Camera Action
Syntax:
#CameraAction
camera = 1
mode = 2
128

7.2 Modify ACQ Files

The camera action is executed before the camera readout in most cases. It
can be used to start the exposure (mode=1), clear a camera pipeline (mode=2)
or clear the CCD or execute other actions.

Item Readout Camera


Syntax:
#ReadoutCamera
camera = 1
The camera value is the number of the selected camera (1..6) or 0 to disable
the item.
Special modi are implemented for fast readout of two or more FlowMaster 3
cameras. In this cases the speed will be the same as for a single FM3 camera.
Mode 7 means fast readout of cameras 1 and 2 (both FM3 types), mode 8
means cameras 1 to 3, mode 9 means cameras 1 to 4 and mode 10 means
cameras 3 and 4. Mode 9 may cause problems because the limit of the PCI
bus can be reached. The solution is a d ecrease of the data rate by selecting
smaller readout regions of by including a delay into the acquisition file.

Item Readout Camera FS/LS-II

The cameras memory is read out into an image buffer. Depending on the
camera in use this item looks slightly different. The one shown above is for a
FlameStar or LightStarII. Items for other cameras are shown below.
With the readout item the CCD-exposure is stopped automatically. For example, if it is specified to control the CCD with the TTL-I/O port OUT-A1,
this port is automatically set high to terminate the CCD-exposure before the
actual readout begins.
Area Of Interest: With the coordinates x1, y1, x2, y2 an Area Of Interest
AOI is set in the Camera Parameter dialog box, which can be smaller than
the maximal size of the CCD field. This decreases the acquisition time and
memory. In order to resize the AOI to the normal size (full CCD), click on
the max button
129

7 Hardware

Item Readout Camera FS III

For FlameStar III cameras it is possible to set binning factors separately in


the horizontal (xbin) and vertical (ybin) direction. This is an extra option
in addition to the AOI which has already been described directly above.
Item Readout Camera StreakStar

For a StreakStar camera working with the LaVision sequencer in the linear
streak and the sweep / framing mode the full size of the CCD is read out.
In order to work in the sequencer burst (imaging) mode, the camera has
to be specified as FlameStar-II! In this mode only half the CCD size is read
out (384x286).
Item Readout Camera test image

If the camera to be readout is specified as the test image (set in the Camera
Setup), this item appears.
In this case no actual readout takes place, but a fixed test image gets stored
in the active image buffer.
Item Multi Readout Camera

130

7.2 Modify ACQ Files

Syntax:
#ReadoutMultiCamera
camera = 1
Readout all selected cameras into a single buffer. The camera value is a bit
coded value (bit 0 for camera 1, ...) , which is the sum of 1 for camera 1, 2
for camera 2, 4 for camera 3, ..., 32 for camera 6.
Each camera image and even each single image of a double image camera is
stored as a single frame. The resulting buffer includes at least n frames if n
cameras are enabled. Some buffer attributes are set to describe the source
camera for every frame and store other information.
The multi camera readout item can combine cameras and settings with the
different finale image sizes. This means, all cameras images can have a different size after binning and image correction! In this case the final frame
size is calculated as the maximum width and maximum height of all single
camera frames. The real image size of erevy frame is stored as buffer attribute RealFrameSizeX with X as the number of the frame (0,..,n-1). There
are functions available to copy the real frame out of this large buffer into
an own buffer (see the CL-Manual and macro CopyRealFrameToBuffer).
It is possible to use more than one multi readout item in an acquisition file.
The item checks for optimal readout combinations for the FlowMaster cameras, which are described in the section above about the single readout camera
item.

7.2.4

Video Cameras Only

The items described in this section are only used when working with a Video
camera (Falcon or Hawk). In this case a framegrabber performs the data
transfer from the analog output of the CCD to digital data for the computer
input.

The framegrabber can be told to wait for its vertical synchronization signal
(V-Sync), in order to synchronize the image acquisition procedure with the
frame grabbing. In the standard setting snap (digitize) + wait it waits
until the end of the next V-Sync.
The other modes are only important when working in the fast image display
mode Framegrabber Life, where all digitized images are displayed on the
screen. They relate to the digitization of the incoming video signal. The
131

7 Hardware

standard mode if not using framegrabber life is snap (digitize) + wait.


snap, return immediately:
The framegrabber digitizes the next two incoming frames. This function gives
the command to the framegrabber and returns immediately. Note that it takes
between 40-60 msec until the complete image is digitized (time to next VSync
+ 20 + 20).
snap + wait (standard mode)
The framegrabber digitizes the next two incoming frames and waits until
the digitization is completed.
start continuous snapping
Tells the framegrabber to digitize all frames from now on. This is only
visible in the framegrabber life mode. Before reading-in an image
into a buffer with the camera read-out item, the stop snapping function
should be called first.
stop snapping
Tells the framegrabber to stop snapping
The framegrabbers memory is read out into the active image buffer.
For a framegrabber the read out can be performed in three different
modes. The selection must be done as operating mode in the Camera
Parameter dialog box (see page 90).
retrieve image
In this standard mode the image is stored in the active image buffer.
add image to buffer
Adds each image from framegrabber memory onto the already existing
buffer (averaging or summing mode).
peak detection
Analyses the image as specified by the parameters in the Real Time Peak Detection dialog box and stores the peak intensities and coordinates into
the active buffer.
Syntax:
#FramegrabberAction
mode = 7

7.2.5

CIO-16 Special

The following item is designed for working with a CIO-16 AD-Converter-board.


132

7.2 Modify ACQ Files

In the above example is specified to read 1 line of 720 data points into storage
buffer 10.
Before the AD-conversion begins, the computer optionally waits for a start
trigger. (In the above example it is specified as the rising edge (LH) of a
pulse at IN-1.)
The acquired data points are stored line by line in the specified storage buffer
(the storage buffer has to be different from the active buffer!). If buffer=-1
the next buffer after the camera buffer is used, if buffer=-2 the data is stored
in an internal (reserved) buffer, which is available only via the energy item,
buffer=0 means no action.
The storage starts in the first pixel of the first line (Pix[buf,0,0]). The following points are written into the next pixels of the same line (row) until the
number data points per line is reached (up to Pix[buf,0, DataPointsPerLine-1]).
If number of lines is set higher than one, the process is repeated and the
storage proceeds in the next line and so on until the number of lines is completed.
The button CIO 16 setup opens the CIO-8/16 Setup dialog box to specify
the input channel(s) and internal clock rate. Here it is possible to enable the
storage of all CIO data as attributes of the first camera buffer.
Consult the CIO Hardware Manual for further details.
133

7 Hardware

7.2.6

Restart Mode

The restart mode has been especially designed for the investigation of cycle
to cycle fluctuations in the cylinder of a car engine.
readout sub-frames
In this mode only a fraction of the CCD image is read out into DaVis computer
memory. Such a sub-frame consists of a selectable number of lines (each line
has 384 columns as usual). Each time the camera is triggered (short LOWpulse) the CCD performs a frame-transfer followed by readingout the lines.
number of subframes:
Defines how many subframes are read into the image buffer. Each time
going through the loop as described below.
lines per sub-frame:
Each sub-frame consists of this specified number of lines.
loop:
Optionally, wait for one start trigger for every frame (e.g. at IN-1)
to begin the acquisition. OUT-A1 pulse transfers the image into the
memory area. Immediately, readout sub-frame into the active image
buffer.
timing considerations
For a FlameStar II the read-out of a whole image of 286 lines last approximately 100 msec. By reducing the number of lines the readout is faster. When,
e.g., recording a phenomena with 40 Hz (every 25 msec) a readout of about
70 lines can take place.

7.2.7

Example

The Acquisition Timing Dialog displays the actual loaded and activated
acquisition timing. Press button Load to activate another timing. After
changing some settings you can save the changed timing with button Save
or store it with another filename via button Save As. If you change some
settings in the original file with a text editor, e.g. add a new acquisition item,
please press Reload to activate your changes.
The expert level can be enabled to change critical settings like the initialization state of the TTL ports (displayed right to the start item).
134

7.3 TTL I/O-Board

7.3

TTL I/O-Board

GetPio
int GetPio (int port);
Get the state of a port of the TTL-I/O-board (Parallel Input/Output, PIO)
device. Only the state of the output bits is returned for port A (port=0), port
B (port=1) or port C (port=2). For port=-1 the state of the input lines of
port C, bits 1...4, is returned.
The lines are numbered from 1 to 8, e.g. a return value of 0x15 means: lines
1, 3 and 5 high.
135

7 Hardware

136

start

The TTL-Input/ Output-board is initialized.

interrupts

The interrupts of the computer are disabled in order to


avoid timing problems.

TTLoutput

The ports of the TTL-I/O-board are set to be ready for


the accumulation of light.
OUT-A1 LOW: (usually controls the CCD exposure)
an initial frame transfer is performed
OUT-A7 LOW (only used for FSII E camera systems).

delay

Wait the specified number of milliseconds (here 0.5


msec) befor performing the next item.

TTLoutput

The ports of the TTL-I/O-board are set to enable the


I/I Controller.
OUT-A3 HIGH: usually enables the image intensifier,

burst

The actual trigger to open the camera (image intensifier) takes place. (default port is OUT-A4).
In the mode N-pulses and the number of pulses set to
N = 1 the image intensifier will be opened once. (For
more than one puls (N= 2 or more), dt defines the time
between two pulses.)
The I/I-exposure opening is defined via the I/I Controller dialog box (parameters gate, delay). If several trigger will be performed, the time gate + delay
has to be shorter than dt.

delay

Wait the specified number of milliseconds befor performing the next item.

TTLoutput

The ports of the TTL-I/O-board are set to disable the


I/I Controller and CCD-exposure.
OUT-A1 HIGH: end of CCD-exposure,
OUT-A3 LOW: disables the image intensifier.

readout
camera

The specified camera (here camera1: FlameStar/


LightStar-II) is read out into the active image buffer.
With the coordinates x1, y1, x2, y2 an Area Of Interest AOI is set, which can be smaller than the maximal size of the CCD field. In order to resize the AOI to
the default (its maximal size), click on the max button.

interrupts

The interrupts of the computer are enabled.

7.4 General I/O

SetPio
void SetPio (int port, int bit, int switchOnOff);
Switch a line on a port of the parallel input/output (PIO) device.
port: 0..2
bit: 1..8
switchOnOff: 0 ( Off, TTL-High ) or 1 ( On, TTL-Low ).
Get / SetTimer
int GetTimer (int timer);
void SetTimer (int timer, int mode, int count);
Get (or set) the count value (0..65535) of a 8254-timer (0..2) on the PIO card.
A count value of 0 is equivalent to 65536.
Consult a manufacturer description of the 8254 (or 8253) chip for the different
possible modes 0-4.
SetStepmotor
void SetStepmotor ( int motor, float position);
Set a step motor to specified position (in user defined units).
motor: 0 for step motor 1, 1 for step motor 2.
This subroutine is performing the following actions:
limiting position to StepMin[ ], StepMax[ ]
then converting position to actual step motor steps using StepUnitA[ ],
StepUnitB[ ] and StepPosB[ ]
then calling RotateSteps() to turn the step motor
at the end StepPos[ ] is set to position.
RotateSteps
void RotateSteps (int motor, int steps);
Rotating step motor by the specified number of steps.
motor: 0 for step motor 1, 1 for step motor 2.
Low-level step motor rotation taking care of slippage and frequency ramp.
using: StepSlip[ ], StepDuty[ ], StepFmin[ ], StepFmax[ ] and StepTmax[ ]

7.4

General I/O

HardwareInit
int HardwareInit( int mode );
137

7 Hardware

Initialize and check all hardware, return error code or 0=ok.


This is the function called when closing the hardware parameter windows.
mode = -1: all hardware components, =0: general hardware parameter, =1-6:
camera 1-6

7.4.1

Serial Port

All serial port subroutines need the number of the COM port as first parameter. In normal cases the PC has two ports (port=1/2), but DaVis supports
up to 19 serial ports. The ports 20 to 23 are reserved for the framegrabber
PCDIG.
Since DaVis 6.1 the execution can be done in a special mode to receive strings
with a size larger than some kilobytes or to receive a complete word buffer
(could be used for raw data instead of character strings). The special modes
are defined by subroutine SetComParameter.
SetBaudRate
void SetBaudRate (int port, int baud);
Set the baud rate (bits per second) of the serial port. Most common values
are 1200, 2400, 9600 and 19200. The maximum rate depends on your PC, but
it can be 128 000 or even more.
SetComParameter
void SetComParameter ( int port, int bytesize, int parity, int stopbits);
Set special parameters of a serial port. Default settings are 8,0,0 for every
port. If single parameters should be changed, use value -1 for the unchanged
parameters.
bytesize : 5 to 8
parity : 0=no, 1=odd, 2=even, 3=mark, 4=space
stopbits: 0=1 bit, 1=1.5 bits, 2=2 bits
The use of 5 data bits with 2 stop bits is an invalid combination, as is 6, 7, or
8 data bits with 1.5 stop bits.
Use bytesize<0 to change some special settings:
bytesize = -1: use overlapped mode if parity!=0
bytesize = -2: set buffer size for SendCom to value of parity
bytesize = -3: close serial port
bytesize = -4: not used yet
138

7.4 General I/O

bytesize = -5: echo mode: undefined (0), no echo send by device


(1), echo send by device (2)
bytesize = -6:
receive

msec pause between single characters during send or

The following macro functions can be used as shortcuts for the special parameter settings:
void SetComDefault( int port );
void SetComOverlappedMode( int port, int enable );
void SetComBufferSize( int port, int buffersize );
void CloseComPort (int port);
void SetComFastMode (int port);

SendCom
string SendCom ( int thePort, string str2send, int theTimeout, int
termchar);
Send a character string to a device connected via a serial port. Returns the
received string, which length is smaller than 4096 characters by default. For
camera programming the macro SendCamCom should be used instead of this
subroutine.
str2send: string to be sent (may be , in which case it is only checked, if
something is received)
theTimeout: wait at most this number of milliseconds for response from device; dont wait and return immediately if theTimeout<0
termchar: if this char is received, return immediately: usually this is 13 =
end-of-line (CR)
Example:
SendCom(1,"", 0, 0 ); // clear input buffer (COM1:)
receiveStr = SendCom(1, "hi", 1000, 13)
Wait for response at most 1 sec or until a carriage return comes.
Fast sending and receiving:
The fast version of sending and receiving strings is disabled by default for
downwards compability with earlier versions of DaVis . If the echo mode
is disabled by SetComParameter(port,-5,1,0) and the character pause is
switched of by SetComParameter(port,-6,0,0), it is possible to send large
strings with a high baudrate.
139

7 Hardware

ReceiveCom
string ReceiveCom (int thePort, int theStringLength, int theTimeout)
Receive a character string of length theStringLength from a serial port. Returns if the complete string has been received or if timeout.
Note: The maximum time waited by this subroutine is calculated from the
given timeout (in milliseconds), from the string length and the baud rate of
this serial port.

ReceiveComBuffer
int ReceiveComBuffer (int thePort, int theWordValues, int theTimeout,
int theBuffer)
Receive a word array of size theWordValues from a serial port and store the
array in theBuffer., which is set to a size one line with theWordValues pixel.
The number of received words is returned.

SendCamCom
string SendCamCom( int theCamN, string theString2send, int theTimeout,
int theTermChar);
This macro sends a command via the comport to a camera (1..6) and returns
the answer. Such programming of cameras is used often for cameras with
framegrabber cards.
For local cameras this macro uses some global variables to get the number of
the comport, which is connected to the camera. When using a remote camera
(another PC with DaVis to control a second camera), this macro sends the
command to the remote PC, which transfers the command to the camera and
returns the answer to the master DaVis .

Send / ReceiveByte
void SendByte (int port, int byte);
Send a character to a device connected via a serial port.
int ReceiveByte (int port, int timeout);
Receive a character from a device connected via a serial port. Wait for response
at most timeout milliseconds. Returns a negative value if no character has been
received until timeout.
140

7.4 General I/O

7.4.2

Special Devices

SetSequencer
int SetSequencer( int type, int comport, int mode, int c1, int c2,
int c3, int c4 );
Program the LaVision sequencer.
type: 1 = sequencer version 3.0 (1200 baud)
2 = version 4.0 (9600 baud)
comport: 1 = COM1:, 2 = COM2:, ...
mode: command type (see sequencer manual for details). If mode= 0 check if
sequencer is properly responding. Change baud rate if necessary.
c1,c2,c3,c4: parameters for specific command
The return value is usually the requested response from the sequencer. If the
sequencer is not responding, the return value is 0.
DAP WritePattern
void DAP WritePattern (int theNumSequences);
Program the DAP pattern generator with one or two sequences.
DIO48Init / SetValues / SetLine
void DIO48Init (int BaseAddr, int A 0, int B 0, int C 0, int A 1, int
B 1, int C 1);
Set the 6 registers of the DIO48 board to defined states. DIO48 Digital Input/Output Board routines for Langmuir Scan.
void DIO48SetValues (int value1, int value2, int is12Bit);
Output two 4-bit or 12-bit values on the two banks of the DIO48.
void DIO48SetLine(int LineNo, int mode);
Set lines state; mode: 0= set low, 1= set high, 2= pulse normal, 3= pulse
inverted
inport / outport
int inport (int Port);
int inportb (int Port);
Read a word or byte from an I/O port (like the 80x86 IN instruction).
void outport (int Port, int value);
void outportb (int Port, int value);
Write a word or byte to an I/O port (like the 80x86 OUT instruction).
141

7 Hardware

DACset
void DACset (int value1, int value2, int value3, int value4, int value5 );
Special function for setting DACs to move piezo-table outputs on TTL-I/O
board port B, bits 6(load), 7(clock), 8(data) (of bits 1-8)
ADCReadN
void ADCReadN (int theN, int theTriggerMode );
Read N-data points from ADC
theTriggerMode
0

no trigger

start if voltage threshold

start if voltage threshold

stop if voltage threshold

stop if voltage threshold

Uses variables:
CioData[]: data array for storage of converted data
CioDataN:how many data points have been collected
CioTimeOut: when to abort (no data, no external trigger)
CioThreshold: threshold for start/stop-trigger in [mV]
CioOvershoot: overshoot for start/stop-trigger in [mV]
CioClock: ADC-frequency in [kHz]

7.4.3

Joystick

int SetJoystickEvent( int theJoystick, int theMode, int thePollingMsec,


string theEventHandler );
Define an event-handler for joystick number 1 or 2.
theMode < 0 : release joystick
theMode = 0 : get the position and buttons every thePollingMsec time
theMode > 0 : get event when position has changed (bit 1) or button 1-4 has
changed state (bit 2-5)
For an example of the evebt handler see macro Joy0EventHandler in file
SYS DEVS.CL:
void Joy0EventHandler(int button, int posx, int posy)
{
InfoText("Joystick: 0");
142

7.4 General I/O

InfoText(" button:
InfoText(" pos x :
InfoText(" pos y :

"+button);
"+posx);
"+posy);

7.4.4

GPIB and VISA

Consult also the HP VTL Language Reference Manual for syntax of vi...()functions.
The virtual (vi ) instrument handle is initialized with function viOpen().
viOpen(DefaultRM)
void viOpenDefaultRM (int& session vi);
Opens VTL/VXI-session, returns session-handle.
void viOpen ( int session vi, string name, int& vi );
Opens VTL/VXI instrument for communication.
Example for GPIB (General Purpose Interface Bus) - device communication
with gpib-device on port 4:
int session, gpib instr;
viOpenDefaultRM(session); // open session
viOpen(session,"GPIB::4::INSTR", gpib instr);
// open device driver
... // do reads and writes...
viClose(gpib instr);
// closing communication channels
viClose(session);
viClose
void viClose ( int vi );
Closes the VTL/VXI session or the instrument communication.
viSetAttribute
void viSetAttribute ( int vi, int attr, int value );
Set attribute for VTL/VXI instrument (timeout, term char,...).
viRead
void viRead ( int vi, line buf, int cnt, int& retCnt, int source );

143

7 Hardware

attr

meaning

value

timeout (in msec)

timeout

is termination character enabled?

0(off,default) or 1(on)

termination character

term char (0x00 - oxFF)

Tab. 7.3: Attributes for subroutine viSetAttribute


Read binary data (cnt elements) from the VTL/VXI-device vi into array buf[ ].
Return number of data elements received in integer retCnt.
source

source; data type of buf[] to store data

signed integer (2 bytes); use CL float array float[ ] or CL


int array int[ ] or FLOAT buffer line R/C[ , ]

unsigned integer (2 bytes); use WORD buffer line R/C[ , ]

signed long (4 bytes); use CL int array int[ ]

float (4 bytes); use CL float array float[ ] or float buffer


line R/C[ , ]

If source = 1, the incoming data is transformed and stored correctly in buf[ ].


If source != 0, the raw data is copied byte by byte without modification.
The number of bytes read from the device is:
cnt*2 for source=1/2 or
cnt*4 for source =3/4.
Note:
This function is similar to the HP viRead() function, except that cnt and
retCnt are in units of elements of the array buf[ ] instead of bytes.
viWrite
void viWrite(int vi, line buf, int cnt, int& retCnt );
Write binary data to VTL/VXI-device.
Write cnt elements from buf[ ] to the device vi. Return the number of data
actually transmitted in integer retCnt.
Depending on the type of the array buf[ ], different number of bytes correspond to one element of array buf[ ]:
int[ ]: 4 bytes (the type int in CL is actually type signed long int
float[ ]: 4 bytes
R/C[ , ]: 2 bytes if the row is of type WORD, 4 bytes if buffer is FLOAT
Note:
144

7.4 General I/O

This function is similar to the HP viWrite() function, except that cnt and
retCnt are in units of elements of the array buf[ ] instead of bytes.
viClear
void viClear ( int vi );
Reset VTL/VXI communication, clear device.
viSetBuf
void viSetBuf ( int vi, int mask, int size );
Set size of formatted VTL/VXI-buffer.
mask: 1= read, 2= write, 3= read+write
viFlush
void viFlush ( int vi );
Flush formatted VTL/VXI-buffer (input- and output-buffer).
viPrintf
void viPrintf ( int vi, string text );
Send string to VTL/VXI-device.
viScanf(N)
void viScanf ( int vi, string& text );
Read string (single token) from VTL/VXI-device.
void viScanfN ( int vi, string& text, int nbytes );
Read string (single token) from VTL/VXI-device, at most n-bytes.

7.4.5

Remote Control

DDE Command
string DDE Command( int mode, string theService, string theTopic,
string theMessage )
Communicate via DDE to another application (since DaVis 6.3). Send a DDE
command (mode=1), send a DDE request and receive a string (mode=2), start
(mode=-1) or stop (mode=-2) a DDE server to execute CL commands.
If DaVis is setup as DDE server, another application can execute CL macros
in DaVis and request values of variables. Therefore the application has to call
service DAVIS with topic CL in a XTYP EXECUTE and the macro command as
145

7 Hardware

message text. Optional request of an error code is possible via topic CL in a


(XTYP REQUEST). The returned string includes the number of the DaVis error
code. To request a variable value, the application has to send topic GETVAR
via XTYP EXECUTE with the variable name as message text. The next request
of topic GETVAR returns a string with the (string) value of the variable.
Examples:
Display a pdf-file in the Acrobat Reader:
string path = "c:\davis\help\davis.pdf";
DDE Command("acroview","control","[DocOpen(\""+path+"\")]");
Execute a macro on another DaVis (running as DDE server) on the same
PC:
DDE Command(1,"DAVIS","CL","TakeImage(1);Show(1)");
Request variable ProgramPath from another DaVis (running as DDE
server) on the same PC:
DDE Command(1,"DAVIS","GETVAR","ProgramPath");
string result = DDE Command(2,"DAVIS","GETVAR","");
InfoText(DDE Request: +result);
RemoteSend and RemoteGetInfo
All needed commands for administrating and using Remote-DaVis-PCs are
implemented in macro file SYS REMOTE.CL. Please see chapter Remote Control in the Pro Package Manual for a detailed description.
The following subroutines are used by the master DaVis to communicate to
a client (server), which is defined by parameter theServer, a non-negative
index. For some functions value -1 is used to address all servers at the same
time.
int RemoteSend( int theServer, int theMode, string theBuffer, int
theSource, int theDest )
Send something to a server. Parameter theMode is a constant REMOTE SEND *.
string RemoteGetInfo( int theMode, int theServer )
Return an info string. Parameter theMode is a constant REMOTE INFO *.

146

8 General Macros
8.1

About General Macros

In this chapter important macros are described. They are either loaded
by default (macro files SYS *.CL) or have to be loaded manualy or by a
LoadMacroFile() at the beginning of a user macro file. Have a look into
file SYS MACS.CLwhere lots of useful macros are included.
For more information about macros and macro files use the DaVis Online
Help or open help/index.htm with your browser. See Appendix How to
write your own help files if you want to write some descriptions for your
own macro functions. This descriptions can either be called from the Execute
Function dialog box (button Help) or directly from your prefered browser.

8.1.1

Temporary Buffers

For buffer arithmetics often temporary buffers are used to hold results of single
calculation steps. The calculation function should not use constant buffer
numbers for temporary buffers, because this buffer numbers could be used
by other functions. Function GetTempBuffer() always returns the number
of an unused buffer, which should be destroyed at the end of calculation by
FreeBuffer( int bufnum ) :
// calculate logarithm of buffer 1:
int tempBuf = GetTempBuffer();
LogBuffer( 1, tempBuf );
B1 = B[tempBuf];
FreeBuffer(tempBuffer);

B1 = Log(B1)

Function GetTempBuffer() initialize the buffer with minimal size. It is possible to get a free temporary buffer with initialized size by function GetTempBufferSetSize(
int width, int height, int type) with parameters equal to subroutine
SetBufferSize (see page 59). The next macro creates a temporary buffer as
a copy of another buffer:
GetTempBufferCopy( int theBuffer )
The index of a temporary buffer is above the buffer range for normal usage,
so the buffer is not included in the buffer list window.
147

8 General Macros

At the end of a macro run, when the STOP button disappeares, all temporary
buffers are destroyed by the automatically called function DeleteTempBuffer().
So this buffers can not be used to show results of a macro. For this case please
use the reserved buffers, which are described in the following section.

8.1.2

Reserved Buffers

The reserved buffers are used e.g. by the movie dialog to hold the data to be
displayed on screen. A macro dialog should call for the number of such a buffer
at its first execution during one run of DaVis . Then the macro can use this
buffer until DaVis is finished. The reserved buffer can not be freed and given
back to the system for further usage by another macro. To avoid memory
leaks you can set the size of the reserved buffer to 0 (call FreeBuffer).
int GetReservedBuffer(); returnes the buffer index of the reserved buffer.
The index is above the buffer range for normal usage, so the buffer is not
included in the buffer list window.
Example:
// Global variable to hold the index of my buffer.
// Set to 0 and receive the index at the first call.
int myReservedBuffer = 0;
void SetupDialogMyFunction()
{
if (myReservedBuffer==0)
myReservedBuffer = GetReservedBuffer();
// now I can use the buffer...
}

8.1.3

Stop Action and Error Action

At every end of a macro run a special macro is executed as stop action. The
default stop action is defined by CL-variable DefaultStopAction:
string DefaultStopAction =
"DeleteTempBuffer();
Message(\"CL macro stopped\",max(1,pause/2))";
This will delete all temporary buffers and show the message CL macro
stopped for a short time.
The user should not change this default action when programming own macros.
Instead the predefined CL-variable StopAction can be used like
StopAction = MyOwnStopAction(); + StopAction;
148

8.1 About General Macros

Now at the end of a macro run tbe user defined macro MyOwnStopAction() is
executed before the default stop action. DaVis deletes the StopAction string
at every macro start, so the user has to redefine the value at every macro start,
if an action should be executed.
The strings DefaultErrorAction and ErrorAction are handles as before but
executed when an error occures and before the Error Dialog appeares.

8.1.4

Busy Text

During extended calculations or other time intensive functions it is useful to


present some information for the user about the activity, e.g. an information
in the status bar with a progress percentage. Some predefined macros can be
used to open the following dialog on screen and display a text and a progress
bar. The dialog includes a Stop button to break the function and execute the
ErrorAction (see section above).

The macros are defined in macro file SYS DLG.CL.


void BusyText (string text)
Open the Busy dialog without the progress bar and display the given text. If
the dialog is visible, simply change the text.
void BusyProgress (int percent)
Open the Busy dialog with an empty text and set the progress bar to the
given value in range 0,..,100. If the dialog is open, set the bar to the new value
and dont change the text.
void BusyDone()
Close the dialog.
void BusyStart (int doCenter, int hasProgressBar,
string executeAfterModalShow)
Open the Busy dialog, center it in the DaVis main window if doCenter=TRUE,
display a progress bar if hasProgressBar=TRUE, make the dialog modal and
execute the command executeAfterModalShow if the string is not empty. The
command must include your calculation function, because the modal dialog
149

8 General Macros

stops executing the calling macro when opening the dialog! The last thing the
command has to do before finishing is closing the dialog by calling BusyDone().
Then the function which called BusyStart will continue.

8.1.5

Additional Macros for Dialogs

Additional useful dialog macros are described in chapter Additional Item


Macros on page 186.

8.1.6

Additional Mathematical Macros

Some mathematical functions are defined in macro file SYS MATH.CL. See
chapter Mathematical Macros on page 50 for descriptions.

8.2

Macros for Simple Parameter Editing

Sometimes a function needs one or two parameters only, or it is useful to ask


the user for additional information during the macro execution. In this cases
you dont need to create a complete dialog to let the user enter this parameters.
There are some functions included in DaVis for simple parameter editing.
The Question Dialog
The Question dialog can be opened by subroutine Question (see page 35)
. The text of the question can be defined as parameter of this subroutine.
The user can select between Yes, No and the Stop button, which breaks the
macro execution.

The Message Box


The Message dialog can be opened by subroutine Message . In most cases it
is used to give the user a simple information and wait until the user presses
the OK button. Other operation modes allow the creation of a dialog with
two buttons (OK and No or OK and Abort) or with all three buttons.
150

8.3 Macros for Image Acquisition

The Choice Box


The following dialog can be used to let the user select between a free number
of items. The text in the title bar and the description are free. The lines of
the description and the different items must be devided by \n characters.
The macro returns either the number of the item, starting with value 0, or
value -1 if the user presses the Cancel button. Additionally the default item
can be defined to number 0,..,n-1 for n items.
int DialogChoice( string theTitle, string theText, string theItemList,
int defaultValue )

8.3
8.3.1

Macros for Image Acquisition


Image Acquisition Loop

The are three very important macros which have to be used when images
should be acquired: SetupAcquisition(), GetNumberOfImages() and EndAcquisition().
If not used around a call to TakeImage() the image may not be acquired correctly! Intelligent cameras dont work without a call to these macro functions.
All this macros are find in SYS ACQ.CL and loaded by default into DaVis .
If you dont want to do special actions while acquiring images you can use
macro GetSingleImage() for acquiring one image or macro ContinuousGrabbing()
151

8 General Macros

for a series of images. Both macros use the recent used buffer to store the images (variable Buffer).
Use this example for your own acquisition functions, either for single acquisition or for a series of images:
int buf = theBufferWhereToStoreAcquiredImages;
if ( SetupAcquisition() ) return;
// All camera initializing is done here.
// Return TRUE if an error occured.
int ncam = GetNumberOfImages();
// number of buffers used by TakeImage(),
// >1 if multiple cameras are used
do {
...
TakeImage( buf );
...
} while (do acq);
EndAcquisition(); // reset everything

8.3.2

Action String Handler

The action strings are executed before, during and after the run of an image
acquisition loop. Most of DaVis acquisition functions take care of this strings:
the simple Take Image (in macro GetSingleImage), Continuous Grabbing, Sequence/Summing, Image Batch Processing, PIV Batch Processing and other.
A simple way to define the three commands (before, during and after) is described in the DaVis Software Manual, chapter about the Action dialog. On
the other side the user can write own macros to define this strings and to execute them while calling the macros GetSingleImage() or ContinuousGrabbing().
It is possible to write an own acquisition macro and execute the strings from
this macro, too.
If the action strings should be used, CL-variable AcqAction must be set to
value TRUE before the acqusition starts. The three commands are executed
by the following macros:
void ActionInitAcq (int theImages)
initializes the action handler with the number of images to acquire. If the
number is unknown, set theImages to a large value.
void ActionBeforeAcq()
must be called before the start of the acquisition loop. In the Loop example
above this call would be just after the
if (SetupAcquisition()) ...
152

8.4 Special Macros

void ActionDuringAcq(int theImage)


is called after the TakeImage command.
void ActionAfterAcq ()
follows after the EndAcquisition() command.
If the user wants to define some action strings, which are to be executed by
DaVis standard acquisition functions, the string variables itself should not be
used! There could be another dialog, which also defines ist own actions.
There are macros about the handling of action strings. Please use this macros
to add or delete an action. The following macros must be called with the predefined types AS BEFORE, AS DURING and AS AFTER. Parameter action defines
the action string.
void AddActionString ( string action, int type );
void DeleteActionString( string action, int type );
int TestActionString ( string action, int type );
returns TRUE if action is included in the action string.
string GetActionString ( int type );
returns the complete action string.

8.3.3

Masking a buffer

Sometimes it is useful to mask some regions of a buffer before a calculation.


DaVis includes a function to define rectangular regions by the mouse, which
are set to intensity value 0:
void MakeMaskBuffer( int maskBuf, int sourceBuf );
Buffer sourceBuf is copied into buffer maskBuf, which is shown on screen.
Define rectangular regions by first pressing the left mouse button at the upper
left (or lower right) corner of a rectangle, then hold the button pressed and
move the mouse to the second corner. After leaving the mouse button, the
rectangle is filled with intensity 0. Now another rectangle can be defined, or
press the space bar to exit masking.

8.4
8.4.1

Special Macros
Macro Execution during Startup

Sometimes it is useful to execute some macro function during the startup of


DaVis , e.g. to open a dialog or to initialize some special hardware.
In most cases own startup functions should be included into macro UserStartup
in file USER.CL in the DaVis main directory. This macro is executed after the
loading of all important macro files, so the standard functions of DaVis are
153

8 General Macros

available, and after the initialization of all enabled hardware devices. It is


possible to open dialogs, load buffers and display them on screen. But not
every screen function is working now, because the DaVis main window is not
opened yet.
Therefore string variable CLExecAfterMainWindow is executed after displaying
the main task window. If you want to execute some macro here, please dont
replace the variable by your macro but add it like
CLExecAfterMainWindow += "; MySetupAfterMainWindow();"
Additionally likewise functions are available for the hardware setup: The variables CustomerCommandBeforeHardware and CustomerCommandAfterHardware
are executed before and after the hardware initialization.
During the shutdown of DaVis another string variable is executed:
CustomerCommandShutdown
Please note, that no dialog functions are available during the shutdown. For
interactions with the user the subroutines Question and Message have to be
used.
Of cause the autostart function of every macro file can be used to execute
something. For more information please read the section about subroutine
LoadMacroFile on page 51. The number of available macros depends on the
time of the macro file loading: If your macro file is inserted in the array
CustomerMacroFiles, the file is loaded before the hardware initialization.
This array can be edited in dialog Customer Settings in the File menu.
The following list gives an overview about the startup of DaVis :
1. Loading of SYS VARS.CL, SYS SUBS.CLand SYS MACS.CL
2. Execution of macro StartUp() in SYS MACS.CL:
(a) Loading of most system macro files SYS *.CL
(b) Loading of all macros files needed for the enabled hardware
(c) Loading of the CustomerMacroFiles
(d) Execution of CustomerCommandBeforeHardware
(e) Initialization of all enabled hardware
(f) Execution of CustomerCommandAfterHardware
(g) Execution of UserStartup() in USER.CL
3. Display of the DaVis main window
154

8.4 Special Macros

4. Execution of CLExecAfterMainWindow

8.4.2

Events on buffer contents changing

Sometimes the programmer wants to update a dialog when the user changes
some contents of a buffer. Therefore string variable ExecOnBufferChange can
be filled with own macro commands during a macro run. At the start of every
macro the variable DefaultExecOnBufferChange is copied into ExecOnBufferChange.
The buffer handle of the updated buffer is stored in variable Buffer.

8.4.3

Macro Timer

void InitMacroTimer( float theSeconds, string theCommand )


This macro calls subroutine SetWindowDisplay (page 103) to start the timer.
The command is then executed every theSeconds seconds if and only if no
other macro is running. Set theSeconds=0 to disable the macro timer.
A special mode is available for a macro command starting with the character
!: In this case the macro can be executed in smaller intervalls down to
50 milliseconds and it will be executed (quasi-) parallel to another running
macro (in fact the main macro breaks sometimes and gives the second macro
the possibility to run). If you want to use this, please execute short macros
and dont use the macro to display dialogs or windows.
See page 184 for a the description of a Dialog Timer Macro.

8.4.4

Macro Thread

void InitMacroThread( string theCommand )


This macro calls subroutine SetWindowDisplay (page 103) to create a thread,
which executed theCommand. A thread is always running parallel to a main
macro. On a multi processor system the macro thread is even executed on the
second processor while the main DaVis runs on the first processor!
Since DaVis 6.3 it is possible to stop the macro thread during the execution
by command InitMacroThread(""). In DaVis 6.2 it is impossible to stop
the thread, which has to stop by itself (e.g. the macro should check a global
variable and stop itself if the flag is set).
Note: Please avoid any hardware access from the macro thread, which should
not use dialogs and image windows. A macro thread is allowed to execute
StatusText and InfoText.
Macro threads are useful to execute online image processing on the second
processor of a multiprocessor system. Of cause, you have to develop a syn155

8 General Macros

chronisation between the main (data acquisition) macro and the (background)
processing macro.

8.5

Retired Macros and Subroutines

The following macros and subroutines are hold for compability with older
versions of DaVis but should not be used any longer. They are defined in
macro file SYS MACS.CL.
Load / StoreTifG
void LoadTifG ( string filename, int buffer);
Load an 8- or 16-bit gray-scale TIFF-file into a buffer.
void StoreTifG (int buffer, int resolution, string filename);
Store buffer as TIFF file. Since TIFF is in normal case an 8-bit format, the
16 bits of WORD-buffer must be converted to 8 bits. A FLOAT buffer is
first converted to WORD. With parameter resolution=-16 DaVis supports
a 16-bit TIFF-format.
resolution = -1 takes the eight most significant bits and therefore checks
the maximum of image.
resolution = 0..8 takes bits 0..7, 1..8, ..., 8..15
Please use subroutine StoreBuffer (see page 38) instead of this functions!
FileSelectionBox and DirSelectionBox
Both subroutines have been replaced by macros, which call the subroutines
FileSelectBoxOpen and FileSelectBoxSave (see page 42).
string FileSelectionBox (string filetype, string boxtitle);
Open a fileselectbox with title boxtitle and standard extension filetype.
Returns directory and name of selected file or an empty string. The OK-button
has the name Open.
string DirSelectionBox (string boxtitle);
Open a fileselectbox with title boxtitle and return the selected directory or an
empty string. This function does not work on read-only filesystems like CDs.
Get / SetVectorDisplay
int GetVectorDisplay (int win, int& DisplayType, int& DisplayRel,
float& RelativeToX, float& RelativeToY, line& Color, float& Length,
float& Scale, int& Background, int& ShowReference, float& ReferenceLength,
int& DisplayGrid );
156

8.5 Retired Macros and Subroutines

Get the display attributes of an vector image window.


int SetVectorDisplay (int win, int DisplayType, int DisplayRel, float
RelativeToX, float RelativeToY, line Color, float Length, int Background,
int ShowReference, float ReferenceLength, int DisplayGrid );
Set the display attributes of an vector image window.
Get / SetProfileParameter
void GetProfileParameter (int win, int& mode, int& from, int& to,
int& count);
void SetProfileParameter (int win, int mode, int from, int to, int
count);
Get or set the data range which is shown in a profile view of a buffer.

157

8 General Macros

158

9 Dialogs
9.1

About Dialogs

A dialog box is created by subroutine Dialog. After creation the dialog items
(buttons, texts, bitmaps, etc.) have to be defined by subroutine AddItem (one
call for each item).
Most items are connected to global CL-variables (to store user input) or to
CL-commands (to execute when a button is pressed). Standard handling is
done in an optional event handler.

9.1.1

Attributes and Modal Dialogs

Attributes for the dialog can be defined in variable DialogAttributes. A


call to Dialog() will reset DialogAttributes to value 0. This default value
creates a dialog with the icons minimize and close at the right side of the
titlebar; the dialog can not be resized by the user and is not visible until a call
to ShowDialog(). Earlier versions of DaVis used the variable DialogShow
(=1) to display the dialog immediately (empty).
The following constants can be or-ed to set the attributes, e.g.
DialogAttributes = DLGA NOTICON | DLGA NOTCLOSE.
Please use the constants, defined in macro file SYS CONST.CL, because the
values may change in further versions of DaVis .

More about Modal Dialogs


A modal dialog gets the focus immediately after a call to ShowDialog() and
then its the only object in DaVis which can be used for inputs. All other
dialogs, image windows, tool bar icons and menus are switched off until the
modal dialog is closed. No second call to ShowDialog() is allowed. In DaVis
5 modal dialogs can not handle scrollbar items (types Simple Text Editor
and Horizontal and Vertical Scrollbar, see subroutine AddItem).
A modal dialog is able to open an image window via a button or the event
handler. Chapter Clicking in an image window on page 109 describes how
to react on mouse clicks in this just opened window.
159

9 Dialogs

Constant

Function

DLGA SIZE

The dialog is sizeable by the user. If the size


changes, the event handler is called with parameter EVENT RESIZE.

DLGA NOTCLOSE

not closeable (closeable by default), no close


icon appeares in the titlebar

DLGA NOTICON

not iconizable (iconizable by default), no minimize icon appeares in the titlebar

DLGA VISIBLE

initially visible, same as DialogShow = 1

DLGA MODAL

modal dialog (see note below); no other attributes are allowed here

DLGA HELP

call the event handler with index EVENT HELP

DLGA EVENT

call the event handler with the correct id of the


active item when pressing the Return key

DLGA FOCUS

call
the
event
handler
with
index
EVENT FOCUS when the dialog is focused
(first click inside a non-active dialog)

DLGA CENTER

open the dialog at a center position, depends on


the dialog size and screen size

DLGA FONT

enables a standard 8 pixel font for the dialog,


which is smaller than the often used system font
and is used in most DaVis 6 dialogs.

DLGA DEFAULTBUTTON

the first button becomes the default button (gets


a thick black border) and will be executed when
pressing the Return key

Tab. 9.1: Predefined constants for DialogAttributes

160

9.1 About Dialogs

Example for a Modal Dialog


The following macro code creates a dialog with one radio group of three choices
and a button with the label Execute. When the dialog appears on screen,
it is the only useable object in DaVis until the user presses the button. Then
the macro returns the number of the selected choice.
// global variable to store the choice value:
int TestChoice;
int GetRadioChoice()
{
// Create a modal dialog and center the dialog in
// the DaVis main window:
DialogAttributes = DLGA MODAL | DLGA CENTER;
int did = Dialog( "Test", 0,0 /*center*/, 150,110,
Please select! );
// Create the radio group with three choices:
AddItem( did, 1, 7, 10, 10, 130, 60,
"Choice 1 \nChoice 2 \nChoice 3", "TestChoice" );
// This button closes the dialog automatically:
AddItem( did, 2, 1, 30,75, 80,25, Execute",);
// With the following command the macro sleeps
// and waits for a CloseDialog().
ShowDialog(did); // SLEEP
// The dialog is closed now and the macro runs on:
return TestWahl; // return the choice
}

9.1.2

Dialog Event Handler

An event handler macro is called by the dialog when certain items are activated. It has the name
EventtheDialogName(int theItemId)
E.g. if theDialogName is LaserPower, then
void EventLaserPower (int theItemId)
is the event handler. TheItemId is the Id of the activated dialog item. You
must define such an event handler macro, if you need to catch those events for
fancy dynamic dialog changes. For simple dialogs it is not required.
161

9 Dialogs

The event handler is called only when certain types of dialog items are activated. Types of items supported are Checkboxes, Radio buitton groups, List
buttons, List boxes and Scrollbars. It is called with theItemId = -2 when a
sizeable dialog has changed its size.
Note, that you need to first use function ApplyItem() or ApplyDialog() to
save all screen settings into CL-variables before doing any further action.
The event handler is also activated when the return key is pressed. Here it
is called with index theItemId= EVENT RETURN= -1. This can be used when
entering parameters in an edit control item, because the edit control item does
not produce any event itself. If you want to do some action after entering some
data, press return and catch the event with the event handler (theItemId=
EVENT RETURN= -1). Note that this event is not specific to a single item, so
you would have to check all items (use DaVis 6 and attribute DLGA EVENT
to receive the correct item number).
Event handler for multiple dialogs
You can even create multiple dialogs which can be opened more than once
at the same time. The Buffer Properties dialog since DaVis 6 is such a
multiple dialog. The same dialog structure with the same creation function
and the same event handler is used to show information for different buffers
simultaneous.
Multiple dialog are defined by a special naming convention: theDialogName
= NAME###index with NAME as a string without spaces and special characters. Then the event handler EventNAME( int id, int index ) is called,
so the event handler knows which multiple dialog has send the event.

9.1.3

Example for a simple dialog

int LaserStatus = 0; // global CL-variable 0=off, 1=on


void StartMyDialog ()
{
// dialog is closeable, not iconizable
DialogAttributes = DLGA NOTICON;
int myDialogId = Dialog( LaserPower, 100, 100, 300, 300,
"Laser Power Setting" );
AddItem( myDialogId, 1, 6, 20, 20, 200, 30, "laser
status","LaserStatus" ); // check box
...
ShowDialog( myDialogId );
162

9.2 Dialog Properties

}
void EventLaserPower( int theItemId )
{
int myDialogId = GetDialogId( LaserPower );
switch (theItemId) {
case 1: // check box is pressed
ApplyItem( myDialogId, 1 );
// store status of checkbox back
// to variable LaserStatus
InfoText( "laser is " + (LaserStatus?"ON":"OFF" );
break;
}
}

More examples
Macro file Dialog Demo.cl in DaVis subdirectoy CL includes two dialog examples. Execute functions SetupDialogTest() and SetupDialogTestAll()
to open both dialogs. The first one is a simple example for parameter editing
in a dialog, the second includes all possible items. Here you can see how the
dialog items look and work.

9.2

Dialog Properties

The dialog properties are the size, position, handle and title.
For changing or requesting the dialogs title please use functions Get / SetItemText.

Dialog
int Dialog (string theDialogName, int x1, int y1, int width, int height,
string title );
Define a new dialog and using the DialogAttributes for special behaviour or
view parameters. Return an unique integer handle used by all other dialog or
item functions.
theDialogName must be a string without spaces or special characters. The
name is also a way to retrieve the DialogId again later with function GetDialogId().
x1, y1, width and height describe the position and size of this dialog.
title appears in the title bar of the dialog box.
163

9 Dialogs

Note: A dialog cannot be opened during the startup or shutdown of DaVis ,


because the main window is not visible at that time. Please call subroutines
Message or Question instead.
GetDialogId
int GetDialogId( string theDialogName );
Get corresponding unique id of dialog.
In DaVis 5 a number of internal (non-macro) dialogs existed. This dialogs
had been used by negative id numbers. In DaVis 6 the only existing negative
id numbers are -1 for the Acquisition Timing Dialog and -1000 to close all
dialogs.
Get / SetDialogSize
void SetDialogSize (int theDialogId, int x1, int y1, int x width,
int y height);
If x1 10000, current x-position of dialog will not be changed, only a resizing
is done. Same for y1.
int GetDialogSize (int theDialogId, int& x1, int& y1, int& x width,
int& y height );
Get size and position of a dialog. If the dialog exists the return value is
theDialogId, otherwise 0.
ShowDialog
void ShowDialog( int theDialogId );
Display and bring to front dialog.
HideDialog
void HideDialog( int theDialogId );
Apply and close dialog without deleting it.
EnableDialog
void EnableDialog( int theDialogId, int enable );
Enable or disable (enable=0) a dialog. A disable dialog is visible on screen
but can not be used. This mode is useful during time intensive calculations
or dialog updates.
164

9.3 Dialog Items

CloseDialog
void CloseDialog( int theDialogId );
Apply and close dialog, then delete it. theDialogId=-1000 closes all open
dialogs.
CancelDialog
void CancelDialog( int theDialogId );
Close dialog without apply, then delete it. theDialogId=-1000 closes all open
dialogs.
ApplyDialog
void ApplyDialog( int theDialogId );
Store edited values back into CL-variables and update display.
UpdateDialog
void UpdateDialog( int theDialogId );
Reloads CL-variables and displays them on screen.
Note: All changes made by the user on screen are lost!
GetDialogStatus
int GetDialogStatus( string theDialogName );
Check if dialog is not defined (return 0) or defined and visible (1) or hidden
(2). For embedded dialogs bit 2 is set (value 4 is added to the return value).

9.3
9.3.1

Dialog Items
Item Types

r dialog item types, e.g buttons. To


DaVis supports most standard Windows
create a new item in an existing dialog use subroutine AddItem.
AddItem
void AddItem( int theDialogId, int theItemId, int type, int x1, int
y1, int x width, int y height, string text, string variable );
Add item to dialog. The item-id must be a unique number within the dialog
box. The position is relative to the upper left corner of the dialog window.
165

9 Dialogs

Note: Modal dialogs (see section Attributes and Modal Dialogs) can not
handle items with scrollbars in DaVis 5 !
In most cases a dialog box is used to enter some values and then start some
action like image acquisition. Sometimes it is useful to change parameters
while a macro is running, e.g. to change exposure time while continuous
grabbing. Use a ! as first character of variable to execute a command or
to apply a value while a macro is running. Note not to call a function twice (a
button calls the EventHandler while the EventHandler is doing some action),
because DaVis is not able to handle recursive macros! The described function
is available for item types 4, 6, 7, 8, 9, 10, 12 and 15.
In the following sections all available items are described with respect to the
parameters of subroutine AddItem. The type can be either the real constant
value or a predefined CL constant like DITEM OK.
Note: It is not useful (and may cause strange behavior) to use the same
variable in more than one dialog item. After changing the value in the dialog
a call to ApplyDialog() will set the variable to an undefined value, which is
either be the value of the first or of the second item! You may be successful
when using ApplyItem() only.
Standard Buttons
If the attribute DLGA DEFAULTBUTTON is defined and this button is the
first defined button (in the order of all AddItem calls), the button gets a thick
black border and its command is executed when pressing the Return key.
OK button: type = 1 = DITEM OK
Executing CL-command variable when button is pressed or CloseDialog()
is called or the Close-item in the title bar is pressed. variable can be empty
(= ""). Button title is text or OK if empty.
Apply button: type = 2 = DITEM APPLY
Executing CL-command variable when button is pressed or ApplyDialog()
if empty. Button title is text or Apply if empty.
Cancel button: type = 3 = DITEM CANCEL
Executing CL-command variable when button is pressed or CancelDialog()
if empty. Button title is text or Cancel if empty.
User Defined Button
type = 4 = DITEM BUTTON
Executing CL-command variable when pressed. If variable is empty, the
standard event handler is called with the identification number of this item as
166

9.3 Dialog Items

Value
0
1
2
3
4
5
6
7
8
9
10

Color
red
green
blue
cyan
magenta
yellow
black
darkgray
gray
lightgray
white

Tab. 9.2: The standard dialog color table, used e.g. by text items.

id-parameter theItemId. This button can be the default button.


Native Text
type = 5 = DITEM TEXT
Object text. If x width<0 the text is right justified. variable specifies the
font as <font-name>, <size>, <attributes>, <color>, <background-color>,
<angle> with
fontname: T(imes), H(elvetica), C(ourier), F(ixed), M(S Sans Serif) or
S(ystem), D(efault font)
size: size of font in points
attributes: N(one), B(old), I(talic), U(nderline), O(utline) and/or
S(hadow), you can use a combination of attributes.
color: see table 9.2
background-color: see table 9.2, but transparent (-1)
angle: rotation angle in degree

Native Check Box


type = 6 = DITEM CHECKBOX
Uses variable a valid integer variable, which is either 0 (off) or 1 (checked).
The event handler is called immediately.
167

9 Dialogs

Native Radio Group


type = 7 = DITEM RADIO
Uses variable as a valid integer variable, which is 0/1/...
text contains the text for the different radio buttons, seperated by \n, for
vertical item lines or by \t for a horizontal order. In both cases either the
given height or width is devided into equal and equidistant spaces for all items.
E.g. "button0\nbutton1\nbutton2". The event handler is called immediately.
Edit Control
type = 8 = DITEM EDIT
For user input of parameters with variable as a valid CL-variable, either int,
float or string . If the variable is of type int or float, text can be used
as format string (see subroutine FormatNumber on page 46 for syntax). The
event handler is called immediately if return is pressed.
The value can be entered in hidden mode with no displayed text, if text=P.
This can be used to enter a password.
A special disabling mode is availabe, which paints the item like the info item,
makes it readonly but does not paint gray pixels above the item: SetItemPar(
theDialogId, theItemId, -5, mode, "" ) with the following modes: disabled (0), enabled (1), info (2).
List Button
type = 9 = DITEM LIST BUTTON
With variable as a valid integer variable, corresponding to the selected line
(0-n). text contains the text for the different lines in the list, seperated by
\n, e.g. "line0\nline1\nline2". The event handler is called immediately.
List Box
type = 10 = DITEM LIST BOX
Same as list button, but a range of lines is visible. The event handler is called
immediately. If variable is a valid string variable, the user can select multiple
lines, which are returned in the variable as a list of the line names, seperated
by \n.
List Edit
type = 11 = DITEM LIST EDIT
168

9.3 Dialog Items

With variable as a valid CL-variable, either int, float or string, which is set
to the edited or selected value. text contains the text for the different lines of
text, seperated by \n, e.g. "line0\nline1\nline2". The event handler is
called immediately if return is pressed or if a list item is selected. The special
disabling mode of the simple Edit Control item is available.
Simple Text Editor
type = 12 = DITEM TEXT EDIT
This editor uses variable as a valid string CL-variable, which is set to the
edited text. text may contain h or v to add horizontal or vertical scroller.
The event handler is never called.
The value can be entered in hidden mode, where no text is diplayed, if text
includes a P. Use this to enter a password.
Horizontal or Vertical Scrollbar
type = 13 = DITEM SCROLLBAR
This scrollbar is attached to an edit control of type int or float. When moving
the scrollbar the value in an associated edit control object is changed.
text must be in the format of de,min,max,step, where min and max define
the allowed range of the value, and step is the increment when pressing the
small buttons > or <. d is either h for horizontal or v for vertical scrollbar.
If e is added to h or v, it specifies, whether the item should call the event
handler each time it is pressed.
variable must specifiy the integer id-value of the associated edit control item
or a valid integer variable.
Simple Bitmap
type = 14 = DITEM BITMAP
Displays the bitmap defined by text as the filename (must be of type *.bmp).
This simple bitmap can be used as a map like the clickable maps known from
some webpages.
After a call to SetItemPar( theDialogId, theItemId, -7, 1, "" ) and if
a special event handler exists, a click on the bitmap with the left mouse button
causes a call to the macro
void EventClickMyName( int theItemId, int press,
int key, int x, int y )
with press=1 if the mouse button has been pressed (or press=0 when released), key=1 if a Shift-key has been pressed while the mouse click, key=2 for
169

9 Dialogs

a pressed Ctrl-key and x,y as the coordinates inside the bitmap.


If the size of the bitmap item is set to 0 in the call to AddItem(), the size of
the bitmap is used as the size of the item.
Bitmap Button
type = 15 = DITEM BITMAP BUTTON
This button includes a bitmap instead of the text. text is used as filename
(must be of type *) and variable defines the executable CL-command. If
variable is empty, the standard event handler is called with the identification
number of this item as id-parameter theItemId.
A special display mode is availabe, which replaces the eight color of a 8-bitr
bitmap palette by the default background color of your Windows system.
We
use the eights color because the default palette has the light gray background
color as color number 8. For 16- or 24- or 32-bit bitmaps the color 0 (black)
is replaced:
SetItemPar( theDialogId, theItemId, -6, 1, "" ).
Draw Line
type = 16 = DITEM LINE
The line is drawn from x1,y1 to x1+x width,y1+y height with attributes
text= "color,line width,start,end" and
color: see table 9.2
line width: 1,2,3,... pixel
start: draw arrow at start (1)
end: draw arrow at end (1)
Draw Rectangle
type = 17 = DITEM RECTANGLE
Draw rectangle (up to oval) from x1,y1 to x1+x width,y1+y height with attributes text= "border color, fill color,line width, rounded corner"
and
border color: see table 9.2 and no border (-1)
fill color: see table 9.2 and no filling (-1)
line width: 1,2,3,... pixel
170

9.3 Dialog Items

rounded corner: 0(off), 1,2,... n-pixel rounded


Note: When rounded corner is large enough, a circle or an oval is generated!
The value of rounded corner is not equal to a radius!
Toggle Button
type = 18 = DITEM TOGGLE
A toggle button stays pressed after releasing the left mouse button. This item
can display a text or a bitmap, which is defined by parameter text as any
text or as the filename (must have ending ).
variable must be a valid integer CL-variable, optionally followed by =
value. If no value is specified, the value is set to 1. When the button
is pressed, the variable is set to value, when it is released, it is set to 0, and
the event handler is called immediately for both actions.
Note that when other toggle buttons also reference the same variable (using
different values), those buttons are dynamically updated appropiately.
Note that whenever a toggle is pressed, the associated variable is immediately
updated (so that other buttons can change their state also). This is not true
for most other items, where the associated variable is only updated when
ApplyItem() or ApplyDialog() is executed.
The following example behaves like a simple checkbox:
text="toggle", variable="IsPressed=1"
The toggle button can show different texts for the pressed and released mode:
text=normal\npressed. Additionally the toggle button is able to show
bitmaps:
text=standard.bmp or
text=normal.bmp\npressed.bmp
Card Items
type = 19 = DITEM CARD
Create a new card and place the following items in a new card named text.
Only the items of the selected card and of the default card are visible at a time.
Switch between the cards by the card buttons. The default event handler is
called with the id of the pressed card button. In contrast to the other button
items it is impossible to execute a macro given in parameter variable.
If variable is a valid integer variable, it corresponds to the selected card
(0,1,2,...). The variable name must be referenced in a single call to AddItem(),
not in every call.
171

9 Dialogs

The position variables x1, y1, x width and y height define the cards area,
which border is painted as a 3D-looking rectangle. If x width or y height are
0 the whole dialog is used as cards area. This rectangle definition is needed
for the first card only.
All card buttons are placed on top of the area with a height of 30 pixel. If
y height!=0 a rectangle is drawn as border of the cards.
Items defined before the first call to AddItem(*,*,19,...) belong to the
default card and are visible in every card (useful for OK, Close and Apply
buttons).
See DialogGlobalOptions() in SYS DLG.CLas Example. A call with ShowItem()
to a card item will open the card.
Example of Card Items
The following example can be used as template to create a dialog with some
cards.
// global variable to store the index if the active
// (opened) card:
int TestCardOpenN;
void DialogTest()
{
int did = Dialog("Test",0,0,300,200,
"Test of card items ");
// independant and always visible items:
AddItem(did,90,1,100,160,80,25,"OK","");
// first card
AddItem(did,1,19, 0,0,300,150,
"Card 1","TestCardOpenN" );
// items of the first card:
AddItem(did,10,...);
// second card
AddItem(did,2,19, 0,0,0,0, "Karte 2", "");
// items of the second card
AddItem(did,20,...);
// same structure for more cards...

172

9.3 Dialog Items

// display the dialog:


ShowDialog(did);
}
Spin Button
type = 20 = DITEM SPINBUTTON
A spin button is an edit item for integer or float values with small buttons
for counting up and down. The variable must name a valid integer variable.
Use test="min-max,<flags>" as parameter definition and set one or more
of the following flags: horizontal (h), vertikal (v), wrap (w), space between
every third digit (t), buttons right to the edit item (r), left (l), hexadezimal
(x), call event-handler everytime a button is pressed (e), +offset to add or
subtract the offset everytime the user presses a button, *factor to multiply
or devide the value. The default range is from 0 to 100.
When enabling the event-handler for all actions, the handler is called whenever
a key is pressed in the item, e.g. to edit the number manually. The key event
can be avoided by using one of the offset or multiply parameters.
The range can be changed later by a call to
SetItemText(theDialogId,theItemId,"min-max")
Slider Control
type = 21 = DITEM SLIDER
A slider with optional marks above and below the slider line to define a single
value (variable of type integer) or a range (variable of type string).
Text="min-max,hva<tickfreq>nre" defines the modes: h=horizontal, v=vertikal,
atickfreq=auto tick marks with tick frequency (optional, default=(max-min)/10 ),
n=no tick marks, r=range, e=event-handler, (b=buddy)
Progress Bar
type = 22 = DITEM PROGRESS
Display a progress bar, e.g. for showing a progress when running a time
intensive macro. The variable must be of type integer. The text paremeter
defines the display mode: Text="min-max,hvbs ": h=horizontal, v=vertical,
b=filled with blocks, s=smoothed filling
Group Box
type = 23 = DITEM GROUP
173

9 Dialogs

A groupbox is a titled three-dimensional looking rectangle, which can be


aranged arround some dialog items. In DaVis 5 such groups boxes are created
by at least two rectangle items and a simple text item, so it is easier to use
this new item from now on. The text is the groupbox title.

Tree View

type = 24 = DITEM TREEVIEW

r select pathes and files.


A tree view is known from the Windows Explorer to
This item can be defined with constant entries or created dynamically when
clicking on a path with the left mouse button (open a new tree). Additionally
a popup menu can be opened when clicking with the right mouse button.
Every leaf can be combined with a small bitmap.

The constant tree is defined by the text. All trees and leafs are given in a list
devided by "\n". Leading spaces define the depth of every line (tree, subtree
or leaf). When clicking on a tree or leaf, the standard event handler is called
if variable="" or the integer variable is set with the line number of the tree
or leaf.

When a leaf should show a bitmap icon additionally to the text item, the
number of a predefined icon must be added to the items text. Example: Use
"MyExperiment14" for a leaf with label MyExperiment and icon number 14.
For a complete list of the icons see table 9.3.
174

9.3 Dialog Items

Add Text

Icon

Description

Default icon

Open directory

Experiment

DaVis macro file (*.cl)

Closed directory

LaVision bitmap

Set file (*.set)

Acquisition file (*.acq)

Experiment file (*.exp)

Recording

10

Calibration file

11

Vector file (*.vec)

12

Packed image file (*.imx)

13

Image
continued on next page

175

9 Dialogs

Add Text

Icon

Description

14

My Experiment

15

Device

16

Standard (2D) Image

17

Result

18

Floppy

19

Network drive

20

CDROM

21

Root directory

22

Scalar

23

Profile

24

Properties

Since DaVis 6.3:


25

Camera Image Itensifier (for GDI Manager)

26

Stepmotor (for GDI Manager)

27

Sequencer (for GDI Manager)

28

Image Itensifier device (for GDI Manager)

Tab. 9.3: Available bitmap icons for TreeView leafs. Add for example 1
to the text of the item to connect the item with the directory icon. If no
definition is added, either the default icon is used or no icon, if there is no
icon defined for any items.
The usage of dynamic tree views is very complicate. When the variable defines
a macro function
variable( int mode, int index, string path )
this macro function is called as event handler. The mode can be one of change
selection (-1), expand tree (-2) or collaps tree (-3). The index is the number
of the selected item, the path defines this item in path style.
To change the tree view, e.g,. add a branch when event mode=-2 is executed,
the SetItemText subroutine must be executed with the text as one of the
formats in table 9.4.
Use function GetItemPar to receive information about a tree: Get all visible
tree items (theMode=-55), get the active item (theMode=-56), get a list of all
tree items (theMode=-57).
176

9.3 Dialog Items

text

function

itemtype\n
ListOfMenuItems

create a popup menu for the selected item type


(this is equal to the bitmap icon number). The
list includes all menu entries devided by \n

-1,i

deletes all branches and leafes of branch number


i

-2,i\nA\nB

adds leafes with names A and B to branch number i

-3,i\nA\nB

like above, but additionally adds dummy leafes


to the branches

-4,i

deletes the item number i

-5,0\n
Experiment\n
Rec\nTest

add leaf Test to branch with path Experiment

-6,0\n
Experiment\n
Rec\nTest

like above but additionally adds dummy leafes

-7,0\n
Experiment\n
Rec\nTest

deletes this path-style leaf

-8,0\nPath

delete all childs (path style)

-12,i\nA\nB

use the branch of item i and append leafes after


item i

-13,i\nA\nB

use the branch of item i and append branches


after item i, add dummy leafes to this branches

-21,i

expand the branch of item i

-22,i

collapse branch of item i

-23,i

activate leaf number i

-24,0\nPath

expand the branch (path style)

-25,0\nPath

collapse the branch (path style)

-26,0\nPath

activate leaf (path style)

Tab. 9.4: Format strings for TreeView items and SetItemText

177

9 Dialogs

Info Text
type = 25 = DITEM INFO
A info text item looks like a disabled edit item. If the variable="" the text
is displayed and can be changed by subroutine SetItemText.
If the variable is a valid variable, its value is displayed and can be changed by
subroutines UpdateItem and UpdateDialog. In this case the text defines the
display mode: Text="mhv" for multiline, horizontal and/or vertical scrollbar.
Add a "f" to the text and this item will cut the left part of a filepath and
replace it by ..., so the filename itself is visible.
A special mode of the Info Text item is available to display the text of the
Info Window: Enable this mode by command SetItemPar(..,-50,1,""). To
create such an item you should call macro function
void AddItemInfoWin( int theDialogId, int theItemId, int theXPos,
int theYPos, int theXSize, int theYSize )
Edit Digit
type = 26 = DITEM EDITDIGIT
This edit item shown two buttons above and below every digit of the float
value to change the digit upwards or downwards. The height of both button
rows is 12 pixel each, so the size of the edit item itself is y height-24 pixel.
The font is of 12 cpi Courier style.
The text="first,last" defines the number of the displayed buttons before
and after the decimal point. With text="first,last,min,max" a range can
be set. The variable must be of float type.
Embedded Dialog
type = 27 = DITEM EMBEDDED
This item includes a complete dialog with an own dialog-id and own event
handler. The event handler of the parent dialog (which includes the embedded dialog) is called after every event of the embedded dialog. The embedded
dialog is not able to close, cancel, hide or show itself. This actions can be executed with the item functions only (e.g. use HideItem instead of HideDialog).
The close command of an OK-button (type 1) is executed when closing the
parent dialog.
By default the embedding is done without any border surrounding the dialog.
If text="b" a 3D-border is painted.
The embedding of dialogs is very easy: At first write a macro function which
creates a stand-alone dialog. Then include this macro as a CL-command in
178

9.3 Dialog Items

parameter variable of the AddItem(..., DITEM EMBEDDED, ...).


An example is the following embedding of the Global Options dialog:
AddItem( parentDialogId, 1001, 27, 10, 40, sizeX-25, 300,
"b", "DialogGlobalOptions()" );
During the sequence, which defines the embedded dialog items, the global
variable DialogEmbedded is set to the id of the parent dialog. In DaVis 6.1
it is impossible to embed a dialog into an embedded dialog. Since DaVis 6.2
a recursive embedding is allowed.
Later, e.g. during the event handler of the embedded dialog, the macro
can ask the dialog for more information about the embedding. Subroutine
GetDialogStatus returns value 5 if the dialog is embedded and displayed or
value 6 if embedded but hidden. If the dialog would not be embedded, the
return values would have been 1 or 2.
Note: It is useful to create an embedeed dialog, if a complete dialog should be
used as a sub-dialog. With the embedded dialog you need not to program the
original dialog twice as the stand alone dialog and as the embedded dialog. The
code of the original dialog can be used without changes. Of cause the dialog
sizes have to be equal, or the dialog must check variable DialogEmbedded to
resize itself.
Rotation Button
type = 28 = DITEM ROTATION
A rotation button is a round button to select a value in a circle (or arc) or a
given range. The variable must be a valid integer or float variable. The text
defines the range and scale display:
text = "<nScaleLines>, r=<valueFrom><valueTo>,a=<free space>,e"
The button has nScaleLines painted in equidistant angles around the outer
circle. Each scale line can be combined with a text value, if parameter r
is given. If parameter e is included in the text, the event handler is called
everytime the user clicks on the button. Parameter a defines a free angle on
the bottom part of the button with from valueFrom on the left and valueTo
on the right side.
Image Buffer Item
type = 30 = DITEM BUFFER
An image buffer view is displayed in this dialog item like in an image window.
The item can either use a real buffer (text= theBufferNumber) or load
a file into an own local buffer (text= theFileName). If the variable is
179

9 Dialogs

a valid integer variable, it will include a window handle after the first call to
ApplyItem or ApplyDialog. This handle can be used like a normal window
handle to call the display parameter subroutines like SetWindowResolution()
or SetWinPar().
To change the buffer number either call SetItemText with the same text
as above, or call SetWinPar(handle,WINPAR IMAGE BUFFER,bufnum) if the
buffer is a real buffer.
After a call to SetItemPar( theDialogId, theItemId, -7, theMode, "" )
with theMode = 1 and if a special event handler exists, a click on the image
with the left mouse button causes a call to the macro
void EventClickMyName( int theItemId, int press,
int key, int x, int y )
In this function the values are set to press=1 if the mouse button has been
pressed (or press=0 when released), key=1 if a Shift-key has been pressed during the mouse click, key=2 for a pressed Ctrl-key and x,y as the coordinates
inside the bitmap. Note: The positions give the offset of the mouse position during the click in pixel! You have to calculate the scaled image position
by yourself or by using macro function void GetItemImagePixelPos( int
theImageHandle, int thePixelX, int thePixelY, int isScaled, float&
outX, float& outY )
Additionally the mouse movement can be used with parameter theMode = 3
in SetItemPar. In this case the event handler is called with press=-1. If
theMode = 5 the event handler is called only if a mouse button is pressed
during the movement. The different modes are bit flags and can be ored.
Some hints for easy usage of this item: Call SetWinPar (handle,WINPAR ZOOM,0)
to set the zoom to the best value of 25%, 50%, 100%, ..., or call SetWinPar
(handle,WINPAR ZOOM,-1) to fit the image into the item size. This total fit
can be executed automatically on every resizings of the displayed buffer by
SetItemPar(..,-13,1) or SetWinPar(handle,-13,1).
If the image item should be grouped together with scale items and some buttons to change the display attributes, please see chapter Predefined Item
Groups for macro AddItemImage (page 188).
Example of an Image Item
The following example gives the code to create an image item in a dialog, set an
optimal zoom factor to fill the complete item and reads the display parameters
zoom factor, resolution, gamma value and the viewpoint position. With the
corresponding functions and with subroutines SetWinPar and GetWinPar you
can change the display.
180

9.3 Dialog Items

// global variable to store some values of the dialog


int d6siBuffer; // number of the displayed buffer
int d6siImageId; // the handle of the image
int ExampleOfImageItems()
{
...
// Add edit item to change the displayed buffer
AddItem( did, 10, 5, 10, y, 60, 25, "Buffer:", "" );
AddItem( did, 11, 8, 70, y, 60, 25, "", "d6siBuffer");
// Add image item to display the buffer number
// d6siBuffer
AddItem( did, 12, 30, 140, y, 300, 300,
""+d6siBuffer, "d6siImageId");
ApplyItem(did,12); // get handle for image item
// Now the buffer is displayed in a zoom of 50%,
// 100% or 200%, ...
// It looks better if the buffer fills the item:
SetOptimalZoomOfItemImage (d6siImageId);
// Get some display parameters:
d6siResolution = GetWindowResolution(d6siImageId);
d6siZoom = GetWindowZoom(d6siImageId);
d6siGamma = GetWindowGamma(d6siImageId);
GetWindowViewpoint(d6siImageId,d6siPosX,d6siPosY);
...
}
Profile Item
type = 31 = DITEM PROFILE
A profile buffer view is displayed in this dialog item like in a profile window
(without controls, of cause!). Their are different possibilities to define the
profile via the text parameter:
Use text="theBufferNumber,theProfileLine" to display a row of a real
buffer as a profile. To display all lines in the given range, use:
text="theBufferNumber,theProfileLine-theLastLine"
The data values can be defined in a global array variable and displayed by this
181

9 Dialogs

item with text="theArrayVariable", or the array can be defined directly as


text=Value1\nValue2\n...ValueN. Even a buffer attribute including an
array can be displayed by text="theBufferNumber, theAttributeName" or
additionally a range of those buffer attribute by
text="theBufferNumber,theAttributeName,theOffset, theLength"
If the variable is a valid integer variable, it will include a window handle after
the first call to ApplyItem or ApplyDialog. This handle can be used like a
normal profile window handle to call the display parameter subroutines like
Get/SetProfileParameter() or Get/SetProfileDisplay(). This handle is
needed also to set the Scaling of a profile taken from an buffer attribute or a
global array variable. Therefore one of the subroutines SetXScale, SetYScale
and SetIScale has to be called (see page 74).
Changing the default colors of the different profiles is possible via subroutine
SetWinParStr with mode -27 and a string of format <profileNr>,<rgb-color>,
e.g.
SetWinParStr(myProfileHandle,-27, "1," +COLOR BLUE)
to paint the second profile with a blue color. The default colors are in the
same order as the text colors of the native text item (see table 9.2).
Again a mouse click in the profile can be handled, if
SetItemPar( theDialogId, theItemId, -7, theMode, "" )
with theMode = 1 has been called and if the special event handler exists,
which is described a section above for the image item. Note: The positions
give the offset of the mouse position during the click in pixel! You have to
calculate the scaled profile position by yourself.
Additionally the mouse movement can be used with parameter theMode = 3
in SetItemPar. In this case the event handler is called with press=-1. If
theMode = 5 the event handler is called only if a mouse button is pressed
during the movement. The different modes are bit flags and can be ored.
If the profile item should be grouped together with scale items and some
buttons to change the display attributes, please see chapter Predefined Item
Groups for macro AddItemProfile on page 189.
Scale Item
type = 32 = DITEM SCALE
A scale is painted in the defined rectangular region. The parameters are given
by text="HVPLT,r=<from to>, b=<border> ,s=<scale> " with H=horizontal,
V=vertical, P=Profile scaling, L=logarithm, T=transparent background, r=
range from unscaled value to value, b= free pixel space at the left and right
side (or top and bottom), s=scale as "factor offset description units"
182

9.3 Dialog Items

(must be the last parameter!).


Subroutine SetItemText() does not use the parameters HVPL, but all other
parameters can be changed. AddItem() will automatically detect the direction
from the height/width quotient if the HV parameters are missing.
Color Lookup Table
type = 33 = DITEM CLUT
Creates a color lookup table (CLUT) equal to the palette window on the left
side of the DaVis main window.
The text defines the display order, either H for horizontal or V for vertical
display with color 0 at the top (or left). Add an I to invert the display (color
0 right or bottom).
variable must be a valid integer CL-variable and includes the number of the
displayed CLUT. If the value is -1, the item always displays the active image
CLUT, if -2 the active vector CLUT and if -3 the active vector background
CLUT.
It is possible to use this item without a variable, but change the CLUT with
subroutine SetItemText(). In this case the default CLUT is the standard
image palette (-1).
Window Item
type = 34 = DITEM WINDOW
This item creates an image window inside the dialog. The buffer number and
the window type (see subroutine CreateDataWindow on page 99) are given in
parameter text = "buffer,wintype" or text = "buffer,wintype,g". In
the last case the window item is surrounded by a group box.
If the variable is a valid integer variable, it will include a window handle after the first call to ApplyItem or ApplyDialog. This handle can be
used like a normal window handle to call the display parameter subroutines
Set/GetWinPar() and Set/GetWinParStr().
Context Menu
type = -1
A context menu can be defined for opening when pressing the right mouse
button inside the dialog. Parameter text gives the list of all menu items
like text="Menu 0\nMenu 1\n...". An empty item (\n\n) creates a separator line. The complete menu can be changed with a call to subroutine
SetItemText(). The integer variable defines the number of the selected item
183

9 Dialogs

and the standard event handler is called immediately with index theItemId.
It is not possible to define more than one context menu for a single dialog!
Dialog Timer Macro
type = -2
A dialog timer macro is a macro command, which is automatically executed
after a defined number of seconds, if and only if no other macro is running at
the same time.
The text=theSeconds defines the interval in seconds, text=0 disables the timer. The variable defines the macro to be executed, e.g.
variable=theEventMacro to execute MyDialogTimerEvent().
The time interval and the callback macro can be changed by
SetItemText(...,theSeconds theEventMacro)
It is not possible to define more than one timer macro for a single dialog. Is
is not useful to define such timer macros for a large number of dialogs. The
timer is disabled when the dialog is closed.

9.3.2

Changing Item Attributes

Delete Item
void DeleteItem(int theDialogId, int theItemId );
Delete item in dialog. For card items the whole card will be deleted, the card
button and all items inside this card. The other cards will be renumbered, so
the value of the cards variable (see AddItem) will change.
Apply Item
void ApplyItem(int theDialogId, int theItemId );
Store edited value back into CL-variable.
Update Item
void UpdateItem(int theDialogId, int theItemId );
Reload CL-variable and displays it on screen. Note: Previous changes made
by the user on the screen are lost.
Hide / ShowItem
void HideItem( int theDialogId, int theItemId );
void ShowItem( int theDialogId, int theItemId );
184

9.3 Dialog Items

Hide or show dialog item. For card items the card is opened with ShowItem(),
a call to HideItem() has no effect.
Disable / EnableItem
void DisableItem( int theDialogId,int theItemId );
void EnableItem ( int theDialogId,int theItemId );
Disable or enable dialog item. No effect for card items.
Get / SetItemSize
void SetItemSize( int theDialogId, int theItemId, int x1, int y1,
int x width, int y height );
Set new size and position of item. If x1-10000 only a resizing is done. Same
for y1.
void GetItemSize( int theDialogId, int theItemId, int& x1, int& y1,
int& x width, int& y heigth );
Get size and position of an item. If the dialog or item does not exist, all values
are set to 0.
Note: Some item types rechange while creation, so the values may differ from
the values defined by AddItem() and SetItemSize().
Gluing of dialog items is supported via subroutines GetItemPar / SetItemPar
(page 186) with parameter theMode=-8. An item with glue holds the distances
to some borders of the dialog when the dialog is resized. By default the position of the top left corner and the size are not changed during a resizing of
the dialog.
Get / SetItemText
void SetItemText( int theDialogId, int theItemId, string text );
Replace item text with new text. If the item type is bitmap or bitmap button
(types 14 or 15) the new bitmap is loaded. If theItemId=0 set dialogs title
is changed.
string GetItemText( int theDialogId, int theItemId );
Returns items text or an empty string, if item or dialog does not exist. If
theItemId=0 the dialogs title is returned.
SetItemColor
void SetItemColor ( int theDialogId, int theItemId,
int theBackgroundColor, int theForegroundColor );
185

9 Dialogs

Set color of item to RGB color. Works with most item types without buttons.
The following RGB-colors are defined as constants: COLOR BLACK, COLOR BLUE,
COLOR CYAN, COLOR GREEN, COLOR MAGENTA, COLOR RED, COLOR WHITE,
COLOR YELLOW.
Use function RGB(red,green,blue) to calculate the RGB-color by its spectral
parts (each= 0,..,255).
SetItemFocus
void SetItemFocus ( int theDialogId, int theItemId )
Sets the key focus onto the item. For card items the card will be opened.
Get / SetItemPar
void SetItemPar( int theDialogId, int theItemId, int theMode, float
theFloatValue, string theStringValue );
int GetItemPar( int theDialogId, int theItemId, int theMode, float&
theFloatValue, string& theStringValue );
Set or get a parameter (float or string or both, depends on theMode) of a
dialog item. Return 0 if ok or an error code or even a return value (depends
on theMode).
Negative values for theMode are used for dialogs (see table 9.5). If theItemId=0
the parameter of the dialog itself will be set or get. The items Image (30) and
Profile (31) accept the theMode = WINPAR x parameters as used in subroutines GetWinPar / SetWinPar (on page 105). The other values for theMode
are defined as constants DLGPAR x.

9.3.3

Additional Item Macros

The following macros and constants are defined in file SYS DLG.CL:
AddItemLine
void AddItemLine( int theDialogId, int theItemId, int theYpos, int theXwidth );
Creates two line items theItemId and theItemId+1 as a horizontal border
line, e.g. between groups of items. Both lines have different colors and look
3D-like.
SetAbleItem
void SetAbleItem( int set, int theDialogId, int theItemId );
186

9.3 Dialog Items

theMode

Function

>0

WINPAR x, accepted by Image and Profile items


only; the received parameter is theFloatValue, the
return value is 0 if the item exists

-1

Return the ored bits of the item state: item exists


(1), item is visible (2), item is enabled (4)

-2

Set item text

-3

Set background bitmap for dialogs (theItemId=0);


theStringValue must be the name of an existing
bmp-file, an empty string deletes the background
bitmap

-4

Define a macro to be executed just after the


ShowDialog() command, useful for modal dialogs

-5

Special modes for the edit items (8 and 12): disabled


(0), enabled (1), disabled but not grayed like the info
item (2)

-6

For bitmap buttons: replace palette color 0 by the


default system background color

-7

call EventClickName(...) when clicked in a bitmap


or image item

-8

Define a glue mode, so during a resizing of the


dialog the item will automatically be resized or
repositioned. The distance to one or more borders
of the dialog will not change. The following glue
constants can be ored:
GLUE STICKY LEFT,
GLUE STICKY RIGHT, GLUE STICKY TOP and
GLUE STICKY BOTTOM

-50

display info text in an info item

-55 ... -57

see item treeview


Tab. 9.5: Modes for subroitines Get/SetItemPar

187

9 Dialogs

The defined item will be enabled if set=TRUE or disabled if set=FALSE.


MoveItemOffset
void MoveItemOffset( int theDialogId, int theItemId,
int theXOffset, int theYOffset );
Moves an item without resizing.
ExistsItem
int ExistsItem( int theDialogId, int theItemId );
Return TRUE if the item exists. Internally calls GetItemPar(..)
GetItemState
int GetItemState( int theDialogId, int theItemId );
Returns flags of the item state: item exists (1), item is visible (2), item is
enabled (4). Internally calls GetItemPar(..)

9.3.4

Predefined Item Groups

For easier use of the image and profile items, you can call the predefined
macro functions AddItemImage and AddItemProfile to handle the image or
profile item itself, additional scale items and some items to change the display
parameters.
GetItemBufferAndDialog
int GetItemBufferAndDialog( int theImageHandle, int& theDialogId,
int& theItemId )
Return the buffer number of an image or profile item with handle theImageHandle
and get the dialog id and item id.
AddItemImage
int AddItemImage( int theDialogId, int theFirstItemId, int theX0,
int theY0, int theWidth, int theHeight, int theBufferNumber,
int thePaletteMode, string theGroupBoxTitle );
This macro adds an image item, scales, palette- and resolution-buttons to the
dialog. All items are surrounded by a group box with the given title.
Please dont use the item ids theFirstItemId,..., theFirstItemId+29 for
other purposes, because this macro needs them.
188

9.3 Dialog Items

Parameter thePaletteMode defines the usage of a palette item: no palette


(0), standard image palette (1), private palette (2). The size is the total size
of the group box.
The return value is the image handle or 0 if an error occured.

SetOptimalZoomOfItemImage
void SetOptimalZoomOfItemImage( int theImageHandle )
Set the zoom so the image fits into the item and change the scales defined by
AddItemImage.

GetItemImagePixelPos
void GetItemImagePixelPos( int theImageHandle, int thePixelX,
int thePixelY, int isScaled, float& outX, float& outY )
Calculate the (scaled) buffer coordinate from a pixel position inside the image
item. E..g. the macro handling the mouse events of an image item gets the raw
pixel position of the mouse cursor. This macro changes the raw coordinates
into (scaled) coordinates, including the zoom factor and the viewpoint offset.

AddItemProfile
int AddItemProfile( int theDialogId, int theFirstItemId,
int theX0, int theY0, int theWidth, int theHeight,
int theBufferNumber, int theProfileNumber,
string theGroupBoxTitle )
Adds a profile item with scales to the dialog. All items are surrounded by a
group box with the given title.
Please dont use the item ids theFirstItemId, ...,theFirstItemId+9 for
other purposes, because this macro needs them.
The size is the complete size of all profile and scale items. The return value is
the profile handle or 0 if an error occured.

UpdateItemProfile
void UpdateItemProfile( int theProfileHandle )
Update profile and scale items, display maximum range. The maximum is
calculated from the complete buffer.
189

9 Dialogs

UpdateItemProfileRows
void UpdateItemProfileRows( int theProfileHandle, int theFirstProfile,
int theLastProfile )
Update profile and scale items, display maximum range of the given profile
lines. Display only the given range of profile lines.
SetItemProfileDisplay
void SetItemProfileDisplay( int theProfileHandle, float x1, float
x2, float z1, float z2)
Set (unscaled) range of profile display and scale items.

9.4

Dialog Editor

The dialog editor can be used to create own dialogs. It is an easy way to add
new items, set the type without needing the correct type index, move them to
a new position or resize them with the mouse.
The dialog editor opens on menu command Macro Edit Dialog Box:

190

9.4 Dialog Editor

When creating a new dialog, enter the dialog CL-name, the dialog title,
the initial position and the size. Then press button Apply/Test to view the
dialog on screen.

For storage press button Generate, select a CL-macro file in the fileselectbox or enter a new filename. The dialog definition will be stored as macro
DialogName() in this macro file. If such a macro exists, it will be deleted and
replaced by the new definition.

The user can define up to 99 items with the dialog editor. The identification
numbers can be selected as item id. The listbox shows a short name for every
item type right to the number (e.g. 1:cbs for item number one of checkbox
type). Change the item type by the next listbox.

Pressing button New will open a listbox with all editable item types. A mouse
click on such a name of an item type will create a new item with this type at
a default position with a default size. Position and size can be changed either
by entering the values into the fields x-pos, y-pos, x-width and y-width,
or by pressing the shaft buttons or by moving the items with the mouse (see
example below). The shaft buttons will change the values by the entered grid
pixel size.

The edit fields text and CL-variable/command are used to enter the parameters theText and theVariable for the AddItem-subroutine. See the
chapter about Item Types on page 165 for the meaning of this parameters.
Please note to define the variables before entering in this edit fields. Otherwise
DaVis will show an error message about undefined variable names! To avoid
this first create and store the dialog without any items, then define all items
you need in the CL-macro file, then reload the file before editing your dialog.

The following dialog is an example for the view of an edited dialog. All defined
items are visible and underlayed by the grid. After clicking on an item the
object can be moved while holding the left mouse button. After clicking on
one of the appearing small rectangles at every items corner the item can be
resized while holding the left mouse button.

191

9 Dialogs

192

10 Menus and Toolbars


10.1

About Menus and Toolbars

In DaVis 6 the menu and toolbar of the main window can be defined and
created by the user with calls to some subroutines. Even user defined context
menus for image windows and dialogs are supported, which pop up when
clicking with the right mouse button inside the window or dialog. Special
context menus can be used in a Context Menu dialog item.
This chapter describes the creation of user defined menus and toolbars and
the definition of shortcuts (macro execution on key pressing). To edit a
window context menu you have to execute a number of calls to subroutine
EditWindowMenu (see page 102). More information about the dialog context
menus are given in sections Context Menu (page 183) and TreeView (page
174).
The standard menu, toolbar and context menus are defined in macro file
SYS MENU.CL, which can be used as example for the creation of own menus.
You should not change SYS MENU.CLbecause this will cause problems when
updating to a new version of DaVis . A better way is the writing of some
own macro functions for menu and toolbar definition in macro file USER.CL,
which can be copied into an updated software. Best place to define your menu
is the UserStartup() function or a macro called by this function. Macro
UserStartup() is executed at the start of DaVis after building the default
menu in file SYS MENU.CL.
There are some useful predefined pulldown menus for the main menu in file
SYS MENU.CL, e.g. the macro menu or the window menu. These can be easily
included into own menu bars.

10.2

Definition of Shortcuts

The purpose of shortcuts is the execution of often used functions when pressing
a key or a combination of some keys. The functions are usually realized as
CL macros and can be defined for menu items (subroutine SetMenuKey, page
196), toolbar buttons (subroutine SetToolKey, page 200) and as independant
commands (subroutine SetCommandKey, see below).
193

10 Menus and Toolbars

The supported shortcuts, which are defined by parameter theKey of the above
mentioned subroutines, is a combination of a special key code for the shift-,
control- and alt-key and of the key itself.
All function keys "F1",..,"F12" can be used as stand alone keys or in combination with the shift-, control- and/or alt-key: E.g. "sF1" for shift- and the
F1-key, "cF2" for the control- and F2-key, "aF3" for the alt- and F3-key,
"scF4" for the shift- and control- and F4-key, "acsF5" for the altand shift- and control- and F5-key.
The usage of the character keys "a",..,"z", "A",..,"Z" is a little bit of
a problem, because they may be used by the active dialog box before the
shortcut handler sees the key. Better used the character keys together with
the control key "cA",..,"cZ".
The four arrow keys "left", "right", "up", "down" and the special keys
"insert", "delete", "end", "home", "prior", "next", "escape", "tab",
"back" may cause the same problems as the character keys. They are save to
use only if no dialog is active or focused.

SetCommandKey
void SetCommandKey (string theKey, string theCommand)
Define a shortcut, which is independant of a menu or toolbar item. The macro
line theCommand is executed when pressing the shortcut key. To destroy a
shortcut please call this subroutine with the correct value for theKey and an
empty string for parameter theCommand.

10.3

Menu Creation

The menu bar is located on top of the DaVis main window. When the mouse
cursor is moved to a menu title and the left mouse button is clicked there,
a pulldown menu opens. Again an item can be selected by the left mouse
button. In most cases the mouse clicks starts the execution of a CL macro
which is defined for the item.

10.3.1

Subroutines concerning menus

Every item in a menu is named by an unique number (unique to the main


menu, not to context menus in image windows or to the tool bar). An item
can be the title of a pulldown in the main menu bar or an entry in a pulldown
menu itself.
194

10.3 Menu Creation

For every normal item a macro command must be defined, which is executed
when the item is selected by mice or by key shortcuts. The macro command
of all other items (title of pulldown menus or seperators) must be empty.
For all items a short message text can be defined, which is shown in the status
bar when the mouse moves above the item.
NewMenu
void NewMenu()
Destroy the complete menu bar. This is a macro calling subroutine DeleteMenuItem(-1).
A new menu bar must be defined immediately!
ShowMenu
void ShowMenu()
Displays the changed menu bar in the main window of DaVis . Execute this
function at the end of your menu definition macro. This macro calls subroutine
AddMenuItem(-1,0,"","","").
Known bug: On Windows NT systems the menu bar cannot be redefined
more than eight times (on some systems even less). On Windows 2000 systems
the recreation works fine.
AddMenuItem
void AddMenuItem( int theId, int theMotherId, string theName, string
theCommand, string theMessage );
If theMotherId=0 a new pulldown menu is appended to the main menu bar.
The value of theCommand must be the empty string ().
If theMotherId>0 a new item in appended to the pulldown menu defined by
handle theMotherId. The parameter theName defines the title of the item,
theCommand is a macro command to be executed on item selection. The value
of theMessage is displayed in the status bar when the mouse moves above the
item. If theName is the empty string, a separator is created.
The item handle theId must be an unique number in your menu bar. Use
theId=-1 to update the menu bar after changing items.
The following internal functions can be included into the menu by executing
AddItem with empty strings for theName and theMessage. This predefined
items are appended to (pulldown) menu theMotherId.
DeleteMenuItem
void DeleteMenuItem( int theId );
195

10 Menus and Toolbars

theCommand

Function

QUIT

Exit DaVis

BUFLIST

Open or close the buffer list window, place a check


mark next to the item text

TOOLBAR

Show or hide the toolbar, display check mark

CLUT

Open or close the CLUT window, display check mark

STATUSBAR

Show or hide status bar, display check mark

INFOSHOW

Open or close the info text window, display check


mark

LOGOPEN

Open the standard editor with the logfile (LOG.TXT)

LOGCLEAR

Clear the logfile LOG.TXT

LOGSTATUS

Enable or disable logging into LOG.TXT, display check


mark

ABOUT

Display the DaVis About box

Tab. 10.1: Predefined menu items for subroutine AddMenuItem.


Delete menu item. If the item is a pull-down-menu, all included items will be
deleted, too!
For theId=-1 the complete menu is destroyed. In this case you need to define
a new menu immediately (in the same macro run), because when the macro
execution finishes, there could be no menu bar to select a function in!
SetMenuName
void SetMenuName( int theId, string theName );
Change the name (title) of this menu item.
SetMenuCommand
void SetMenuCommand( int theId, string theCommand );
Define a new macro command to be executed when selecting the item.
SetMenuMessage
void SetMenuMessage( int theId, string theMessage );
Define a new message to be shown when moving the mouse above the menu
item.
SetMenuKey
void SetMenuKey( int theId, string theKey );
196

10.3 Menu Creation

Define a shortcut for a menu item, see section Definition of Shortcuts on page
193 for the key definition.
SetMenuState
void SetMenuState( int theId, int isChecked, int isEnabled );
Change the state of this menu item: normal/checked, enabled/disabled (both
0/1).

10.3.2

Macros with predefined pulldown menus

These macros are defined in macro file SYS MENU.CLand can be called by own
menu definition functions to include this standard pulldown menus. All this
macros need a integer parameter base, which must be the handle for the
mother item of this pulldown menu. Some functions are creating a new pulldown menu, some are appending items to an existing pulldown menu. The
bases of some menus are predefined as constant values MENU BASE x in file
SYS MENU.CL.
void AddMenuView( int base )
Append the standard view selection items to the defined mother. This
items can be used to open a view of the recent buffer (image window,
profile, spreadsheet, OpenGL, ...).
void AddMenuEdit( int base )
Create a new pulldown menu called Edit.
void AddMenuRectangle( int base )
Create a new pulldown menu called Rectangle.
void AddMenuMacro( int base )
Create a new pulldown menu called Macro. This menu includes the ten
user defined and editable macro lines.
void AddMenuNonlinearFilter( int base )
Append the items of the nonlinear filter functions to a pulldown menu.
void AddMenuHardware( int base )
Append the hardware items (General, Camera 1 to Camera 6) to a pulldown menu.
197

10 Menus and Toolbars

void UpdateMenuDevices( int base )


Append items for all enabled devices to the pulldown menu. If base=0
the items are refreshed dependant to changed device settings. This function is called when closing the Hardware dialog.
void AddMenuWindow( int base )
Create a new pulldown menu called Window.
void AddMenuResolution( int base )
Append items for the different resolution to the pulldown menu.
void AddMenuColor( int base )
Create a new pulldown menu named Color and add an item for every
color lookup table.
void AddMenuHelp( int base )
Create a pulldown menu named Help, which includes calls to the online
help and to open the About box.
void AddMenuPIV( int base )
Create a new pulldown menu with name Piv/Ptv including the standard PIV functions.
void AddMenuFont( int base )
Append items for font selection to the pulldown menu.

10.4

Subroutines for ToolBar Creation

The toolbar shows a number of bitmap buttons to start often used functions
with a mouse click. Additionaly some predefined lists can be included, e.g.
for the selection of resolution and zoom.
The toolbar can either have a total height of 40 pixel (large mode, global
variable ToolBarWithLargeItems = 1 during ShowToolBar) or of 28 pixel
(small mode).
For every toolbar buttons a shortcut key can be defined. Note that every
shortcut must be unique for the tool bar, menu bar and free shortcuts set
with subroutine SetCommandKey, page 194. A macro command is exectuted
whenever the shortcut is pressed ot the left mouse button is clicked on the
bitmap button. Moving the mouse above the butons shows a message in the
status bar.
198

10.4 Subroutines for ToolBar Creation

Every toolbar item (bitmap or predefined list) has to be defined with an unique
index called theId in every of the following subroutines. This index must be
unique for the toolbar only and does not trouble the menu bar.
NewToolBar
void NewToolBar()
Destroy the complete toolbar. This macro calls subroutine DeleteToolItem(-1).
ShowToolBar
void ShowToolBar()
Reload all bitmaps, reset the positions of every item and show the toolbar if it
had been hidden before. This macro calls the subroutines AddToolItem(-1,"","","")
and ShowDataWindow(-7).
AddToolItem
void AddToolItem( int theId, string theFileName, string theCommand,
string theMessage );
Append bitmap button located in file theFileName to the toolbar. If theId=-1
the toolbar is updated, all bitmaps reloaded and the item positions recalculated.
If theFileName is the empty string, a small space of 10 pixel width is inserted. The following predefined items can be included with special values for
parameter theFileName:
The predefined toolbar bitmaps have a size of 33 x 33 pixel in the large mode
and 20 x 20 pixel in the small mode. The width should be smaller than 50
pixel in the large mode (most common equal to the height or a little bit larger)
and equal to the height in the small mode.
theFileName

item

ZOOM

Listbox to select the zoom factor for the active window

RESO

Listbox to select the resolution of the active window

RECT

Listbox to select the active rectangle

COORD

Three text lines to display the coordinates and intensity of the pixel below the mouse cursor in a window

Tab. 10.2: Predefined tooolbar items for subroutine AddToolItem.

199

10 Menus and Toolbars

DeleteToolItem
void DeleteToolItem( int theId );
Delete an item (button or list). If theId=-1 the complete toolbar is deleted.
SetToolCommand
void SetToolCommand( int theId, string theCommand );
Change the macro command for a bitmap button.
SetToolMessage
void SetToolMessage( int theId, string theMessage );
Change the message shown in the status bar when moving the mouse above
the bitmap item.
SetToolKey
void SetToolKey( int theId, string theKey );
Define a shortcut for a toolbar button. See section Definition of Shortcuts on
page 193 for the correct syntax of parameter theKey.
SetToolState
void SetToolState( int theId, int isEnabled );
Disable or enable (isEnabled=0/1) a bitmap button. This item state can be
set automatically when using the flags 0x0100 to enable if the active buffer is
not empty or/and 0x0200 to enable if the active window is open. Both flags
are implemented as constants TOOLSTATE BUFFER and TOOLSTATE WINDOW. Use
additional flag 0x0010 to enable the color replacement of palette color 0 by
the default system background color.

200

A Appendix
A.1

How to write your own help files

LaVisions DaVis uses an easy way to present descriptions of macro functions.


The information is given either in html-format or in pdf-format, so the user
can view the help files with the prefered browser or with the Acrobat Reader.

A.1.1

HTML Style Help

The following example is file USER.HTM, which includes all help information
for macro file USER.CL:
<HTML>
<HEAD>
<TITLE>Manual:
</HEAD>

USER.cl</TITLE>

The user can write own functions and dialogs into file
USER.CL and start these functions or open
these dialogs from here.
<A NAME=UserStartup><H3>UserStartup()</H3>
Function <I>UserStartup()</I> is called at start of DaVis.
The user can open some dialogs or start some
action from here.
</HTML>
The first paragraph from <HTML> to </HEAD> is the header of the html-file.
It should include the name of the described macro file as title. The second
paragraph gives some descriptions for the contents of the macro file. The third
paragraph, starting with <A NAME=, describes a function. Use this syntax to
append your own descriptions for macro file USER.CL to USER.HTM or to create
help files for your own macro files.
When called from button Help in dialog box Execute Function the browser
jumps to the position referenced by <A NAME=functionname>. The text be201

A Appendix

tween <H3> and </H3> is used as headline of the described function. It should
include the function header.

A.1.2

PDF Style Help

Files of type PDF can be created by the Acrobat Destiller or by a number


of (sometimes free) other programs. It can be useful to write the help files
with an editor which supports hyperlinks to open the document at a specified
position.

A.1.3

Help on Dialogs

You can also enter a short description which appears in the bottom line of dialog Execute Function by defining a string variable with name helpFunctionName.
At least the This Window-help can be used by user dialogs. Define a string
winhelpFunctionName which is used as path and name of a htm- or pdf-file,
e.g.
winhelpUserFunction = "help\\user.htm#UserFunction"
opens the htm-file user.htm in subdirectory help and jumps to the position
of <A NAME=UserFunction>, or e.g.
winhelpUserFunction = "help\\myHelp.pdf#UserFunction"
opens the pdf-file user.pdf in subdirectory help and jumps to the labeled
hyperlink UserFunction.

A.2
A.2.1

File Formats
Image Files of types IMG and IMX

DaVis usually stores image buffers in a compressed IMX format. Uncompressed data storage in the IMG-format is also possible.
Both file formats are devided into the parts image file header (see description
below, first 256 byte of every file), data and (since DaVis 5.4.2 ) the extended
header.
The data is stored in binary format line by line from the top left to the
right bottom of the buffer as unsigned short integers (2 bytes each pixel) or,
for FLOAT buffers, as single precision floating point numbers (4 bytes each
pixel).
The extended header includes long names (more than ten characters) of the
x/y/i-scaling dimension and unit, the complete z- and frame-scaling information, long comments with more then 80 characters and the buffer attributes
202

A.2 File Formats

(see subroutines Get/SetBufferAttribute on page 68 and the table in the


following chapter).
In table A.1 the image file header is shown.
Type
Position Meaning
0

IMG-files = 18, IMX-files = 19,


FLOAT = 20

short xstart

start-pos left, ignored (=0) by


DaVis

short ystart

start-pos top, ignored (=0) by


DaVis

char extended[4]

reserved

short rows

10

number of rows, if -1 use longRows

short columns

12

number of colums, if -1 use longColumns

short sub type

14

subtype,
see
SetImageFormat
5.1 on page 59

short y dim

16

size of y-dimension (always =


rows)

short f dim

18

size of f-dimension (number of


frames)

short vector grid

20

grid size for vector buffers (1-n)

char ext[11]

22

reserved

char version

33

e.g. 62 = DaVis 6.2

char date[9]

34

date

char time[9]

43

time

short xinit

52

x-scale values

float xa

54

scalepos = xa * pixelpos + xb

float xb

58

char xdim[11]

62

x-dimension

char xunits[11]

73

x-units

short yinit

84

y-scale values

float ya

86

scalepos = ya * pixelpos + yb

float yb

90

char ydim[11]

94

y-dimension

char yunits[11]

105

y-units

short iinit

116

i-scale values

short imagetype

subroutine
and
table

continued on next page

203

A Appendix

Type

Position Meaning

float ia

118

float ib

122

char idim[11]

126

i-dimension

char iunits[11]

137

i-units

char com1[40]

148

comment (2 lines)

char com2[40]

188

long longRows

228

rows if rows>32000

long longColumns

232

columns if columns>32000

long longZDim

236

z-dimension

short scalarN

240

number of scalar components, =0


for standard image or vector
buffers

char reserved[10]

242

long checksum

252

scalepos = ia * intensity + ib

not used

Tab. A.1: The 256 bytes of the image file header of IMG and IMX files. Here,
it is defined as a C-structure. The position gives the offset in byte. Note
that short means two byte integer, long means four byte integer, float is a
four byte floating point value and char is a one byte character .

A.2.2

Ascii file format of type TXT

The first line of this Ascii text format defines the data type (image or vector),
the size and some scaling information. The next lines include all raw pixel
intensities from the upper left corner of the image (position x=0,y=0) to the
lower right corner. Every line in the file includes the data of one row of the
buffer.
The format of the header in the first line is defined for image buffers as:
#DaVis 6.0 2D-image PointsPerLine height width xa xb "xdescr"
"xunits" ya yb "ydescr" "yunits" "zdescr" "zunits"
For vector buffers the first line looks like:
#DaVis 6.0 <n>D-vector <Gridsize> <height> <width> "<xdescr>"
"<xunits>" "<ydescr>" "<yunits>" "<zdescr>" "<zunits>"
Every line of a vector type ascii file includes the data of one vector in the order
from top left to bottom right. The first two values define the scaled position of
the vector, the next two (or three for 3D-vectors fields) values give the scaled
vector components.
Example
AsciiFile ("IMAGE1.TXT", 1, 3)
204

A.3 Supported Buffer Attributes

Lets assume that buffer 1 has got a width of 5 columns and a height of 2 rows.
The file is stored with three pixels per line. The ASCII file IMAGE1.TXT looks
like:
%DaVis 6.2 2D-image 3 2 5 1.0 0.0 width mm
2.7 1.5 height mm
Pix[1,0,0] Pix[1,0,1] Pix[1,0,2]
Pix[1,0,3] Pix[1,0,4] Pix[1,1,0]
Pix[1,1,1] Pix[1,1,2] Pix[1,1,3]
Pix[1,1,4]

A.3

Supported Buffer Attributes

Subroutines and macros about the usage of Buffer Attributes are described
on page 67. The following table presents attributes, which are defined by
LaVision for different purposes.
Sometimes indexed attribute names are used, e.g. for different frames. In
this case the name is given as FrameName[0|1|2|...] to define all names like
FrameName0, FrameName1 and so on. The same can be defined by FrameNameX
with X as the index. Note, that frames are numbered starting with frame 0.
Attributes for Display
Some window types readout display attributes to receive more information
about the buffer, e.g. for colored frames.
Name
Value
Description
FrameName[0|1|
2|...]

name

Name of frame number X, will be


displayed in the image window title when viewing single frames

Overlay

definition
string

Overlay graphics, painted in all


frames of a multiframe buffer. See
macro file SYS OVERLAY.CL for further descriptions.

OverlayX

definition
string

Overlay graphics for a single


frame.
Subroutine
TakeImage copies the variable
CamOverlay[camN]
into
this
attribute.
continued on next page

205

A Appendix

Name

Value

Description

OverlayAttributes

0 or 1

Disable or enable the automatically display of string-type buffer


attributes as overlays.

OverlayAttr
[AttrName]

posX posY
color size
absPos
[formatstr]

Display
a
string
attribute
AttrName in the image window.
The string defines the
position, color and size of the text.
If the last value absPos is set
to 1, the position is an absolute
window position and the text is
displayed at this position of the
visible window. This means, the
position is not changing if the
user scrolls through the image.
Value absPos = 0 defines the
position as pixel position of the
buffer, so the text moves when the
user scrolls through the image.
If a format string is given, the
placeholder %% is replaced by the
attributes value.
continued on next page

206

A.3 Supported Buffer Attributes

Name

Value

Description

WhiteAdjust

r,g,b,offset

White adjustment factors and offset for dark image (like background subtraction)

RGBFrameX

rgb mode

Frame X is colored. The order of


the rgb-pixel is given by the mode
(0= no color).

Frame RGB
MATRIX

number 0

Frame is colored (from color camera)

SourceFile

filename

Name of IMX/IMG file, which has


been the source of e.g. a vector
calculation; overwrites SourceFileExp

SourceFileExp

filename

Like SourceFile, but autodetected


and set by the LoadBuffer subroutine; used if SourceFile does not
exist

Tab. A.2: Attributes for display information


Attributes for 3D-Display
Some attributes should be used to define special OpenGL window display.
The 3DPeak window needs this attributes to determine the scalar values to
be used as radius or intensity information of a peak.
Name

Value

Description

3DPeak

Display sparse buffers with 2


scalars in a 3d-peak-window

3DPeakRadius

scalarN

Number of scalar with radius


value in simple sparse buffer

3DPeakIntens

scalarN

Number of scalar with intensity


value in simple sparse buffer

Tab. A.3: Attributes for 3D-Display

Attributes for Acquisition


The acquisition attributes are usualy stored in the buffer during execution of
the TakeImage subroutine.

207

A Appendix

Name

Value

Description

CameraName
[0|...]

number: name

Information about the camera


which acquired a frame (the index
after CameraName), e.g.
1A: FlowMaster3 for first image
in double-frame-mode of camera 1
which is a FM3-camera

FrameProcessingX

bitcoded value

This flag includes information


about the executed processing
steps:
1: background subtraction done
2: rotation
4: standard image correction

RealFrameSizeX

width and height

This array stores the real frame


size of a buffer, which is acquired
via a multi-camera-readout item.
The first element is the real width
of the camera frame, the second
element is the height.

CCDExposureTimeX

time

CCD exposure time in msec or


sec (the scale is stored, too)

IIWidthX

Width of image itensifier

IIDelayX

Delay of image itensifier

PivDt

Time in sec

Has been comment dt = ... in


DaVis 5

FrameTimes

Time\nTime\n... Supercedes PivDt in multi frame


buffers
Tab. A.4: Attributes for acquisition information

Attributes about Attributes

Some systems or acquisition modes are creating lots of attributes (a class of


attributes), e.g. the analog data acquisition described in the next section.
Here the best way to display the attribute class is the usage of an own dialog,
which can be opened from the general Buffer Attributes Dialog. See table
A.4 for the complete list.
208

A.3 Supported Buffer Attributes

Name

Value

Description

AttributeDisplayX

macro command

Executed by the buffer attribute


dialog to open a special attribute
display dialog. The X in the attribute name should describe the
attribute class and should be an
unique name.

Tab. A.5: Attributes to display more information about other attributes.


Attributes about Buffers
Some systems or acquisition modes create special components, which are
stored like normal intensity values in the buffer. E.g. a 2D vector buffer with
three additional floating point components is a buffer with five float values for
every pixel. See table A.4 for the complete list.
Name

Value

Description

ComponentNameX description

Name of the additional component


number 0,1,2...

ExecAfterLoadBuffer

Execute
command
ExecAfterLoadBuffer+
(bufnum) at the end of
subroutine LoadBuffer

macroname

Tab. A.6: Attributes to define additional information for buffers.

Attributes for Analog Data Acquisition


It is possible to readout more than one analog data device. Therefore attribute
AnalogSource gives the number of used devices and all variables concerning
a single device are indexed from 1 to AnalogSources, e.g. AnalogNameX.
Additionally a device can read out more than one channels, e.g. the CIO is
able to scan up to eight analog inputs. The number of channels is defined
in attribute AnalogChannelsX. So lots of the following analog data attributes
are either stored as a single value (string type attribute) or as a float array.
If AnalogChannelsX > 1 the type is an array, but if AnalogChannelsX = 1
the type is unknown and depends on the acquisition device. Please use macro
GetBufferAttributeValue to readout this attributes without knowing the
real type.

209

A Appendix

Name

Value

Description

AnalogSources

number

Number of analog devices

AnalogName
[1|...]

name

Name of analog data source number X

AnalogTypeX

1: energy,
2: ADC

type of analog data

AnalogScaleX

aa\nbb\nunit\n
descr.

Scaling of analog data (intensity)


for source X, seperated by line
feeds (,\n)

AnalogChannelsX

number

Number of channels of data source


X

AnalogChannelIndexX

index

For display in Analog Dialog: real


CIO channel index

AnalogValueX

value or float array

Analog data for every channel, e.g.


the energy value(s)

AnalogTraceX

float array

Analog data trace of all channel


len(trace)/channels values for
each channel

AnalogTraceScaleX

aa\nbb\nunit\n
descr.

Scaling for x-axis of trace, normaly used as time

AnalogAvgX

value or float array

Average (per channel)

AnalogRmsX

value or float array

Rms (per channel)

AnalogMinX

value or float array

Minimum (per channel)

AnalogMaxX

value or float array

Maximum (per channel)

AnalogReferenceX

value or float array

Reference value (per channel),


needed for image correction

AnalogFlagX

value or integer
array

Bit-coded flag (per channel):


1: correction done

AnalogImageX

value or integer
array

The analog data (per channel) is


applied to an image/frame of this
buffer:
-1: no image / independent
0: applied to this frame number
-2: applied to all frames
continued on next page

210

A.4 Supported Window Parameters

Name

Value

Description

AnalogPostStatistics

value (1=yes)

Automatically calculate trace


statistics in the Analog Attributes
Dialog

AnalogPostProcessing

mode

Automatically call macro function ExecuteAnalogCio() from


the Analog Attributes Dialog before displaying the data

Tab. A.7: Attributes for analog data acquisition

A.4

Supported Window Parameters

The following table lists some parameter types for the subroutines Get /
SetWinPar (see page 105), which can be used to setup the view in an image or profile window or even of some dialog items. All this constants are
defined in macro file SYS CONST.CL.
Parameters for Image Window
Type

Parameter

WINPAR GAMMA

see GetWindowGamma

WINPAR RESOLUTION

Get (or set) the color resolution


of an image window. Not equal
to Get/SetWindowResolution!
Values are -2 for a bitshift of 64,
-1 for 128, 0 for 256, ..., 8 for
65536. This paramater can be
used for the modes 0-max (9),
+-max (10), min-max (11) and
for range (12), resolution up (100) or down (-101) and optimal resolution (-102). Please
use the constants RESOLUTION x
instead of the direct values.
Another way to set some of
this modes is parameter WINPAR COLOR MAP MODE.
continued on next page

211

A Appendix

Type

Parameter

WINPAR RESO MIN

Minimum of min-max-resolution

WINPAR RESO MAX

Maximum of min-max-resolution

WINPAR RESO PERCENT

Percent of intensities to calcaulate min and max from an intensity histogram

WINPAR ZOOM

See GetWindowZoom

WINPAR FRAME

See GetWindowFrame

WINPAR IMAGE FRAMESCROLLING

Show slider for frames

WINPAR CLUT IMAGE

Individual palette for the image,


-1 for the active global image
palette

WINPAR COLOR REP

Disable or enable the repeated


color mapping mode

WINPAR COLOR MAP MODE

Set the color mapping mode: optimal bitshift (0), fixed bitshift
(1), range (2), 0..max (3), +-max
(4) , min-max (5)

WINPAR PROFILE MIN

Minimum of the small profiles below and right to the image

WINPAR PROFILE MIN

Maximum of the added profile

WINPAR CLUT WIDTH

Width (in pixel) of the color


lookup tables right to the image
display

WINPAR ATTR SUPPORT

Returns
the
flags
available
for
subroutines
Get/SetWindowDisplay (page
103)

WINPAR ATTR SUPPORT2

Returns additional flags, see subroutines Get/SetWindowDisplay


(page 103)

WINPAR STR IMG SCALE

Returns a string with the scaling


unit of the image buffer

WINPAR STR EVENTONMOUSE Define a callback macro for


events on mouse movements on
an image window or on a dialog
item window. See example on
page 109.
continued on next page

212

A.4 Supported Window Parameters

Type

Parameter

WINPAR REPAINT

Disable (=0) or enable (=1) the


repainting of a window, which is
done after every call to SetWinPar when enabled. When a sequence of SetWinPar-calls is programmed, better disable the repainting at the beginning and enable it at the end of the sequence.

Tab. A.8: Parameters for Image Windows to be defined via SetWinPar or to


be readout via GetWinPar.
Parameters for Profile Windows
Type

Parameter

WINPAR PROFILE MODE

Mode: horizontal line (0), horizontal sum in range of lines (1),


average (2), vertical column (3),
vertical sum in range (4), vertical
average in range of columns (5),
arbitrary line (6), circle (7)

WINPAR PROFILE VECMODE

Vector length (0), Vx (1), Vy (2),


Vz (3)

WINPAR PROFILE NPROFILES

Number of visible profiles

WINPAR PROFILE RANGE FROM

Range from row or column

WINPAR PROFILE RANGE TO

Range to row or column

WINPAR PROFILE POS X1

Start position (X) of arbitrary


line or center of circle

WINPAR PROFILE POS Y1

Start position (Y)

WINPAR PROFILE POS X2

End position (X) or arbitrary line


or radius of circle

WINPAR PROFILE POS Y2

End position (Y)

WINPAR CHANGE RESO

Optimal resolution (0): adjust Xrange and I-range to optimal values


continued on next page

213

A Appendix

Type

Parameter

WINPAR PROFILE MULTI DISTANCE

Lines (or columns) between


stacked profiles (number of
visible profiles)

WINPAR PROFILE BAR OFFSET

If enabled, the bars are centered


on the profile points; if disabled,
the profile points define the left
side or the bar.

Tab. A.9: Parameters for Image Windows to be defined via SetWinPar or to


be readout via GetWinPar. The selection of display modes lines, dots, filled or
bars can be defined by subroutine SetWindowDisplay (page 103).
Parameters for Vector Windows
Type

Parameter

WINPAR IMAGE SMOOTH

Smooth the background image

WINPAR IMAGE MODE

Background image mode

WINPAR IMAGE BUFFER

Number of the image buffer used


as background

WINPAR IMAGE COMPONENT

Number of the displayed component information in image mode


component

WINPAR CLUT VECTOR

Individual palette for vector display, -2 for the active global vector palette

WINPAR CLUT BACKGROUND

Individual palette for the vector


background display, -3 for the active global background palette

WINPAR VEC DISPLAY TYPE

Vector Display Parameter

WINPAR VEC DISPLAY REL MODE

Relative vector display mode

WINPAR VEC DISPLAY REL X

Relative to X

WINPAR VEC DISPLAY REL Y

Relative to Y

WINPAR VEC DISPLAY REL Z

Relative to Z

WINPAR VEC LENGTH

Vector length factor

WINPAR VEC SCALE

Return the intensity scale of the


vector buffer (retired function)
continued on next page

214

A.4 Supported Window Parameters

Type

Parameter

WINPAR VEC REFERENCE

Show (1) or hide (0) the reference


vector

WINPAR VEC REFERENCE LEN

Length of the reference vector

WINPAR VEC REFERENCE SIZE

Size of reference vector description (default: 12 points)

WINPAR VEC GRID

Grid factor
...6=8/1)

WINPAR VEC INVERSION

Invert Vx, Vy and Vz (multiply


with -1)

WINPAR VEC RESO MIN


MAX

(0=1/8,

1=1/4,

Min/max for vector color resolution

WINPAR VEC MODE

Display arrows or grid

WINPAR VEC PERCENT

Like
PAR RESO PERCENT

WINPAR VEC COLOR MODE

Vector color mode, e.g. vector


length or choice or q-ratio

WINPAR VEC COLMAP MODE

Mapping mode (0..max, minmax,...)

WINPAR VEC COMPONENT

Number of the displayed component in color mode component

WINPAR VEC ARROW WIDTH

Width of the vector lines

WINPAR VEC COLOR BUFFER

Use this buffer as reference for


vector color.

WINPAR VEC COLOR BUFFER MODE

Use grid (bit 0), every second


frame (bit 1)

WINPAR VEC RAWIMAGE MODE

Blend source image into background (1), including image correction (2)

WINPAR VEC RAWIMAGE FRAME

Use this frame of the source image

WINPAR COLOR (+1, +2, .., +6)

Set or get the vector colors (index


to a predefined colors, see table
6.7); the first five vector colors
define the vector choice colors,
the sixth color if the background
color, the seventh the color of the
reference vector

WIN-

continued on next page

215

A Appendix

Type

Parameter

WINPAR STR VEC SCALE

Returns a string with the scaling


unit of the vector color mode

WINPAR STR BACK SCALE

Returns a string with the scaling


unit of the vector background

Tab. A.10: Parameters for Vector Windows to be defined via SetWinPar or to


be readout via GetWinPar.
Parameters for OpenGL Windows
The following parameters set display information of 3D (OpenGL) views.
Type
Parameter
WINPAR 3D x

For 3D-view of 3D buffers

WINPAR 3D TYPE

Returns the type of the 3D-view:


see WINTYPE 3D x in macro file
SYS CONST.CL

WINPAR 3D PROJECTION

Perspective (0) or orthogonal (1)


view

WINPAR 3D COORDCROSS

Display the x-, y- and z-axis


(on=1)

WINPAR 3D LEN MODE

Use a different (vector) length


factor for the z-component

WINPAR 3D LEN XY

Length factor of the x- and ycomponent; for the vector view


this parameter is equal to WINPAR VEC LENGTH

WINPAR 3D LEN Z

Length factor of the z-component

WINPAR 3D POS X / Y / Z

Viewing position

WINPAR 3D ANGLE H / V

Horizontal and vertical viewing


angle

WINPAR 3D RESET VIEW

Reset the viewing position and


angle to the default values

WINPAR 3D IMG COMPRESS

Compression factor for image


and vector background displays;
set this value larger than one to
reduce the number of displayed
filled squares; a low value will decrease the display speed
continued on next page

216

A.4 Supported Window Parameters

Type

Parameter

WINPAR 3DVEC AXIS

Additional display for vector


view: paint xy-grid (1), xz-plane
(2), z-beam (4); the values can be
summed

WINPAR 3DVEC ARROW

paint no vector arrows (0), paint


arrows proportinal to the vector
length (-1), use the value as factor for the grid value (0)

WINPAR 3DIMG MODE

Display mode for image view: no


processing (0), iso-lines (1), iso
min-max (2), iso-planes (3), iso
contour (4), iso range contour (5)

WINPAR 3DIMG ISO LINES

Number of iso lines

WINPAR 3DIMG ISO MIN


MAX

Range of the iso lines

WINPAR 3D MOVIE STOREPOS

Store the recent view position


and angle as start position of the
movie (1), as end position (2),
goto the start position (-1), goto
final position (-2)

WINPAR 3D MOVIE MODE

Walking mode: linear (0) or arc


(1), once (0) or repeat (256) or
turn around (512)

WINPAR 3D MOVIE STEPS

Number of steps to walk between


starting and final position

WINPAR 3D MOVIE WALK

Start walking with this number


of steps per second (> 0; or stop
walking (-1)

WINPAR 3DSLICE THRESHOLD MODE

Display slices without a thresholding range (0), cut everything


below a minimum (1), cut above
a maximum (2), use range (3)
continued on next page

217

A Appendix

Type

Parameter

WINPAR 3DSLICE THRESHOLD MIN / MAX

Minimum and maximum of the


slice thresholding range

Tab. A.11: Parameters for 3D (OpenGL) Windows to be defined via


SetWinPar or to be readout via GetWinPar.

218

Index

Index
C
ColorTable

DITEM SCALE . . . . . . . . . . 182


DITEM SCROLLBAR . . . . 169

Dialog . . . . . . . . . . . . . . . . . . . . 167

DITEM SLIDER . . . . . . . . . .173

Vector . . . . . . . . . . . . . . . . . . . . 111

DITEM SPINBUTTON . . . 173

Constant

DITEM TEXT. . . . . . . . . . . .167

AS AFTER . . . . . . . . . . . . . . . 153

DITEM TEXT EDIT . . . . . 169

AS BEFORE . . . . . . . . . . . . . 153

DITEM TOGGLE . . . . . . . . 171

AS DURING . . . . . . . . . . . . . 153

DITEM TREEVIEW . . . . . 174

COLOR * . . . . . . . . . . . . 110, 186

DITEM WINDOW . . . . . . . 183

DISP2 * . . . . . . . . . . . . . . . . . . 103

DLGA * . . . . . . . . . . . . . . . . . . 159

DISP * . . . . . . . . . . . . . . . . . . . 103

DLGPAR * . . . . . . . . . . . . . . . 186

DITEM APPLY . . . . . . . . . . 166

FRAMEPROC * . . . . . . . . . . . 71

DITEM BITMAP . . . . . . . . . 169

GLUE STICKY * . . . . . . . . . 187

DITEM BITMAP BUTTON170

RESOLUTION * . . . . . . . . . 211

DITEM BUFFER. . . . . . . . .179

V OP * . . . . . . . . . . . . . . . . . . . . 94

DITEM BUTTON . . . . . . . . 166

WINPAR * . . . . . . . . . . 105, 211

DITEM CANCEL . . . . . . . . 166


DITEM CARD . . . . . . . . . . . 171

WINPAR STR EVENTONMOUSE


109

DITEM CHECKBOX . . . . . 167

WINTYPE *. . . . . . . . . . . . . . .99

DITEM CLUT . . . . . . . . . . . . 183


D

DITEM EDIT . . . . . . . . . . . . 168


DITEM EDITDIGIT . . . . . 178
DITEM EMBEDDED. . . . .178

Dialog
AcquisitionTiming

DITEM GROUP . . . . . . . . . . 173

Edit . . . . . . . . . . . . . . . . . . . . 135

DITEM INFO . . . . . . . . . . . . 178

BusyText . . . . . . . . . . . . . . . . . 149

DITEM LINE. . . . . . . . . . . . .170

Choice . . . . . . . . . . . . . . . . . . . . 151

DITEM LIST BOX . . . . . . . 168

Debugger . . . . . . . . . . . . . . . . . . 18

DITEM LIST BUTTON . . 168

DialogEditor . . . . . . . . . . . . . . 190

DITEM LIST EDIT . . . . . . 168

DialogEditorText . . . . . . . . . 192

DITEM OK. . . . . . . . . . . . . . .166

Error . . . . . . . . . . . . . . . . . . . . . . 16

DITEM PROFILE . . . . . . . . 181

Extended . . . . . . . . . . . . . . . . 16

DITEM PROGRESS . . . . . . 173

Stack . . . . . . . . . . . . . . . . . . . . 16

DITEM RADIO . . . . . . . . . . 168

Message. . . . . . . . . . . . . . . . . . .151

DITEM RECTANGLE. . . .170

Question . . . . . . . . . . . . . . . . . . 150

DITEM ROTATION . . . . . . 179

Variables . . . . . . . . . . . . . . . . . . . 17
219

Index

E
Event
Update Buffer. . . . . . . . . . . . .155
F
Function
AbsBuffer . . . . . . . . . . . . . . . . . . 75
acos . . . . . . . . . . . . . . . . . . . . . . . . 50
acosd . . . . . . . . . . . . . . . . . . . . . . 50
ActionAfterAcq . . . . . . . . . . . 153
ActionBeforeAcq . . . . . . . . . . 152
ActionDuringAcq . . . . . . . . . 153
ActionInitAcq. . . . . . . . . . . . .152
ADCReadN . . . . . . . . . . . . . . . 142
AddActionString . . . . . . . . . . 153
AddItem . . . . . . . . . . . . . . . . . . 165
AddItemImage . . . . . . . . . . . . 188
AddItemLine. . . . . . . . . . . . . .186
AddItemProfile . . . . . . . . . . . 189
AddMenuColor . . . . . . . . . . . 198
AddMenuEdit. . . . . . . . . . . . .197
AddMenuFont . . . . . . . . . . . . 198
AddMenuHardware . . . . . . . 197
AddMenuHelp . . . . . . . . . . . . 198
AddMenuItem . . . . . . . . . . . . 195
AddMenuMacro . . . . . . . . . . . 197
AddMenuNonlinearFilter . . 197
AddMenuPIV . . . . . . . . . . . . . 198
AddMenuRectangle . . . . . . . 197
AddMenuResolution . . . . . . 198
AddMenuView . . . . . . . . . . . . 197
AddMenuWindow . . . . . . . . . 198
AddToolItem . . . . . . . . . . . . . 199
Amplitude . . . . . . . . . . . . . . . . . 91
AppendFrameToBuffer . . . . . 66
ApplyDialog . . . . . . . . . . . . . . 165
ApplyItem . . . . . . . . . . . . . . . . 184
AsciiFile . . . . . . . . . . . . . . 40, 204
asin . . . . . . . . . . . . . . . . . . . . . . . . 51
asind . . . . . . . . . . . . . . . . . . . . . . . 51
220

atan . . . . . . . . . . . . . . . . . . . . . . . 50
atan2 . . . . . . . . . . . . . . . . . . . . . . 50
AvgLine . . . . . . . . . . . . . . . . . . . 83
AvgRect . . . . . . . . . . . . . . . . . . . 87
Beep . . . . . . . . . . . . . . . . . . . . . . . 38
Bin . . . . . . . . . . . . . . . . . . . . . . . . 46
BinarizeRectLevel . . . . . . . . . . 88
BufferDrawCircle. . . . . . . . . . .75
BufferDrawLine . . . . . . . . . . . . 75
BufferDrawText . . . . . . . . . . . . 75
BufferName . . . . . . . . . . . . . . . . 67
BusyDone. . . . . . . . . . . . . . . . .149
BusyProgress . . . . . . . . . . . . . 149
BusyStart . . . . . . . . . . . . . . . . . 149
BusyText . . . . . . . . . . . . . . . . . 149
CallDll . . . . . . . . . . . . . . . . . . . . . 55
CancelDialog . . . . . . . . . . . . . . 165
ceil. . . . . . . . . . . . . . . . . . . . . . . . .50
ChDir . . . . . . . . . . . . . . . . . . . . . . 41
CheckKey . . . . . . . . . . . . . . . . . . 37
CheckLoadCLFile . . . . . . . . . . 52
CL command . . . . . . . . . . . . . . 51
ClearInfoText . . . . . . . . . . . . . . 36
Close. . . . . . . . . . . . . . . . . . . . . . .44
CloseComPort . . . . . . . . . . . . 139
CloseDialog . . . . . . . . . . . . . . . 165
CloseWindow . . . . . . . . . . . . . 101
CombineAmplitudePhase . . . 92
CompressBuffer . . . . . . . . . . . . 77
CompressRectangle . . . . . . . . 87
ContourPlot . . . . . . . . . . . . . . . 76
Contrast . . . . . . . . . . . . . . . . . . . 88
ConvertPeakBuffer . . . . . . . . . 79
ConvertRGBImage . . . . . . . . . 81
CopyAttributeArrayToProfileItem
70
CopyBufferAttributes . . . . . . 69
CopyBufferPlane . . . . . . . . . . . 66
CopyBufferScalarComponent62,

Index

67

EnterString . . . . . . . . . . . . . . . . 37

CopyBufferToFrame . . . . . . . . 66

Error . . . . . . . . . . . . . . . . . . . . . . 36

CopyFile . . . . . . . . . . . . . . . . . . . 41

ExecuteProgram . . . . . . . . . . . 54

CopyFrameToBuffer . . . . . . . . 66

ExistsItem . . . . . . . . . . . . . . . . 188

CopyRealFrameToBuffer . . . 71

ExpandBuffer . . . . . . . . . . . . . . 77

cos . . . . . . . . . . . . . . . . . . . . . . . . . 50

ExpBuffer . . . . . . . . . . . . . . . . . . 75

CountChar . . . . . . . . . . . . . . . . . 45

ExpLine . . . . . . . . . . . . . . . . . . . 84

CountInsideRectPixel . . . . . . 88

ExStr . . . . . . . . . . . . . . . . . . . . . . 45

CreateDataWindow . . . . . . . . 99

ExtractChannel . . . . . . . . . . . . 78

CreateHandleFromBuffer . . 100

FFT . . . . . . . . . . . . . . . . . . . . . . . 89

CreateImageBuffer . . . . . . . . . 63

FileExists . . . . . . . . . . . . . . . . . . 41

CreateVectorBuffer . . . . . . . . . 63

FileGetExtension. . . . . . . . . . .42

CreateVolumeBuffer . . . . . . . . 62

FileGetName . . . . . . . . . . . . . . . 42

CutoutRectangleShift . . . . . . 86

FileGetPath . . . . . . . . . . . . . . . . 42

DACset . . . . . . . . . . . . . . . . . . . 142

FileSelectBoxOpen . . . . . . . . . 42

DAP WritePattern . . . . . . . . 141

FileSelectBoxSave . . . . . . . . . . 43

DDE Command . . . . . . . . . . . 145

FileSelectionBox . . . . . . . . . . 156

Decimal . . . . . . . . . . . . . . . . . . . . 46

FilesInString . . . . . . . . . . . . . . . 47

DecimalBin . . . . . . . . . . . . . . . . 46

FileStripExt. . . . . . . . . . . . . . . .42

Delete. . . . . . . . . . . . . . . . . . . . . .40

FileStripPath . . . . . . . . . . . . . . 42

DeleteActionString . . . . . . . . 153

FileToRow . . . . . . . . . . . . . . . . . 40

DeleteBufferAttribute . . . . . . 69

FindToken . . . . . . . . . . . . . . . . . 47

DeleteItem . . . . . . . . . . . . . . . . 184

FlipBuffer . . . . . . . . . . . . . . . . . . 76

DeleteMenuItem . . . . . . . . . . 195

floor . . . . . . . . . . . . . . . . . . . . . . . 50

DeleteToolItem . . . . . . . . . . . 200

fmax . . . . . . . . . . . . . . . . . . . . . . . 50

Dialog . . . . . . . . . . . . . . . . . . . . 163

fmin . . . . . . . . . . . . . . . . . . . . . . . 50

DialogChoice . . . . . . . . . . . . . . 151

fmod1 . . . . . . . . . . . . . . . . . . . . . . 51

DIO48Init . . . . . . . . . . . . . . . . 141

FormatNumber. . . . . . . . . . . . .46

DIO48SetLine . . . . . . . . . . . . . 141

frange . . . . . . . . . . . . . . . . . . . . . . 51

DIO48SetValues . . . . . . . . . . 141

FreeBuffer . . . . . . . . . . . . . . . . 147

DirSelectionBox . . . . . . . . . . . 156

Get3DVector . . . . . . . . . . . . . . . 97

DisableItem . . . . . . . . . . . . . . . 185

Get4DVector . . . . . . . . . . . . . . . 97

EditWindowMenu . . . . . . . . . 102

GetAcqPar . . . . . . . . . . . . . . . . 115

EnableDialog . . . . . . . . . . . . . 164

GetAcqTime . . . . . . . . . . . . . . . 69

EnableItem . . . . . . . . . . . . . . . 185

GetActionString . . . . . . . . . . 153

EndAcquisition . . . . . . . . . . . 152

GetBufferAttribute . . . . . . . . . 68

EndOfFile. . . . . . . . . . . . . . . . . .44

GetBufferAttributeArray . . . 68

EnterFloat . . . . . . . . . . . . . . . . . 37

GetBufferAttributeScale . . . . 70

EnterInt . . . . . . . . . . . . . . . . . . . 37

GetBufferAttributeType . . . . 68
221

Index

222

GetBufferAttributeValue . . . 70

GetProfileCoordinate . . . . . 112

GetBufferFrames . . . . . . . . . . . 66

GetProfileDisplay . . . . . . . . . 112

GetBufferFromHandle . . . . . 100

GetReadoutParameter . . . . 122

GetBufferName . . . . . . . . . . . . 67

GetRealFrameSize. . . . . . . . . .71

GetBufferNX . . . . . . . . . . . . . . . 63

GetRect. . . . . . . . . . . . . . . . . . . .86

GetBufferNY . . . . . . . . . . . . . . . 63

GetReservedBuffer . . . . . . . . 148

GetBufferNZ . . . . . . . . . . . . . . . 63

GetSelectedRegion . . . . . . . . 107

GetBufferSize . . . . . . . . . . . . . . 59

GetTempBuffer . . . . . . . . . . . 147

GetCamPar . . . . . . . . . . . . . . . 119

GetTempBufferCopy . . . . . . 147

GetChar . . . . . . . . . . . . . . . . . . . 47

GetTempBufferSetSize . . . . 147

GetCircle . . . . . . . . . . . . . . . . . . 85

GetTimeMicroSec . . . . . . . . . . 38

GetCLUT . . . . . . . . . . . . . . . . . 112

GetTimer . . . . . . . . . . . . . . . . . 137

GetColorPixel . . . . . . . . . . . . . . 60

GetTokenN . . . . . . . . . . . . . . . . 47

GetComment . . . . . . . . . . . . . . 68

GetVariableType . . . . . . . . . . . 53

GetDialogId. . . . . . . . . . . . . . .164

GetVector . . . . . . . . . . . . . . . . . . 93

GetDialogSize . . . . . . . . . . . . . 164

GetVectorDisplay . . . . . . . . . 156

GetDialogStatus . . . . . . . . . . 165

GetVectorGrid . . . . . . . . . . . . . 68

GetDirectory . . . . . . . . . . . . . . . 41

GetVolumeBufferInfo . . . . . . . 63

GetDirName . . . . . . . . . . . . . . . 41

GetVolumeBufferSize . . . . . . . 63

GetEnvironmentVariable . . . 53

GetVolumePointFloat . . . . . . 64

GetFileDate . . . . . . . . . . . . . . . . 41

GetVolumePointVector . . . . . 64

GetFileSize . . . . . . . . . . . . . . . . 41

GetVolumePointWord . . . . . . 64

GetFirstVolumePoint. . . . . . .65

GetWindowDisplay . . . . . . . 103

GetFramegrabberADC . . . . 122

GetWindowFrame. . . . . . . . .105

GetFScale . . . . . . . . . . . . . . . . . . 74

GetWindowGamma . . . . . . . 104

GetImageFormat . . . . . . . . . . . 59

GetWindowResolution . . . . 103

GetInfoText . . . . . . . . . . . . . . . . 36

GetWindowSize . . . . . . . . . . . 101

GetInterpolated3DVector . . . 97

GetWindowType . . . . . . . . . . 100

GetIScale . . . . . . . . . . . . . . . . . . 74

GetWindowViewpoint . . . . . 105

GetItemBufferAndDialog . . 188

GetWindowZoom . . . . . . . . . 105

GetItemImagePixelPos . . . . 189

GetWinPar . . . . . . . . . . . . . . . 105

GetItemPar . . . . . . . . . . . . . . . 186

GetWinParStr . . . . . . . . . . . . 105

GetItemSize . . . . . . . . . . . . . . 185

GetXScale . . . . . . . . . . . . . . . . . 74

GetItemState . . . . . . . . . . . . . 188

GetYScale . . . . . . . . . . . . . . . . . 74

GetItemText . . . . . . . . . . . . . . 185

GetZScale . . . . . . . . . . . . . . . . . . 74

GetLine . . . . . . . . . . . . . . . . . . . . 84

GrepFiles . . . . . . . . . . . . . . . . . . 44

GetNextVolumePoint. . . . . . .65

HardwareInit . . . . . . . . . . . . . 137

GetNumberOfImages . 118, 152

Hex . . . . . . . . . . . . . . . . . . . . . . . . 46

GetPio . . . . . . . . . . . . . . . . . . . . 135

HideDialog . . . . . . . . . . . . . . . . 164

Index

HideItem . . . . . . . . . . . . . . . . . 184

Message . . . . . . . . . . . 20, 35, 150

IFFT . . . . . . . . . . . . . . . . . . . . . . 90

min . . . . . . . . . . . . . . . . . . . . . . . . 50

ImageCorrection . . . . . . . . . . . 82

MinimizeWindow . . . . . . . . . 101

InfoText . . . . . . . . . . . . . . . . 21, 36

MinLine. . . . . . . . . . . . . . . . . . . .84

InitMacroThread . . . . . . . . . . 155

MinRect . . . . . . . . . . . . . . . . . . . 87

InitMacroTimer . . . . . . . . . . . 155

MirrorLeftRight . . . . . . . . . . . . 76

inport. . . . . . . . . . . . . . . . . . . . .141

MirrorTopBottom . . . . . . . . . . 76

inportb . . . . . . . . . . . . . . . . . . . 141

MkDir . . . . . . . . . . . . . . . . . . . . . 41

IntensityHistogram . . . . . . . . . 76

MoveBuffer . . . . . . . . . . . . . . . . 77

Is3DVector . . . . . . . . . . . . . . . . . 70

MoveItemOffset . . . . . . . . . . . 188

IsBin . . . . . . . . . . . . . . . . . . . . . . . 46

MoveRectangle . . . . . . . . . . . . . 86

IsEmpty . . . . . . . . . . . . . . . . . . . 69

MultiplyFFT . . . . . . . . . . . . . . . 90

IsFloat . . . . . . . . . . . . . . . . . . . . . 70

NewMenu . . . . . . . . . . . . . . . . . 195

IsHex . . . . . . . . . . . . . . . . . . . . . . 46

NewToolBar . . . . . . . . . . . . . . 199

IsLocked . . . . . . . . . . . . . . . . . . . 69

NonlinearFilter . . . . . . . . . . . . . 89

IsProcessedBuffer . . . . . . . . . . 71

Open . . . . . . . . . . . . . . . . . . . . . . 43

IsValidSymbol. . . . . . . . . . . . . .53

outport . . . . . . . . . . . . . . . . . . . 141

IsVector . . . . . . . . . . . . . . . . . . . . 70

outportb . . . . . . . . . . . . . . . . . . 141

LinearFilter . . . . . . . . . . . . . . . . 88

OvGAddEllipse . . . . . . . . . . . . 73

LoadAcqFile . . . . . . . . . . . . . . 118

OvGAddLine. . . . . . . . . . . . . . .72

LoadAsciiFile . . . . . . . . . . . . . . 40

OvGAddPolygon . . . . . . . . . . . 73

LoadBuffer . . . . . . . 38, 207, 209

OvGAddRect . . . . . . . . . . . . . . 73

LoadBufferErr . . . . . . . . . . . . . 39

OvGAddText . . . . . . . . . . . . . . 73

LoadCLFile . . . . . . . . . . . . . . . . 52

OvGDeleteItems . . . . . . . . . . . 73

LoadMacroFile . . . . . . . . . . . . . 51

OvGRemoveAttribute . . . . . . 74

LoadProfile . . . . . . . . . . . . . . . . 39

OvGSetVisibleAttributes . . . 74

LoadProfileToBuffer . . . . . . . . 40

OvGShowAttribute . . . . . . . . 73

LoadSet . . . . . . . . . . . . . . . . . . . . 52

OvGShowAttributeFormat . 74

LoadSetGroup . . . . . . . . . . . . . 52

OvGViewAllString . . . . . . . . 111

LoadSetInfo . . . . . . . . . . . . . . . . 52

PeakDetection . . . . . . . . . . . . . 78

LockBuffer . . . . . . . . . . . . . . . . . 69

Phase . . . . . . . . . . . . . . . . . . . . . . 91

LogBuffer . . . . . . . . . . . . . . . . . . 75

PivCalculateVectorField . . . . 92

LogLine . . . . . . . . . . . . . . . . . . . . 84

PlotXY . . . . . . . . . . . . . . . . . . . . 85

LUT . . . . . . . . . . . . . . . . . . . . . . . 80

PosInStr . . . . . . . . . . . . . . . . . . . 45

MakeMaskBuffer . . . . . . . . . . 153

ProfileSelection . . . . . . . . . . . 112

MakeNiceFileName . . . . . . . . . 42

PtvCalculateVectorField . . . 92

max . . . . . . . . . . . . . . . . . . . . . . . . 50

Question . . . . . . . . . . . . . . 35, 150

MaxLine . . . . . . . . . . . . . . . . . . . 84

random . . . . . . . . . . . . . . . . . . . . 50

MaxRect . . . . . . . . . . . . . . . . . . . 87

randomize . . . . . . . . . . . . . . . . . . 50
223

Index

224

RandomParticleImage . . . . . . 80

SetBufferAttributeArray . . . 68

range . . . . . . . . . . . . . . . . . . . . . . 51

SetBufferAttributeScale . . . . 70

ReadFile . . . . . . . . . . . . . . . . . . . 44

SetBufferSize . . . . . . . . . . . . . . . 59

ReadFloat . . . . . . . . . . . . . . . . . 44

SetCamPar . . . . . . . . . . . . . . . 119

ReadInt . . . . . . . . . . . . . . . . . . . . 44

SetChar . . . . . . . . . . . . . . . . . . . . 47

ReadLine . . . . . . . . . . . . . . . . . . 44

SetCLUT . . . . . . . . . . . . . . . . . 112

ReadSetVariable . . . . . . . . . . . 53

SetCLUT2RGB . . . . . . . . . . . 113

ReceiveByte. . . . . . . . . . . . . . .140

SetColorPixel . . . . . . . . . . . . . . 60

ReceiveCom. . . . . . . . . . . . . . .140

SetComBufferSize . . . . . . . . . 139

ReceiveComBuffer . . . . . . . . 140

SetComDefault. . . . . . . . . . . .139

RectStatistics . . . . . . . . . . . . . . 87

SetComFastMode . . . . . . . . . 139

RectStatisticsScaled . . . . . . . . 87

SetCommandKey . . . . . . . . . 194

RemoteGetInfo . . . . . . . . . . . 146

SetComment . . . . . . . . . . . . . . . 68

RemoteSend . . . . . . . . . . . . . . 146

SetComOverlappedMode . . 139

Rename . . . . . . . . . . . . . . . . . . . . 40

SetComParameter. . . . . . . . .138

ReplaceChar . . . . . . . . . . . . . . . 46

SetDialogSize . . . . . . . . . . . . . 164

ResizeBuffer. . . . . . . . . . . . . . . .64

SetFramegrabberADC. . . . .122

RGBCombine . . . . . . . . . . . . . . 61

SetFScale . . . . . . . . . . . . . . . . . . 74

RGBFilter . . . . . . . . . . . . . . . . . 61

SetImageFormat . . . . . . . . . . . 59

RmDir . . . . . . . . . . . . . . . . . . . . . 42

SetInsideRectConstant . . . . . 87

RmDirTree . . . . . . . . . . . . . . . . . 42

SetIScale . . . . . . . . . . . . . . . . . . . 74

RmsRect . . . . . . . . . . . . . . . . . . . 87

SetItemColor . . . . . . . . . . . . . 185

RotateBuffer . . . . . . . . . . . . . . . 76

SetItemFocus . . . . . . . . . . . . . 186

RotateSteps . . . . . . . . . . . . . . . 137

SetItemPar . . . . . . . . . . . 169, 186

SaveAcqFile. . . . . . . . . . . . . . .118

SetItemProfileDisplay . . . . . 190

SaveWindowAsBitmap . . . . 101

SetItemSize . . . . . . . . . . . . . . . 185

Segmentation . . . . . . . . . . . . . . 81

SetItemText . . . . . . . . . . . . . . 185

SelectRect . . . . . . . . . . . . . . . . . 86

SetJoystickEvent . . . . . . . . . . 142

SendByte . . . . . . . . . . . . . . . . . 140

SetMenuCommand . . . . . . . . 196

SendCamCom. . . . . . . . . . . . .140

SetMenuKey . . . . . . . . . . . . . . 196

SendCom . . . . . . . . . . . . . . . . . 139

SetMenuMessage . . . . . . . . . . 196

Set3DVector . . . . . . . . . . . . . . . 97

SetMenuName . . . . . . . . . . . . 196

Set4DVector . . . . . . . . . . . . . . . 97

SetMenuState . . . . . . . . . . . . . 197

SetAbleItem . . . . . . . . . . . . . . 186

SetOptimalZoomOfItemImage189

SetAboveIntConstant . . . . . . 77

SetOutsideRectConstant . . . 87

SetAcqPar . . . . . . . . . . . . . . . . 115

SetPio . . . . . . . . . . . . . . . . . . . . 137

SetBaudRate. . . . . . . . . . . . . .138

SetProfileDisplay . . . . . . . . . . 112

SetBelowIntConstant . . . . . . . 77

SetReadoutParameter . . . . . 122

SetBufferAttribute. . . . . .62, 68

SetRect . . . . . . . . . . . . . . . . . . . . 86

Index

SetSequencer . . . . . . . . . . . . . . 141

SortString . . . . . . . . . . . . . . . . . . 48

SetSparseBufferSize . . . . . . . . 63

SortStringByIndex . . . . . . . . . 48

SetStepmotor . . . . . . . . . . . . . 137

SqrtBuffer . . . . . . . . . . . . . . . . . 75

SetTimer . . . . . . . . . . . . . . . . . 137

StatusProgress . . . . . . . . 36, 105

SetToolCommand . . . . . . . . . 200

StatusText . . . . . . . . . . . . . . . . . 36

SetToolKey . . . . . . . . . . . . . . . 200

StoreBuffer. . . . . . . . . . . . . . . . .38

SetToolMessage . . . . . . . . . . . 200

StoreBufferErr . . . . . . . . . . . . . 39

SetToolState . . . . . . . . . . . . . . 200

StoreBufferFrame . . . . . . . . . . 39

SetupAcquisition . . . . . . . . . . 152

StoreMacroFile . . . . . . . . . . . . . 52

SetVector . . . . . . . . . . . . . . . . . . 96

StoreProfile . . . . . . . . . . . . . . . . 39

SetVectorDisplay . . . . . . . . . . 157

StoreSet . . . . . . . . . . . . . . . . . . . 52

SetVectorGrid . . . . . . . . . . . . . . 68

Strip . . . . . . . . . . . . . . . . . . . . . . . 45

SetVolumeBufferSize . . . . . . . 61

StrLen . . . . . . . . . . . . . . . . . . . . . 45

SetVolumePointFloat . . . 62, 64

SumLine . . . . . . . . . . . . . . . . . . . 83

SetVolumePointVector . . . . . 64

SumRect . . . . . . . . . . . . . . . . . . . 87

SetVolumePointWord . . . . . . 64

TakeImage. . . . . . . .12, 119, 152

SetWindowDisplay . . . . . . . . 103

TakeProfile . . . . . . . . . . . . . . . 112

SetWindowFrame . . . . . . . . . 105

tan. . . . . . . . . . . . . . . . . . . . . . . . .50

SetWindowGamma . . . . . . . 104

TestActionString . . . . . . . . . . 153

SetWindowResolution . . . . . 103

TestSetVariable . . . . . . . . . . . . 53

SetWindowSize . . . . . . . . . . . 101

Time . . . . . . . . . . . . . . . . . . . . . . . 48

SetWindowViewpoint . . . . . 105

ToLower . . . . . . . . . . . . . . . . . . . 45

SetWindowZoom . . . . . . . . . . 105

ToUpper . . . . . . . . . . . . . . . . . . . 45

SetWinPar . . . . . . . . . . . . . . . . 105

TransferAllAttributes . . . . . . 71

SetWinParStr . . . . . . . . . . . . . 105

TransferScales . . . . . . . . . . . . . . 74

SetXScale . . . . . . . . . . . . . . . . . . 74

UnloadDll . . . . . . . . . . . . . . . . . . 55

SetYScale . . . . . . . . . . . . . . . . . . 74

UnloadMacroFile . . . . . . . . . . . 52

SetZScale . . . . . . . . . . . . . . . . . . 74

UnlockBuffer . . . . . . . . . . . . . . . 69

sgn. . . . . . . . . . . . . . . . . . . . . . . . .51

UpdateDialog . . . . . . . . . . . . . 165

Show . . . . . . . . . . . . . . . . . . . 20, 59

UpdateItem . . . . . . . . . . . . . . . 184

ShowDataWindow . . . . . . . . . 99

UpdateItemProfile . . . . . . . . 189

ShowDialog . . . . . . . . . . . . . . . 164

UpdateItemProfileRows . . . 190

ShowItem . . . . . . . . . . . . . . . . . 184

UpdateMenuDevices . . . . . . 198

ShowMenu . . . . . . . . . . . . . . . . 195

UpdateScreen . . . . . . . . . . . . . . 37

ShowToolBar . . . . . . . . . . . . . 199

UserStartup . . . . . . . . . . 153, 154

sin . . . . . . . . . . . . . . . . . . . . . . . . . 50

Vector3DStatistics . . . . . . . . . 98

sizeof . . . . . . . . . . . . . . . . . . . . . . 28

VectorAvgRms . . . . . . . . . . . . . 98

SmoothSingleVector . . . . . . . . 97

VectorMinMax . . . . . . . . . . . . . 97

SortLine . . . . . . . . . . . . . . . . . . . 85

VectorOperation . . . . . . . . . . . 93
225

Index

VectorProcessing . . . . . . . . . . . 93
viClear. . . . . . . . . . . . . . . . . . . .145
viClose. . . . . . . . . . . . . . . . . . . .143
viFlush . . . . . . . . . . . . . . . . . . . 145
viOpen . . . . . . . . . . . . . . . . . . . 143
viOpenDefaultRM . . . . . . . . 143
viPrintf . . . . . . . . . . . . . . . . . . . 145
viRead . . . . . . . . . . . . . . . . . . . . 143
viScanf . . . . . . . . . . . . . . . . . . . 145
viScanfN . . . . . . . . . . . . . . . . . . 145
viSetAttribute . . . . . . . . . . . . 143
viSetBuf . . . . . . . . . . . . . . . . . . 145
viWrite . . . . . . . . . . . . . . . . . . . 144
Wait . . . . . . . . . . . . . . . . . . . . . . . 38
WindowSelection . . . . . . . . . . 107
WinDrawCircle . . . . . . . . . . . 110
WinDrawLine . . . . . . . . . . . . . 110
WinDrawRect. . . . . . . . . . . . .110
WinDrawText. . . . . . . . . . . . .110
WinSelectPos . . . . . . . . . . . . . 108
WinSelectRegion . . . . . . . . . . 108
Write . . . . . . . . . . . . . . . . . . . . . . 44
XCopyFile . . . . . . . . . . . . . . . . . 41
M
MacroEvent
ClExecWinMouseLeft . . . . . 109
ClExecWinMouseProfile. . .109
Mouseclicks . . . . . . . . . . . . . . . 109
Update Window . . . . . . . . . . 110
V
Variable
ActiveWindow . . . . . . . . . . . . 110
Buffer . . . . . . . . . . . . . . . . . 86, 155
CLExecAfterMainWindow 154
ClExecWinMouseLeft . . . . . 109
ClExecWinMouseProfile. . .109
CustomerCommandAfterHardware . . . . . . . . . . . . . . . . . . 154
226

CustomerCommandBeforeHardware . . . . . . . . . . . . . . . . . . 154
CustomerCommandShutdown154
CustomerMacroFiles . . . . . . 154
DefaultErrorAction . . . . . . . 149
DefaultExecOnBufferChange155
DefaultStopAction . . . . . . . . 148
ErrorAction . . . . . . . . . . . . . . . 149
ExecOnActiveWindow . . . . 110
ExecOnBufferChange . . . . . 155
StopAction. . . . . . . . . . . . . . . .148

LaVision GmbH
Anna-Vandenhoeck-Ring 19
D-37081 Goettingen
E-Mail: info@lavision.de
www.lavision.de
Tel.: +49-(0)551-9004-0
Fax.: +49-(0)551-9004-100

LaVision Inc.
301 W. Michigan Ave., Suite 403
Ypsilanti, MI 48197, USA
E-Mail: sales@lavisioninc.com
www.lavisioninc.com
Phone: (734)485-0913
Fax: (240)465-4306

You might also like