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.

Team: Bio Image Analysis Unit
Institution: Institut Pasteur
Website: https://icy.bioimageanalysis.org

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.

Resources needing this

2 reviews on “Math operations

  1. s
    Daniel Sage
    Very useful plugin and easy to use. I like the block interface for protocols.

Leave a Review

Leave a review
Cancel review
View full changelog
Close changelog

Changelog

  • Version 2.0.5.0 • Released on: 2021-07-19 13:00:00
    Download
    Description:

    Added support for dataset larger than 2 GPixels.

  • Version 2.0.3.0 • Released on: 2020-03-24 18:00:00
    Download
    Description:

    Fixed a possible commodification exception on block loading

  • Version 2.0.2.1 • Released on: 2016-02-12 14:13:11
    Download
    Description:

    Re-uploaded (proper) jar file

  • Version 2.0.2.0 • Released on: 2016-02-11 17:22:42
    Download
    Description:

    Fixed an issue with the "expression" block not producing any output

  • Version 2.0.1.0 • Released on: 2013-04-22 13:42:06
    Download
    Description:

    Add: Operation1.COPY

  • Version 2.0.0.0 • Released on: 2013-04-16 10:29:04
    Download
    Description:

    Major code refactoring, add sub-sequences.

  • Version 1.2.1.0 • Released on: 2012-12-12 10:20:06
    Download
    Description:

    Fix: Variant.IllegalNullValue devient RuntimeException

  • Version 1.2.0.0 • Released on: 2012-12-10 14:51:56
    Download
    Description:

    Clarify the system of exceptions used by the plugin (the 'InvalidOperation' exception does not exist anymore)

  • Version 1.1.5.0 • Released on: 2012-10-17 13:17:36
    Download
    Description:

    Fix: missing .java sources in the .jar file.

  • Version 1.1.4.0 • Released on: 2012-09-28 22:51:19
    Download
    Description:

    Fix: wrong output object of math operation blocks when the output type is a scalar.

  • Version 1.1.3.0 • Released on: 2012-09-14 16:17:43
    Download
    Description:

    Fix: Support functors with 0 input argument (useful in MathOperations++).

  • Version 1.1.2.0 • Released on: 2012-09-06 11:46:47
    Download
    Description:

    Fix: save/load XML for VarOperation objects (only used in the EzPlug)

  • Version 1.1.1.0 • Released on: 2012-08-30 17:12:20
    Download
    Description:

    Fix: minor compatiblity issues with Math operations++

  • Version 1.1.0.0 • Released on: 2012-08-16 14:15:07
    Download
    Description:

    Fix: improve the naming of the result sequences (remove useless .0 and add () around negative scalars)
    Add: support for the upcoming Math operations++ plugin

  • Version 1.0.4.0 • Released on: 2012-08-03 15:25:53
    Download
    Description:

    Fix: VarEditor becomes SwingVarEditor, remove the FunctorUnary and FunctorBinary classes (the number of arguments of the 'apply' functions is now checked at runtime within the Functor class).

  • Version 1.0.3.0 • Released on: 2012-07-10 13:16:08
    Download
    Description:

    Fix: accept native datatypes as scalar input values in blocks

  • Version 1.0.2.0 • Released on: 2012-07-10 11:38:50
    Download
    Description:

    Fix: begin/endUpdate when allocating a sequence

  • Version 1.0.1.0 • Released on: 2012-07-02 16:25:25
    Download
    Description:

    Fix: Affect a default value to the output of MathOperation blocks when defining the output type.

  • Version 1.0.0.0 • Released on: 2012-06-28 17:34:36
    Download
    Description:

    Add: enable operations on arrays within the blocks

  • Version 0.99.1.0 • Released on: 2012-06-26 13:00:16
    Download
    Description:

    Fix: use VarArrayNative instead of VarArray

  • Version 0.99.0.0 • Released on: 2012-06-22 17:34:27
    Download
    Description:

    Add: support array inputs, except in blocks for the moment due VarMutable and arrays issues

  • Version 0.0.2.0b • Released on: 2012-06-22 16:33:43
    Download
    Description:

    Add: support 1D arrays

  • Version 0.0.1.0b • Released on: 2012-06-22 13:39:09
    Download