USGS

Isis 3.0 Object Programmers' Reference

Home

NewHorizonsLorriCamera.cpp
Go to the documentation of this file.
1 
21 #include "NewHorizonsLorriCamera.h"
22 
23 #include "CameraDetectorMap.h"
24 #include "CameraDistortionMap.h"
25 #include "CameraFocalPlaneMap.h"
26 #include "CameraGroundMap.h"
27 #include "CameraSkyMap.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "NaifStatus.h"
32 
33 using namespace std;
34 
35 namespace Isis {
49  NewHorizonsLorriCamera::NewHorizonsLorriCamera(Cube &cube) : FramingCamera(cube) {
51 
52  // The LORRI focal length is fixed and is designed not to change throught the operational
53  // temperature. The NAIF code, set in the ISIS labels, will be used to read a single focal
54  // length from the SP:ICE kernels, but the units need to be changed from m to mm.
55  QString fl = "INS" + toString(naifIkCode()) + "_FOCAL_LENGTH";
56  double focalLength = Spice::getDouble(fl);
57  focalLength *= 1000.0;
58  SetFocalLength(focalLength);
59 
60  // For setting the pixel pitch, the Naif keyword PIXEL_SIZE is used instead of the ISIS
61  // default of PIXEL_PITCH, so set the value directly.
62  QString pp = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
63  double pixelPitch = Spice::getDouble(pp);
64  pixelPitch /= 1000.0;
65  SetPixelPitch(pixelPitch);
66 
67  // Since the two summing modes are handeled via different Naif codes, force the summing modes
68  // to 1 for both the 1x1 and 4x4 modes
69  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
70  detectorMap->SetDetectorSampleSumming(1);
71  detectorMap->SetDetectorLineSumming(1);
72 
73  // Setup focal plane map. The class will read data from the instrument addendum kernel to pull
74  // out the affine transforms from detector samp,line to focal plane x,y.
75  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
76 
77  // The boresight position recorded in the IK is zero-based and therefore needs to be adjusted
78  // for ISIS
79  double boresightSample = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",0) + 1.0;
80  double boresightLine = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",1) + 1.0;
81  focalMap->SetDetectorOrigin(boresightSample,boresightLine);
82 
83  // Setup distortion map. Start by reading the distortion coefficient from the instrument kernel.
84  // Then construct the distortion model.
85 // new CameraDistortionMap(this, -1);
86 // CameraDistortionMap *distortionMap = new CameraDistortionMap(this, -1);
87 // distortionMap->SetDistortion(naifIkCode());
88  QString e2("INS" + toString(naifIkCode()) + "_EPSILON2");
89  QString e5("INS" + toString(naifIkCode()) + "_EPSILON5");
90  QString e6("INS" + toString(naifIkCode()) + "_EPSILON6");
91  new NewHorizonsLorriDistortionMap(this, getDouble(e2, 0), getDouble(e5, 0),
92  getDouble(e6, 0), -1);
93 
94  // Setup the ground and sky map
95  new CameraGroundMap(this);
96  new CameraSkyMap(this);
97 
98  // The observation start time and clock count for LORRI are based on the center of the exposure.
99  Pvl &lab = *cube.label();
100  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
101  QString clockCount = inst["SpacecraftClockStartCount"];
102  double et = getClockTime(clockCount).Et();
103  double exposureDuration = (double)inst["ExposureDuration"] / 1000.0;
104 
105  pair<iTime, iTime> startStop = ShutterOpenCloseTimes(et, exposureDuration);
106  setTime(et);
107 
108  // Internalize all the NAIF SPICE information into memory.
109  LoadCache();
111  }
112 
127  pair<iTime, iTime> NewHorizonsLorriCamera::ShutterOpenCloseTimes(double time,
128  double exposureDuration) {
129  return FramingCamera::ShutterOpenCloseTimes(time - exposureDuration / 2.0, exposureDuration);
130  }
131 
132 
133 
134 }
135 
148  return new Isis::NewHorizonsLorriCamera(cube);
149 }