When it starts up, LWDAQ installs hundreds of Tcl/Tk commands for use in instruments and tools. The script commands are those installed by the Tcl/Tk scripts that LWDAQ runs at start-up. The library commands are those installed by the lwdaq.so shared library that LWDAQ loads at start-up. This library has been compiled from our Pascal source code. Script commands all begin with LWDAQ in upper case letters, while library commands all begin with lwdaq in lower case letters.
The Tcl/Tk scripts define the script commands are in the ./LWDAQ.app/Contents/LWDAQ directory of the LWDAQ software installation, and its sub-directories. You will also find them on our Sources Page. We describe these scripts in turn below. Each script command has its own entry in this manual, with its Tcl declaration and its in the TCL comments above the declaration in the script.
The Pascal files that define the library commands are in the ./Sources directory. Each operating system has its own version of lwdaq.so, but all versions define the same commands. Each library command takes some mandatory parameters, and a list of optional parameters. You specify the mandatory parameters by passing their values directly to the command, in the correct order. You specify optional parameters with a list of option names in the form "?option value?". You can specify any number of these options, and in any order. Here is an example library command call from the Rasnik instrument script.
set result [lwdaq_rasnik $image_name \ -show_fitting $config(analysis_show_fitting) \ -show_timing $config(analysis_show_timing) \ -reference_code $config(analysis_reference_code) \ -orientation_code $config(analysis_orientation_code) \ -pixel_size_um $info(analysis_pixel_size_um) \ -reference_x_um $info(analysis_reference_x_um) \ -reference_y_um $info(analysis_reference_y_um) \ -square_size_um $config(analysis_square_size_um) ]
The lwdaq.pas file acts as an interface between our Pascal libraries and Tcl/Tk. It provides init_Lwdaq, which Tcl/Tk calls when it loads the lwdaq dynamic library, and it defines all the library commands. The init_Lwdaq routine installs these commands in the TCL interpreter. The lwdaq.pas file is a Pascal main program rather than a Pascal unit, even though we compile it into a dynamic library. The GPC compiler expects a main program if it is to include the "_p_initialize" routine in the compiled object. We will need this routine to be present in the lwdaq.o object when we link the final lwdaq.dylib dynamic library with GCC.
The lwdaq command (lower case) grants access to a selection of mathematical routines declared in our Pascal library. We call these the lwdaq routines to distinguish them from the lwdaq commands, of which lwdaq is an exmaple. The following command calls our linear interpolator on a set of x-y data pairs to estimate the value of a curve at x=2.
lwdaq linear_interpolate 2 "0 0 3 3 6 6"
You will find a list of the routines available through the lwdaq command in a table below, as well as descriptions of each of them.
The image parameters taken by many of the library commands are the names of images in the LWDAQ image list. This list of images is maintained in memory by the library commands. Each image contains its pixel intensities and an overlay in which the library routines can draw lines. You draw an image in a TK photo widget with lwdaq_draw. First lwdaq_draw renders the pixel intensity in the photo, and then it renders the overlay. The same image can be rendered in multiple TK photos. When an instrument captures consecutive images from a data acquisition system, it is deleting previous images (now redundant) from the LWDAQ image list, creating a new image, filling it with the acquired pixel intensities, and rendering the image in the same TK photo in the instrument window.
Here we have section for each of the LWDAQ scripts.
Script_Descriptions Script_Commands Library_Commands Library_Routines