![]() |
Observation
|
A LUT contains the lookup table used to map 14-bit CCD sensor values to 8-bit image pixel values. More...
#include <LUT.hh>
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. | |
LUT & | operator= (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. | |
LUT & | width (unsigned int groups) |
Sets the table print listing width. | |
idaeim::PVL::Aggregate * | PVL () const |
Produces a PVL rendition of the component. | |
idaeim::PVL::Aggregate * | PVL_PDS () const |
Provides a PDS label representation of the LUT values. | |
idaeim::PVL::Aggregate * | PVL_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.40 2020/02/14 01:17:18)" |
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. |
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/).
1.33
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.
stream | The istream from which to read the component data. |
Copy constructor.
component | The LUT to be copied. |
data_duplicate | true if the data content of the copied component is to be duplicated in the copy; false if the data content is to be shared. |
Assigns another LUT to this one.
component | The LUT to be assigned. |
References Data_Component::operator=().
string id | ( | ) | const [virtual] |
Provides the class ID on a line followed by the base Data_Component::id.
Reimplemented from Data_Component.
References LUT::ID.
const char * name | ( | ) | const [virtual] |
Gets the NAME of this class.
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.
index | An array Index into the table of values. |
std::out_of_range | If 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.
index | An array Index into the table of values. |
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.
maping_table | The data storage array for the resultant pukool table. Warning: Space for 256 UA::HiRISE::Pixel_type values must be provided. |
offset_percentage | A value between 0.0 and 1.0, inclusive. |
invalid_argument | If 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.
stream | The ostream where the listing will be written. |
verbose | true if the listing is to be verbose, otherwise some structural details will be omitted for easier human consumption. |
Implements Data_Component.
References ID.
Referenced by list_data(), and list_selections().
unsigned int width | ( | ) | const [inline] |
Gets the table print listing width.
LUT& width | ( | unsigned int | groups ) | [inline] |
Sets the table print listing width.
The DEFAULT_WIDTH applies if no other width has been set.
groups | The number of value groups per line. If this is zero the DEFAULT_WIDTH is used. |
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.
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.
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.
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.
Implements Data_Component.
References LUT::COMPONENT_BYTES, and Data_Component::data().
const char *const ID = "UA::HiRISE::LUT (1.40 2020/02/14 01:17:18)" [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().
{ 0, COMPONENT_BYTES, 0 }
Data_Block data storage address offset for each Element.
const Index ARRAY_COUNTS [static] |
{ {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.
This list must be zero-terminated.
const char * TYPE_NAMES [static] |
{ "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] |
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().