Short Description
Execute some simple math operations on sequences, such as addition, product, absolute value extraction, rounding to the closest integer, etc. All the operations are executed pointwise.
Documentation
This plugin allows the user to perform the usual pointwise math operations on sequences, such as addition, product, absolute value extraction, rounding to the closest integer, etc. It provides extended features compared to the Simple Operations plugin.
A pointwise operation means that each atomic value in the resulting object is obtained by applying a certain function to the corresponding atomic atomic values of the input objects. For example, the sequence S obtained by adding two sequences A and B (S = A + B) is defined such that S(x,y,z,t,c) = A(x,y,z,t,c) + B(x,y,z,t,c) for each pixel (x,y) in each frame t, each stack z and each channel c. As a consequence, S has exactly the same dimensions than A and B, and it is forbidden to add A and B if these sequences do not have the same dimensions.
The features provided by this plugin can be accessed:
- directly through the GUI (using a EzPlug interface),
- through the protocol editor provided by the Blocks plugin,
- from the java code (see the documentation in the Functor.java and Operation*.java files for more details).
Input types
The main goal of this plugin is to operate on sequences, but it also accepts other types of input objects:
- scalar values,
- number arrays,
- and Icy sequences, as already mentioned.
For example, an operation such as S = A + B with A a sequence and B a scalar value (let’s say 42.0) is allowed: the resulting object S will be a sequence having the same size than A such that S(x,y,z,t,c) = A(x,y,z,t,c) + 42.0 for each point (x,y,z,t,c). The allowed combinations of input types are the following:
- Scalar values only => the result object is a scalar value.
- Number arrays only => the result object is an array having the same length than the inputs.
- Sequences only => the result object is a sequence having the same dimensions than the inputs.
- Scalar and array => the result object is an array having the same length than the input array.
- Scalar and sequence => the result object is a sequence having the same dimensions than the input sequences.
Supported operations
Two kind of operations are supported by the plugin: binary operations, that takes two objects in input, and unary operations, that take only one object in input. Both types of operations can be accessed through the same EzPlug interface, but two different blocks are provided depending on the number of input objects: MathOperationBinaryBlock and MathOperationUnaryBlock.
Here is the list of currently supported binary operations:
- Addition
- Subtraction
- Product
- Division
- Power
- Pointwise maximum and minumum
Then, the list of unary operations:
- Absolute value
- Sign extraction
- Square root
- Exponential function
- Natural and decimal logarithm
- Trigonometric transforms (sine, cosine and tangent)
- Inverse trigonometric transforms (arc sine, arc cosine and arc tangent)
- Hyperbolic transforms (hyperbolic sine, hyperbolic cosine, and hyperbolic tangent)
- Rounding to the largest previous integer (floor)
- Rounding to the smallest following integer (ceiling)
- Rounding to the closest integer (round)
Finally, four blocks are also provided as shortcuts for the usual arithmetic operations: AddBlock, SubtractBlock, MultiplyBlock and DivideBlock.
2 reviews on “Math operations”