USGS

Isis 3.0 Object Programmers' Reference

Home

NewHorizonsMvicTdiCamera.cpp
Go to the documentation of this file.
1 
22 
23 #include <QDebug>
24 
26 #include "CameraFocalPlaneMap.h"
27 #include "IException.h"
28 #include "iTime.h"
31 #include "LineScanCameraSkyMap.h"
32 #include "NaifStatus.h"
33 
34 using namespace std;
35 namespace Isis {
43  NewHorizonsMvicTdiCamera::NewHorizonsMvicTdiCamera(Cube &cube) : LineScanCamera(cube) {
45 
46  // Set the pixel pitch, focal length and row offset from Mvic frame transfer array
47  SetPixelPitch();
49 
50  Pvl &lab = *cube.label();
51  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
52  QString stime = inst["SpacecraftClockStartCount"];
53 
54  m_etStart = getClockTime(stime).Et();
55  m_lineRate = 1.0 / (double)inst["TdiRate"];
56 
57  // The detector map tells us how to convert from image coordinates to
58  // detector coordinates. In our case, a (sample,line) to a (sample,time)
59  new LineScanCameraDetectorMap(this, m_etStart, m_lineRate);
60 
61  // The focal plane map tells us how to go from detector position
62  // to focal plane x/y (distorted). That is, (sample,time) to (x,y).
63  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
64 
65  // This origin does not use 5024/2 because we strip off the leading and trailing 12 pixels
66  focalMap->SetDetectorOrigin(2500.5, -16.5);
67 
68  // Read legendre polynomial distortion coefficients and boresight offsets from the instrument
69  // kernels. Then construct the distortion map.
70 
71  // read legendre polynomial distortion coefs from the NAIF Kernels
72  QString naifXKey = "INS-98900_DISTORTION_COEF_X";
73  QString naifYKey = "INS-98900_DISTORTION_COEF_Y";
74  QString naifppKey = "INS-98900_PP_OFFSET";
75  vector<double> distCoefX;
76  vector<double> distCoefY;
77  vector<double> residualColumnDistCoefs;
78  vector<double> residualRowDistCoefs;
79 
80  for (int i=0; i < 20; i++) {
81  distCoefX.push_back(getDouble(naifXKey,i));
82  distCoefY.push_back(getDouble(naifYKey,i));
83  }
84 
85  // read residual polynomial distortion coefs from the NAIF Kernels
86  int code = naifIkCode();
87  QString naifCOLKey = "INS" + toString(code) + "_RESIDUAL_COL_DIST_COEF";
88  QString naifROWKey = "INS" + toString(code) + "_RESIDUAL_ROW_DIST_COEF";
89 
90  for (int i=0; i < 6; i++) {
91  residualColumnDistCoefs.push_back(getDouble(naifCOLKey,i));
92  residualRowDistCoefs.push_back(getDouble(naifROWKey,i));
93  }
94 
95  new NewHorizonsMvicTdiCameraDistortionMap(this, distCoefX, distCoefY, residualColumnDistCoefs,
96  residualRowDistCoefs);
97 
98  // Setup the ground and sky map
99  new LineScanCameraGroundMap(this);
100  new LineScanCameraSkyMap(this);
101 
102  LoadCache();
104  }
105 
106 }
107 
108 
109 
110 // Plugin
121  return new Isis::NewHorizonsMvicTdiCamera(cube);
122 }