dip::Measurement::IteratorFeature class

An iterator to visit all features (column groups) in the dip::Measurement table. Can also be seen as a view over a specific feature.

Contents

The iterator can be indexed with an object ID to access the table cell that contains the feature’s values for that object. It is also possible to iterate over all objects. See dip::Measurement for examples of using this class.

The Subset method selects a subset of the values of the current feature. This does not invalidate the iterator: incrementing it will select the next feature in the same way it would have if Subset hadn’t been called. When indexing a subset feature using an object ID, the resulting table cell is the same subset of the cell, as one would expect. Thus, subsetting can be used to look at only one value of a feature as if that feature had produced only one value. For example:

dip::Measurement msr = measureTool.Measure( label, grey, {"Feret"}, {} );
auto featureValues = msr[ "Feret" ];
featureValues.Subset( 1 ); // Select the "FeretMin" column only

Classes

class Iterator
An iterator to visit all objects (rows) within a feature (column group) of the dip::Measurement table.

Functions

auto FirstObject() const -> dip::Measurement::IteratorFeature::Iterator
Iterator to the first object for this feature
auto Subset(dip::uint first, dip::uint number = 1) -> dip::Measurement::IteratorFeature&
Selects a subset of values from the current feature. This does not invalidate the iterator.
auto IsAtEnd() const -> bool
True if done iterating (do not call other methods if this is true!)
auto FeatureName() const -> dip::String const&
Name of the feature
auto Values() const -> dip::Feature::ValueInformationArray
Returns an array with names and units for each of the values for the feature. (Note: data are copied to output array, this is not a trivial function).
auto NumberOfValues() const -> dip::uint
Number of values
auto ObjectExists(dip::uint objectID) const -> bool
True if the object ID is available in this.
auto ObjectIndex(dip::uint objectID) const -> dip::uint
Finds the index for the given object ID
auto ObjectIndices() const -> dip::ObjectIdToIndexMap const&
Returns the map that links object IDs to row indices.
auto Objects() const -> dip::UnsignedArray const&
Returns a list of object IDs
auto NumberOfObjects() const -> dip::uint
Number of objects
auto Data() const -> dip::Measurement::ValueType*
A raw pointer to the data of the feature. All values for one object are contiguous.
auto Stride() const -> dip::sint
The stride to use to access the next row of data (next object).

Operators

auto operator[](dip::uint objectID) const -> dip::Measurement::IteratorFeature::Iterator
Iterator to the given object for this feature
auto operator++() -> dip::Measurement::IteratorFeature&
Pre-increment, to access the next feature
auto operator++(int ) -> dip::Measurement::IteratorFeature
Post-increment, to access the next feature
auto operator bool() const -> bool explicit
True if the iterator is valid and can be used