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 
27 using namespace std;
28 namespace Isis {
35  ApolloPanoramicCamera::ApolloPanoramicCamera(Isis::Cube &cube) : Isis::LineScanCamera(cube) {
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";
48  m_instrumentNameShort = "Pan";
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 
153 extern "C" Isis::Camera *ApolloPanoramicCameraPlugin(Isis::Cube &cube) {
154  return new Isis::ApolloPanoramicCamera(cube);
155 }
Isis::LineScanCameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: LineScanCameraSkyMap.h:34
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::ApolloPanoramicCamera::m_residualStdev
double m_residualStdev
Standard deviation of interior orientation residual vector length.
Definition: ApolloPanoramicCamera.h:106
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::ApolloPanoramicCamera::m_residualMean
double m_residualMean
Max interior orientation residual vector length.
Definition: ApolloPanoramicCamera.h:100
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::ApolloPanoramicCamera::m_CkFrameId
int m_CkFrameId
CK "Camera Matrix" kernel frame ID.
Definition: ApolloPanoramicCamera.h:109
Isis::CameraDetectorMap::SetDetectorSampleSumming
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Definition: CameraDetectorMap.h:108
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::CameraFocalPlaneMap::SetDetectorOffset
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
Definition: CameraFocalPlaneMap.cpp:324
Isis::Camera
Definition: Camera.h:236
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
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:97
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::ApolloPanoramicDetectorMap::meanResidual
double meanResidual()
Mean (average) of interior orientation residual vector lengths, accesor.
Definition: ApolloPanoramicDetectorMap.h:86
Isis::ApolloPanoramicDetectorMap::stdevResidual
double stdevResidual()
Standard deviation of interior orientation residual vector lengths, accesor.
Definition: ApolloPanoramicDetectorMap.h:100
Isis::LineScanCamera
Generic class for Line Scan Cameras.
Definition: LineScanCamera.h:36
Isis::LineScanCameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: LineScanCameraGroundMap.h:49
Isis::CameraDistortionMap
Distort/undistort focal plane coordinates.
Definition: CameraDistortionMap.h:41
Isis::ApolloPanoramicCamera
Apollo Panoramic Camera.
Definition: ApolloPanoramicCamera.h:38
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::CameraDetectorMap::SetStartingDetectorSample
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
Definition: CameraDetectorMap.h:79
Isis::ApolloPanoramicDetectorMap
Convert between parent image (aka encoder aka machine) coordinates and detector coordinates.
Definition: ApolloPanoramicDetectorMap.h:32
std
Namespace for the standard library.
Isis::Camera::LoadCache
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2420
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::CameraFocalPlaneMap
Convert between distorted focal plane and detector coordinates.
Definition: CameraFocalPlaneMap.h:85
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::Spice::getDouble
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1039
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis::ApolloPanoramicCamera::m_residualMax
double m_residualMax
Mean (average) of interior orientation residual vector length.
Definition: ApolloPanoramicCamera.h:103
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::ApolloPanoramicDetectorMap::maxResidual
double maxResidual()
Max interior orientation residual vector length, accesor.
Definition: ApolloPanoramicDetectorMap.h:93