USGS

Isis 3.0 Object Programmers' Reference

Home

ApolloPanoramicCamera.cpp
2 
3 #include "ApolloPanIO.h"
5 
6 #include <QString>
7 
8 #include "CameraDistortionMap.h"
9 #include "CameraFocalPlaneMap.h"
10 #include "IException.h"
11 #include "IString.h"
12 #include "iTime.h"
15 #include "LineScanCameraSkyMap.h"
16 #include "PvlGroup.h"
17 #include "PvlKeyword.h"
18 
19 using namespace std;
20 namespace Isis {
27  ApolloPanoramicCamera::ApolloPanoramicCamera(Isis::Cube &cube) : Isis::LineScanCamera(cube) {
28  // Set up the camera info from ik/iak kernels
29  SetFocalLength(610.0); //nominal (uncalibrated) focal length in mm from "Apollo 15 SIM Bay
30  // Photographic Equipment and Mission Summary" August, 1971
31  SetPixelPitch(0.005); //internally all images are modeled as if they have 5 micron pixels
32 
33  double constantTimeOffset = 0.0,
34  additionalPreroll = 0.0,
35  additiveLineTimeError = 0.0,
36  multiplicativeLineTimeError = 0.0;
37 
38  // Set up naming info
39  m_instrumentNameLong = "Panoramic Camera";
40  m_instrumentNameShort = "Pan";
41 
42  // Apollo15 Pan naif code = -915230
43  if (naifIkCode() == -915230) {
44  m_spacecraftNameLong = "Apollo 15";
45  m_spacecraftNameShort = "Apollo15";
46  }
47  // Apollo16 Pan naif code = -916230
48  else if (naifIkCode() == -916230) {
49  m_spacecraftNameLong = "Apollo 16";
50  m_spacecraftNameShort = "Apollo16";
51  }
52  // Apollo17 Pan naif code = -917230
53  else if (naifIkCode() == -917230) {
54  m_spacecraftNameLong = "Apollo 17";
55  m_spacecraftNameShort = "Apollo17";
56  }
57  else {
58  QString msg = "File does not appear to be an Apollo image";
60  }
61 
62  //following keywords in InstrumentAddendum file
63  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET";
64  constantTimeOffset = getDouble(ikernKey);
65 
66  ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIONAL_PREROLL";
67  additionalPreroll = getDouble(ikernKey);
68 
69  ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR";
70  additiveLineTimeError = getDouble(ikernKey);
71 
72  ikernKey = "INS" + toString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR";
73  multiplicativeLineTimeError = getDouble(ikernKey);
74 
75  Pvl &lab = *cube.label();
76  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
77  QString stime = (QString)inst["StartTime"];
78  SpiceDouble etStart;
79  str2et_c(stime.toAscii().data(), &etStart);
80  stime = (QString) inst["StopTime"];
81  SpiceDouble etStop;
82  str2et_c(stime.toAscii().data(), &etStop);
83  iTime isisTime( (QString) inst["StartTime"]);
84 
85  // Get other info from labels
86  // line exposure duration, sec/mm
87  double lineRate = ( (double) inst["LineExposureDuration"] )*0.005;
88 
89  lineRate *= 1.0 + multiplicativeLineTimeError;
90  lineRate += additiveLineTimeError;
91  etStart += additionalPreroll * lineRate;
92  etStart += constantTimeOffset;
93 
94  setTime(isisTime);
95 
96  // Setup detector map
97  //note (etStart+etStop)/2.0 is the time in the middle of image
98  // (line = 0 after interior orientation)
99  ApolloPanoramicDetectorMap *detectorMap =
100  new ApolloPanoramicDetectorMap((Camera *)this,
101  (etStart+etStop)/2.0,
102  (double)lineRate, &lab);
103  //interior orientation residual stats
104  m_residualMean = detectorMap->meanResidual();
105  m_residualMax = detectorMap->maxResidual();
106  m_residualStdev = detectorMap->stdevResidual();
107 
108  detectorMap->SetDetectorSampleSumming(1.0);
109  detectorMap->SetStartingDetectorSample(0.0);
110  // Setup focal plane map
111  PvlGroup &kernel = lab.findGroup("Kernels", Pvl::Traverse);
112  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, (int) kernel["NaifFrameCode"]);
113 
114  // Retrieve boresight location from instrument kernel (IK) (addendum?)
115  double sampleBoreSight = 0.0; //Presently no NAIF keywords for this sensor
116  double lineBoreSight = 0.0; //Presently no NAIF keywords for this sensor
117 
118  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
119  focalMap->SetDetectorOffset(0.0, 0.0);
120 
121  // Setup distortion map
122  new CameraDistortionMap(this, -1.0);
123  //distMap->SetDistortion(naifIkCode()); Presently no NAIF keywords for this sensor
124 
125  //Setup the ground and sky map
126  new LineScanCameraGroundMap(this);
127  new LineScanCameraSkyMap(this);
128 
129  PvlGroup &instP = lab.findGroup("Kernels", Pvl::Traverse);
130  m_CkFrameId = toInt(instP["NaifFrameCode"][0]);
131  m_CkFrameId = -int(-m_CkFrameId/1000)*1000;
132 
133  LoadCache();
134  }
135 }// end Isis namespace
136 
137 
145 extern "C" Isis::Camera *ApolloPanoramicCameraPlugin(Isis::Cube &cube) {
146  return new Isis::ApolloPanoramicCamera(cube);
147 }