Isis 3 Programmer Reference
ApolloMetricCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ApolloMetricCamera.h"
10
11#include "ApolloMetricDistortionMap.h"
12
13#include <QString>
14
15#include "CameraDetectorMap.h"
16#include "CameraFocalPlaneMap.h"
17#include "CameraGroundMap.h"
18#include "CameraSkyMap.h"
19#include "FileName.h"
20#include "IException.h"
21#include "IString.h"
22#include "iTime.h"
23#include "NaifStatus.h"
24#include "ReseauDistortionMap.h"
25
26using namespace std;
27namespace Isis {
41
42 m_instrumentNameLong = "Metric Camera";
43 m_instrumentNameShort = "Metric";
44
45 Pvl &lab = *cube.label();
46 const PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
47
48 // The Spacecraft Name should be either Apollo 15, 16, or 17. The name
49 // itself could be formatted any number of ways, but the number contained
50 // in the name should be unique between the missions
51 // We use the naifIkCode instead now
52 //QString spacecraft = inst.findKeyword("SpacecraftName")[0];
53 // Apollo 15 Pan naif code = -917240
54 if (naifIkCode() == -915240) {
55 p_ckFrameId = -915240;
57 p_spkTargetId = -915;
58 m_spacecraftNameLong = "Apollo 15";
59 m_spacecraftNameShort = "Apollo15";
60 }
61 // Apollo 16 Pan naif code = -917240
62 else if (naifIkCode() == -916240) {
63 p_ckFrameId = -916240;
65 p_spkTargetId = -916;
66 m_spacecraftNameLong = "Apollo 16";
67 m_spacecraftNameShort = "Apollo16";
68 }
69 // Apollo 17 Pan naif code = -917240
70 else if (naifIkCode() == -917240) {
71 p_ckFrameId = -917240;
73 p_spkTargetId = -917;
74 m_spacecraftNameLong = "Apollo 17";
75 m_spacecraftNameShort = "Apollo17";
76 }
77 else {
78 QString msg = "File does not appear to be an Apollo image";
79 throw IException(IException::User, msg, _FILEINFO_);
80 }
81
82 // Get the camera characteristics
85
86 // Setup detector map
87 new CameraDetectorMap(this);
88
89 // Setup focal plane map
90 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
91 focalMap->SetDetectorOrigin(ParentSamples() / 2.0, ParentLines() / 2.0);
92
93 QString ppKey("INS" + toString(naifIkCode()) + "_PP");
94 QString odkKey("INS" + toString(naifIkCode()) + "_OD_K");
95 QString decenterKey("INS" + toString(naifIkCode()) + "_DECENTER");
96
97 new ApolloMetricDistortionMap(this, getDouble(ppKey, 0),
98 getDouble(ppKey, 1), getDouble(odkKey, 0), getDouble(odkKey, 1),
99 getDouble(odkKey, 2), getDouble(decenterKey, 0),
100 getDouble(decenterKey, 1), getDouble(decenterKey, 2));
101
102 // Setup the ground and sky map
103 new CameraGroundMap(this);
104 new CameraSkyMap(this);
105
106 // Create a cache and grab spice info since it does not change for
107 // a framing camera (fixed spacecraft position and pointing)
108 // Convert the start time to et
109 setTime((QString)inst["StartTime"]);
110 LoadCache();
112 }
113
114
136 pair<iTime, iTime> ApolloMetricCamera::ShutterOpenCloseTimes(double time,
137 double exposureDuration) {
138 pair<iTime, iTime> shuttertimes;
139 // To get shutter start (open) time, subtract half exposure duration
140 shuttertimes.first = time - (exposureDuration / 2.0);
141 // To get shutter end (close) time, add half exposure duration
142 shuttertimes.second = time + (exposureDuration / 2.0);
143 return shuttertimes;
144 }
145
146} // End Apollo namespace
147
148
160extern "C" Isis::Camera *ApolloMetricCameraPlugin(Isis::Cube &cube) {
161 return new Isis::ApolloMetricCamera(cube);
162}
Apollo Metric Camera Model.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
int p_ckFrameId
"Camera-matrix" Kernel Frame ID
int p_ckReferenceId
"Camera-matrix" Kernel Reference ID
ApolloMetricCamera(Cube &cube)
Constructs an Apollo Metric Camera object using the image labels.
int p_spkTargetId
Spacecraft Kernel Target ID.
Convert between parent image coordinates and detector coordinates.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
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
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition Camera.cpp:2836
int ParentSamples() const
Returns the number of samples in the parent alphacube.
Definition Camera.cpp:2846
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
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 time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
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
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.