HiRISE
 Observation

Observation.hh
Go to the documentation of this file.
1 /* HiRISE Observation
2 
3 PIRL CVS ID: Observation.hh,v 1.50 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_Observation_
20 #define _HiRISE_Observation_
21 
22 // UA::HiRISE
23 #include "Data_Component.hh"
24 #include "MROSP_Header.hh"
26 #include "LUT.hh"
27 #include "Engineering_Header.hh"
28 #include "Image_Line.hh"
29 #include "Gap_Map.hh"
30 
31 #if defined (INCLUDE_PVL)
32 // idaeim::PVL
33 #include "PVL.hh"
34 #endif
35 
36 #include <iosfwd>
37 #include <vector>
38 
39 
40 namespace UA
41 {
42 namespace HiRISE
43 {
67  : public Instrument
68 {
69 public:
70 /*==============================================================================
71  Constants:
72 */
74 static const char* const
75  ID;
76 
78 static const char
79  * const PDS_VERSION_ID,
80  * const RECORD_TYPE,
81  * const DATA_SET_ID,
82  * const DATA_SET_NAME,
84  * const PRODUCER_ID,
88  * const INSTRUMENT_NAME,
89  * const INSTRUMENT_ID,
90  * const TARGET_NAME,
93 
95 static const char
97 
99 static const char
101 
113 static const char
115 
117 static const int
119 
121 static const int
123 
124 /*==============================================================================
125  Constructors
126 */
128 Observation ();
129 
149 explicit Observation (std::istream& stream);
150 
151 /*==============================================================================
152  Accessors
153 */
167 std::string data_ID () const;
168 
204 std::vector<Data_Component*>& data_components ()
205  {return Components;}
206 
216 unsigned int line_count () const
217  {return Line.count ();}
218 
219 /*==============================================================================
220  I/O
221 */
232 std::istream& source () const;
233 
252 Observation& source (std::istream& stream)
253  {Source = &stream; Bytes_Read = 0; return *this;}
254 
308 bool components ();
309 
324 unsigned long components (std::ostream& stream) const;
325 
343 Observation& line ();
344 
358 std::ostream& line (std::ostream& stream) const;
359 
399 void reset_line ();
400 
431  {Mirror_Channel_1 = enable; return *this;}
432 
439 bool mirror_channel_1 () const
440  {return Mirror_Channel_1;}
441 
452 static void mirror_channel_1_default (bool enable)
453  {Mirror_Channel_1_Default = enable;}
454 
466  {return Mirror_Channel_1_Default;}
467 
482 unsigned long long bytes_read () const
483  {return Bytes_Read;}
484 
498 std::ostream& print
499  (std::ostream& stream = std::cout, bool verbose = false) const;
500 
506 std::string data_set_version () const
507  {return Data_Set_Version;}
508 
521 Observation& data_set_version (const char* version);
522 
527 std::string product_version () const
528  {return Product_Version;}
529 
542 Observation& product_version (const char* version);
543 
544 #if defined (INCLUDE_PVL)
545 /*==============================================================================
546  PVL
547 */
564 idaeim::PVL::Aggregate* PVL () const;
565 
621  {return PVL_PDS (Line);}
622 
623 idaeim::PVL::Aggregate* PVL_PDS (const Image_Line& image_line) const;
624 
650 
651 #endif // defined (INCLUDE_PVL)
652 
653 /*------------------------------------------------------------------------------
654  Data
655 */
656 // Data_Component blocks:
657 
661 
665 
667 LUT
669 
673 
677 
679 Gap_Map
681 
683 std::vector<Data_Component*>
685 
686 /*..............................................................................
687  Object management data memembers
688 */
689 private:
690 
692 std::istream
693  *Source;
694 
696 unsigned long long
697  Bytes_Read;
698 
700 static bool
701  Mirror_Channel_1_Default;
702 
704 bool
705  Mirror_Channel_1;
706 
708 std::string
709  Data_Set_Version;
710 
712 std::string
713  Product_Version;
714 
715 }; // class Observation
716 
717 /*==============================================================================
718  Helper functions
719 */
727 std::ostream& operator<<
728  (std::ostream& stream, const Observation& observation);
729 
730 } // namespace HiRISE
731 } // namespace UA
732 #endif
Gap_Map * gap_map(istream &source, long location, unsigned int entries)
Definition: HiRISE_Observation.cc:2333
An Engineering_Header contains a minimal core set of observation control parameters.
Definition: Engineering_Header.hh:93
A Gap_Map contains a map of data gap ranges for the file with which it is associated.
Definition: Gap_Map.hh:70
An Image_Line contains a cache of observation channel image pixel data.
Definition: Image_Line.hh:112
unsigned int count() const
Gets the current line count.
Definition: Image_Line.cc:967
A LUT contains the lookup table used to map 14-bit CCD sensor values to 8-bit image pixel values.
Definition: LUT.hh:68
An MROSP_Header contains information used by the HiRISE instrument to identify a stored data block to...
Definition: MROSP_Header.hh:83
Observation manages the components of a MRO HiRISE instrument science observation data set.
Definition: Observation.hh:68
void reset_line()
Resets the Observation Image_Line structure.
Definition: Observation.cc:739
static const char *const *const *const *const *const *const *const *const *const INSTRUMENT_HOST_ID
Definition: Observation.hh:87
static const char *const *const *const *const DATA_SET_NAME
Definition: Observation.hh:82
Observation & source(std::istream &stream)
Sets the input stream to be used as the source of observation data.
Definition: Observation.hh:252
static const char *const *const *const DATA_SET_ID
Definition: Observation.hh:81
std::istream & source() const
Gets the istream being used as the source of observation data.
Definition: Observation.cc:292
static void gap_map_shift(idaeim::PVL::Parameter *gap_map, int shift)
Shifts the locations of gaps in a gap map.
Definition: Observation.cc:1737
Observation & line()
Loads the next line of image data from the source into the Line cache.
Definition: Observation.cc:650
bool mirror_channel_1() const
Tests if mirroring of channel 1 Line data is enabled.
Definition: Observation.hh:439
static const int MINIMUM_MICROSECONDS_PRECISION
The minimum precision (all digits) of microsecond time values.
Definition: Observation.hh:118
bool components()
Reads a set of header data components from the data source.
Definition: Observation.cc:302
Gap_Map Gaps
Gap range map for the channel data (excludes the MROSP).
Definition: Observation.hh:680
static const char *const *const *const *const *const *const *const *const *const *const *const INSTRUMENT_ID
Definition: Observation.hh:89
static const char *const *const RECORD_TYPE
Definition: Observation.hh:80
Science_Channel_Header Science
Science channel data containing a wealth of instrument settings.
Definition: Observation.hh:664
idaeim::PVL::Aggregate * PVL_PDS() const
Produces a set of PVL parameters for use in generating a PDS standards compliant EDR product label.
Definition: Observation.hh:620
static const char *const *const *const *const *const *const PRODUCER_ID
Definition: Observation.hh:84
unsigned long long bytes_read() const
Gets the number of bytes read since the data source stream was attached to this Observation.
Definition: Observation.hh:482
static const char *const *const *const *const *const *const *const PRODUCER_FULL_NAME
Definition: Observation.hh:85
static const char *const NON_PDS_NAMESPACE_PARAMETERS[]
PDS label parameters that are not in the MRO namespace.
Definition: Observation.hh:114
static const char *const DEFAULT_PRODUCT_VERSION
Default product version specification.
Definition: Observation.hh:100
std::string product_version() const
Gets the version string for the PRODUCT_VERSION_ID parameter.
Definition: Observation.hh:527
Engineering_Header Engineering
CPMM/Telemetry engineering info (just a few key settings).
Definition: Observation.hh:672
static const char *const *const *const *const *const *const *const *const *const *const *const *const TARGET_NAME
Definition: Observation.hh:90
std::vector< Data_Component * > Components
Data_Component header objects: Science, Lookup_Table, Engineering.
Definition: Observation.hh:684
MROSP_Header MROSP
MROSP header. Usually absent (present in instrument manufacturer test data).
Definition: Observation.hh:660
std::ostream & print(std::ostream &stream=std::cout, bool verbose=false) const
Prints a detailed description of the current header data components.
Definition: Observation.cc:1806
static const int PVL_PDS_BYTES
The absolute size to set the PDS PVL label.
Definition: Observation.hh:122
std::vector< Data_Component * > & data_components()
Gets the vector of pointers to the Observation Data_Component header data objects.
Definition: Observation.hh:204
static void mirror_channel_1_default(bool enable)
Enables or disables the default mirroring of channel 1 Line data.
Definition: Observation.hh:452
static const char *const *const *const *const *const *const *const *const *const *const *const *const *const *const PDS_NAMESPACE_PARAMETER_PREFIX
Definition: Observation.hh:92
std::string data_ID() const
Gets the string representation of the observation data identification values for the current header d...
Definition: Observation.cc:249
Observation & mirror_channel_1(bool enable)
Enables or disables mirroring of channel 1 Line data.
Definition: Observation.hh:430
static const char *const *const *const *const *const *const *const *const *const *const INSTRUMENT_NAME
Definition: Observation.hh:88
static const char *const *const *const *const *const *const *const *const *const *const *const *const *const FLIGHT_SOFTWARE_ID_PREFIX
Definition: Observation.hh:91
static const char *const *const *const *const *const PRODUCER_INSTITUTION_NAME
Definition: Observation.hh:83
Observation()
Constructs an empty Observation.
Definition: Observation.cc:214
Image_Line Line
Image data (lines cache).
Definition: Observation.hh:676
LUT Lookup_Table
Lookup table used for 14-bit observation data to 8-bit image data mapping.
Definition: Observation.hh:668
std::string data_set_version() const
Gets the version string for the DATA_SET_ID and DATA_SET_NAME PDS PVL parameters.
Definition: Observation.hh:506
static bool mirror_channel_1_default()
Tests the state of default mirroring of channel 1 Line data.
Definition: Observation.hh:465
static const char *const *const *const *const *const *const *const *const INSTRUMENT_HOST_NAME
Definition: Observation.hh:86
unsigned int line_count() const
The number of lines read since the last set of header data components was read.
Definition: Observation.hh:216
static const char *const DEFAULT_DATA_SET_VERSION
Default data set version specification.
Definition: Observation.hh:96
static const char *const ID
Class identification name with source code version and date.
Definition: Observation.hh:75
static const char *const PDS_VERSION_ID
Constant Parameter String values for the PDS label PVL contents.
Definition: Observation.hh:79
idaeim::PVL::Aggregate * PVL() const
Produces an exhausitive PVL (Parameter Value Language) rendition of the header data components.
Definition: Observation.cc:814
A Science_Channel_Header contains the science metadata describing the observation channel data.
Definition: Science_Channel_Header.hh:243
string shift(std::string lines, int amount)
Shifts (indents) lines of text by the specified number of spaces.
Definition: Data_Component.cc:1209
University of Arizona.