Transformations

Transformations are pre-defined generalized workers applicable for various purposes. They function as compact helper functions embedded within a component, facilitating data transformations and performing other useful tasks. The existing list of transformations includes:

  • UnpackNamed: Unwraps an encapsulated object; for instance, if we have Just a, then the transformation will yield a.

    Example: BoundingBox -> {class:DetectedClass,rectangle:Rectangle<Double>}

  • PackNamed: Takes a and encapsulates it into a named type, for example from a to Just a.

    Example: {class:DetectedClass,rectangle:Rectangle<Double>} -> BoundingBox

  • UnpackTuple: Unwraps a stream of tuples, returning all its elements into separate streams ($ts...) -> $ts....

    Example: (Segmentation, BoundingBox) -> Segmentation and BoundingBox

  • PackTuple: Encapsulates a stream of tuple elements into a stream of tuples $ts... -> ($ts...).

    Example: Segmentation and BoundingBox -> (Segmentation, BoundingBox)

  • UnpackRecord: Unpacks a record type into separate stream outputs. Behaves just like tuple except has field names instead of indexed types.

    Example 1: {class:DetectedClass,rectangle:Rectangle<Double>} -> DetectedClass and Rectangle<Double>

    Example 2: {class:DetectedClass, rectangle:Rectangle<Double>, counter:UInt64} -> DetectedClass, Rectangle<Double> and UInt64

  • PackRecord: Packs streams inputs into a single stream of records.

    Example: DetectedClass, Rectangle<Double> and UInt64 -> {class:DetectedClass, rectangle:Rectangle<Double>, counter:UInt64}

  • UnpackUnion: Splits stream of unions into separate streams for every union option.

    Example: Image.BGR | Image.GRAY | Image.RGB -> Image.BGR, Image.GRAY, Image.RGB

  • PackUnion: Packs input streams into a stream of unions

    Example: Image.BGR, Image.GRAY, Image.RGB -> Image.BGR | Image.GRAY | Image.RGB

  • Constant: Streams exactly one pre-defined value given as a parameter.

  • DelayByOne: Delays the stream by one message, initially streaming a pre-defined value provided as a parameter.

    Example: If the streamed message is 1and predefined value is 0; then DelayByOne outputs 0 as the first message and 1 as second.

  • ConvertValue: Takes an atomic type and converts another atomic type. Convertion is done according to C++ rules for corresponding fundamental types. (a -> b)

    Example: Int32 -> Double

    Input: 1

    Output: 1.0

  • Flatten: Takes a list and streams the elements within that list [a] -> a.

    Example: [Int32] -> Int32

    Input: [0, 1, 2, 3, 4]

    Output: 0, 1, 2, 3, 4

  • Filter: Takes two values, a boolean and another value, and returns nothing if the boolean is false; otherwise, it returns that value (Bool, t -> t)

    Example: If inputs are true and 1 returns 1. If inputs are false and 1 then no messages will be sent.

  • Repeat: Takes two inputs, first input is of type UInt64 and has value x and the second input is a steam of any type. The transformation streams message of second input x many times.

    Example: If x is set to 5, the value 1 will be streamed 5 times.

    Input 1: 5

    Input 2: ["this is a message"]

    Output: ["this is a message"], ["this is a message"], ["this is a message"], ["this is a message"], ["this is a message"]

  • Length: Takes a list and returns its size ([t] -> UInt64).

    Example:

    Input: [0, 1, 2, 3, 4]

    Output: 5

  • UniteStreams: Takes a number of streams and combines them into a single stream (t... -> t).

  • SelectStreams: Takes a number of streams and an index and streams a value from the stream selected by the index (UInt64, t... -> t).

  • Shuffle: Takes a list of pairs and combines the pairs with the same key ([(K, V)] -> [(K, [V])]).

  • Join: Functions as the SQL join operation ([(K, V1)], [(K, V2)] -> [(K, V1, V2)]).

  • LiftUnroll: Takes a list and outputs its size and streams its each elements as a separate Message.

    Example:

    Input: [0, 1, 2, 3, 4]

    Output 1: 5

    Output 2: 0, 1, 2, 3, 4

  • LiftReroll: Takes the streamed elements and puts them into a list, first input is the size of the list.

    Example:

    Input 1: 2, 3, 5

    Input 2: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

    Output: [0, 1], [2, 3, 4], [5, 6, 7, 8, 9]

Was this page helpful?