Isis 3 Programmer Reference
NewHorizonsMvicTdiCamera.cpp
Go to the documentation of this file.
1 
22 
23 #include <QDebug>
24 #include <QString>
25 
27 #include "CameraFocalPlaneMap.h"
28 #include "IException.h"
29 #include "iTime.h"
32 #include "LineScanCameraSkyMap.h"
33 #include "NaifStatus.h"
34 
35 using namespace std;
36 namespace Isis {
44  NewHorizonsMvicTdiCamera::NewHorizonsMvicTdiCamera(Cube &cube) : LineScanCamera(cube) {
45  m_instrumentNameLong = "Multispectral Visible Imaging TDI Camera";
46  m_instrumentNameShort = "MVIC TDI";
47  m_spacecraftNameLong = "New Horizons";
48  m_spacecraftNameShort = "NewHorizons";
49 
51 
52  // Set the pixel pitch, focal length and row offset from Mvic frame transfer array
53  SetPixelPitch();
55 
56  Pvl &lab = *cube.label();
57  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
58  QString stime = inst["SpacecraftClockStartCount"];
59 
60  m_etStart = getClockTime(stime).Et();
61  m_lineRate = 1.0 / (double)inst["TdiRate"];
62 
63  // The detector map tells us how to convert from image coordinates to
64  // detector coordinates. In our case, a (sample,line) to a (sample,time)
65  new LineScanCameraDetectorMap(this, m_etStart, m_lineRate);
66 
67  // The focal plane map tells us how to go from detector position
68  // to focal plane x/y (distorted). That is, (sample,time) to (x,y).
69  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
70 
71  // This origin does not use 5024/2 because we strip off the leading and trailing 12 pixels
72  focalMap->SetDetectorOrigin(2500.5, -16.5);
73 
74  // Read legendre polynomial distortion coefficients and boresight offsets from the instrument
75  // kernels. Then construct the distortion map.
76 
77  // read legendre polynomial distortion coefs from the NAIF Kernels
78  QString naifXKey = "INS-98900_DISTORTION_COEF_X";
79  QString naifYKey = "INS-98900_DISTORTION_COEF_Y";
80  QString naifppKey = "INS-98900_PP_OFFSET";
81  vector<double> distCoefX;
82  vector<double> distCoefY;
83  vector<double> residualColumnDistCoefs;
84  vector<double> residualRowDistCoefs;
85 
86  for (int i=0; i < 20; i++) {
87  distCoefX.push_back(getDouble(naifXKey,i));
88  distCoefY.push_back(getDouble(naifYKey,i));
89  }
90 
91  // read residual polynomial distortion coefs from the NAIF Kernels
92  int code = naifIkCode();
93  QString naifCOLKey = "INS" + toString(code) + "_RESIDUAL_COL_DIST_COEF";
94  QString naifROWKey = "INS" + toString(code) + "_RESIDUAL_ROW_DIST_COEF";
95 
96  for (int i=0; i < 6; i++) {
97  residualColumnDistCoefs.push_back(getDouble(naifCOLKey,i));
98  residualRowDistCoefs.push_back(getDouble(naifROWKey,i));
99  }
100 
101  new NewHorizonsMvicTdiCameraDistortionMap(this, distCoefX, distCoefY, residualColumnDistCoefs,
102  residualRowDistCoefs);
103 
104  // Setup the ground and sky map
105  new LineScanCameraGroundMap(this);
106  new LineScanCameraSkyMap(this);
107 
108  LoadCache();
110  }
111 }
112 
113 
114 // Plugin
125  return new Isis::NewHorizonsMvicTdiCamera(cube);
126 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
Isis::Camera * NewHorizonsMvicTdiCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a NewHorizonsMvicTdiCamera object...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
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
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.
Convert between undistorted focal plane and ground coordinates.
Distort/undistort focal plane coordinates for New Horizons/MVIC.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:977
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
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
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
New Horizons Mvic Camera, Tdi mode.
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