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 
27 namespace Isis {
34  RollingShutterCamera(cube) {
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 
45  SetPixelPitch();
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 
115  }
116 
117 
131  return (-159000);
132  }
133 
134 
149  return (1);
150  }
151 
152 
165  return (1);
166  }
167 }
168 
169 
178 extern "C" Isis::Camera *ClipperNacRollingShutterCameraPlugin(Isis::Cube &cube) {
179  return new Isis::ClipperNacRollingShutterCamera(cube);
180 }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::CameraDistortionMap::SetDistortion
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
Definition: CameraDistortionMap.cpp:58
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::ClipperNacRollingShutterCamera::CkFrameId
virtual int CkFrameId() const
CK frame ID.
Definition: ClipperNacRollingShutterCamera.cpp:130
Isis::ClipperNacRollingShutterCamera::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID - J2000.
Definition: ClipperNacRollingShutterCamera.cpp:148
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::Camera
Definition: Camera.h:236
Isis::TableRecord
Definition: TableRecord.h:38
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
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:97
Isis::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::RollingShutterCameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: RollingShutterCameraDetectorMap.h:29
Isis::ClipperNacRollingShutterCamera::~ClipperNacRollingShutterCamera
~ClipperNacRollingShutterCamera()
Destructor for a ClipperNacRollingShutterCamera object.
Definition: ClipperNacRollingShutterCamera.cpp:114
Isis::Table
Class for storing Table blobs information.
Definition: Table.h:61
Isis::PvlContainer::fileName
QString fileName() const
Returns the filename used to initialise the Pvl object.
Definition: PvlContainer.h:232
Isis::CameraDistortionMap
Distort/undistort focal plane coordinates.
Definition: CameraDistortionMap.h:41
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::ClipperNacRollingShutterCamera::ClipperNacRollingShutterCamera
ClipperNacRollingShutterCamera(Cube &cube)
Constructs a ClipperNacRollingShutterCamera object using the image labels.
Definition: ClipperNacRollingShutterCamera.cpp:33
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::Camera::LoadCache
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2420
Isis::Cube::hasTable
bool hasTable(const QString &name)
Check to see if the cube contains a pvl table by the provided name.
Definition: Cube.cpp:2043
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::CameraFocalPlaneMap
Convert between distorted focal plane and detector coordinates.
Definition: CameraFocalPlaneMap.h:85
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
Isis::RollingShutterCamera
Generic class for Rolling Shutter Cameras.
Definition: RollingShutterCamera.h:38
Isis::ClipperNacRollingShutterCamera
Clipper EIS Camera model.
Definition: ClipperNacRollingShutterCamera.h:29
Isis::PvlKeyword::size
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:125
Isis::ClipperNacRollingShutterCamera::SpkReferenceId
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Definition: ClipperNacRollingShutterCamera.cpp:164
Isis::PvlContainer::findKeyword
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Definition: PvlContainer.cpp:62
Isis::Table::Records
int Records() const
Returns the number of records.
Definition: Table.cpp:313
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16