Package inra.ijpb.morphology.strel
Class LocalExtremumBufferDouble
java.lang.Object
inra.ijpb.morphology.strel.LocalExtremumBufferDouble
- All Implemented Interfaces:
LocalExtremum
public class LocalExtremumBufferDouble extends java.lang.Object implements LocalExtremum
Computes the maximum in a local buffer around current point.
This implementation considers a circular buffer (when a value is added, it replaces the first value that was inserted) that makes it possible to update extremum if needed.
- Author:
- David Legland
-
Nested Class Summary
Nested classes/interfaces inherited from interface inra.ijpb.morphology.strel.LocalExtremum
LocalExtremum.Type
-
Constructor Summary
Constructors Constructor Description LocalExtremumBufferDouble(int n)
Main constructor.LocalExtremumBufferDouble(int n, double value)
Initializes an histogram filled with the given value.LocalExtremumBufferDouble(int n, LocalExtremum.Type type)
Constructor from size and type of extremum (minimum or maximum). -
Method Summary
Modifier and Type Method Description void
add(double value)
Adds a value to the local histogram, and update bounds if needed.void
clear()
Resets inner counts with default maximum values (+INFINITY for MAX, -INFINITY for MIN)void
fill(double value)
Resets histogram by considering it is filled with the given value.double
getMax()
Returns the maximum value stored in this local histogramvoid
setMinMaxSign(int sign)
Changes the sign used for distinguishing minimum and maximum.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LocalExtremumBufferDouble
public LocalExtremumBufferDouble(int n)Main constructor.- Parameters:
n
- the size of the buffer
-
LocalExtremumBufferDouble
Constructor from size and type of extremum (minimum or maximum).- Parameters:
n
- the size of the buffertype
- the type of extremum (maximum or minimum)
-
LocalExtremumBufferDouble
public LocalExtremumBufferDouble(int n, double value)Initializes an histogram filled with the given value.- Parameters:
n
- the size of the buffervalue
- the initial value of all elements in buffer
-
-
Method Details
-
setMinMaxSign
public void setMinMaxSign(int sign)Changes the sign used for distinguishing minimum and maximum.- Parameters:
sign
- +1 for maximum, -1 for minimum
-
add
public void add(double value)Adds a value to the local histogram, and update bounds if needed. Then removes the last stored value, and update bounds if needed.- Parameters:
value
- the value to add
-
clear
public void clear()Resets inner counts with default maximum values (+INFINITY for MAX, -INFINITY for MIN) -
fill
public void fill(double value)Resets histogram by considering it is filled with the given value. Update max and max accordingly.- Parameters:
value
- the new value of all elements in buffer
-
getMax
public double getMax()Returns the maximum value stored in this local histogram- Returns:
- the maximum value in neighborhood
-