VPASCAL

VPascal is a powerful programming language that allows you to easily automate complex or repetitive tasks in V++. It is a full featured language which implicitly supports image, vector and matrix math enabling you to calculate complicated image expressions in a single line of code. You can handle images as easily as other languages handle individual numbers.

Click here for a detailed summary of VPascal language elements

VPascal is easy to learn because it uses virtually the same syntax as the popular Pascal programming language (widely used worldwide as a teaching language) but has many enhancements for imaging applications.

Module Recorder
VPascal programs are referred to as "modules". The module recorder allows you to create simple modules by pointing and clicking - without writing a single line of code yourself. This is a great way to speed up development or to learn about VPascal programming.

Mathematical Expressions
You can enter equations to perform image processing operations just as you would write them down mathematically. For example, a reference subtraction requires a line of code like this:

NewImg := OldImg - RefImg ;

No longer do you have to write code to loop over every pixel in the image - the automation language takes care of that for you.

When you do need to get at individual pixels, the image is accessed just like a regular array:

x := NewImg[ 23,54 ] ;

VPascal's  powerful image range notation enables you to refer to whole regions within an image in a single expression. For example, the following code copies the third and fourth columns to the first and second columns:

Image[..,0..1] := Image[..,2..3] ;

Expressions can be of any complexity, and you can freely mix scalars (single numbers) and images. For example, a simple flat-field calculation might be:

New := 123*( Old - Ref )/( Flat - Ref ) ;

Sequences and Stacks
A sequence (or stack) is the natural extension of an image into the third dimension. Sequences are treated just like 3D arrays of numbers so to get at a single pixel just use three coordinates.

APixel := MySeq[ 73,54,123 ] ;

You can even refer to entire 3D regions within a sequence using a single line of code, thanks to index range notation:

Volume := MySeq[ 23..50, 54..102, .. ] ;

In addition, numerous built-in functions are provided for getting at any slice, sub-sequence or line in a sequence.

Flow Control
All the usual programming elements are included to control the flow of a module: if-then-else, repeat-loops and while-loops. For example, to avoid a divide-by-zero error in a flat-field correction use the if-then-else statement:

if Any( Flat - Ref = 0 ) then
  WriteError( 'Divide by zero!' )
else
  New := 123*( Old - Ref )/( Flat - Ref ) ;

Toolbar and Menu Activation
Any VPascal module can create toolbar buttons and menu commands which activate the functions it has defined. Modules can be pre-compiled and ready to go (and even executed if required) when V++ starts. 

Built-in Functions
VPascal has over 400 built-in functions to handle image processing operations such as filtering, zooming, histogram calculation, object analysis, morphology, and much more besides. Numerous utility routines take care of other tasks.

Dynamic Data Exchange (DDE)
Use DDE to control other applications or have them control V++, even over a network. You can not only share an entire VPascal program via DDE but even share the VPascal program’s variables and individual procedures! This lets you link variables, results and images directly to applications like Microsoft Excel.

Serial Port Control
Full control of serial ports is built into VPascal. This makes it easy to control external serial devices such as shutters, stage controllers and photometers.

Built-in Dialogs
There are several built-in dialog boxes to prompt the user for input, such as entering a number or a string, or selecting an image from the V++ desktop. For example, the statements:

Msg := 'Choose an image to transform' ;
SelectImage( Msg,MyImg ) ;

display a dialog box with the message, together with a list of all the desktop images, and returns the selected image in the variable MyImg.

User-defined Functions
Automation modules are easier to understand and maintain if they are compact and modular. Functions and procedures are sections of code that neatly encapsulate the complexity of an algorithm, and can be invoked just like any of the built-in functions.

External Functions
Incorporating special-purpose code you have written yourself, or library functions you have purchased, is incredibly easy. Simply declare the functions in your module and use the external keyword to indicate that they can be found in a particular DLL. Then you can just call the external functions the same way as any function defined in VPascal itself. You can even call the Windows API directly, giving a VPascal module an extremely high level of control.

Windows Interaction
Controlling the appearance of many on-screen images is simplified using the built-in window management functions. Images are easily tiled or cascaded, or the size and position can be set precisely. During lengthy operations keep the user informed of progress by updating the status bar with informative messages.

Extensive On-line Help
Comprehensive help is available for beginners and experts alike. First-time users can follow the step by step instructions on how to write, compile and run a module. The many built-in functions have detailed descriptions of parameters, return values and - most importantly - example code you can cut and paste into your own modules.

[ Top of page ]