HiRISE

HiRISE.HiPlan.HOGG
Class Square_Root_LUT

java.lang.Object
  extended by HiRISE.HiPlan.HOGG.Square_Root_LUT
All Implemented Interfaces:
Function2D

public class Square_Root_LUT
extends Object
implements Function2D

A two-dimensional function that implements the HiRISE square root lookup table algorithm.

This algorithm maps 14-bit data numbers (DNs) between 0 and 16383 to 8-bit DNs between 0 and 254. (The 8-bit number 255 is a reserved value.) The algorithm has two parameters: a median value that specifies where the square root curve is steepest and a constant k that determines how spreading out the curve is. k is sometimes referred to as the "spreading constant" for this reason.

The algorithm is strictly an integer algorithm. This implementation returns doubles, however, because the Function2D interface is double-based. In addition, because this function represents a lookup table that maps 14-bit data to 8-bit data, the values are bounded: If the input parameter (the 14-bit DN) is less than MINIMUM_14_BIT_VALUE, MINIMUM_8_BIT_VALUE is returned. If the input is greater than MAXIMUM_14_BIT_VALUE, MAXIMUM_8_BIT_VALUE is returned.

Algorithm Details

(Insert algorithm details here.) The spreading constant k is constrained to be between 14 and 100.

Version:
1.8
Author:
Christian Schaller - UA/PIRL

Field Summary
static int DEFAULT_MEDIAN
          The default median input 14-bit value.
static int DEFAULT_SPREADING
          The default spreading constant k.
static int MAXIMUM_14_BIT_VALUE
          The maximum value for input 14-bit data.
static int MAXIMUM_8_BIT_VALUE
          The largest value output by this function.
static int MEDIAN_8_BIT_VALUE
          The output median value for this function.
static int MINIMUM_14_BIT_VALUE
          The minimum value for input 14-bit data.
static int MINIMUM_8_BIT_VALUE
          The smallest value output by this function.
static int SPREADING_MAXIMUM
          The maximum allowable value for the spreading constant k.
static int SPREADING_MINIMUM
          The minimum allowable value for the spreading constant k.
 
Constructor Summary
Square_Root_LUT()
          Creates a Square_Root_LUT using default values for the median and spreading constant k.
Square_Root_LUT(int median, int spreading)
          Creates a Square_Root_LUT from a median input 14-bit value and a spreading constant k.
 
Method Summary
 int getMedian()
          Returns the median input 14-bit value used by this lookup table function.
 int getSpreading()
          Returns the spreading constant k used by this lookup table function.
 double getValue(double x)
          Returns the value of the function (y) for a given input (x).
 void setMedian(int median)
          Sets the median input 14-bit value used by this lookup table function.
 void setSpreading(int spreading)
          Sets the spreading constant k used by this lookup table function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_14_BIT_VALUE

public static final int MINIMUM_14_BIT_VALUE
The minimum value for input 14-bit data. Any input less than this value results in output of MINIMUM_8_BIT_VALUE.

See Also:
Constant Field Values

MAXIMUM_14_BIT_VALUE

public static final int MAXIMUM_14_BIT_VALUE
The maximum value for input 14-bit data. Any input greater than this value results in output of MAXIMUM_8_BIT_VALUE.

See Also:
Constant Field Values

MINIMUM_8_BIT_VALUE

public static final int MINIMUM_8_BIT_VALUE
The smallest value output by this function.

See Also:
Constant Field Values

MAXIMUM_8_BIT_VALUE

public static final int MAXIMUM_8_BIT_VALUE
The largest value output by this function.

See Also:
Constant Field Values

MEDIAN_8_BIT_VALUE

public static final int MEDIAN_8_BIT_VALUE
The output median value for this function.

See Also:
Constant Field Values

SPREADING_MINIMUM

public static final int SPREADING_MINIMUM
The minimum allowable value for the spreading constant k. Values less than this value will be set to this value.

See Also:
Constant Field Values

SPREADING_MAXIMUM

public static final int SPREADING_MAXIMUM
The maximum allowable value for the spreading constant k. Values greater than this value will be set to this value.

See Also:
Constant Field Values

DEFAULT_MEDIAN

public static final int DEFAULT_MEDIAN
The default median input 14-bit value.

See Also:
Constant Field Values

DEFAULT_SPREADING

public static final int DEFAULT_SPREADING
The default spreading constant k.

See Also:
Constant Field Values
Constructor Detail

Square_Root_LUT

public Square_Root_LUT(int median,
                       int spreading)
Creates a Square_Root_LUT from a median input 14-bit value and a spreading constant k.

Parameters:
median - the value for the median input 14-bit value used by this lookup table function.
spreading - the value for the spreading constant k used by this lookup table function.

Square_Root_LUT

public Square_Root_LUT()
Creates a Square_Root_LUT using default values for the median and spreading constant k.

See Also:
DEFAULT_MEDIAN, DEFAULT_SPREADING
Method Detail

getMedian

public int getMedian()
Returns the median input 14-bit value used by this lookup table function.

Returns:
the lookup table function's median input 14-bit value.

setMedian

public void setMedian(int median)
Sets the median input 14-bit value used by this lookup table function. If the median value is less than MINIMUM_14_BIT_VALUE, MINIMUM_14_BIT_VALUE will be used instead. Likewise, if the median value is greater than MAXIMUM_14_BIT_VALUE, MAXIMUM_14_BIT_VALUE will be used.

Parameters:
median - the new value for the median input 14-bit value used by this lookup table algorithm.

getSpreading

public int getSpreading()
Returns the spreading constant k used by this lookup table function.

Returns:
the lookup table function's spreading constant k.

setSpreading

public void setSpreading(int spreading)
Sets the spreading constant k used by this lookup table function. If the spreading constant is less than SPREADING_MINIMUM, SPREADING_MINIMUM is used instead. If the spreading constant is greater than SPREADING_MAXIMUM, then SPREADING_MAXIMUM is used.

Parameters:
spreading - the new value for the spreading constant k used by this lookup table algorithm.

getValue

public double getValue(double x)
Returns the value of the function (y) for a given input (x). In the case of a Square_Root_LUT object, the value of the function is the 8-bit value calculated using the square root lookup table algorithm. The input is the 14-bit value of the original data.

Specified by:
getValue in interface Function2D
Parameters:
x - the input x-value, a 14-bit pixel brightness.
Returns:
the function value, an 8-bit pixel brightness.

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona