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 <QString>
25 
26 #include "CameraFocalPlaneMap.h"
27 #include "IException.h"
28 #include "IString.h"
29 #include "iTime.h"
32 #include "LineScanCameraSkyMap.h"
34 #include "NaifStatus.h"
35 
36 using namespace std;
37 namespace Isis {
46  KaguyaMiCamera::KaguyaMiCamera(Cube &cube) : LineScanCamera(cube) {
47  m_spacecraftNameLong = "Kaguya";
48  m_spacecraftNameShort = "Kaguya";
49 
50  int ikCode = naifIkCode();
51 
52  // https://darts.isas.jaxa.jp/pub/spice/SELENE/kernels/ik/SEL_MI_V01.TI
53  // MI-VIS instrument kernel codes -131331 through -131335
54  if (ikCode <= -131331 && ikCode >= -131335) {
55  m_instrumentNameLong = "Multi Band Imager Visible";
56  m_instrumentNameShort = "MI-VIS";
57  }
58  // MI-NIR instrument kernel codes -131341 through -131344
59  else if (ikCode <= -131341 && ikCode >= -131344) {
60  m_instrumentNameLong = "Multi Band Imager Infrared";
61  m_instrumentNameShort = "MI-NIR";
62  }
63  else {
64  QString msg = QString::number(ikCode);
65  msg += " is not a supported instrument kernel code for Kaguya.";
67  }
68 
70  // Set up the camera info from ik/iak kernels
71 
73  //Kaguya IK kernal uses INS-131???_PIXEL_SIZE instead of PIXEL_PITCH
74  QString ikernKey = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
75  SetPixelPitch(getDouble(ikernKey));
76 
77 
78  // Get the start time from labels
79  Pvl &lab = *cube.label();
80  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
81  QString stime = (QString)inst["StartTime"];
82  SpiceDouble etStart=0;
83 
84  if(stime != "NULL") {
85  etStart = iTime(stime).Et();
86  }
87  else {
88  //TODO throw an error if "StartTime" keyword is absent
89  }
90 
92 
93 
94  // Get other info from labels
95  double lineRate = (double) inst["CorrectedSamplingInterval"] / 1000.0;
96  setTime(etStart);
97 
98  // Setup detector map
99  LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate);
100  detectorMap->SetDetectorSampleSumming(1.0);
101  detectorMap->SetStartingDetectorSample(1.0);
102 
103  // Setup focal plane map
104  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
105  // Retrieve boresight location from instrument kernel (IK) (addendum?)
106  ikernKey = "INS" + toString(naifIkCode()) + "_CENTER";
107  double sampleBoreSight = getDouble(ikernKey,0);
108  double lineBoreSight = getDouble(ikernKey,1)-1.0;
109 
110  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
111  focalMap->SetDetectorOffset(0.0, 0.0);
112 
113 
115  //LroNarrowAngleDistortionMap *distMap = new LroNarrowAngleDistortionMap(this);
116  distMap->SetDistortion(naifIkCode());
117 
118  // Setup the ground and sky map
119  new LineScanCameraGroundMap(this);
120  new LineScanCameraSkyMap(this);
121 
122  LoadCache();
123 
125  }
126 }
127 
139  return new Isis::KaguyaMiCamera(cube);
140 }