Package omeis.providers.re.quantum
Class QuantumStrategy
- java.lang.Object
-
- omeis.providers.re.quantum.QuantumStrategy
-
- Direct Known Subclasses:
BinaryMaskQuantizer
,Quantization_32_bit
,Quantization_8_16_bit
,Quantization_float
public abstract class QuantumStrategy extends java.lang.Object
Subclasses Work on explicit pixel types. Taking into account the pixel types, transform the pixel intensity value passed toquantize(double)
by delegating to the configured quantum map. Encapsulate a computation strategy for the quantization process i.e. LUT and Approximation. ImplementonWindowChange()
to get notified when the input interval changes.- Since:
- OME2.2
-
-
Field Summary
Fields Modifier and Type Field Description static int
DECILE
Determines the number of sub-intervals of the [globalMin, globalMax] interval.static int
MAX
Maximum value (255
) allowed for the upper bound of the codomain interval.static int
MIN
Minimum value (0
) allowed for the lower bound of the codomain interval.protected ome.model.core.Pixels
pixels
The pixels this strategy is for.protected ome.model.display.QuantumDef
qDef
Reference to a quantumDef object.protected QuantumMap
valueMapper
Reference to the value mapper.
-
Constructor Summary
Constructors Modifier Constructor Description protected
QuantumStrategy(ome.model.display.QuantumDef qd, ome.model.core.Pixels pixels)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
getCurveCoefficient()
Returns the coefficient identifying a curve within a given family.ome.model.enums.Family
getFamily()
Returns the mapping family.double
getGlobalMax()
Returns the maximum of all maxima.double
getGlobalMin()
Returns the minimum of all minima.protected java.lang.Double
getMiddleRange(double value)
Returns the range the values belongs to.boolean
getNoiseReduction()
Returnstrue
if the noise reduction algorithm is turned on,false
if turned off.double
getOriginalGlobalMax()
Returns the original maximum of all minima.double
getOriginalGlobalMin()
Returns the original minimum of all minima.double
getPixelsTypeMax()
Returns the upper bound of the pixels range or0
if the value couldn't be set.double
getPixelsTypeMin()
Returns the lower bound of the pixels range or0
if the value couldn't be set.double
getWindowEnd()
Returns the upper bound of the input interval.double
getWindowStart()
Returns the lower bound of the input interval.protected abstract void
onWindowChange()
Notifies when the input interval has changed or the mapping strategy has changed.abstract int
quantize(double value)
Maps a value from [windowStart, windowEnd] to a value in the codomain interval.void
setExtent(double globalMin, double globalMax)
Sets the maximum range of the input window.void
setMap(QuantumMap qMap)
Sets the quantum map.void
setMapping(ome.model.enums.Family family, double k, boolean noiseReduction)
Sets the selected family, the curve coefficient and the noise reduction flag.void
setQuantizationMap(ome.model.enums.Family family, double k, boolean noiseReduction)
Sets the selected family, the curve coefficient and the noise reduction flag and rebuilds the look-up table.void
setWindow(double start, double end)
Sets the input window interval.
-
-
-
Field Detail
-
MAX
public static final int MAX
Maximum value (255
) allowed for the upper bound of the codomain interval.- See Also:
- Constant Field Values
-
MIN
public static final int MIN
Minimum value (0
) allowed for the lower bound of the codomain interval.- See Also:
- Constant Field Values
-
DECILE
public static final int DECILE
Determines the number of sub-intervals of the [globalMin, globalMax] interval.- See Also:
- Constant Field Values
-
qDef
protected final ome.model.display.QuantumDef qDef
Reference to a quantumDef object.
-
pixels
protected final ome.model.core.Pixels pixels
The pixels this strategy is for.
-
valueMapper
protected QuantumMap valueMapper
Reference to the value mapper.
-
-
Method Detail
-
getMiddleRange
protected java.lang.Double getMiddleRange(double value)
Returns the range the values belongs to.- Parameters:
value
- The value to handle- Returns:
- See above.
-
setExtent
public void setExtent(double globalMin, double globalMax)
Sets the maximum range of the input window.- Parameters:
globalMin
- The minimum of all minima for a specified stack.globalMax
- The maximum of all maxima for a specified stack.
-
setWindow
public void setWindow(double start, double end)
Sets the input window interval.- Parameters:
start
- The lower bound of the interval.end
- The upper bound of the interval.
-
setMapping
public void setMapping(ome.model.enums.Family family, double k, boolean noiseReduction)
Sets the selected family, the curve coefficient and the noise reduction flag.- Parameters:
family
- The mapping family.k
- The curve coefficient.noiseReduction
- The noise reduction flag.
-
setQuantizationMap
public void setQuantizationMap(ome.model.enums.Family family, double k, boolean noiseReduction)
Sets the selected family, the curve coefficient and the noise reduction flag and rebuilds the look-up table.- Parameters:
family
- The mapping family.k
- The curve coefficient.noiseReduction
- The noise reduction flag.
-
setMap
public void setMap(QuantumMap qMap)
Sets the quantum map.- Parameters:
qMap
- The value to set.
-
getFamily
public ome.model.enums.Family getFamily()
Returns the mapping family.- Returns:
- See above.
-
getCurveCoefficient
public double getCurveCoefficient()
Returns the coefficient identifying a curve within a given family.- Returns:
- See above.
-
getNoiseReduction
public boolean getNoiseReduction()
Returnstrue
if the noise reduction algorithm is turned on,false
if turned off.- Returns:
- See above.
-
getGlobalMin
public double getGlobalMin()
Returns the minimum of all minima.- Returns:
- See above.
-
getGlobalMax
public double getGlobalMax()
Returns the maximum of all maxima.- Returns:
- See above.
-
getOriginalGlobalMin
public double getOriginalGlobalMin()
Returns the original minimum of all minima.- Returns:
- See above.
-
getOriginalGlobalMax
public double getOriginalGlobalMax()
Returns the original maximum of all minima.- Returns:
- See above.
-
getPixelsTypeMin
public double getPixelsTypeMin()
Returns the lower bound of the pixels range or0
if the value couldn't be set.- Returns:
- See above.
-
getPixelsTypeMax
public double getPixelsTypeMax()
Returns the upper bound of the pixels range or0
if the value couldn't be set.- Returns:
- See above.
-
getWindowStart
public double getWindowStart()
Returns the lower bound of the input interval.- Returns:
- See above.
-
getWindowEnd
public double getWindowEnd()
Returns the upper bound of the input interval.- Returns:
- See above.
-
onWindowChange
protected abstract void onWindowChange()
Notifies when the input interval has changed or the mapping strategy has changed.
-
quantize
public abstract int quantize(double value) throws QuantizationException
Maps a value from [windowStart, windowEnd] to a value in the codomain interval.- Parameters:
value
- The pixel intensity value.- Returns:
- The value in the codomain interval i.e. sub-interval of [0, 255].
- Throws:
QuantizationException
- If the specified value is not in the interval [globalMin, globalMax].
-
-