Isis 3 Programmer Reference
LoHighCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "LoHighCamera.h"
10#include "LoHighDistortionMap.h"
11#include "LoCameraFiducialMap.h"
12
13#include <QString>
14
15#include "Affine.h"
16#include "CameraDetectorMap.h"
17#include "CameraFocalPlaneMap.h"
18#include "CameraGroundMap.h"
19#include "CameraSkyMap.h"
20#include "IException.h"
21#include "IString.h"
22#include "iTime.h"
23#include "NaifStatus.h"
24
25using namespace std;
26namespace Isis {
40
41 m_instrumentNameLong = "High Resolution Camera";
42 m_instrumentNameShort = "High";
43
44 // LO3 High instrument kernel code = -533001
45 if (naifIkCode() == -533001) {
46 m_spacecraftNameLong = "Lunar Orbiter 3";
48 }
49 // L04 High instrument kernel code = -534001
50 else if (naifIkCode() == -534001) {
51 m_spacecraftNameLong = "Lunar Orbiter 4";
53 }
54 // LO5 High instrument kernel code = -535001
55 else if (naifIkCode() == -535001) {
56 m_spacecraftNameLong = "Lunar Orbiter 5";
58 }
59 else {
60 QString msg = "File does not appear to be a Lunar Orbiter image: ";
61 msg += QString::number(naifIkCode());
62 msg += " is not a supported instrument kernel code for Lunar Orbiter.";
63 throw IException(IException::Programmer, msg, _FILEINFO_);
64 }
65
66 // Get the Instrument label information needed to define the camera for this frame
67 Pvl &lab = *cube.label();
68 PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
69 QString spacecraft = (QString)inst["SpacecraftName"];
70 QString instId = (QString)inst["InstrumentId"];
71
72 // Turn off the aberration corrections for the instrument position object
73 instrumentPosition()->SetAberrationCorrection("NONE");
74
75 // Get the camera characteristics
78
79 // Get the start time in et
80 double time = iTime((QString)inst["StartTime"]).Et();
81
82 // Setup focal plane map
84
85 // Setup detector map
86 new CameraDetectorMap(this);
87
88 // Setup focalplane map
89 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
90 // Try (0.,0.)
91 focalMap->SetDetectorOrigin(0.0, 0.0);
92
93 // Setup distortion map
94 LoHighDistortionMap *distortionMap = new LoHighDistortionMap(this);
95 distortionMap->SetDistortion(naifIkCode());
96 // Setup the ground and sky map
97 new CameraGroundMap(this);
98 new CameraSkyMap(this);
99
100 // Determine the NAIF ID for the CK frame reference.
101 if ( spacecraft.contains("3") ) {
102 m_ckFrameId = -533000;
103 }
104 else if ( spacecraft.contains("4") ) {
105 m_ckFrameId = -534000;
106 }
107 else if ( spacecraft.contains("5") ) {
108 m_ckFrameId = -535000;
109 }
110 else {
111 QString msg = "File does not appear to be an LunarOrbiter 3,4,5 image";
112 throw IException(IException::User, msg, _FILEINFO_);
113 }
114
115 setTime(time);
116 LoadCache();
118 }
119
120
143 pair<iTime, iTime> LoHighCamera::ShutterOpenCloseTimes(double time,
144 double exposureDuration) {
145 pair<iTime, iTime> shuttertimes;
146 // To get shutter start (open) time, subtract half the exposure duration from the center time
147 shuttertimes.first = time - (exposureDuration / 2);
148 // To get shutter end (close) time, add half the exposure duration to the center time
149 shuttertimes.second = time + (exposureDuration / 2);
150 return shuttertimes;
151 }
152}
153
154
166extern "C" Isis::Camera *LoHighCameraPlugin(Isis::Cube &cube) {
167 return new Isis::LoHighCamera(cube);
168}
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 High Resolution camera class.
int m_ckFrameId
LO 3,4,5 CK frame id.
LoHighCamera(Cube &cube)
Constructs the LoHigh camera model object from the labels.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
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.