functions -- CIGAL Functions

In CIGAL, a function is any command that returns a value. The value can be a number or any of the other CIGAL data types: character string, vector, array, matrix, image, or solid (see VARIABLES[1]). The nature of the returned value depends on the function and the arguments you give it. Returned values can either be displayed on the screen, stored in a data variable or used as arguments to other CIGAL commands (but not to other functions -- see below).

The following is a summary list of CIGAL's intrinsic functions:
= -assign values to variables
Accept -get data from keyboard, cursor, screen, or current input
Accum -compute a running sum of elements within a variable
Acos -calculate arc-cosine of a variable
Address -get the physical memory address of a variable
Alert -display message window and wait for response
Alog -calculate anti-logarithm of a variable
Analyze -calculate frequency distribution of values within a variable
Angle -calculate the angle formed by three points
Area -calculate the area within a polygon
Array -allocate memory for an array variable
Asin -calculate arc-sine of a variable
Atan -calculate the arc tangent of a variable or a ratio
Bin -combine input values within interval bins - Column -perform arithmetic column by column within a variable
Compress -compress a data variable by removing empty values
Comread -read from serial communication port
Convolve -convolve a variable using a kernel matrix
Cos -calculate the cosine of a variable
Dialog -get or set menu items in dialog boxes
File -assign a data file to a pointer variable
Filter -perform a non-convolution neighborhood transform of an image
Findvec -find the vector nearest a specified position
Fit -fit a straight line to a curve
Flip -flip a 2-D variable around the X or Y axis
Format -convert data values to character string, specifying format
Getbox -get the upper left and lower right coordinates of a box
Getchar -read one character from the keyboard
Getfile -get a filename from directory lists interactively
Gettxt -read text information from the screen display
Getxyz -read the cursor position
Getz -read the current Z value (from ZDEV or ZVAL)
Index -find the position of a value in a variable
Integer -convert floating point number to integer value
Interpolate -calculate Y values from X values, using a standard curve
Lcase -convert a character string to lower case text
Length -calculate distance between 2 points or along a vector path
Log -calculate the logarithm of a variable
Maklut -create a ramped lookup table
Map -copy a variable to another through a lookup table
Mask -use a mask to select part of a variable
Matrix -allocate memory for a matrix or image variable
Max -find the maximum value in a variable, or between 2 variables
Mean -calculate the mean value of a variable
Measure -calculate the length and area of a vector list
Menuitem -get information about menu commands
Min -find the minimum value in a variable, or between 2 variables
Mode -get information about a variable's data and storage type
Pdstr -expand a repeated character string sequence
Perp -calculate the perpendicular intercept from a point to a line
Pointer -create a pointer to a variable
Projection -get a variable's scale, offset, rotation, and pin parameters
Ramp -generate a ramped sequence of numbers
Random -generate a random sequence of numbers
Rank -determine the sorted order of elements of a variable
Rem -calculate the remainder after performing integer division
RGB -convert color data formats
Round -convert floating point value to the nearest integer
Row -perform arithmetic row by row within a variable
Sample -sample data values along a vector path
Search -find 1st image value within given intensity range
Shift -do bitwise shift of integer data values
Sin -calculate the sine of a variable
Size -return the number of elements in a variable
Smooth -remove kinks by averaging values along a path
Solid -allocate memory for a solid variable
Sqrt -calculate square root of a variable
Stats -return 12 statistics describing a variable
Stdev -calculate the standard deviation within a variable
Sum -calculate the sum of the values within a variable
Sweep -record a number variable and display as on an oscilloscope
Time -get current date and time, or elapsed time
Trace -generate vector list by tracing an image intensity contour
Transform -copy a variable with rotation, scaling, and offset
Ucase -convert a character string to upper case text
Vector -assign values to a vector variable
Vrbxy -get XY position within a WATCHed variable
Warp -distort an image by interpolating between fixed points
Xor -calculate an "exclusive or" operation on 2 variables
Zoom -transform a variable by pixel replication or ommision
Zproj -Perform arithmetic by z-column within a solid variable

( ) -group operations within an arithmetic expression
== -logical "is equal to" operator
++ -auto-increment suffix operator
-- -auto-decrement suffix operator
** -"raise to the power" operator
// -join operator
>> -append operator
= -assign operator
+ -addition operator
- -subtraction operator
* -multiplication operator
/ -division operator
>= -logical "greater than or equal to" operator
> -logical "greater than" operator
<= -logical "less than or equal to" operator
< -logical "less than" operator
!= -logical "not equal to" operator
! -bit-wise complement operator, or Factorial operator
& -bit-wise AND operator
| -bit-wise OR operator
? -"query" operator -- gets status of operand

In general, if a function operand has more than one value, the function will be repeated for every value, and the output will have as many values as the inputs. For binary functions, if the two operands have different numbers of values the extra values in the larger operand are simply ignored, UNLESS the smaller operand has only a single value, in which case the single value will be combined with each element in the larger operand.

Arguments to functions are usually entered in parentheses (immediately after the function name) and individual arguments separated by commas. However, if the function is not being assigned to a variable or combined with some other command the parentheses can be omitted and the arguments simply separated by spaces.

Examples: (Assume A, B, C, ARAY1, ARAY2, and ARAY3 are previously declared variables.)
sqrt 2000 ; print result
a = sqrt(2000) ; store result in A
aray1 = sqrt(aray2) ; get SQRT of each value
aray3 = (a+sqrt(aray1/c))*log(b+aray2) ; combine as you wish
text accept("Enter text string: ",,string) 100 ; use ACCEPT as an
; argument to TEXT cmd
type stats(aray1) > stats.dat ; store STATS in file