Isis 3 Programmer Reference
ApolloMetricCamera.cpp
Go to the documentation of this file.
1 
20 #include "ApolloMetricCamera.h"
21 
23 
24 #include <QString>
25 
26 #include "CameraDetectorMap.h"
27 #include "CameraFocalPlaneMap.h"
28 #include "CameraGroundMap.h"
29 #include "CameraSkyMap.h"
30 #include "FileName.h"
31 #include "IException.h"
32 #include "IString.h"
33 #include "iTime.h"
34 #include "NaifStatus.h"
35 #include "ReseauDistortionMap.h"
36 
37 using namespace std;
38 namespace Isis {
50  ApolloMetricCamera::ApolloMetricCamera(Cube &cube) : FramingCamera(cube) {
52 
53  m_instrumentNameLong = "Metric Camera";
54  m_instrumentNameShort = "Metric";
55 
56  Pvl &lab = *cube.label();
57  const PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
58 
59  // The Spacecraft Name should be either Apollo 15, 16, or 17. The name
60  // itself could be formatted any number of ways, but the number contained
61  // in the name should be unique between the missions
62  // We use the naifIkCode instead now
63  //QString spacecraft = inst.findKeyword("SpacecraftName")[0];
64  // Apollo 15 Pan naif code = -917240
65  if (naifIkCode() == -915240) {
66  p_ckFrameId = -915240;
67  p_ckReferenceId = 1;
68  p_spkTargetId = -915;
69  m_spacecraftNameLong = "Apollo 15";
70  m_spacecraftNameShort = "Apollo15";
71  }
72  // Apollo 16 Pan naif code = -917240
73  else if (naifIkCode() == -916240) {
74  p_ckFrameId = -916240;
75  p_ckReferenceId = 1;
76  p_spkTargetId = -916;
77  m_spacecraftNameLong = "Apollo 16";
78  m_spacecraftNameShort = "Apollo16";
79  }
80  // Apollo 17 Pan naif code = -917240
81  else if (naifIkCode() == -917240) {
82  p_ckFrameId = -917240;
83  p_ckReferenceId = 1;
84  p_spkTargetId = -917;
85  m_spacecraftNameLong = "Apollo 17";
86  m_spacecraftNameShort = "Apollo17";
87  }
88  else {
89  QString msg = "File does not appear to be an Apollo image";
91  }
92 
93  // Get the camera characteristics
95  SetPixelPitch();
96 
97  // Setup detector map
98  new CameraDetectorMap(this);
99 
100  // Setup focal plane map
101  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
102  focalMap->SetDetectorOrigin(ParentSamples() / 2.0, ParentLines() / 2.0);
103 
104  QString ppKey("INS" + toString(naifIkCode()) + "_PP");
105  QString odkKey("INS" + toString(naifIkCode()) + "_OD_K");
106  QString decenterKey("INS" + toString(naifIkCode()) + "_DECENTER");
107 
108  new ApolloMetricDistortionMap(this, getDouble(ppKey, 0),
109  getDouble(ppKey, 1), getDouble(odkKey, 0), getDouble(odkKey, 1),
110  getDouble(odkKey, 2), getDouble(decenterKey, 0),
111  getDouble(decenterKey, 1), getDouble(decenterKey, 2));
112 
113  // Setup the ground and sky map
114  new CameraGroundMap(this);
115  new CameraSkyMap(this);
116 
117  // Create a cache and grab spice info since it does not change for
118  // a framing camera (fixed spacecraft position and pointing)
119  // Convert the start time to et
120  setTime((QString)inst["StartTime"]);
121  LoadCache();
123  }
124 
125 
147  pair<iTime, iTime> ApolloMetricCamera::ShutterOpenCloseTimes(double time,
148  double exposureDuration) {
149  pair<iTime, iTime> shuttertimes;
150  // To get shutter start (open) time, subtract half exposure duration
151  shuttertimes.first = time - (exposureDuration / 2.0);
152  // To get shutter end (close) time, add half exposure duration
153  shuttertimes.second = time + (exposureDuration / 2.0);
154  return shuttertimes;
155  }
156 
157 } // End Apollo namespace
158 
159 
172  return new Isis::ApolloMetricCamera(cube);
173 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
int p_spkTargetId
Spacecraft Kernel Target ID.
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Search child objects.
Definition: PvlObject.h:170
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.
Apollo Metric Distortion Map.
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition: Camera.cpp:2818
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
int p_ckReferenceId
"Camera-matrix" Kernel Reference ID
Convert between distorted focal plane and detector coordinates.
int p_ckFrameId
"Camera-matrix" Kernel Frame ID
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
int ParentSamples() const
Returns the number of samples in the parent alphacube.
Definition: Camera.cpp:2828
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
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
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Apollo Metric Camera Model.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:48
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3075
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Generic class for Framing Cameras.
Definition: FramingCamera.h:48
Isis::Camera * ApolloMetricCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate an ApolloMetricCamera object...
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
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809