HiRISE
 Observation

LUT.hh
Go to the documentation of this file.
1 /* HiRISE LUT (Look-up table)
2 
3 PIRL CVS ID: LUT.hh,v 1.33 2020/02/14 01:17:18 schaller Exp
4 
5 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and
6 Planetary Laboratory at the University of Arizona.
7 
8 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9 this file except in compliance with the License. You may obtain a copy of the
10 License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14 Unless required by applicable law or agreed to in writing, software distributed
15 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16 CONDITIONS OF ANY KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations under the License.
18 */
19 #ifndef _HiRISE_LUT_
20 #define _HiRISE_LUT_
21 
22 #include "Data_Component.hh"
23 
24 #if defined (INCLUDE_PVL)
25 // idaeim::PVL
26 #include "PVL.hh"
27 #endif
28 
29 #include <iostream>
30 #include <string>
31 
32 namespace UA
33 {
34 namespace HiRISE
35 {
36 /*******************************************************************************
37  LUT
38 */
66 class LUT
67 : public Data_Component
68 {
69 public:
70 /*==============================================================================
71  Constants:
72 */
74 static const char* const
75  ID;
76 
78 static const char* const
80 
82 static const Index
84 
86 static const Index
88 
106 static const Index
108 
111  {
116 
118  };
119 
121 static const char*
123 
125 static const char* const
127 
129 static const char* const
131 
133 static const double
135 
137 static const unsigned int
139 
140 /*==============================================================================
141  Constructors
142 */
150 LUT ();
151 
163 explicit LUT (std::istream& stream);
164 
173 LUT (const LUT& component, bool data_duplicate = true);
174 
180 LUT& operator= (const LUT& component);
181 
182 /*==============================================================================
183  Accessors
184 */
191 std::string id () const;
192 
198 const char* name () const;
199 
212 u_int_8 operator[] (Index index) const;
213 
223 u_int_8& operator[] (Index index);
224 
256 Pixel_type* pukool_table (Pixel_type* maping_table,
257  double offset_percentage = DEFAULT_PUKOOL_OFFSET);
258 
259 /*==============================================================================
260  Printing
261 */
283 std::ostream& print
284  (std::ostream& stream = std::cout, bool verbose = false) const;
285 
291 unsigned int width () const
292  {return Width;}
293 
303 LUT& width (unsigned int groups)
304  {Width = groups ? groups : DEFAULT_WIDTH; return *this;}
305 
306 #if defined (INCLUDE_PVL)
307 /*==============================================================================
308  PVL
309 */
321 idaeim::PVL::Aggregate* PVL () const;
322 
345 
356 
357 #endif // defined (INCLUDE_PVL)
358 
359 /*==============================================================================
360  Validation
361 */
369 bool is_valid () const;
370 
371 private:
372 /*------------------------------------------------------------------------------
373  Data
374 */
376 unsigned int
377  Width;
378 
379 }; // class LUT
380 
381 /*==============================================================================
382  Utility functions
383 */
384 #if defined (INCLUDE_PVL)
419 Pixel_type* pukool_table (const idaeim::PVL::Value& conversion_table,
420  Pixel_type* maping_table,
421  double offset_percentage = LUT::DEFAULT_PUKOOL_OFFSET);
422 
423 #endif // defined (INCLUDE_PVL)
424 
425 } // namespace HiRISE
426 } // namespace UA
427 #endif
A Data_Component provides a common, virtual interface for all HiRISE Observation data blocks.
Definition: Data_Component.hh:124
A LUT contains the lookup table used to map 14-bit CCD sensor values to 8-bit image pixel values.
Definition: LUT.hh:68
static const char *const PVL_NODES_NAME
The Parameter name of the PVL LUT nodes table.
Definition: LUT.hh:126
std::ostream & print(std::ostream &stream=std::cout, bool verbose=false) const
Prints the component structure and contents.
Definition: LUT.cc:337
std::string id() const
Provides the class ID on a line followed by the base Data_Component::id.
Definition: LUT.cc:203
static const Index OFFSETS[]
Data_Block data storage address offset for each Element.
Definition: LUT.hh:87
unsigned int width() const
Gets the table print listing width.
Definition: LUT.hh:291
const char * name() const
Gets the NAME of this class.
Definition: LUT.cc:207
static const double DEFAULT_PUKOOL_OFFSET
The default pukool_table reverse mapping offset.
Definition: LUT.hh:134
bool is_valid() const
Tests if the component data is valid.
Definition: LUT.cc:771
static const char *const PVL_PDS_TABLE_NAME
The Parameter name of the PVL_PDS LUT conversion table.
Definition: LUT.hh:130
LUT & width(unsigned int groups)
Sets the table print listing width.
Definition: LUT.hh:303
Pixel_type * pukool_table(Pixel_type *maping_table, double offset_percentage=DEFAULT_PUKOOL_OFFSET)
Gets the reverse lookup (pukool) table.
Definition: LUT.cc:228
LUT & operator=(const LUT &component)
Assigns another LUT to this one.
Definition: LUT.cc:187
static const Index ARRAY_COUNTS[][2]
Data_Block array element value counts each keyed to an Element Index.
Definition: LUT.hh:107
LUT()
Constructs an empty LUT.
Definition: LUT.cc:148
static const char * TYPE_NAMES[]
The name of each LUT type.
Definition: LUT.hh:122
idaeim::PVL::Aggregate * PVL_PDS() const
Provides a PDS label representation of the LUT values.
Definition: LUT.cc:451
u_int_8 operator[](Index index) const
Gets a table entry using array notation.
Definition: LUT.cc:212
static const unsigned int DEFAULT_WIDTH
The default width, in value groups, of a table print listing.
Definition: LUT.hh:138
static const char *const ID
Class identification name with source code version and date.
Definition: LUT.hh:75
static const char *const NAME
The component name.
Definition: LUT.hh:79
idaeim::PVL::Aggregate * PVL_description() const
Produces a PVL description of the component for a PDS label.
Definition: LUT.cc:707
idaeim::PVL::Aggregate * PVL() const
Produces a PVL rendition of the component.
Definition: LUT.cc:409
static const Index COMPONENT_BYTES
Total number of bytes in the Data_Block.
Definition: LUT.hh:83
LUT_Type
The LUT types available for use.
Definition: LUT.hh:111
@ Linear
Definition: LUT.hh:114
@ Total_LUT_Types
Definition: LUT.hh:117
@ Stored
Definition: LUT.hh:115
@ None
Definition: LUT.hh:112
@ Square_Root
Definition: LUT.hh:113
U_INT_8_TYPE u_int_8
8-bit unsigned integer type.
Definition: Data_Component.hh:56
PIRL::Data_Block::Index Index
Data_Block element index type.
Definition: Data_Component.hh:95
u_int_16 Pixel_type
The type of a generic pixel value.
Definition: Data_Component.hh:98
Pixel_type * pukool_table(const Value &conversion_table, Pixel_type *mapping_table, double offset_percentage)
Generates a reverse lookup (pukool) table from a LUT PVL_PDS LOOKUP_CONVERSION_TABLE Parameter Value.
Definition: LUT.cc:539
University of Arizona.