Isis 3 Programmer Reference
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 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
Parse and return pieces of a time string.
Definition: iTime.h:78
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Generic class for Line Scan Cameras.
Search child objects.
Definition: PvlObject.h:170
LRO Narrow Angle Camera Model.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
Convert between undistorted focal plane and ground coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition: Sensor.cpp:112
Distort/undistort focal plane coordinates.
Container for cube-like labels.
Definition: Pvl.h:135
Convert between undistorted focal plane and ra/dec coordinates.
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2432
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:509
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Isis::Camera * KaguyaMiCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a KaguyaMi object.
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
Convert between parent image coordinates and detector coordinates.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:963
IO Handler for Isis Cubes.
Definition: Cube.h:170