Observation
|
00001 /* HiRISE LUT (Look-up table) 00002 00003 PIRL CVS ID: LUT.hh,v 1.33 2020/02/14 01:17:18 schaller Exp 00004 00005 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and 00006 Planetary Laboratory at the University of Arizona. 00007 00008 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 00009 this file except in compliance with the License. You may obtain a copy of the 00010 License at 00011 00012 http://www.apache.org/licenses/LICENSE-2.0 00013 00014 Unless required by applicable law or agreed to in writing, software distributed 00015 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016 CONDITIONS OF ANY KIND, either express or implied. See the License for the 00017 specific language governing permissions and limitations under the License. 00018 */ 00019 #ifndef _HiRISE_LUT_ 00020 #define _HiRISE_LUT_ 00021 00022 #include "Data_Component.hh" 00023 00024 #if defined (INCLUDE_PVL) 00025 // idaeim::PVL 00026 #include "PVL.hh" 00027 #endif 00028 00029 #include <iostream> 00030 #include <string> 00031 00032 namespace UA 00033 { 00034 namespace HiRISE 00035 { 00036 /******************************************************************************* 00037 LUT 00038 */ 00066 class LUT 00067 : public Data_Component 00068 { 00069 public: 00070 /*============================================================================== 00071 Constants: 00072 */ 00074 static const char* const 00075 ID; 00076 00078 static const char* const 00079 NAME; 00080 00082 static const Index 00083 COMPONENT_BYTES; 00084 00086 static const Index 00087 OFFSETS[]; 00088 00106 static const Index 00107 ARRAY_COUNTS[][2]; 00108 00110 enum LUT_Type 00111 { 00112 None, 00113 Square_Root, 00114 Linear, 00115 Stored, 00116 00117 Total_LUT_Types 00118 }; 00119 00121 static const char* 00122 TYPE_NAMES[]; 00123 00125 static const char* const 00126 PVL_NODES_NAME; 00127 00129 static const char* const 00130 PVL_PDS_TABLE_NAME; 00131 00133 static const double 00134 DEFAULT_PUKOOL_OFFSET; 00135 00137 static const unsigned int 00138 DEFAULT_WIDTH; 00139 00140 /*============================================================================== 00141 Constructors 00142 */ 00150 LUT (); 00151 00163 explicit LUT (std::istream& stream); 00164 00173 LUT (const LUT& component, bool data_duplicate = true); 00174 00180 LUT& operator= (const LUT& component); 00181 00182 /*============================================================================== 00183 Accessors 00184 */ 00191 std::string id () const; 00192 00198 const char* name () const; 00199 00212 u_int_8 operator[] (Index index) const; 00213 00223 u_int_8& operator[] (Index index); 00224 00256 Pixel_type* pukool_table (Pixel_type* maping_table, 00257 double offset_percentage = DEFAULT_PUKOOL_OFFSET); 00258 00259 /*============================================================================== 00260 Printing 00261 */ 00283 std::ostream& print 00284 (std::ostream& stream = std::cout, bool verbose = false) const; 00285 00291 unsigned int width () const 00292 {return Width;} 00293 00303 LUT& width (unsigned int groups) 00304 {Width = groups ? groups : DEFAULT_WIDTH; return *this;} 00305 00306 #if defined (INCLUDE_PVL) 00307 /*============================================================================== 00308 PVL 00309 */ 00321 idaeim::PVL::Aggregate* PVL () const; 00322 00344 idaeim::PVL::Aggregate* PVL_PDS () const; 00345 00355 idaeim::PVL::Aggregate* PVL_description () const; 00356 00357 #endif // defined (INCLUDE_PVL) 00358 00359 /*============================================================================== 00360 Validation 00361 */ 00369 bool is_valid () const; 00370 00371 private: 00372 /*------------------------------------------------------------------------------ 00373 Data 00374 */ 00376 unsigned int 00377 Width; 00378 00379 }; // class LUT 00380 00381 /*============================================================================== 00382 Utility functions 00383 */ 00384 #if defined (INCLUDE_PVL) 00385 00419 Pixel_type* pukool_table (const idaeim::PVL::Value& conversion_table, 00420 Pixel_type* maping_table, 00421 double offset_percentage = LUT::DEFAULT_PUKOOL_OFFSET); 00422 00423 #endif // defined (INCLUDE_PVL) 00424 00425 } // namespace HiRISE 00426 } // namespace UA 00427 #endif