You are here: Start » Programming Reference » Data Types
Data Types
Read first: Introduction to Data Flow Programming.
Introduction
Integer number, image or two-dimensional straight line are examples of what is called a type of data. Types define the structure and the meaning of information that is being processed. In FabImage Studio types also play an important role in guiding program construction – the environment assures that only inputs and outputs of compatible types can be connected.
Primitive Types
The most fundamental data types in FabImage Studio are:
- Integer – Integer number in the range of approx. ±2 billions (32 bits).
- Real – Floating-point approximation of real numbers (32 bits)
- Bool – Logical value – False or True.
- String – Sequence of characters (text) encoded as UTF-16 unicode.
Type Constructs
Complex types of data used in FabImage Studio are built with one of the following constructs:
Structures
Composite data consisting of a fixed number of named fields. For example, the Point2D type is a structure composed of two real-valued fields: X and Y.
More information about using structures can be found: here.
Arrays
Composite data composed of zero, one or many elements of the same type. In FabImage Studio, for any type X there is a corresponding XArray type, including XArrayArray. For example, there are types: Point2D, Point2DArray, Point2DArrayArray and more.
Example filters having arrays on the outputs:
- ScanMultipleEdges – returns an array of multiple found edge points.
- SplitRegionIntoBlobs – returns an array of multiple blob regions.
Example filters having arrays on inputs:
- Average – calculates the average of multiple real numbers.
- FitLineToPoints_M – creates a line best matching a set of two-dimensional points.
More information about using arrays can be found: here.
Optional
Some filter inputs can be left not connected and not set at all. These are said to be of an optional type. As for arrays, for each type X there is a corresponding optional X* type. The special value corresponding to the special not-set case is identified as Auto.
Example filters with optional inputs:
- ThresholdImage – has an optional inRoi input of the Region type for defining the region-of-interest. If the Auto value is provided, the entire image will be processed.
- FitLineToPoints_M – has an optional inOutlierSuppression input specifying one of several possible enhancement of line fitting. If the Auto value is provided, no enhancement is used.
More information about using optional inputs can be found: here.
Conditional
Conditional types are similar to optional, but their purpose is different – with the Nil value (usually read "not detected") they can represent lack of data on filter outputs which results in conditional execution of the filters that follow. For each type X there is a corresponding conditional X? type.
Example filters with conditional outputs:
- SegmentSegmentIntersection – returns a common point of two segments or Nil if no such point exists.
- ReadSingleBarcode – returns a value read from a barcode or Nil if no barcode was found.
More information about conditional data can be found: here.
Enumerations
Enumeration types are intended to represent a fixed set of alternative options. For example, a value of the DrawingMode type can be equal to HighQuality or Fast. This allows for choosing between quality and speed in the image drawing filters.
Composite Types
Array and conditional or optional types can be mixed together. Their names are then read in the reverse order. For example:
- IntegerArray? is read as "conditional array of integer numbers".
- Integer?Array is read as "array of conditional integer numbers".
Please note, that the above two types are very different. In the first case we have an array of numbers or no array at all (Nil). In the second case there is an array, in which every single element may be present or not.
Built-in Types
A list of the most important data types available in FabImage Studio is here.
Angles
Angles are using Real data type. If you are working with them bear in mind these assumptions:
- All the filters working with angles return their results in degrees.
- The default direction of the measurement between two objects is clockwise. In some of the measuring filters, it is possible to change that.
Automatic Conversions
There is a special category of filters, Conversions, containing filters that define additional possibilities for connecting inputs and outputs. If there is a filter named XToY (where X and Y stand for some specific type names), then it is possible to create connections from outputs of type X to inputs of type Y. You can for example connect Integer to Real or Region to Image, because there are filters IntegerToReal and RegionToImage respectively. A conversions filter may only exist if the underlying operation is obvious and non-parametric. Further options can be added with user filters.
Previous: Programming Reference | Next: Structures |