USGS

Isis 3.0 Object Programmers' Reference

Home

LroNarrowAngleCamera.cpp
Go to the documentation of this file.
1 
20 #include "LroNarrowAngleCamera.h"
21 
22 #include <iomanip>
23 
24 #include "CameraFocalPlaneMap.h"
25 #include "IException.h"
26 #include "IString.h"
27 #include "iTime.h"
30 #include "LineScanCameraSkyMap.h"
32 #include "NaifStatus.h"
33 
34 using namespace std;
35 namespace Isis {
44  LroNarrowAngleCamera::LroNarrowAngleCamera(Cube &cube) : LineScanCamera(cube) {
46  // Set up the camera info from ik/iak kernels
48  SetPixelPitch();
49 
50  double constantTimeOffset = 0.0,
51  additionalPreroll = 0.0,
52  additiveLineTimeError = 0.0,
53  multiplicativeLineTimeError = 0.0;
54 
55  QString ikernKey = "INS" + toString(naifIkCode()) + "_CONSTANT_TIME_OFFSET";
56  constantTimeOffset = getDouble(ikernKey);
57 
58  ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIONAL_PREROLL";
59  additionalPreroll = getDouble(ikernKey);
60 
61  ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIVE_LINE_ERROR";
62  additiveLineTimeError = getDouble(ikernKey);
63 
64  ikernKey = "INS" + toString(naifIkCode()) + "_MULTIPLI_LINE_ERROR";
65  multiplicativeLineTimeError = getDouble(ikernKey);
66 
67  // Get the start time from labels
68  Pvl &lab = *cube.label();
69  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
70  QString stime = inst["SpacecraftClockPrerollCount"];
71  SpiceDouble etStart;
72 
73  if(stime != "NULL") {
74  etStart = getClockTime(stime).Et();
75  }
76  else {
77  etStart = iTime((QString)inst["PrerollTime"]).Et();
78  }
79 
80  // Get other info from labels
81  double csum = inst["SpatialSumming"];
82  double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
83  double ss = inst["SampleFirstPixel"];
84  ss += 1.0;
85 
86  lineRate *= 1.0 + multiplicativeLineTimeError;
87  lineRate += additiveLineTimeError;
88  etStart += additionalPreroll * lineRate;
89  etStart += constantTimeOffset;
90 
91  setTime(etStart);
92 
93  // Setup detector map
94  LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate);
95  detectorMap->SetDetectorSampleSumming(csum);
96  detectorMap->SetStartingDetectorSample(ss);
97 
98  // Setup focal plane map
99  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
100 
101  // Retrieve boresight location from instrument kernel (IK) (addendum?)
102  ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
103  double sampleBoreSight = getDouble(ikernKey);
104 
105  ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
106  double lineBoreSight = getDouble(ikernKey);
107 
108  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
109  focalMap->SetDetectorOffset(0.0, 0.0);
110 
111  // Setup distortion map
113  distMap->SetDistortion(naifIkCode());
114 
115  // Setup the ground and sky map
116  new LineScanCameraGroundMap(this);
117  new LineScanCameraSkyMap(this);
118 
119  LoadCache();
121  }
122 }
123 
135  return new Isis::LroNarrowAngleCamera(cube);
136 }