Isis 3 Programmer Reference
CissLabels.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include <string>
10#include "CissLabels.h"
11#include "Pvl.h"
12#include "PvlGroup.h"
13#include "SpecialPixel.h"
14#include "IException.h"
15#include "IString.h"
16
17using namespace std;
18namespace Isis {
25 Init(lab);
26 }
27
33 CissLabels::CissLabels(const QString &file) {
34 Pvl lab(file);
35 Init(lab);
36 }
37
45 void CissLabels::Init(Pvl &lab) {
46 try {
47 ReadLabels(lab);
49 }
50 catch(IException &e) {
51 e.print();
52 string msg = "Labels do not appear contain a valid Cassini ISS instrument";
53 throw IException(IException::Unknown, msg, _FILEINFO_);
54 }
55 }
56
66 // Get values out of the instrument group
67 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
68 p_ABflag = (QString) inst["AntiBloomingStateFlag"]; //valid values: On, Off, Unknown
69 p_biasStripMean = (double) inst["BiasStripMean"]; //valid values: real numbers
70 p_compressionRatio = (QString) inst["CompressionRatio"]; //valid values: NotCompressed or real number
71 p_compressionType = (QString) inst["CompressionType"]; //valid values: Lossy, Lossless, NotCompressed
72 p_dataConversionType = (QString) inst["DataConversionType"]; //valid values: 12Bit, 8LSB, Table
73 p_delayedReadoutFlag = (QString) inst["DelayedReadoutFlag"]; //valid values: Yes, No, Unknown
74 p_exposureDuration = (double) inst["ExposureDuration"]; //valid values: real numbers
75 p_flightSoftwareVersion = (QString) inst["FlightSoftwareVersionId"]; //valid values: Unknown, 1.2, 1.3, 1.4
76 p_gainModeId = (int) inst["GainModeId"]; //valid values: 12, 29, 95, 215
77 p_gainState = (int) inst["GainState"]; //valid values: 0, 1, 2, 3
78 p_instrumentDataRate = (double) inst["InstrumentDataRate"]; //valid values: 60.9, 121.9, 182.8, 243.7, 304.6, 365.6, -999.0
79 p_instrumentModeId = (QString) inst["InstrumentModeId"]; //valid values: Full, Sum2, Sum4
80 p_instrumentId = (QString) inst["InstrumentId"]; //valid values: ISSNA, ISSWA
81 p_readoutCycleIndex = (QString) inst["ReadoutCycleIndex"]; //valid values: Unknown or integers 0-15
82 p_readoutOrder = (int) inst["ReadoutOrder"]; //valid values: 0 or 1
83 p_shutterModeId = (QString) inst["ShutterModeId"]; //valid values: BothSim, NacOnly, WacOnly
84 p_shutterStateId = (QString) inst["ShutterStateId"]; //valid values: Enabled or Disabled
85 p_summingMode = (int) inst["SummingMode"]; //valid values: 1, 2, 4
86 p_frontOpticsTemp = toDouble(inst["OpticsTemperature"][0]); //valid values: real numbers
87 p_imageTime = (QString) inst["ImageTime"];
88 p_targetName = (QString) inst["TargetName"]; //valid values: may change overtime, any subject of a Cassini image
89 // Get values out of the archive group
90 PvlGroup &arch = lab.findGroup("Archive", Pvl::Traverse);
91 p_imageNumber = (double) arch["ImageNumber"];
92 // Get values out of the bandbin group
93 PvlGroup &bandbin = lab.findGroup("BandBin", Pvl::Traverse);
94 IString filter = (QString) bandbin["FilterName"];
95 p_filter.push_back(filter.Token("/").ToQt());
96 p_filter.push_back(filter.ToQt());
97 }
98
99
108 //set boolean p_antiblooming if antiblooming flag is on
109 if(p_ABflag == "On") p_antiblooming = true;
110 else p_antiblooming = false;
111
112 //set boolean p_cissNA if camera type is narrow
113 if(p_instrumentId == "ISSNA") p_cissNA = true;
114 else p_cissNA = false;
115
116 //set filter 1 and filter 2 indices
117 if(p_filter[0] == "UV1") p_filterIndex.push_back(0);
118 else if(p_filter[0] == "UV2") p_filterIndex.push_back(1);
119 else if(p_filter[0] == "BL1") p_filterIndex.push_back(3);
120 else if(p_filter[0] == "RED") p_filterIndex.push_back(6);
121 else if(p_filter[0] == "IR2") p_filterIndex.push_back(8);
122 else if(p_filter[0] == "IR4") p_filterIndex.push_back(10);
123 else if(p_filter[0] == "CL1") p_filterIndex.push_back(17);
124 else if(p_filter[0] == "HAL") p_filterIndex.push_back(19);
125 else if(p_filter[0] == "IRP0") p_filterIndex.push_back(20);
126 else if(p_filter[0] == "P0") p_filterIndex.push_back(21);
127 else if(p_filter[0] == "P60") p_filterIndex.push_back(22);
128 else if(p_filter[0] == "P120") p_filterIndex.push_back(23);
129 else if(p_filter[0] == "IR3") p_filterIndex.push_back(24);
130 else if(p_filter[0] == "IR5") p_filterIndex.push_back(25);
131 else if(p_filter[0] == "CB3") p_filterIndex.push_back(26);
132 else if(p_filter[0] == "MT3") p_filterIndex.push_back(27);
133 else if(p_filter[0] == "CB2") p_filterIndex.push_back(28);
134 else if(p_filter[0] == "MT2") p_filterIndex.push_back(29);
135 else throw IException(IException::Unknown, "Labels have invalid filter 1 name. Cannot get filter 1 index.", _FILEINFO_);
136
137 if(p_filter[1] == "UV3") p_filterIndex.push_back(2);
138 else if(p_filter[1] == "BL2") p_filterIndex.push_back(4);
139 else if(p_filter[1] == "GRN") p_filterIndex.push_back(5);
140 else if(p_filter[1] == "IR1") p_filterIndex.push_back(7);
141 else if(p_filter[1] == "IR3") p_filterIndex.push_back(9);
142 else if(p_filter[1] == "CB1") p_filterIndex.push_back(11);
143 else if(p_filter[1] == "CB2") p_filterIndex.push_back(12);
144 else if(p_filter[1] == "CB3") p_filterIndex.push_back(13);
145 else if(p_filter[1] == "MT1") p_filterIndex.push_back(14);
146 else if(p_filter[1] == "MT2") p_filterIndex.push_back(15);
147 else if(p_filter[1] == "MT3") p_filterIndex.push_back(16);
148 else if(p_filter[1] == "CL2") p_filterIndex.push_back(18);
149 else if(p_filter[1] == "RED") p_filterIndex.push_back(30);
150 else if(p_filter[1] == "BL1") p_filterIndex.push_back(31);
151 else if(p_filter[1] == "VIO") p_filterIndex.push_back(32);
152 else if(p_filter[1] == "HAL") p_filterIndex.push_back(33);
153 else if(p_filter[1] == "IRP90") p_filterIndex.push_back(34);
154 else if(p_filter[1] == "IRP0") p_filterIndex.push_back(35);
155 else throw IException(IException::Unknown, "Labels have invalid filter 2 name. Cannot get filter 2 index.", _FILEINFO_);
156 return;
157 }
158}
QString p_readoutCycleIndex
Value of the PDS keyword ReadoutCycleIndex in the cube's labels.
Definition CissLabels.h:492
QString p_delayedReadoutFlag
Value of the PDS keyword DelayedReadoutFlag in the cube's labels.
Definition CissLabels.h:468
double p_frontOpticsTemp
Value of the PDS keyword OpticsTemperature[0] in the cube's labels.
Definition CissLabels.h:478
QString p_shutterModeId
Value of the PDS keyword ShutterModeId in the cube's labels.
Definition CissLabels.h:496
QString p_dataConversionType
Value of the PDS keyword DataConversionType in the cube's labels.
Definition CissLabels.h:466
QString p_compressionRatio
Value of the PDS keyword CompressionRatio in the cube's labels.
Definition CissLabels.h:462
double p_instrumentDataRate
Value of the PDS keyword ImageTime in the cube's labels.
Definition CissLabels.h:486
QString p_targetName
Value of the PDS keyword TargetName in the cube's labels.
Definition CissLabels.h:502
QString p_shutterStateId
Value of the PDS keyword ShutterState in the cube's labels.
Definition CissLabels.h:498
bool p_cissNA
Indicates whether camera is narrow-angle.
Definition CissLabels.h:460
bool p_antiblooming
Indicates whether anti-blooming state flag on.
Definition CissLabels.h:456
int p_gainState
Value of the PDS keyword GainState in the cube's labels.
Definition CissLabels.h:482
QString p_instrumentModeId
Value of the PDS keyword InstrumentModeId in the cube's labels.
Definition CissLabels.h:490
double p_biasStripMean
Value of the PDS keyword BiasStripMean in the cube's labels.
Definition CissLabels.h:458
std::vector< QString > p_filter
Two-element array of optical filters used for this image.
Definition CissLabels.h:472
QString p_ABflag
Value of the PDS keyword AntiBloomingFlag in the cube's labels.
Definition CissLabels.h:454
double p_exposureDuration
Value of the PDS keyword ExposureDuration in the cube's labels.
Definition CissLabels.h:470
void ReadLabels(Pvl &lab)
Reads the Pvl Labels.
QString p_flightSoftwareVersion
Value of the PDS keyword FlightSoftwareVersion in the cube's labels.
Definition CissLabels.h:476
QString p_instrumentId
Value of the PDS keyword InstrumentId in the cube's labels.
Definition CissLabels.h:488
QString p_imageTime
Value of the PDS Keyword ImageTime in the cube's labels.
Definition CissLabels.h:504
CissLabels(Pvl &lab)
Constructs a CissLabels object from an Isis::Pvl object.
double p_imageNumber
Value of the PDS keyword ImageNumber in the cube's labels.
Definition CissLabels.h:484
int p_gainModeId
Value of the PDS keyword GainModeId in the cube's labels.
Definition CissLabels.h:480
QString p_compressionType
Value of the PDS keyword CompressionType in the cube's labels.
Definition CissLabels.h:464
std::vector< int > p_filterIndex
Two-element array of filter indices corresponding to optical filters.
Definition CissLabels.h:474
int p_summingMode
Value of the PDS keyword SummingMode in the cube's labels.
Definition CissLabels.h:500
void ComputeImgProperties()
Computes values of non-keyword image properties.
int p_readoutOrder
Value of the PDS keyword ReadoutOrder in the cube's labels.
Definition CissLabels.h:494
void Init(Pvl &lab)
General initializer.
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
Adds specific functionality to C++ strings.
Definition IString.h:165
IString Token(const IString &separator)
Returns the first token in the IString.
Definition IString.cpp:897
QString ToQt() const
Retuns the object string as a QString.
Definition IString.cpp:869
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
@ Traverse
Search child objects.
Definition PvlObject.h:158
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149
Namespace for the standard library.