Isis 3 Programmer Reference
ApolloPanoramicCamera.cpp
2 
3 #include "ApolloPanIO.h"
5 
6 #include <QString>
7 
8 #include "CameraDistortionMap.h"
9 #include "CameraFocalPlaneMap.h"
10 #include "IException.h"
11 #include "IString.h"
12 #include "iTime.h"
15 #include "LineScanCameraSkyMap.h"
16 #include "PvlGroup.h"
17 #include "PvlKeyword.h"
18 
19 using namespace std;
20 namespace Isis {
27  ApolloPanoramicCamera::ApolloPanoramicCamera(Isis::Cube &cube) : Isis::LineScanCamera(cube) {
28  // Set up the camera info from ik/iak kernels
29  SetFocalLength(610.0); //nominal (uncalibrated) focal length in mm from "Apollo 15 SIM Bay
30  // Photographic Equipment and Mission Summary" August, 1971
31  SetPixelPitch(0.005); //internally all images are modeled as if they have 5 micron pixels
32 
33  double constantTimeOffset = 0.0,
34  additionalPreroll = 0.0,
35  additiveLineTimeError = 0.0,
36  multiplicativeLineTimeError = 0.0;
37 
38  // Set up naming info
39  m_instrumentNameLong = "Panoramic Camera";
40  m_instrumentNameShort = "Pan";
41 
42  // Apollo15 Pan naif code = -915230
43  if (naifIkCode() == -915230) {
44  m_spacecraftNameLong = "Apollo 15";
45  m_spacecraftNameShort = "Apollo15";
46  }
47  // Apollo16 Pan naif code = -916230
48  else if (naifIkCode() == -916230) {
49  m_spacecraftNameLong = "Apollo 16";
50  m_spacecraftNameShort = "Apollo16";
51  }
52  // Apollo17 Pan naif code = -917230
53  else if (naifIkCode() == -917230) {
54  m_spacecraftNameLong = "Apollo 17";
55  m_spacecraftNameShort = "Apollo17";
56  }
57  else {
58  QString msg = "File does not appear to be an Apollo image";
60  }
61 
62  //following keywords in InstrumentAddendum file
63  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET";
64  constantTimeOffset = getDouble(ikernKey);
65 
66  ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIONAL_PREROLL";
67  additionalPreroll = getDouble(ikernKey);
68 
69  ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR";
70  additiveLineTimeError = getDouble(ikernKey);
71 
72  ikernKey = "INS" + toString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR";
73  multiplicativeLineTimeError = getDouble(ikernKey);
74 
75  Pvl &lab = *cube.label();
76  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
77  QString stime = (QString)inst["StartTime"];
78  SpiceDouble etStart;
79  str2et_c(stime.toLatin1().data(), &etStart);
80  stime = (QString) inst["StopTime"];
81  SpiceDouble etStop;
82  str2et_c(stime.toLatin1().data(), &etStop);
83  iTime isisTime( (QString) inst["StartTime"]);
84 
85  // Get other info from labels
86  // line exposure duration, sec/mm
87  double lineRate = ( (double) inst["LineExposureDuration"] )*0.005;
88 
89  lineRate *= 1.0 + multiplicativeLineTimeError;
90  lineRate += additiveLineTimeError;
91  etStart += additionalPreroll * lineRate;
92  etStart += constantTimeOffset;
93 
94  setTime(isisTime);
95 
96  // Setup detector map
97  //note (etStart+etStop)/2.0 is the time in the middle of image
98  // (line = 0 after interior orientation)
99  ApolloPanoramicDetectorMap *detectorMap =
100  new ApolloPanoramicDetectorMap((Camera *)this,
101  (etStart+etStop)/2.0,
102  (double)lineRate, &lab);
103  //interior orientation residual stats
104  m_residualMean = detectorMap->meanResidual();
105  m_residualMax = detectorMap->maxResidual();
106  m_residualStdev = detectorMap->stdevResidual();
107 
108  detectorMap->SetDetectorSampleSumming(1.0);
109  detectorMap->SetStartingDetectorSample(0.0);
110  // Setup focal plane map
111  PvlGroup &kernel = lab.findGroup("Kernels", Pvl::Traverse);
112  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, (int) kernel["NaifFrameCode"]);
113 
114  // Retrieve boresight location from instrument kernel (IK) (addendum?)
115  double sampleBoreSight = 0.0; //Presently no NAIF keywords for this sensor
116  double lineBoreSight = 0.0; //Presently no NAIF keywords for this sensor
117 
118  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
119  focalMap->SetDetectorOffset(0.0, 0.0);
120 
121  // Setup distortion map
122  new CameraDistortionMap(this, -1.0);
123  //distMap->SetDistortion(naifIkCode()); Presently no NAIF keywords for this sensor
124 
125  //Setup the ground and sky map
126  new LineScanCameraGroundMap(this);
127  new LineScanCameraSkyMap(this);
128 
129  PvlGroup &instP = lab.findGroup("Kernels", Pvl::Traverse);
130  m_CkFrameId = toInt(instP["NaifFrameCode"][0]);
131  m_CkFrameId = -int(-m_CkFrameId/1000)*1000;
132 
133  LoadCache();
134  }
135 }// end Isis namespace
136 
137 
145 extern "C" Isis::Camera *ApolloPanoramicCameraPlugin(Isis::Cube &cube) {
146  return new Isis::ApolloPanoramicCamera(cube);
147 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
Parse and return pieces of a time string.
Definition: iTime.h:78
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
double m_residualMean
Max interior orientation residual vector length.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
int m_CkFrameId
CK "Camera Matrix" kernel frame ID.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Generic class for Line Scan Cameras.
Search child objects.
Definition: PvlObject.h:170
double m_residualStdev
Standard deviation of interior orientation residual vector length.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
double stdevResidual()
Standard deviation of interior orientation residual vector lengths, accesor.
Convert between undistorted focal plane and ground coordinates.
double maxResidual()
Max interior orientation residual vector length, accesor.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
Distort/undistort focal plane coordinates.
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:112
Container for cube-like labels.
Definition: Pvl.h:135
Apollo Panoramic Camera
Convert between undistorted focal plane and ra/dec coordinates.
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2432
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:509
double meanResidual()
Mean (average) of interior orientation residual vector lengths, accesor.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
Convert between parent image (aka encoder aka machine) coordinates and detector coordinates ...
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
double m_residualMax
Mean (average) of interior orientation residual vector length.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:963
IO Handler for Isis Cubes.
Definition: Cube.h:170