USGS

Isis 3.0 Object Programmers' Reference

Home

KaguyaMiCamera.cpp
Go to the documentation of this file.
1 
20 #include "KaguyaMiCamera.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  KaguyaMiCamera::KaguyaMiCamera(Cube &cube) : LineScanCamera(cube) {
46  // Set up the camera info from ik/iak kernels
47 
49  //Kaguya IK kernal uses INS-131???_PIXEL_SIZE instead of PIXEL_PITCH
50  QString ikernKey = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
51  SetPixelPitch(getDouble(ikernKey));
52 
53 
54  // Get the start time from labels
55  Pvl &lab = *cube.label();
56  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
57  QString stime = (QString)inst["StartTime"];
58  SpiceDouble etStart=0;
59 
60  if(stime != "NULL") {
61  etStart = iTime(stime).Et();
62  }
63  else {
64  //TODO throw an error if "StartTime" keyword is absent
65  }
66 
68 
69 
70  // Get other info from labels
71  double lineRate = (double) inst["CorrectedSamplingInterval"] / 1000.0;
72  setTime(etStart);
73 
74  // Setup detector map
75  LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate);
76  detectorMap->SetDetectorSampleSumming(1.0);
77  detectorMap->SetStartingDetectorSample(1.0);
78 
79  // Setup focal plane map
80  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
81  // Retrieve boresight location from instrument kernel (IK) (addendum?)
82  ikernKey = "INS" + toString(naifIkCode()) + "_CENTER";
83  double sampleBoreSight = getDouble(ikernKey,0);
84  double lineBoreSight = getDouble(ikernKey,1)-1.0;
85 
86  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
87  focalMap->SetDetectorOffset(0.0, 0.0);
88 
89 
91  //LroNarrowAngleDistortionMap *distMap = new LroNarrowAngleDistortionMap(this);
92  distMap->SetDistortion(naifIkCode());
93 
94  // Setup the ground and sky map
95  new LineScanCameraGroundMap(this);
96  new LineScanCameraSkyMap(this);
97 
98  LoadCache();
99 
101  }
102 }
103 
115  return new Isis::KaguyaMiCamera(cube);
116 }