HiRISE
 Observation

Public Types | Public Member Functions | Static Public Attributes

LUT Class Reference

A LUT contains the lookup table used to map 14-bit CCD sensor values to 8-bit image pixel values. More...

#include <LUT.hh>

Inheritance diagram for LUT:
Inheritance graph
[legend]
Collaboration diagram for LUT:
Collaboration graph
[legend]

List of all members.

Public Types

enum  LUT_Type {
  None,
  Square_Root,
  Linear,
  Stored,
  Total_LUT_Types
}
 

The LUT types available for use.

More...

Public Member Functions

 LUT ()
 Constructs an empty LUT.
 LUT (std::istream &stream)
 Constructs an LUT loaded from a data stream.
 LUT (const LUT &component, bool data_duplicate=true)
 Copy constructor.
LUToperator= (const LUT &component)
 Assigns another LUT to this one.
std::string id () const
 Provides the class ID on a line followed by the base Data_Component::id.
const char * name () const
 Gets the NAME of this class.
u_int_8 operator[] (Index index) const
 Gets a table entry using array notation.
u_int_8 & operator[] (Index index)
 Provides a reference to a table entry using array notation.
Pixel_type * pukool_table (Pixel_type *maping_table, double offset_percentage=DEFAULT_PUKOOL_OFFSET)
 Gets the reverse lookup (pukool) table.
std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const
 Prints the component structure and contents.
unsigned int width () const
 Gets the table print listing width.
LUTwidth (unsigned int groups)
 Sets the table print listing width.
idaeim::PVL::AggregatePVL () const
 Produces a PVL rendition of the component.
idaeim::PVL::AggregatePVL_PDS () const
 Provides a PDS label representation of the LUT values.
idaeim::PVL::AggregatePVL_description () const
 Produces a PVL description of the component for a PDS label.
bool is_valid () const
 Tests if the component data is valid.

Static Public Attributes

static const char *const ID = "UA::HiRISE::LUT (1.39 2010/11/25 02:51:13)"
 Class identification name with source code version and date.
static const char *const NAME = "LUT"
 The component name.
static const Index COMPONENT_BYTES = LUT_BYTES
 Total number of bytes in the Data_Block.
static const Index OFFSETS []
 Data_Block data storage address offset for each Element.
static const Index ARRAY_COUNTS [][2]
 Data_Block array element value counts each keyed to an Element Index.
static const char * TYPE_NAMES []
 The name of each LUT type.
static const char *const PVL_NODES_NAME = "Table_Nodes"
 The Parameter name of the PVL LUT nodes table.
static const char *const PVL_PDS_TABLE_NAME = "LOOKUP_CONVERSION_TABLE"
 The Parameter name of the PVL_PDS LUT conversion table.
static const double DEFAULT_PUKOOL_OFFSET = LUT_DEFAULT_PUKOOL_OFFSET
 The default pukool_table reverse mapping offset.
static const unsigned int DEFAULT_WIDTH = LUT_PRINT_GROUPS_WIDTH
 The default width, in value groups, of a table print listing.

Detailed Description

A LUT contains the lookup table used to map 14-bit CCD sensor values to 8-bit image pixel values.

This Data_Component is the second in the observation channel data stream. It contains a single array Element in which each entry Index, of 16,384 entries, corresponds to an input CCD sensor value and its single byte value is the output image pixel value. When the CCD sensor values are not mapped through a lookup table the image pixel values in the observation data stream are 16-bits each and the LUT component for the channel will be zero-filled.

N.B.: The LUT is a forward mapping from instrument CCD sensor values to image line pixel values in the observation channel data stream. The reverse mapping from image pixel values to sensor values is a different table that can be obtained from the LUT.

For details consult the "HiRISE Command and Telemetry Handbook" (http://hirise.lpl.arizona.edu/team_site/instrument/Command_and_Telemetry_Handbook/).

Author:
Bradford Castalia, UA/PIRL

1.32

See also:
Data_Component

Member Enumeration Documentation

enum LUT_Type

The LUT types available for use.

Enumerator:
None 
Square_Root 
Linear 
Stored 
Total_LUT_Types 

Constructor & Destructor Documentation

LUT (  )

Constructs an empty LUT.

The base Data_Component is initialized with the COMPONENT_BYTES, OFFSETS, and ARRAY_COUNTS that define a LUT component structure and the DEFAULT_WIDTH is set as the element grouping width for printing a LUT.

LUT ( std::istream &  stream ) [explicit]

Constructs an LUT loaded from a data stream.

The base Data_Component is initialized with the COMPONENT_BYTES, OFFSETS, and ARRAY_COUNTS that define an LUT component structure and the DEFAULT_WIDTH is set as the element grouping width for printing a LUT. The stream is then read for COMPONENT_BYTES to fill the data block. Therefore, the stream must be positioned at the beginning of the LUT data.

Parameters:
streamThe istream from which to read the component data.
LUT ( const LUT component,
bool  data_duplicate = true 
)

Copy constructor.

Parameters:
componentThe LUT to be copied.
data_duplicatetrue if the data content of the copied component is to be duplicated in the copy; false if the data content is to be shared.
See also:
Data_Component(const Data_Component&, bool)

Member Function Documentation

LUT & operator= ( const LUT component )

Assigns another LUT to this one.

Parameters:
componentThe LUT to be assigned.
See also:
Data_Component::operator=(const Data_Component&)

References Data_Component::operator=().

string id (  ) const [virtual]

Provides the class ID on a line followed by the base Data_Component::id.

Returns:
The multi-line identification string.
See also:
Data_Component::id()

Reimplemented from Data_Component.

References LUT::ID.

const char * name (  ) const [virtual]

Gets the NAME of this class.

Returns:
A pointer to the constant class name C-string.
See also:
Data_Component::name()

Implements Data_Component.

References LUT::NAME.

u_int_8 operator[] ( Index  index ) const

Gets a table entry using array notation.

Warning: The index value is normally not range checked. However, if this class is compiled with the DATA_BLOCK_LIMITS_CHECK symbol set to true, then range checking will be applied to the index.

Parameters:
indexAn array Index into the table of values.
Returns:
The table value at the indexed entry.
Exceptions:
std::out_of_rangeIf an invalid index is specified and range checking is in effect.
u_int_8& operator[] ( Index  index )

Provides a reference to a table entry using array notation.

This operator is typically used to assign a value to an entry.

Warning: The index value is not range checked.

Parameters:
indexAn array Index into the table of values.
Returns:
A reference to the table value at the indexed entry.
Pixel_type * pukool_table ( Pixel_type *  maping_table,
double  offset_percentage = DEFAULT_PUKOOL_OFFSET 
)

Gets the reverse lookup (pukool) table.

A pukool maps output pixel values back to their input CCD sensor values. The index of the pukool table corresponds to a single byte image data value. A two byte table entry value corresponds to the CCD sensor value. Thus, while a LUT maps two byte (UA::HiRISE::Pixel_type) CCD sesnor values to single byte image pixel values, a pukool maps single byte image pixel values to CCD sensor values.

However, due to the loss of precision during LUT mapping, pukool mapping is not able to identify which of of multiple CCD sensor values that mapped to the same pixel value. Since the LUT is expected to be a monotonically increasing set, a many-to-one LUT mapping is over a continuous range. The offset_percentage is used to selected a value from this range based on a percentage of the distance between the ends of the range. An offset_percentage of 0.0 will pick the low end, 1.0 will pick the high end, and 0.5 will pick the middle of the range.

Note: The last pukool entry will always map invalid (gap) pixel values to invalid (-1) CCD sensor values.

Parameters:
maping_tableThe data storage array for the resultant pukool table. Warning: Space for 256 UA::HiRISE::Pixel_type values must be provided.
offset_percentageA value between 0.0 and 1.0, inclusive.
Returns:
The mapping_table.
Exceptions:
invalid_argumentIf the maping_table is NULL or the offset_percentage is not in the range 0.0 to 1.0.

References ID.

Referenced by main().

ostream & print ( std::ostream &  stream = std::cout,
bool  verbose = false 
) const [virtual]

Prints the component structure and contents.

Each line of a table listing contains width value groups. In verbose mode each table value is listed separated by a space and the beginning of each line has the index number of the first element on the line followed by a colon (':') character. In non-verbose mode value groups are comma separated and have the format:

index:count*value

where index applies to the first of count contiguous table entries all having the same value.

Parameters:
streamThe ostream where the listing will be written.
verbosetrue if the listing is to be verbose, otherwise some structural details will be omitted for easier human consumption.
Returns:
The stream that was written.
See also:
Data_Component::print(std::ostream&, bool) const

Implements Data_Component.

References ID.

Referenced by list_data(), and list_selections().

unsigned int width (  ) const [inline]

Gets the table print listing width.

Returns:
The number of value groups per line.
See also:
print(std::ostream&, bool) const
LUT& width ( unsigned int  groups ) [inline]

Sets the table print listing width.

The DEFAULT_WIDTH applies if no other width has been set.

Parameters:
groupsThe number of value groups per line. If this is zero the DEFAULT_WIDTH is used.
Returns:
This LUT.
See also:
print(std::ostream&, bool) const

References LUT::DEFAULT_WIDTH.

Aggregate * PVL (  ) const [virtual]

Produces a PVL rendition of the component.

The table is described as an Array of (index, value) node Integer pairs. A node indicates the index where a contiguous sequence of entries of the same value starts. The first node always has index 0.

Returns:
A pointer to a PVL::Aggregate. This Aggregate contains a single Array Assignment Parameter named PVL_NODES_NAME.
See also:
Data_Component::PVL() const

Implements Data_Component.

References Aggregate::add(), Array::add(), Vectal< T >::clear(), LUT::COMPONENT_BYTES, Data_Component::data(), LUT::NAME, and LUT::PVL_NODES_NAME.

Referenced by list_selections().

Aggregate * PVL_PDS (  ) const

Provides a PDS label representation of the LUT values.

The table is described as an Array (SEQUENCE) of 256 (start, end) Integer pairs (each a SEQUENCE) that provides a reverse map from output 8-bit image pixel values back to the input 14-bit CCD sensor values range that produced the pixel values. The index of each pair in the Array corresponds to an output image pixel value: 0-255. The values of each pair are the lower and upper ends, inclusive, of the input CCD sensor value range that the LUT translated to the output image pixel. Image pixel values that are not mapped by LUT entries have a pair with the special Observation::NOT_APPLICABLE_NUMBER values; e.g. pixel value 255 should never be mapped.

N.B.: All LUTs should be composed of strictly monotonically increasing values. If this is not the case, "dips" in the LUT sequence will be "leveled" to the previous valid output pixel mapping value.

Returns:
An idaeim::PVL::Aggregate pointer with the Aggregate containing the Array named PVL_PDS_TABLE_NAME.

References Aggregate::add(), Array::add(), Vectal< T >::clear(), LUT::COMPONENT_BYTES, Data_Component::data(), LUT::NAME, Instrument::NOT_APPLICABLE_NUMBER, and LUT::PVL_PDS_TABLE_NAME.

Aggregate * PVL_description (  ) const

Produces a PVL description of the component for a PDS label.

The description is an OBJECT that contains the PDS parameters required to describe a data product binary data object.

Returns:
A pointer to a PVL::Aggregate. The object pointed to is a copy of an internal static object.

References Parser::get_parameters(), and LUT::ID.

bool is_valid (  ) const [virtual]

Tests if the component data is valid.

The table values must be strictly monotonically increasing and less than 255.

Returns:
true if the component has valid data; false otherwise.

Implements Data_Component.

References LUT::COMPONENT_BYTES, and Data_Component::data().


Member Data Documentation

const char *const ID = "UA::HiRISE::LUT (1.39 2010/11/25 02:51:13)" [static]

Class identification name with source code version and date.

Reimplemented from Data_Component.

Referenced by LUT::id(), main(), and LUT::PVL_description().

const char *const NAME = "LUT" [static]

The component name.

Referenced by LUT::name(), LUT::PVL(), and LUT::PVL_PDS().

const Index COMPONENT_BYTES = LUT_BYTES [static]

Total number of bytes in the Data_Block.

Referenced by Observation::components(), LUT::is_valid(), Observation::line(), LUT::PVL(), Observation::PVL_PDS(), and LUT::PVL_PDS().

const Index OFFSETS [static]
Initial value:
        {
        0,  

        
        COMPONENT_BYTES,

        0   
        }

Data_Block data storage address offset for each Element.

const Index ARRAY_COUNTS [static]
Initial value:
        {
        {0, COMPONENT_BYTES},
        {0,0}
        }

Data_Block array element value counts each keyed to an Element Index.

All values of an array element are the same size (the total size of the Element divided by the count of array entries). Any Element not listed here has only one value.

ARRAY_COUNTS[*][0]
An Element Index.
ARRAY_COUNTS[*][1]
The number of array values for the indexed Element.

This list must be zero-terminated.

See also:
Data_Block::size_of(Index)
Data_Block::count_of(Index)
const char * TYPE_NAMES [static]
Initial value:
        {
        "NONE",
        "SQUARE ROOT",
        "LINEAR",
        "STORED"
        }

The name of each LUT type.

Referenced by Observation::PVL_PDS().

const char *const PVL_NODES_NAME = "Table_Nodes" [static]

The Parameter name of the PVL LUT nodes table.

Referenced by LUT::PVL().

const char *const PVL_PDS_TABLE_NAME = "LOOKUP_CONVERSION_TABLE" [static]

The Parameter name of the PVL_PDS LUT conversion table.

Referenced by Observation::PVL_PDS(), and LUT::PVL_PDS().

const double DEFAULT_PUKOOL_OFFSET = LUT_DEFAULT_PUKOOL_OFFSET [static]

The default pukool_table reverse mapping offset.

Referenced by main(), and usage().

const unsigned int DEFAULT_WIDTH = LUT_PRINT_GROUPS_WIDTH [static]

The default width, in value groups, of a table print listing.

Referenced by LUT::width().


The documentation for this class was generated from the following files: