Isis 3 Programmer Reference
LoMediumCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "LoMediumCamera.h"
10#include "LoMediumDistortionMap.h"
11#include "LoCameraFiducialMap.h"
12
13#include <QString>
14
15#include "Affine.h"
16#include "CameraDetectorMap.h"
17#include "CameraDistortionMap.h"
18#include "CameraFocalPlaneMap.h"
19#include "CameraGroundMap.h"
20#include "CameraSkyMap.h"
21#include "IString.h"
22#include "iTime.h"
23#include "NaifStatus.h"
24
25using namespace std;
26namespace Isis {
42
43 m_instrumentNameLong = "Medium Resolution Camera";
44 m_instrumentNameShort = "Medium";
45
46 // L03 Medium instrument kernel code = -533002
47 if (naifIkCode() == -533002) {
48 m_spacecraftNameLong = "Lunar Orbiter 3";
50 }
51 // LO4 Medium instrument kernel code = -534002
52 else if (naifIkCode() == -534002) {
53 m_spacecraftNameLong = "Lunar Orbiter 4";
55 }
56 // LO5 Medium instrument kernel code = -535002
57 else if (naifIkCode() == -535002) {
58 m_spacecraftNameLong = "Lunar Orbiter 5";
60 }
61 else {
62 QString msg = "File does not appear to be a Lunar Orbiter image: ";
63 msg += QString::number(naifIkCode());
64 msg += " is not a supported instrument kernel code for Lunar Orbiter.";
65 throw IException(IException::Programmer, msg, _FILEINFO_);
66 }
67
68 // Get the Instrument label information needed to define the camera for this frame
69 Pvl &lab = *cube.label();
70 PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
71 QString spacecraft = inst["SpacecraftName"];
72 QString instId = inst["InstrumentId"];
73
75 if(inst.hasKeyword("FiducialSamples")) {
76 type = Fiducial;
77 }
78 else if(inst.hasKeyword("BoresightSample")) {
79 type = Boresight;
80 }
81 else {
82 string msg = "Unknown focal plane map type: ";
83 msg += "Labels must include fiducials or boresight";
84 throw IException(IException::User, msg, _FILEINFO_);
85 }
86
87 // Turn off the aberration corrections for the instrument position object
88 instrumentPosition()->SetAberrationCorrection("NONE");
89
90 // Get the camera characteristics
93
94 // Get the start time in et
95 double time = iTime((QString)inst["StartTime"]).Et();
96
97 // Setup focal plane map
98 if(type == Fiducial) {
100 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
101 // Try (0.,0.)
102 focalMap->SetDetectorOrigin(0.0, 0.0);
103
104 }
105 else {
106 // Read boresight
107 double boresightSample = inst["BoresightSample"];
108 double boresightLine = inst["BoresightLine"];
109 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
110 focalMap->SetDetectorOrigin(boresightSample, boresightLine);
111 }
112
113 // Setup detector map
114 new CameraDetectorMap(this);
115
116 // Setup distortion map
117 LoMediumDistortionMap *distortionMap = new LoMediumDistortionMap(this);
118 distortionMap->SetDistortion(naifIkCode());
119 // Setup the ground and sky map
120 new CameraGroundMap(this);
121 new CameraSkyMap(this);
122
123 // Determine the NAIF ID for the CK frame reference.
124 if ( spacecraft.contains("3") ) {
125 m_ckFrameId = -533000;
126 }
127 else if ( spacecraft.contains("4") ) {
128 m_ckFrameId = -534000;
129 }
130 else if ( spacecraft.contains("5") ) {
131 m_ckFrameId = -535000;
132 }
133 else {
134 QString msg = "File does not appear to be an LunarOrbiter 3,4,5 image";
135 throw IException(IException::User, msg, _FILEINFO_);
136 }
137
138
139 setTime(time);
140 LoadCache();
142 }
143
144
167 pair<iTime, iTime> LoMediumCamera::ShutterOpenCloseTimes(double time,
168 double exposureDuration) {
169 pair<iTime, iTime> shuttertimes;
170 // To get shutter start (open) time, subtract half the exposure duration from the center time
171 shuttertimes.first = time - (exposureDuration / 2);
172 // To get shutter end (close) time, add half the exposure duration to the center time
173 shuttertimes.second = time + (exposureDuration / 2);
174 return shuttertimes;
175 }
176}
177
178
190extern "C" Isis::Camera *LoMediumCameraPlugin(Isis::Cube &cube) {
191 return new Isis::LoMediumCamera(cube);
192}
Convert between parent image coordinates and detector 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
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition Camera.cpp:3093
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.
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
Generic class for Framing Cameras.
Isis exception class.
Definition IException.h:91
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Computes map from image coordinates to focal plane based on fiducials.
Defines the Lunar Orbiter Medium Resolution camera class.
int m_ckFrameId
LO 3,4,5 CK frame id.
FocalPlaneMapType
This enum defines the types of focal plane maps supported in this class.
@ Fiducial
Fiducial Focal Plane Map.
@ Boresight
Boresight Focal Plane Map.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
LoMediumCamera(Cube &cube)
Initialize the LoMedium 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
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 time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
virtual SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition Spice.cpp:1612
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
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
Namespace for the standard library.