Isis 3 Programmer Reference
ClipperNacRollingShutterCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ClipperNacRollingShutterCamera.h"
10
11#include <QString>
12
13#include "CameraDistortionMap.h"
14#include "CameraFocalPlaneMap.h"
15#include "CameraGroundMap.h"
16#include "CameraSkyMap.h"
17#include "Cube.h"
18#include "iTime.h"
19#include "NaifStatus.h"
20#include "Pvl.h"
21#include "PvlGroup.h"
22#include "RollingShutterCamera.h"
23#include "RollingShutterCameraDetectorMap.h"
24#include "Table.h"
25#include "TableRecord.h"
26
27namespace Isis {
35
36 m_spacecraftNameLong = "Europa Clipper";
37 m_spacecraftNameShort = "Clipper";
38
39 m_instrumentNameLong = "Europa Imaging System Rolling Shutter Narrow Angle Camera";
40 m_instrumentNameShort = "EIS-RSNAC";
41
43
46
47 Pvl &lab = *cube.label();
48 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
49
50 // Set up start time and exposure duration
51 QString startTime = inst["StartTime"];
52 iTime etStart(startTime);
53
54 // Use to calculate center time when exposure duration is available
55 // double exposureDuration = ((double) inst["ExposureDuration"]);
56
57 // Grab the coefficients for the polynomial that fit the jitter and the normal readout times of
58 // the lines of the image
59
60 // The two keywords and table below are _all_ required for remove/addJitter in the
61 // RollingShutterCameraDetectorMap to work. If any are missing, just leave the below arrays
62 // unitialized, and add/removeJitter will default to 0.
63
64 std::vector<double> sampleCoeffs, lineCoeffs, readoutTimes;
65
66 if ( (inst.hasKeyword("JitterSampleCoefficients") && inst.hasKeyword("JitterLineCoefficients") )
67 && cube.hasTable("Normalized Main Readout Line Times")) {
68 PvlKeyword sampleCoefficients = inst.findKeyword("JitterSampleCoefficients");
69 for (int i = 0; i < sampleCoefficients.size(); i++) {
70 sampleCoeffs.push_back(sampleCoefficients[i].toDouble());
71 }
72
73 PvlKeyword lineCoefficients = inst.findKeyword("JitterLineCoefficients");
74 for (int i = 0; i < lineCoefficients.size(); i++) {
75 lineCoeffs.push_back(lineCoefficients[i].toDouble());
76 }
77
78 Table normalizedReadoutTimes("Normalized Main Readout Line Times", lab.fileName(), lab);
79
80 for (int i = 0; i < normalizedReadoutTimes.Records(); i++) {
81 TableRecord record = normalizedReadoutTimes[i];
82 readoutTimes.push_back((double) record["time"]);
83 }
84 }
85
86 // Set up camera detector map with the coefficients and readout times
87 new RollingShutterCameraDetectorMap(this, readoutTimes, sampleCoeffs, lineCoeffs);
88
89 // Setup focal plane map, and detector origin
90 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
91 focalMap->SetDetectorOrigin(2048.5, 1024.5);
92
93 // Set up distortion map (use default for now)
94 CameraDistortionMap *distMap = new CameraDistortionMap(this);
95 distMap->SetDistortion(naifIkCode());
96
97 // Set up the ground and sky map
98 new CameraGroundMap(this);
99 new CameraSkyMap(this);
100
101 setTime(etStart.Et()); // Consider changing to center in future.
102 LoadCache();
104 }
105
106
116
117
131 return (-159000);
132 }
133
134
149 return (1);
150 }
151
152
165 return (1);
166 }
167}
168
169
178extern "C" Isis::Camera *ClipperNacRollingShutterCameraPlugin(Isis::Cube &cube) {
180}
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
Convert between undistorted focal plane and ground 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
Convert between undistorted focal plane and ra/dec coordinates.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
virtual int CkReferenceId() const
CK Reference ID - J2000.
ClipperNacRollingShutterCamera(Cube &cube)
Constructs a ClipperNacRollingShutterCamera object using the image labels.
~ClipperNacRollingShutterCamera()
Destructor for a ClipperNacRollingShutterCamera object.
IO Handler for Isis Cubes.
Definition Cube.h:168
bool hasTable(const QString &name)
Check to see if the cube contains a pvl table by the provided name.
Definition Cube.cpp:2049
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1707
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
A single keyword-value pair.
Definition PvlKeyword.h:87
@ Traverse
Search child objects.
Definition PvlObject.h:158
Convert between parent image coordinates and detector coordinates.
Generic class for Rolling Shutter Cameras.
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
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
Class for storing Table blobs information.
Definition Table.h:61
Parse and return pieces of a time string.
Definition iTime.h:65
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149