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 Types inherited from Data_Block | |
enum | Data_Order |
enum | Array_Index_Counts |
enum | Array_Offset_Counts |
typedef unsigned int | Index |
typedef std::vector< Index > | Value_List |
typedef void(* | Copier) (unsigned char *destination, int destination_amount, const unsigned char *source, int source_amount) |
Public Member Functions | |
LUT () | |
Constructs an empty LUT. More... | |
LUT (std::istream &stream) | |
Constructs an LUT loaded from a data stream. More... | |
LUT (const LUT &component, bool data_duplicate=true) | |
Copy constructor. More... | |
LUT & | operator= (const LUT &component) |
Assigns another LUT to this one. More... | |
std::string | id () const |
Provides the class ID on a line followed by the base Data_Component::id. More... | |
const char * | name () const |
Gets the NAME of this class. More... | |
u_int_8 | operator[] (Index index) const |
Gets a table entry using array notation. More... | |
u_int_8 & | operator[] (Index index) |
Provides a reference to a table entry using array notation. More... | |
Pixel_type * | pukool_table (Pixel_type *maping_table, double offset_percentage=DEFAULT_PUKOOL_OFFSET) |
Gets the reverse lookup (pukool) table. More... | |
std::ostream & | print (std::ostream &stream=std::cout, bool verbose=false) const |
Prints the component structure and contents. More... | |
unsigned int | width () const |
Gets the table print listing width. More... | |
LUT & | width (unsigned int groups) |
Sets the table print listing width. More... | |
idaeim::PVL::Aggregate * | PVL () const |
Produces a PVL rendition of the component. More... | |
idaeim::PVL::Aggregate * | PVL_PDS () const |
Provides a PDS label representation of the LUT values. More... | |
idaeim::PVL::Aggregate * | PVL_description () const |
Produces a PVL description of the component for a PDS label. More... | |
bool | is_valid () const |
Tests if the component data is valid. More... | |
Public Member Functions inherited from Data_Component | |
Data_Component (const char **names=NULL, unsigned int size=0, const Index *offsets=NULL, const Index indexed_arrays[][2]=NULL, Data_Order order=Data_Block::MSB) | |
Constructs a Data_Component using component specifications. More... | |
Data_Component (const Data_Component &component, bool data_duplicate=true) | |
Copy constructor. More... | |
Data_Component & | operator= (const Data_Component &component) |
Assignment operator. More... | |
virtual | ~Data_Component () |
Destructor. More... | |
const char * | name (Index element) const |
Gets the name of a component Element. More... | |
virtual u_int_32 | get (Index element, Index index=0) const |
Gets a value from a data Element or array entry of the component. More... | |
virtual Data_Component & | put (const u_int_32 value, Index element, Index index=0) |
Puts a value into a data Element or array entry of the component. More... | |
std::ostream & | print_element (const Index element, int format=DECIMAL, std::ostream &stream=std::cout, int width=0) const |
Prints an Element description. More... | |
std::ostream & | print_element (const Index element, std::ostream &stream) const |
Prints an Element description. More... | |
std::ostream & | print_element_location (const Index element, std::ostream &stream=std::cout) const |
Prints the location of an Element in the component. More... | |
unsigned int | element_location_print_width (Index element) const |
Gets the width of the Element location printing fields. More... | |
unsigned int | name_field_width () const |
Gets the width of the Element name printing field. More... | |
Data_Component & | name_field_width (unsigned int width) |
Sets the width of the Element name field for printing. More... | |
Data_Block & | data (void *const block) |
Overrides the base Data_Block::data to reset Local_Data. More... | |
Data_Block & | attach (void *const block, unsigned int size) |
Attaches a new block of data to the component. More... | |
Data_Component & | resize (unsigned int size) |
Resizes the block of local data storage. More... | |
unsigned char * | data () const |
Gets a pointer to the current component storage. More... | |
unsigned int | local_data () |
Gets the size of the local data storage area. More... | |
u_int_16 | internet_checksum () const |
Calculates the Internet Checksum as per RFC 1071. More... | |
Public Member Functions inherited from Data_Block | |
Data_Block () | |
Data_Block (void *const data, const Index *offsets, Index total_elements=0, const Index *array_counts=NULL, bool native_order=true) | |
Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, bool native_order=true) | |
Data_Block (void *const data, const Value_List &offsets, bool native_order=true) | |
Data_Block (void *const data, const Index *offsets, Index total_elements, const Index *array_counts, Data_Order data_order) | |
Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, Data_Order data_order) | |
Data_Block (void *const data, const Index *offsets, Index total_elements, Data_Order data_order) | |
Data_Block (void *const data, const Index *offsets, Data_Order data_order) | |
Data_Block (void *const data, const Value_List &offsets, Data_Order data_order) | |
Data_Block (void *const data, const Index *offsets, const Index indexed_counts[][2], Data_Order data_order) | |
Data_Block (const Data_Block &data_block) | |
Data_Block & | operator= (const Data_Block &data_block) |
virtual | ~Data_Block () |
bool | native () const |
Data_Block & | native (bool native_order) |
Data_Order | data_order () const |
Data_Block & | data_order (Data_Order order) |
unsigned char * | data () const |
Index | size () const |
Value_List | element_offsets_list () const |
Index * | element_offsets () |
bool | element_offsets (const Value_List &offsets) |
bool | element_offsets (const Index *offsets, Index total_elements=NO_INDEX) |
bool | element_sizes (const Value_List &sizes) |
bool | element_sizes (const Index *sizes, Index total_elements=NO_INDEX) |
Index | offset_of (Index element) const |
bool | offset_of (Index element, Index offset) |
bool | insert_element (Index offset, Index size, Index array_count=1) |
Data_Block & | delete_element (Index element) |
Data_Block & | shift_offsets (int amount) |
Index | elements () const |
Index | size_of (Index element) const |
bool | size_of (Index element, Index size) |
Index | value_size_of (Index element) const |
Data_Block & | value_size_of (Index element, Index size) |
Index | index_of (Index offset) const |
Value_List | array_counts_list () const |
Index * | array_counts () |
Data_Block & | array_counts (const Value_List &counts, Index begin=0) |
Data_Block & | array_counts (const Index *counts, Index begin=0, Index end=NO_INDEX) |
Data_Block & | array_indexed_counts (const Index indexed_counts[][2], Index total_counts=NO_INDEX) |
Data_Block & | array_offset_counts (const Index offset_counts[][2], Index total_counts=NO_INDEX) |
Index | count_of (Index element) const |
Data_Block & | count_of (Index element, Index count) |
bool | reset_counts (bool unconditional=true, Index begin=0, Index end=NO_INDEX) |
const Data_Block & | get (T &value, const Index element, const Index index=0) const |
const Data_Block & | get (T &value, const Index element, const Index index=0) const |
T | get (const Index element, const Index index=0) const |
T | get (const Index element, const Index index=0) const |
Data_Block & | put (T &value, const Index element, const Index index=0) |
Data_Block & | put (T &value, const Index element, const Index index=0) |
const Data_Block & | get (T *array, const Index element, Index count=0) const |
const Data_Block & | get (T *array, const Index element, Index count=0) const |
Data_Block & | put (T *array, const Index element, Index count=0) |
Data_Block & | put (T *array, const Index element, Index count=0) |
std::istream & | input (std::istream &stream) |
std::ostream & | output (std::ostream &stream) const |
std::ostream & | print (std::ostream &stream=std::cout) const |
Static Public Attributes | |
static const char *const | ID |
Class identification name with source code version and date. More... | |
static const char *const | NAME = "LUT" |
The component name. More... | |
static const Index | COMPONENT_BYTES = LUT_BYTES |
Total number of bytes in the Data_Block. More... | |
static const Index | OFFSETS [] |
Data_Block data storage address offset for each Element. More... | |
static const Index | ARRAY_COUNTS [][2] |
Data_Block array element value counts each keyed to an Element Index. More... | |
static const char * | TYPE_NAMES [] |
The name of each LUT type. More... | |
static const char *const | PVL_NODES_NAME = "Table_Nodes" |
The Parameter name of the PVL LUT nodes table. More... | |
static const char *const | PVL_PDS_TABLE_NAME = "LOOKUP_CONVERSION_TABLE" |
The Parameter name of the PVL_PDS LUT conversion table. More... | |
static const double | DEFAULT_PUKOOL_OFFSET = LUT_DEFAULT_PUKOOL_OFFSET |
The default pukool_table reverse mapping offset. More... | |
static const unsigned int | DEFAULT_WIDTH = LUT_PRINT_GROUPS_WIDTH |
The default width, in value groups, of a table print listing. More... | |
Static Public Attributes inherited from Data_Component | |
static const char *const | ID |
Class identification name with source code version and date. More... | |
static const int | DECIMAL = 0 |
Format specifier. More... | |
static const int | HEX = -1 |
static const int | BOOLEAN = -2 |
static const char | PATHNAME_DELIMITER = FILESYSTEM_PATHNAME_DELIMITER |
Host filesystem pathname delimiter. More... | |
static const int | UTC_SECONDS_PRECISION = SECONDS_PRECISION |
UTC seconds precision (digits after the decimal point). More... | |
static const char | SUBSECONDS_DELIMITER = ':' |
Delimits subseconds from seconds in clock count representations. More... | |
static const char *const | SPICE_METAKERNEL_VARIABLE |
The name of the environment variable for the SPICE metakernel pathname. More... | |
static const char *const | DEFAULT_SPICE_METAKERNEL |
The default SPICE metakernal pathname. More... | |
static const int | MRO_CLOCK_ID = MRO_CLOCK_NAIF_ID |
The ID used by NAIF for specifying the MRO clock to CSPICE routines. More... | |
static const char *const | INVALID_UTC_TIME = DEFAULT_INVALID_UTC_TIME |
Static Public Attributes inherited from Instrument | |
static const char *const | ID |
static const unsigned int | CCDS |
static const unsigned int | CCD_UNKNOWN |
static const char *const | CCD_NAMES [] |
static const char *const | CCD_FILTER_NAMES [] |
static const unsigned int | CCD_BY_CPMM [] |
static const unsigned int | CPMM_BY_CCD [] |
static const char *const | WAVELENGTH_UNITS |
static const unsigned int | CCD_CENTER_WAVELENGTHS [] |
static const unsigned int | CCD_BANDWIDTHS [] |
static const double | CCD_FOCAL_PLANE_X_OFFSETS_MM [] |
static const double | CCD_FOCAL_PLANE_Y_OFFSETS_MM [] |
static const double | CCD_PIXEL_SIZE_MM |
static const unsigned int | CCD_CHANNELS |
static const unsigned int | CCD_CHANNEL_UNKNOWN |
static const unsigned int | CCD_IMAGE_SENSORS |
static const unsigned int | MAX_BYTES_PER_PIXEL |
static const unsigned int | MAX_PIXEL_VALUES [] |
static const unsigned int | MAX_IMAGE_LINES |
static const unsigned int | TOTAL_TDI_STAGES |
static const unsigned int | TDI_STAGES [] |
static const unsigned int | TOTAL_BINNING_FACTORS |
static const unsigned int | BINNING_FACTORS [] |
static const unsigned int | CCD_BINNED_PIXELS [] |
static const unsigned int | STORED_LUTS |
static const unsigned int | STIMULATOR_LEDS |
static const char *const | STIMULATOR_LED_NAMES [] |
static const double | EXPOSURE_SETUP_MICROS |
static const unsigned int | DELTA_LINE_TIME_MAX |
static const double | DELTA_LINE_TIME_TICK_NANOS |
static const double | LINE_TIME_PRE_OFFSET |
static const unsigned int | TRIM_ADDITION_LINES |
static const unsigned int | REVERSE_READOUT_LINES |
static const unsigned int | MASKED_LINES |
static const unsigned int | DLL_LOCKED |
static const unsigned int | DLL_NOT_LOCKED |
static const unsigned int | SPACECRAFT_EPOCH |
static const double | MRO_CLOCK_SUBTICK_MICROS |
static const double | HIRISE_CLOCK_SUBTICK_MICROS |
static const int | SPACECRAFT_NAIF_ID |
static const unsigned int | SSR_BYTE_BOUNDARY |
static const int | UNKNOWN_NUMBER |
static const int | NOT_APPLICABLE_NUMBER |
static const char *const | UNKNOWN_STRING |
static const char *const | NOT_APPLICABLE_STRING |
Static Public Attributes inherited from Data_Block | |
static const char *const | ID |
static const Index | NO_INDEX |
Additional Inherited Members | |
Static Public Member Functions inherited from Instrument | |
static unsigned int | calibration_lines_minimum (unsigned int TDI, unsigned int binning) |
static int | focal_plane_x_offset (unsigned int CPMM, unsigned int binning=1) |
Static Public Member Functions inherited from Data_Block | |
static Data_Order | native_order () |
static Value_List & | sizes_to_offsets (Value_List &sizes) |
static Index * | sizes_to_offsets (Index *sizes, Index total_elements=NO_INDEX) |
static Value_List & | offsets_to_sizes (Value_List &offsets) |
static Index * | offsets_to_sizes (Index *offsets, Index total_elements=NO_INDEX) |
Public Attributes inherited from Data_Block | |
MSB | |
LSB | |
ELEMENT_INDEX | |
INDEX_COUNT | |
ELEMENT_OFFSET | |
OFFSET_COUNT | |
Copier | Get |
Copier | Put |
Protected Member Functions inherited from Data_Block | |
void | limits_checker (const Index element, const Index index, bool getter, bool array) const |
Static Protected Member Functions inherited from Data_Block | |
static void | get_forwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount) |
static void | get_backwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount) |
static void | put_forwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount) |
static void | put_backwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount) |
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
enum LUT_Type |
The LUT types available for use.
Enumerator | |
---|---|
None | |
Square_Root | |
Linear | |
Stored | |
Total_LUT_Types |
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.
|
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. |
References Data_Block::input().
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=().
|
virtual |
Provides the class ID on a line followed by the base Data_Component::id.
Reimplemented from Data_Component.
References Data_Component::id(), and LUT::ID.
|
virtual |
Gets the NAME of this class.
Implements Data_Component.
References LUT::NAME.
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. |
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 LUT::COMPONENT_BYTES, LUT::ID, and Instrument::MAX_PIXEL_VALUES.
Referenced by main().
|
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 LUT::COMPONENT_BYTES, LUT::ID, and LUT::NAME.
Referenced by list_data(), and list_selections().
|
inline |
Gets the table print listing width.
|
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.
|
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, 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, Parameter::indenting(), LUT::NAME, Instrument::NOT_APPLICABLE_NUMBER, and LUT::PVL_PDS_TABLE_NAME.
Referenced by Observation::PVL_PDS().
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.
Referenced by Observation::PVL_PDS().
|
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().
|
static |
Class identification name with source code version and date.
Referenced by LUT::id(), main(), LUT::print(), UA::HiRISE::pukool_table(), LUT::pukool_table(), and LUT::PVL_description().
|
static |
The component name.
Referenced by LUT::name(), LUT::print(), LUT::PVL(), and LUT::PVL_PDS().
Total number of bytes in the Data_Block.
Referenced by Observation::components(), LUT::is_valid(), Observation::line(), LUT::print(), LUT::pukool_table(), LUT::PVL(), LUT::PVL_PDS(), and Observation::PVL_PDS().
|
static |
Data_Block data storage address offset for each Element.
|
static |
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. @see Data_Block::size_of(Index) @see Data_Block::count_of(Index)
|
static |
The name of each LUT type.
Referenced by Observation::PVL_PDS().
|
static |
The Parameter name of the PVL LUT nodes table.
Referenced by LUT::PVL().
|
static |
The Parameter name of the PVL_PDS LUT conversion table.
Referenced by LUT::PVL_PDS(), and Observation::PVL_PDS().
|
static |
|
static |
The default width, in value groups, of a table print listing.
Referenced by LUT::width().