ImageDev

Measurement

Base class (or protocol in python) of all measurements that can be computed by any analysis algorithm with user-defined measurements.

Some algorithms, like BinaryAnalysis, LabelAnalysis or LabelFilteringAnalysis, allow the selection of the set of measurements to be computed. Examples related to these algorithms and the AnalysisMsr object description give more details on how to to select a measurement.

Python users
In python, there is no Measurement base class but all measurements follow the same protocol. This protocol is also documented in the Syntax section.

C++ or C# users
The normal way to read a measurement result is to use the dedicated class that inherits from Measurement. For instance:
std::cout << intensityMinimum->value(0, 0); // this measurement has an indexing with two parameters (label, channel)
std::cout << area->value(0); // this measurement has a indexing with one parameter (label)
Where, area and intensityMinimum are instances of the measurement Area and IntensityMinimum that inherits from Measurement. Here, the code outputs the minimum intensity on channel 0 and the area of the particle defined by the label 0. We can notice that the two accessors have a different signatures because the indexing scheme for intensity-based measurements usually includes channels contrary to geometric measurements like Area. Using dedicated accessors with a method signature that depends on the indexing scheme is usually less error-prone and should be the preferred way.

However, sometimes it can be useful to be able to read the measurement more generically. Consider the case where the user has selected a set of measurements and simply wants to display the results. In this case, you probably want to be able to iterate over the indexing more generically, the methods of the base class are dedicated to this purpose.

Indexing
You can refer to all the sections of NativeMeasurements to find out the indexing scheme of a measurement.

Enumerations
Possible values for DataType are:
UNSIGNED_INTEGER = 0
SIGNED_INTEGER
FLOATING

Syntax

Method Description
double toDouble(iolink::VectorXu64 index) Returns the value at the index position in the analysis and converts it to a 64-bit float.
uint64_t toUInt64(iolink::VectorXu64 index) Returns the value at the index position in the analysis and converts it to an unsigned 64-bit integer.
Caution:
  • If the original value is floating point, a precision loss will occur.
  • If the original value is negative, the returned value will be inconsistent.
int64_t toInt64(iolink::VectorXu64 index) Returns the value at the index position in the analysis and converts it to a signed 64-bit integer.
Caution:
  • If the original value is floating point, a precision loss will occur.
iolink::VectorXu64 shape() Returns the shape of the array.
DataType dataType() Returns the data type of the measurement.
Method Description
shape -> Tuple(int) Returns the shape of the array.
shape -> Tuple(int) shape of the measurement as a tuple of int.
Method Description
double ToDouble(iolink.VectorXu64 index) Returns the value at the index position in the analysis and converts it to a 64-bit float.
unsigned long ToUInt64(iolink::VectorXu64 index) Returns the value at the index position in the analysis and converts it to an unsigned 64-bit integer.
Caution:
  • If the original value is floating point, a precision loss will occur.
  • If the original value is negative, the returned value will be inconsistent.
long ToInt64(iolink::VectorXu64 index) Returns the value at the index position in the analysis and converts it to a signed 64-bit integer.
Caution:
  • If the original value is floating point, a precision loss will occur.
iolink.VectorXu64 Shape() Returns the shape of the array.
DataType DataType() Returns the data type of the measurement.