USGS

Isis 3.0 Object Programmers' Reference

Home

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