ImageDev

Cooccurrence

This attribute manages measurements belonging to the Cooccurrence category of native measurements.

More information about co-occurrence matrices is available in the Cooccurrence2d documentation.
All measurements available in the Cooccurrence category are customizable with the following methods.

Syntax

Method Description
void setAutoAdjusted( bool autoAdjusted ) Enables or disables the automatic computation of the joint histogram range.
bool isAutoAdjusted() Returns true if the range of the joint histogram is automatically determined, false otherwise.
void setBinSize( float size ) Sets the histogram bin size. It must be strictly positive. It is ignored when the automatic mode is disabled.
float binSize() Returns the bin size of the joint histogram. This parameter is ignored is the automatic mode is disabled.
void setMinIntensity( float value ) Sets the minimum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
float minIntensity() Returns the minimum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
void setMaxIntensity( float value ) Sets the maximum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
float maxIntensity() Returns the maximum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
void setVectorCount( size_t number ) Sets the number of offset vectors; that is, the number of cooccurrence matrices to compute.
size_t vectorCount() Returns the number of offset vectors; that is, the number of cooccurrence matrices to compute.
void addVector( int32_t x, int32_t y ) Adds an offset vector defined by x and y displacements in pixels.
This vector is not pushed to the end of the list, but inserted at a position sorting the list in ascending order of x then y.
The y displacement cannot be negative. If a vector $\overrightarrow{v}$ is added with a negative y offset, it is automatically replaced by $-\overrightarrow{v}$ which gives the same cooccurrence matrix.
iolink::Vector2i32 vector( int32_t index ) Returns the offset vector at the index position.

Cooccurrence::Ptr cooc = MeasurementAttributes::cooccurrence();
cooc->setVectorCount( 1 );
int vectorNumberValue = cooc->vectorCount();
cooc->addVector( 10, 20 );
iolink::Vector2i32 vectorValue = cooc->vector( 1 );
cooc->setAutoAdjusted( false );
bool valueAutoAdjusted = cooc->isAutoAdjusted()();
cooc->setBinSize( 2 );
float valueBinSize = cooc->binSize();
cooc->setMinIntensity( 5 );
float valueMinValue = cooc->minIntensity();
cooc->setMaxIntensity( 200 );
float valueMaxValue = cooc->maxIntensity();
        
Method Description
add_vector(x, y) Adds an offset vector defined by x and y displacements in pixels.
This vector is not pushed to the end of the list, but inserted at a position sorting the list in ascending order of x then y.
The y displacement cannot be negative. If a vector $\overrightarrow{v}$ is added with a negative y offset, it is automatically replaced by $-\overrightarrow{v}$ which gives the same cooccurrence matrix.
vector(index) Returns the offset vector at the index position.
Attributes Description
vector_count Returns or sets the number of offset vectors; that is, the number of cooccurrence matrices to compute.
auto_adjusted Returns or sets the automatic mode for setting the joint histogram parameters. If it equals false, the bin size and gray level ranges must be user defined.
bin_size Returns or sets the joint histogram bin size. It must be strictly positive. It is ignored when the automatic mode is disabled.
min_intensity Returns or sets the minimum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
max_intensity Returns or sets the maximum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.

cooc = imagedev.MeasurementAttributes.cooccurrence
cooc.vector_count = 3
vector_count_value = cooc.vector_count
cooc.add_vector(10, 8)
vector_value = cooc.vector(3)
cooc.auto_adjusted = True
is_adjusted = cooc.auto_adjusted
cooc.min_intensity = 10.0
min_intensity_value = cooc.min_intensity
cooc.max_intensity = 51.0
max_intensity_value = cooc.max_intensity
cooc.bin_size = 1
bin_size_value = cooc.bin_size
        
Method Description
void AddVector(int x, int y) Adds an offset vector defined by x and y displacements in pixels.
This vector is not pushed to the end of the list, but inserted at a position sorting the list in ascending order of x then y.
The y displacement cannot be negative. If a vector $\overrightarrow{v}$ is added with a negative y offset, it is automatically replaced by $-\overrightarrow{v}$ which gives the same cooccurrence matrix.
float[] Vector(long index) Returns the offset vector at the index position.
Attributes Description
autoAdjusted Enables or disables the automatic computation of the joint histogram range.
binSize Gets or sets the histogram bin size. It must be strictly positive. It is ignored when the automatic mode is disabled.
minIntensity Gets or s ets the minimum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
maxIntensity Gets or sets the maximum gray level value used to compute the joint histogram. This parameter is ignored if the automatic mode is disabled.
vectorCount Gets or sets the number of offset vectors; that is, the number of cooccurrence matrices to compute.

Cooccurrence cooc = MeasurementAttributes.cooccurrence();
cooc.vectorCount = 1;
auto vectorNumberValue = cooc.vectorCount;
cooc.AddVector(10, 20);
auto vectorValue = cooc.Vector(1);
cooc.autoAdjusted = false;
auto valueAutoAdjusted = cooc.autoAdjusted;
cooc.binSize = 2;
auto valueBinSize = cooc.binSize;
cooc.minValue = 5;
auto valueMinValue = cooc.minValue;
cooc.SetMaxValue(200);