AlgART Home

net.algart.matrices.morphology
Interface CustomRankPrecision

All Known Implementing Classes:
RankPrecision

public interface CustomRankPrecision

Complete description of precision characteristics of rank operations, described in RankMorphology interface. Usually this interface is used for instantiating BasicRankMorphology class by BasicRankMorphology.getInstance(net.algart.arrays.ArrayContext, double, net.algart.matrices.morphology.CustomRankPrecision) method.

This package offers RankPrecision class, providing a ready set of instances of this interface, enough for most situations. If you need another precision parameters, not listed in that class, you can implement this interface yourself.

The classes, implementing this interface, are immutable and thread-safe: there are no ways to modify settings of the created instance.

AlgART Laboratory 2007-2013

Since:
JDK 1.5
Version:
1.2
Author:
Daniel Alievsky

Field Summary
Modifier and Type Field and Description
static int MAX_NUMBER_OF_ANALYZED_BITS
          The maximal possible number of analyzed bits: 30.
 
Method Summary
Modifier and Type Method and Description
 int[] bitLevels()
          The bit levels.
 boolean interpolated()
          Selects the histogram model used while calculating rank characteristics: true means the precise histogram model, false means the simple histogram model.
 int numberOfAnalyzedBits()
          Returns the last element of the bitLevels() array.
 

Field Detail

MAX_NUMBER_OF_ANALYZED_BITS

static final int MAX_NUMBER_OF_ANALYZED_BITS
The maximal possible number of analyzed bits: 30. The bit levels, returned by bitLevels() method, must not be greater than this value; in other case, an attempt to create an instance of BasicRankMorphology will lead to IllegalArgumentException.

See Also:
Constant Field Values
Method Detail

bitLevels

int[] bitLevels()
The bit levels. (Here and below we shall designate this array as bitLevels.)

The last element of this array bitLevels[bitLevels.length-1] is named the number of analysed bits and specifies the logarithm of the length of the histogram, used while calculating rank characteristics. More precisely, the length of the histogram is M=2μ, where μ = bitLevels[bitLevels.length-1] for floating-point matrix elements or μ = min(bitLevels[bitLevels.length-1], β) for fixed-point matrix elements, β = M.array().bitsPerElement(). See more details in comments to RankMorphology interface, section 3.

First bitLevels.length-1 elements of this array, i.e. JArrays.copyOfRange(bitLevels,0,bitLevels.length-1), are passed as bitLevelsOfPyramid argument of Histogram.newIntHistogram or SummingHistogram.newSummingIntHistogram methods, when they are called for creating objects, which really calculate the rank characteristics, described in RankMorphology interface. In other words, first bitLevels.length-1 elements describe the levels of the pyramid of histograms: it is necessary for efficient processing large histograms, consisting of thousands or millions bars.

This array must not be empty and must not contain more than 31 elements, and all its elements must be sorted in strictly increasing order: bitLevels[k]<bitLevels[k+1] for all k. The elements of this array must not exceed MAX_NUMBER_OF_ANALYZED_BITS limit.

Below are possible examples of the array, returned by this method:

Note that the situation, when some or even all elements of this array are greater than 2β, is not an error — it just will lead to unjustified slowing down of calculations, because some levels of the pyramid of histograms will contain only 1 "wide" bar.

Returns:
bit levels of the pyramid of histograms (all elements excepting the last one) and the maximal possible total number of analyzed bits μ=log2(histogram length) (the last element of this array).
See Also:
numberOfAnalyzedBits()

numberOfAnalyzedBits

int numberOfAnalyzedBits()
Returns the last element of the bitLevels() array.

Returns:
the maximal possible total number of analyzed bits μ=log2(histogram length).

interpolated

boolean interpolated()
Selects the histogram model used while calculating rank characteristics: true means the precise histogram model, false means the simple histogram model. See comments to Histogram and SummingHistogram classes about these models.

Returns:
whether the rank operations should be performed in the precise histogram model.