HiRISE.HiPlan.HOGG

## Class 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

Fields
Modifier and Type Field and Description
`static int` `DEFAULT_MEDIAN`
The default median input 14-bit value.
`static int` `DEFAULT_SPREADING`
`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

Constructors
Constructor and Description
`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

Methods
Modifier and Type Method and Description
`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_8_BIT_VALUE

`public static final int MINIMUM_8_BIT_VALUE`
The smallest value output by this function.
Constant Field Values
• #### MAXIMUM_8_BIT_VALUE

`public static final int MAXIMUM_8_BIT_VALUE`
The largest value output by this function.
Constant Field Values
• #### MEDIAN_8_BIT_VALUE

`public static final int MEDIAN_8_BIT_VALUE`
The output median value for this function.
Constant Field Values

`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.
Constant Field Values

`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.
Constant Field Values
• #### DEFAULT_MEDIAN

`public static final int DEFAULT_MEDIAN`
The default median input 14-bit value.
Constant Field Values

`public static final int DEFAULT_SPREADING`
Constant Field Values
• ### Constructor Detail

• #### Square_Root_LUT

```public Square_Root_LUT(int median,
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.
• ### 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.

`public int getSpreading()`
Returns the spreading constant k used by this lookup table function.
Returns:
the lookup table function's spreading constant k.
• #### 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.

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