Class RankProcessors
A set of streaming aperture processors
,
implementing all operations, specified in RankMorphology
interface.
This class cannot be instantiated.
- Author:
- Daniel Alievsky
-
Method Summary
Modifier and TypeMethodDescriptionstatic StreamingApertureProcessor
getAveragerBetweenPercentiles
(ArrayContext context, double filler, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the mean between 2 percentiles of the source matrix M.static StreamingApertureProcessor
getAveragerBetweenValues
(ArrayContext context, double filler, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the mean between 2 values of the source matrix M.static StreamingApertureProcessor
getPercentilePairProcessor
(ArrayContext context, Func processingFunc, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the result of some given functionf(v0, v1,v2) of some matrix M0 and two percentiles v1,v2 of the source matrix M.static StreamingApertureProcessor
getPercentiler
(ArrayContext context, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the percentile of the source matrix M.static StreamingApertureProcessor
getRanker
(ArrayContext context, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the rank of the source matrix M.static StreamingApertureProcessor
getSummator
(ArrayContext context, Func processingFunc) Creates a new streaming aperture processor, which finds the result of some given functionf(S) of the aperture sum S of the source matrix M.
-
Method Details
-
getPercentiler
public static StreamingApertureProcessor getPercentiler(ArrayContext context, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the percentile of the source matrix M. Seecomments to RankMorphology
, section 4 about the "percentile" term. The real index r of the percentile for every element of the result is equal to the corresponding element of the additional matrix M0.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context, precision.
interpolated()
and precision.bitLevels()
are the same as the arguments of this method. Then in the streaming aperture processor, created by this method:- the number of required additional matrices is 1;
asProcessed
method is equivalent toR=rm. , if the requiredType argument ofasPercentile
(M, M0, P)asProcessed
method is equal to M.type()
==R.type()
;- if requiredType is not equal to M.
type()
, it is equivalent to ;Matrices.asFuncMatrix
(true,Func.IDENTITY
, requiredType, R) process
method is equivalent torm. .percentile
(R, M, M0, P)
This processor is really created and called in the implementation of
asPercentile
andpercentile
methods inBasicRankMorphology
class.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.interpolated
- the histogram model used while calculating percentile: true means the precise histogram model, false means the simple histogram model (see comments toHistogram
class).bitLevels
- thebit levels
used while calculations.- Returns:
- the new streaming aperture processor, finding the percentile.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-
getRanker
public static StreamingApertureProcessor getRanker(ArrayContext context, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the rank of the source matrix M. Seecomments to RankMorphology
, section 4 about the "rank" term. The real value v for every element of the result is equal to the corresponding element of the additional matrix M0.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context, precision.
interpolated()
and precision.bitLevels()
are the same as the arguments of this method. Then in the streaming aperture processor, created by this method:- the number of required additional matrices is 1;
asProcessed
method is equivalent torm. , where requiredType is the first argument ofasRank
(requiredType, M, M0, P)asProcessed
method;process
method is equivalent torm. .rank
(R, M, M0, P)
This processor is really created and called in the implementation of
asRank
andrank
methods inBasicRankMorphology
class.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.interpolated
- the histogram model used while calculating percentile: true means the precise histogram model, false means the simple histogram model (see comments toHistogram
class).bitLevels
- thebit levels
used while calculations.- Returns:
- the new streaming aperture processor, finding the rank.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-
getAveragerBetweenPercentiles
public static StreamingApertureProcessor getAveragerBetweenPercentiles(ArrayContext context, double filler, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the mean between 2 percentiles of the source matrix M. Seecomments to RankMorphology
, section 4 about the "mean between 2 percentiles" term. The real indexes r1 and r2 of the percentiles for every element of the result are equal to the corresponding elements of the additional matrices M0 and M1.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context, precision.
interpolated()
and precision.bitLevels()
are the same as the arguments of this method. Then in the streaming aperture processor, created by this method:- the number of required additional matrices is 2;
asProcessed
method is equivalent toR=rm. (where filler is the argument of this method), if the requiredType argument ofasMeanBetweenPercentiles
(M, M0, M1, P, filler)asProcessed
method is equal to M.type()
==R.type()
;- if requiredType is not equal to M.
type()
, it analogously calculates the mean between percentile with maximal (double) precision and then casts the floating-point results to the desired element type by the same rules asArrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true; note that such result cannot be obtained byRankMorphology
methods; process
method is equivalent torm. (where filler is the argument of this method).meanBetweenPercentiles
(R, M, M0, M1, P, filler)
This processor is really created and called in the implementation of
asMeanBetweenPercentiles
andmeanBetweenPercentiles
methods inBasicRankMorphology
class.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.filler
- the reserved value, returned whenr1≥r2 .interpolated
- the histogram model used while calculating percentile: true means the precise histogram model, false means the simple histogram model (see comments toHistogram
class).bitLevels
- thebit levels
used while calculations.- Returns:
- the new streaming aperture processor, finding the mean between 2 percentiles.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-
getAveragerBetweenValues
public static StreamingApertureProcessor getAveragerBetweenValues(ArrayContext context, double filler, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the mean between 2 values of the source matrix M. Seecomments to RankMorphology
, section 4 about the "mean between 2 values" term. The real numbers v1 and v2 for every element of the result are equal to the corresponding elements of the additional matrices M0 and M1.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context, precision.
interpolated()
and precision.bitLevels()
are the same as the arguments of this method. Then in the streaming aperture processor, created by this method:- the number of required additional matrices is 2;
asProcessed
method is equivalent toR=rm. (where filler is the argument of this method), if the requiredType argument ofasMeanBetweenValues
(M, M0, M1, P, filler)asProcessed
method is equal to M.type()
==R.type()
;- if requiredType is not equal to M.
type()
, it analogously calculates the mean between values with maximal (double) precision and then casts the floating-point results to the desired element type by the same rules asArrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true; note that such result cannot be obtained byRankMorphology
methods; process
method is equivalent torm. (where filler is the argument of this method).meanBetweenValues
(R, M, M0, M1, P, filler)
This processor is really created and called in the implementation of
asMeanBetweenValues
andmeanBetweenValues
methods inBasicRankMorphology
class.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.filler
- the reserved value, returned when r(v1*σ)≥r(v2*σ), or one of the special keysRankMorphology.FILL_MIN_VALUE
,RankMorphology.FILL_MAX_VALUE
,RankMorphology.FILL_NEAREST_VALUE
, which mean using of special calculation modes B, C, D.interpolated
- the histogram model used while calculating percentile: true means the precise histogram model, false means the simple histogram model (see comments toHistogram
class).bitLevels
- thebit levels
used while calculations.- Returns:
- the new streaming aperture processor, finding the mean between 2 values.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-
getSummator
Creates a new streaming aperture processor, which finds the result of some given functionf(S) of the aperture sum S of the source matrix M. Seecomments to RankMorphology
, section 4 about the "aperture sum" term.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context is the same as the argument of this method and other argument are any (they do not affect calculating the aperture sum). Then in the streaming aperture processor, created by this method:
- no additional matrices are required;
asProcessed
method is equivalent toR=rm. (where processingFunc is the argument of this method), if the requiredType argument ofasFunctionOfSum
(M, P, processingFunc)asProcessed
method is equal to M.type()
==R.type()
;- if requiredType is not equal to M.
type()
, it analogously calculates the functionf(S) of the aperture sum S with maximal (double) precision and then casts the floating-point results to the desired element type by the same rules asArrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true; note that such result cannot be obtained byRankMorphology
methods; process
method is equivalent torm. (where processingFunc is the argument of this method).functionOfSum
(R, M, P, processingFunc)
This processor is really created and called in the implementation of
asFunctionOfSum
andfunctionOfSum
methods inBasicRankMorphology
class.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.processingFunc
- the function, which should be applied to every calculated aperture sum.- Returns:
- the new streaming aperture processor, finding the given function of the aperture sum.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-
getPercentilePairProcessor
public static StreamingApertureProcessor getPercentilePairProcessor(ArrayContext context, Func processingFunc, boolean interpolated, int... bitLevels) Creates a new streaming aperture processor, which finds the result of some given functionf(v0, v1,v2) of some matrix M0 and two percentiles v1,v2 of the source matrix M. Seecomments to RankMorphology
, section 4 about the "percentile" term. The real indexes r of two percentiles for every element of the result are equal to the corresponding elements of the additional matrices M1 and M2.More precisely, let rm is an instance of
BasicRankMorphology
, created by the callrm =
BasicRankMorphology.getInstance(ArrayContext context, double dilationLevel, CustomRankPrecision precision)
,so that context, precision.
interpolated()
and precision.bitLevels()
are the same as the arguments of this method. Then in the streaming aperture processor, created by this method:- the number of required additional matrices is 3;
asProcessed
method is equivalent toR=rm. (where processingFunc is the argument of this method), if M0==M and the requiredType argument ofasFunctionOfPercentilePair
(M, M1, M2, P, processingFunc)asProcessed
method is equal to M.type()
==R.type()
;- if requiredType is not equal to
M.
type()
, it analogously calculates the functionf(v0, v1,v2) of the matrix M0 and two percentiles v1,v2 of the source matrix M with maximal (double) precision and then casts the floating-point results to the desired element type by the same rules asArrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true; - if M0==M,
process
method is equivalent torm. (where processingFunc is the argument of this method), in other case if works analogously, but gets the first argument of f function from M0 matrix instead of M.functionOfPercentilePair
(R, M, M1, M2, P, processingFunc)
Note that this processor, unlike
RankMorphology.asFunctionOfPercentilePair
andRankMorphology.functionOfPercentilePair
methods, allows to use any matrix M0 as the source of first arguments of the functionf(v0, v1,v2) . (Those methods always get the first function argument from the source M matrix.)This processor is really created and called in the implementation of
asFunctionOfPercentilePair
andfunctionOfPercentilePair
methods inBasicRankMorphology
class. Those methods pass the same src matrix to this processor twice: as the main source matrix M and as the first additional matrix M0.- Parameters:
context
- thecontext
that will be used by this object; may be null, then it will be ignored.processingFunc
- the function, which should be applied to every three(v0,v1,v2) , where v0 is the element of M0 matrix, v1 and v2 are the corresponding percentiles of the source M matrix.interpolated
- the histogram model used while calculating percentiles: true means the precise histogram model, false means the simple histogram model (see comments toHistogram
class).bitLevels
- thebit levels
used while calculations.- Returns:
- the new streaming aperture processor, finding the given function of the additional matrix M0 and the pair of percentiles.
- Throws:
NullPointerException
- if bitLevels argument is null.IllegalArgumentException
- if bitLevels.length==0, or if bitLevels.length>31, or if some of elements bitLevels is not in 1..30 range, or ifbitLevels[k]>=bitLevels[k+1] for some k.
-