Isis 3 Programmer Reference
NewHorizonsMvicTdiCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "NewHorizonsMvicTdiCamera.h"
10
11#include <QDebug>
12#include <QString>
13
14#include "NewHorizonsMvicTdiCameraDistortionMap.h"
15#include "CameraFocalPlaneMap.h"
16#include "IException.h"
17#include "iTime.h"
18#include "LineScanCameraDetectorMap.h"
19#include "LineScanCameraGroundMap.h"
20#include "LineScanCameraSkyMap.h"
21#include "NaifStatus.h"
22
23using namespace std;
24namespace Isis {
33 m_instrumentNameLong = "Multispectral Visible Imaging TDI Camera";
34 m_instrumentNameShort = "MVIC TDI";
35 m_spacecraftNameLong = "New Horizons";
36 m_spacecraftNameShort = "NewHorizons";
37
39
40 // Set the pixel pitch, focal length and row offset from Mvic frame transfer array
43
44 Pvl &lab = *cube.label();
45 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
46 QString stime = inst["SpacecraftClockStartCount"];
47
48 m_etStart = getClockTime(stime).Et();
49 m_lineRate = 1.0 / (double)inst["TdiRate"];
50
51 // The detector map tells us how to convert from image coordinates to
52 // detector coordinates. In our case, a (sample,line) to a (sample,time)
53 new LineScanCameraDetectorMap(this, m_etStart, m_lineRate);
54
55 // The focal plane map tells us how to go from detector position
56 // to focal plane x/y (distorted). That is, (sample,time) to (x,y).
57 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
58
59 // This origin does not use 5024/2 because we strip off the leading and trailing 12 pixels
60 focalMap->SetDetectorOrigin(2500.5, -16.5);
61
62 // Read legendre polynomial distortion coefficients and boresight offsets from the instrument
63 // kernels. Then construct the distortion map.
64
65 // read legendre polynomial distortion coefs from the NAIF Kernels
66 QString naifXKey = "INS-98900_DISTORTION_COEF_X";
67 QString naifYKey = "INS-98900_DISTORTION_COEF_Y";
68 QString naifppKey = "INS-98900_PP_OFFSET";
69 vector<double> distCoefX;
70 vector<double> distCoefY;
71 vector<double> residualColumnDistCoefs;
72 vector<double> residualRowDistCoefs;
73
74 for (int i=0; i < 20; i++) {
75 distCoefX.push_back(getDouble(naifXKey,i));
76 distCoefY.push_back(getDouble(naifYKey,i));
77 }
78
79 // read residual polynomial distortion coefs from the NAIF Kernels
80 int code = naifIkCode();
81 QString naifCOLKey = "INS" + toString(code) + "_RESIDUAL_COL_DIST_COEF";
82 QString naifROWKey = "INS" + toString(code) + "_RESIDUAL_ROW_DIST_COEF";
83
84 for (int i=0; i < 6; i++) {
85 residualColumnDistCoefs.push_back(getDouble(naifCOLKey,i));
86 residualRowDistCoefs.push_back(getDouble(naifROWKey,i));
87 }
88
89 new NewHorizonsMvicTdiCameraDistortionMap(this, distCoefX, distCoefY, residualColumnDistCoefs,
90 residualRowDistCoefs);
91
92 // Setup the ground and sky map
94 new LineScanCameraSkyMap(this);
95
96 LoadCache();
98 }
99}
100
101
102// Plugin
112extern "C" Isis::Camera *NewHorizonsMvicTdiCameraPlugin(Isis::Cube &cube) {
113 return new Isis::NewHorizonsMvicTdiCamera(cube);
114}
Convert between distorted focal plane and detector coordinates.
QString m_spacecraftNameLong
Full spacecraft name.
Definition Camera.h:499
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition Camera.cpp:1422
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition Camera.cpp:1429
void LoadCache()
This loads the spice cache big enough for this image.
Definition Camera.cpp:2450
QString m_instrumentNameShort
Shortened instrument name.
Definition Camera.h:498
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition Camera.h:500
QString m_instrumentNameLong
Full instrument name.
Definition Camera.h:497
IO Handler for Isis Cubes.
Definition Cube.h:168
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1707
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Generic class for Line Scan Cameras.
Convert between undistorted focal plane and ra/dec coordinates.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Distort/undistort focal plane coordinates for New Horizons/MVIC.
New Horizons Mvic Camera, Tdi mode.
NewHorizonsMvicTdiCamera(Cube &cube)
Constructor for the New Horizons Mvic/Tdi Camera Model.
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
@ Traverse
Search child objects.
Definition PvlObject.h:158
virtual iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition Spice.cpp:1060
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition Spice.cpp:1046
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
Namespace for the standard library.