Isis 3 Programmer Reference
ApolloPanoramicCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ApolloPanoramicCamera.h"
10
11#include "ApolloPanIO.h"
12#include "ApolloPanoramicDetectorMap.h"
13
14#include <QString>
15
16#include "CameraDistortionMap.h"
17#include "CameraFocalPlaneMap.h"
18#include "IException.h"
19#include "IString.h"
20#include "iTime.h"
21#include "LineScanCameraDetectorMap.h"
22#include "LineScanCameraGroundMap.h"
23#include "LineScanCameraSkyMap.h"
24#include "PvlGroup.h"
25#include "PvlKeyword.h"
26
27using namespace std;
28namespace Isis {
36 // Set up the camera info from ik/iak kernels
37 SetFocalLength(610.0); //nominal (uncalibrated) focal length in mm from "Apollo 15 SIM Bay
38 // Photographic Equipment and Mission Summary" August, 1971
39 SetPixelPitch(0.005); //internally all images are modeled as if they have 5 micron pixels
40
41 double constantTimeOffset = 0.0,
42 additionalPreroll = 0.0,
43 additiveLineTimeError = 0.0,
44 multiplicativeLineTimeError = 0.0;
45
46 // Set up naming info
47 m_instrumentNameLong = "Panoramic Camera";
49
50 // Apollo15 Pan naif code = -915230
51 if (naifIkCode() == -915230) {
52 m_spacecraftNameLong = "Apollo 15";
53 m_spacecraftNameShort = "Apollo15";
54 }
55 // Apollo16 Pan naif code = -916230
56 else if (naifIkCode() == -916230) {
57 m_spacecraftNameLong = "Apollo 16";
58 m_spacecraftNameShort = "Apollo16";
59 }
60 // Apollo17 Pan naif code = -917230
61 else if (naifIkCode() == -917230) {
62 m_spacecraftNameLong = "Apollo 17";
63 m_spacecraftNameShort = "Apollo17";
64 }
65 else {
66 QString msg = "File does not appear to be an Apollo image";
67 throw IException(IException::User, msg, _FILEINFO_);
68 }
69
70 //following keywords in InstrumentAddendum file
71 QString ikernKey = "INS" + toString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET";
72 constantTimeOffset = getDouble(ikernKey);
73
74 ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIONAL_PREROLL";
75 additionalPreroll = getDouble(ikernKey);
76
77 ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR";
78 additiveLineTimeError = getDouble(ikernKey);
79
80 ikernKey = "INS" + toString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR";
81 multiplicativeLineTimeError = getDouble(ikernKey);
82
83 Pvl &lab = *cube.label();
84 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
85 QString stime = (QString)inst["StartTime"];
86 SpiceDouble etStart;
87 str2et_c(stime.toLatin1().data(), &etStart);
88 stime = (QString) inst["StopTime"];
89 SpiceDouble etStop;
90 str2et_c(stime.toLatin1().data(), &etStop);
91 iTime isisTime( (QString) inst["StartTime"]);
92
93 // Get other info from labels
94 // line exposure duration, sec/mm
95 double lineRate = ( (double) inst["LineExposureDuration"] )*0.005;
96
97 lineRate *= 1.0 + multiplicativeLineTimeError;
98 lineRate += additiveLineTimeError;
99 etStart += additionalPreroll * lineRate;
100 etStart += constantTimeOffset;
101
102 setTime(isisTime);
103
104 // Setup detector map
105 //note (etStart+etStop)/2.0 is the time in the middle of image
106 // (line = 0 after interior orientation)
107 ApolloPanoramicDetectorMap *detectorMap =
109 (etStart+etStop)/2.0,
110 (double)lineRate, &lab);
111 //interior orientation residual stats
112 m_residualMean = detectorMap->meanResidual();
113 m_residualMax = detectorMap->maxResidual();
114 m_residualStdev = detectorMap->stdevResidual();
115
116 detectorMap->SetDetectorSampleSumming(1.0);
117 detectorMap->SetStartingDetectorSample(0.0);
118 // Setup focal plane map
119 PvlGroup &kernel = lab.findGroup("Kernels", Pvl::Traverse);
120 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, (int) kernel["NaifFrameCode"]);
121
122 // Retrieve boresight location from instrument kernel (IK) (addendum?)
123 double sampleBoreSight = 0.0; //Presently no NAIF keywords for this sensor
124 double lineBoreSight = 0.0; //Presently no NAIF keywords for this sensor
125
126 focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
127 focalMap->SetDetectorOffset(0.0, 0.0);
128
129 // Setup distortion map
130 new CameraDistortionMap(this, -1.0);
131 //distMap->SetDistortion(naifIkCode()); Presently no NAIF keywords for this sensor
132
133 //Setup the ground and sky map
134 new LineScanCameraGroundMap(this);
135 new LineScanCameraSkyMap(this);
136
137 PvlGroup &instP = lab.findGroup("Kernels", Pvl::Traverse);
138 m_CkFrameId = toInt(instP["NaifFrameCode"][0]);
139 m_CkFrameId = -int(-m_CkFrameId/1000)*1000;
140
141 LoadCache();
142 }
143}// end Isis namespace
144
145
153extern "C" Isis::Camera *ApolloPanoramicCameraPlugin(Isis::Cube &cube) {
154 return new Isis::ApolloPanoramicCamera(cube);
155}
ApolloPanoramicCamera(Cube &lab)
Constructs an Apollo Panoramic Camera object using the image labels.
double m_residualMean
Max interior orientation residual vector length.
double m_residualMax
Mean (average) of interior orientation residual vector length.
int m_CkFrameId
CK "Camera Matrix" kernel frame ID.
double m_residualStdev
Standard deviation of interior orientation residual vector length.
Convert between parent image (aka encoder aka machine) coordinates and detector coordinates.
double maxResidual()
Max interior orientation residual vector length, accesor.
double stdevResidual()
Standard deviation of interior orientation residual vector lengths, accesor.
double meanResidual()
Mean (average) of interior orientation residual vector lengths, accesor.
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
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
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
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
Convert between undistorted focal plane and ground coordinates.
Generic class for Line Scan Cameras.
Convert between undistorted focal plane and ra/dec coordinates.
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
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
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
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition IString.cpp:93
Namespace for the standard library.