File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
LroNarrowAngleCamera.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "LroNarrowAngleCamera.h"
10
11#include <iomanip>
12
13#include "CameraFocalPlaneMap.h"
14#include "IException.h"
15#include "IString.h"
16#include "iTime.h"
17#include "LineScanCameraDetectorMap.h"
18#include "LineScanCameraGroundMap.h"
19#include "LineScanCameraSkyMap.h"
20#include "LroNarrowAngleDistortionMap.h"
21#include "NaifStatus.h"
22
23using namespace std;
24namespace Isis {
34 m_spacecraftNameLong = "Lunar Reconnaissance Orbiter";
36 // NACL instrument kernel code = -85600
37 if (naifIkCode() == -85600) {
38 m_instrumentNameLong = "Narrow Angle Camera Left";
39 m_instrumentNameShort = "NACL";
40 }
41 // NACR instrument kernel code = -85610
42 else if (naifIkCode() == -85610) {
43 m_instrumentNameLong = "Narrow Angle Camera Right";
44 m_instrumentNameShort = "NACR";
45 }
46 else {
47 QString msg = "File does not appear to be a Lunar Reconnaissance Orbiter Image: ";
48 msg += QString::number(naifIkCode());
49 msg += " is not a supported instrument kernel code for Lunar Reconnaissance Orbiter.";
50 throw IException(IException::Programmer, msg, _FILEINFO_);
51 }
53
54 // Set up the camera info from ik/iak kernels
57
58 double constantTimeOffset = 0.0,
59 additionalPreroll = 0.0,
60 additiveLineTimeError = 0.0,
61 multiplicativeLineTimeError = 0.0;
62
63 QString ikernKey = "INS" + toString(naifIkCode()) + "_CONSTANT_TIME_OFFSET";
64 constantTimeOffset = getDouble(ikernKey);
65
66 ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIONAL_PREROLL";
67 additionalPreroll = getDouble(ikernKey);
68
69 ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIVE_LINE_ERROR";
70 additiveLineTimeError = getDouble(ikernKey);
71
72 ikernKey = "INS" + toString(naifIkCode()) + "_MULTIPLI_LINE_ERROR";
73 multiplicativeLineTimeError = getDouble(ikernKey);
74
75 // Get the start time from labels
76 Pvl &lab = *cube.label();
77 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
78 QString stime = inst["SpacecraftClockPrerollCount"];
79 SpiceDouble etStart;
80
81 if(stime != "NULL") {
82 etStart = getClockTime(stime).Et();
83 }
84 else {
85 etStart = iTime((QString)inst["PrerollTime"]).Et();
86 }
87
88 // Get other info from labels
89 double csum = inst["SpatialSumming"];
90 double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
91 double ss = inst["SampleFirstPixel"];
92 ss += 1.0;
93
94 lineRate *= 1.0 + multiplicativeLineTimeError;
95 lineRate += additiveLineTimeError;
96 etStart += additionalPreroll * lineRate;
97 etStart += constantTimeOffset;
98
99 setTime(etStart);
100
101 // Setup detector map
102 LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate);
103 detectorMap->SetDetectorSampleSumming(csum);
104 detectorMap->SetStartingDetectorSample(ss);
105
106 // Setup focal plane map
107 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
108
109 // Retrieve boresight location from instrument kernel (IK) (addendum?)
110 ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
111 double sampleBoreSight = getDouble(ikernKey);
112
113 ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
114 double lineBoreSight = getDouble(ikernKey);
115
116 focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
117 focalMap->SetDetectorOffset(0.0, 0.0);
118
119 // Setup distortion map
121 distMap->SetDistortion(naifIkCode());
122
123 // Setup the ground and sky map
124 new LineScanCameraGroundMap(this);
125 new LineScanCameraSkyMap(this);
126
127 LoadCache();
129 }
130}
131
142extern "C" Isis::Camera *LroNarrowAngleCameraPlugin(Isis::Cube &cube) {
143 return new Isis::LroNarrowAngleCamera(cube);
144}
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
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:1734
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
LineScanCamera(Isis::Cube &cube)
Constructs the LineScanCamera object.
Convert between undistorted focal plane and ra/dec coordinates.
LRO Narrow Angle Camera Model.
LroNarrowAngleCamera(Cube &cube)
Constructor for the LRO NAC Camera Model.
Distort/undistort focal plane coordinates.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
@ Traverse
Search child objects.
Definition PvlObject.h:158
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition PvlObject.h:129
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:99
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
Parse and return pieces of a time string.
Definition iTime.h:65
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition iTime.h:126
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.