Professional Documents
Culture Documents
Command Language
by
Table of Contents
Table of Contents
1 Introduction
1.1
1.2
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Macro Menu
2.1
11
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
2.1.1
Logging Functions . . . . . . . . . . . . . . . . . . . . .
12
Macro Execution . . . . . . . . . . . . . . . . . . . . . . . . . .
13
2.2.1
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
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
7.4.5
8 General Macros
8.1
147
8.1.2
8.1.3
8.1.4
8.1.5
8.1.6
8.2
8.3
8.4
8.5
8.3.1
8.3.2
8.3.3
8.4.2
8.4.3
8.4.4
9 Dialogs
9.1
159
About Dialogs
. . . . . . . . . . . . . . . . . . . . . . . . . . . 159
9.1.1
9.1.2
9.1.3
9.2
9.3
9.4
9.3.1
9.3.2
9.3.3
9.3.4
193
Table of Contents
. . . .
. . . .
menus
. . . .
. . .
. . .
. . .
. . .
. . .
IMX
. . .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
194
194
197
198
.
.
.
.
.
.
.
.
.
201
201
201
202
202
202
202
204
205
211
Table of Contents
1 Introduction
1.1
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
2 Macro Menu
2.1.1
Logging Functions
2.2
12.06.98 time:
11:23:07
Macro Execution
2.2.1
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.3
Execute Line
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
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
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
3 CL Language
*/
z = y / 5; /*This is a comment too.*/
3.1.3
IF Statement
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
3 CL Language
3.1.8
RETURN Statement
3.1.9
FOR Statement
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
3 CL Language
String
String constants must be enclosed in double quotation marks.
Example:
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
\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
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)
3 CL Language
int var1[=value],var2[=value],...;
float var1[=value],var2[=value],...;
string var1[=value],var2[=value],...;
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
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
3.3.1
Arithmetic operators
28
operator
function
++
add 1 to a variable
addition
multiplication
division
3.3 CL Operators
=
=
=
=
3;
3;
++a;
d++;
3.3.2
Assignment Operators
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
>
greater than
3.3.4
Logical Operators
3 CL Language
operator
function
&&
AND
||
OR
3.3.5
Bit Operators
function
&
AND
OR
Example:
0x100 | 0x001 = 0x101
0x111 & 0x010 = 0x010
3.3.6
String Operators
3.3.7
Other Operators
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
3.4
Macro Programs
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
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
4.2
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
-2
-3
>0
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
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
>0
-1
-2
-3
< 3
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
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
-4
-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
4.3.2
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
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
4.3.3
MakeNiceFileName
string MakeNiceFileName( string filename )
This macro replaces all forbidden characters in a filename. Dont include a
path into the filename!
4.3.4
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
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
4 Subroutines
ReplaceChar
string ReplaceChar (string str, int ch, int newchar);
Replaces all occurences of a character by another and returns the new string.
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
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
abbreviated week-day
complete week-day
abbreviated month
complete month
AM or PM
time (HH:MM:SS)
49
4 Subroutines
4.6
Scalar Arithmetic
4.6.1
Mathematical Macros
4.7
Miscellaneous Functions
4.7.1
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
syntax error
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
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
GetEnvironmentVariable
string GetEnvironmentVariable (string varname);
53
4 Subroutines
DaVis waits until the independent process in the operating system is completed. Afterwards, new DaVis
actions can be made.
4.7.3
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
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
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
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
-2
-11
5.2
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
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
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.3.2
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
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
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
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
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
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
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
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 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
5.6
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
opaque
invers
8..23
background color
24..26
font:
0=times, 1=helvetica,
2=courier, 3=fixed, 4=system
5.7
Buffer Arithmetic
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.
mode
0
(no change)
flipping x y axis
horizontal
mirror
MirrorLeftRight)
+0x40
(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
2/3
11
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 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
density
particle density
size
size of particle
intensity
a1...a4
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
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
function
4 - 13
14 - 23
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
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
filter type
0/1/2/3
4/5/6/7
8-11
12-15
coeffs
divide
rim
0
1
89
5 Image Buffers
mode
filter
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
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
3, 4, 5
B(bin1) * complex-conjugate-of(B(bin2)) ;
(3=hor.,...)
5 Image Buffers
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
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
1-4
10
Use constants V OP *
99
98
97
Vx
96
Vy
95
Vz
94
93
93
5 Image Buffers
mode
VectorOperation
No action
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.
10
> 10
94
mode
Action
no action
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.
header
Action
89
88
87
86
85
(rot-x,rot-y,rot-z) as vector
84
83
-( Exx + Ezz )
82
-( Eyy + Ezz )
81
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
66
Eyx
65
Eyy
64
63
62
61
59
58
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.
99
96
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
-2
< 2
>0
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
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
WINTYPE PROFILE
profile window
WINTYPE 3DPROFILE
WINTYPE SPREADSHEET
spreadsheet window
WINTYPE 3D
WINTYPE FRAMEOVERVIEW
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
ShowDataWindow
void ShowDataWindow (int win);
99
6 Image Window
Window
-1
task window
-2
info window
-3
-4
-5
-6
statusbar
-7
toolbar
-8
CLUT window
-97
print the active window without displaying the system printing dialog box
-98
-99
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
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
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
enable item
102
6.2
6.2.1
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
DISP TIME
DISP RESO
DISP COLORBAR
DISP INTENSITY
DISP COLORBAR2
DISP INTENSITY2
DISP PROFILE X
DISP PROFILE Y
DISP SCALE X
Horizontal scale
DISP SCALE Y
Vertical scale
DISP PROFILE Z
DISP OVERLAY
DISP SHOWINFO
DISP LOG X
DISP LOG Y
DISP CONTROLS
DISP2 CLUTWIDTH
DISP2 ZOOMWIN
(k*Pix[x,y])
(1/gamma)
6 Image Window
display function
single frame n
-1
all frames
-2
-3
-4
-5
-6
-7
6.2.2
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
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
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
circle
<0
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
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.2
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
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
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
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
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.
6.5
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
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
Mode
Profile
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
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
delay
delay time
burst
1
2
3
4
TTL-I/O
1-8
9-16
1
2
3
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
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
2
13
multi-readout
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.
continued on next page
117
7 Hardware
type
20-21
Item
CIO boards
20 = CIO16 / 330
21 = CIO16 / M1
npar
value (command)
-1
1
2
3
4
5
6
7
10
7.1.2
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
BackgroundSubCam[6]
BackgroundBuffer
BackgroundOffset
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
0.2 - ...
0
1
exposure modes:
single,
double (PIV cross correlation) normal with antiblooming,
119
7 Hardware
ParCode
value
2
3
0...
timeout in seconds
100
101
102
103
104
122
0,1
130
0,1
900
0..4
Imager-3,FlowMaster-3 only:
4
-1
0
-2
-3
1 - 255
11
1-5
120
ParCode
value
NanoStar only:
20
21
0-999999
I/I-delay
22
0-999999
I/I-width
23
0-999
I/I-gain
24
0-...
loop count
25
[msec]
DynaMight only:
50
51
52
0-5
clearing mode:
3=post exposure
53
1 - 16
PixelVision only:
1
0, 1
66
0, 1
67
-2,..,8
68
1, 4
number of channels
69
0, 1
70-72
102
-1, 0
-1001
-1,
1
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
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
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
Compress the buffer data and return, but store the file in background mode. Slower than mode 2.
7.2
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
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
124
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
Wait a specified number of milliseconds (here 0.5 msec) before performing the
next item.
Syntax:
#Delay
time = 5 msec
Item Burst
126
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).
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
7.2.3
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.
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
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
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
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
7.2.5
CIO-16 Special
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
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
interrupts
TTLoutput
delay
TTLoutput
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
readout
camera
interrupts
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
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
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.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
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
InfoText(" button:
InfoText(" pos x :
InfoText(" pos y :
"+button);
"+posx);
"+posy);
7.4.4
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
0(off,default) or 1(on)
termination character
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
146
8 General Macros
8.1
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
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
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
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
8.1.6
Some mathematical functions are defined in macro file SYS MATH.CL. See
chapter Mathematical Macros on page 50 for descriptions.
8.2
8.3
8.3.1
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
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.3.3
Masking a buffer
8.4
8.4.1
Special Macros
Macro Execution during Startup
8 General Macros
4. Execution of CLExecAfterMainWindow
8.4.2
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
8.4.4
Macro Thread
8 General Macros
chronisation between the main (data acquisition) macro and the (background)
processing macro.
8.5
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
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
9 Dialogs
Constant
Function
DLGA SIZE
DLGA NOTCLOSE
DLGA NOTICON
DLGA VISIBLE
DLGA MODAL
modal dialog (see note below); no other attributes are allowed here
DLGA HELP
DLGA EVENT
DLGA FOCUS
call
the
event
handler
with
index
EVENT FOCUS when the dialog is focused
(first click inside a non-active dialog)
DLGA CENTER
DLGA FONT
DLGA DEFAULTBUTTON
160
9.1.2
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
}
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
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
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
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.
9 Dialogs
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
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 Dialogs
Tree View
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
Add Text
Icon
Description
Default icon
Open directory
Experiment
Closed directory
LaVision bitmap
Recording
10
Calibration file
11
12
13
Image
continued on next page
175
9 Dialogs
Add Text
Icon
Description
14
My Experiment
15
Device
16
17
Result
18
Floppy
19
Network drive
20
CDROM
21
Root directory
22
Scalar
23
Profile
24
Properties
26
27
28
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
text
function
itemtype\n
ListOfMenuItems
-1,i
-2,i\nA\nB
-3,i\nA\nB
-4,i
-5,0\n
Experiment\n
Rec\nTest
-6,0\n
Experiment\n
Rec\nTest
-7,0\n
Experiment\n
Rec\nTest
-8,0\nPath
-12,i\nA\nB
-13,i\nA\nB
-21,i
-22,i
-23,i
-24,0\nPath
-25,0\nPath
-26,0\nPath
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 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 Dialogs
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
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
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
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
theMode
Function
>0
-1
-2
-3
-4
-5
-6
-7
-8
-50
187
9 Dialogs
9.3.4
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
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
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
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
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
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
theCommand
Function
QUIT
Exit DaVis
BUFLIST
TOOLBAR
CLUT
STATUSBAR
INFOSHOW
LOGOPEN
LOGCLEAR
LOGSTATUS
ABOUT
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
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.4
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
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
RESO
RECT
COORD
Three text lines to display the coordinates and intensity of the pixel below the mouse cursor in a window
199
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
A.1.1
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
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
short xstart
short ystart
char extended[4]
reserved
short rows
10
short columns
12
14
subtype,
see
SetImageFormat
5.1 on page 59
short y dim
16
short f dim
18
20
char ext[11]
22
reserved
char version
33
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
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
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
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
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
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
Overlay
definition
string
OverlayX
definition
string
205
A Appendix
Name
Value
Description
OverlayAttributes
0 or 1
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
Name
Value
Description
WhiteAdjust
r,g,b,offset
White adjustment factors and offset for dark image (like background subtraction)
RGBFrameX
rgb mode
Frame RGB
MATRIX
number 0
SourceFile
filename
SourceFileExp
filename
Value
Description
3DPeak
3DPeakRadius
scalarN
3DPeakIntens
scalarN
207
A Appendix
Name
Value
Description
CameraName
[0|...]
number: name
FrameProcessingX
bitcoded value
RealFrameSizeX
CCDExposureTimeX
time
IIWidthX
IIDelayX
PivDt
Time in sec
FrameTimes
Name
Value
Description
AttributeDisplayX
macro command
Value
Description
ComponentNameX description
ExecAfterLoadBuffer
Execute
command
ExecAfterLoadBuffer+
(bufnum) at the end of
subroutine LoadBuffer
macroname
209
A Appendix
Name
Value
Description
AnalogSources
number
AnalogName
[1|...]
name
AnalogTypeX
1: energy,
2: ADC
AnalogScaleX
aa\nbb\nunit\n
descr.
AnalogChannelsX
number
AnalogChannelIndexX
index
AnalogValueX
AnalogTraceX
float array
AnalogTraceScaleX
aa\nbb\nunit\n
descr.
AnalogAvgX
AnalogRmsX
AnalogMinX
AnalogMaxX
AnalogReferenceX
AnalogFlagX
value or integer
array
AnalogImageX
value or integer
array
210
Name
Value
Description
AnalogPostStatistics
value (1=yes)
AnalogPostProcessing
mode
A.4
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
211
A Appendix
Type
Parameter
Minimum of min-max-resolution
Maximum of min-max-resolution
WINPAR ZOOM
See GetWindowZoom
WINPAR FRAME
See GetWindowFrame
Set the color mapping mode: optimal bitshift (0), fixed bitshift
(1), range (2), 0..max (3), +-max
(4) , min-max (5)
Returns
the
flags
available
for
subroutines
Get/SetWindowDisplay (page
103)
212
Type
Parameter
WINPAR REPAINT
Parameter
213
A Appendix
Type
Parameter
Parameter
Individual palette for vector display, -2 for the active global vector palette
Relative to X
Relative to Y
Relative to Z
214
Type
Parameter
Grid factor
...6=8/1)
(0=1/8,
1=1/4,
Like
PAR RESO PERCENT
Blend source image into background (1), including image correction (2)
WIN-
215
A Appendix
Type
Parameter
WINPAR 3D TYPE
WINPAR 3D PROJECTION
WINPAR 3D COORDCROSS
WINPAR 3D LEN XY
WINPAR 3D LEN Z
WINPAR 3D POS X / Y / Z
Viewing position
WINPAR 3D ANGLE H / V
216
Type
Parameter
217
A Appendix
Type
Parameter
218
Index
Index
C
ColorTable
Dialog . . . . . . . . . . . . . . . . . . . . 167
Vector . . . . . . . . . . . . . . . . . . . . 111
Constant
AS AFTER . . . . . . . . . . . . . . . 153
AS BEFORE . . . . . . . . . . . . . 153
AS DURING . . . . . . . . . . . . . 153
DISP2 * . . . . . . . . . . . . . . . . . . 103
DLGA * . . . . . . . . . . . . . . . . . . 159
DISP * . . . . . . . . . . . . . . . . . . . 103
DLGPAR * . . . . . . . . . . . . . . . 186
FRAMEPROC * . . . . . . . . . . . 71
RESOLUTION * . . . . . . . . . 211
V OP * . . . . . . . . . . . . . . . . . . . . 94
WINTYPE *. . . . . . . . . . . . . . .99
Dialog
AcquisitionTiming
Edit . . . . . . . . . . . . . . . . . . . . 135
BusyText . . . . . . . . . . . . . . . . . 149
Choice . . . . . . . . . . . . . . . . . . . . 151
Debugger . . . . . . . . . . . . . . . . . . 18
DialogEditor . . . . . . . . . . . . . . 190
DialogEditorText . . . . . . . . . 192
Error . . . . . . . . . . . . . . . . . . . . . . 16
Extended . . . . . . . . . . . . . . . . 16
Stack . . . . . . . . . . . . . . . . . . . . 16
Message. . . . . . . . . . . . . . . . . . .151
Question . . . . . . . . . . . . . . . . . . 150
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
FileSelectBoxSave . . . . . . . . . . 43
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
Hex . . . . . . . . . . . . . . . . . . . . . . . . 46
GetPio . . . . . . . . . . . . . . . . . . . . 135
HideDialog . . . . . . . . . . . . . . . . 164
Index
HideItem . . . . . . . . . . . . . . . . . 184
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
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
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
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
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
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
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