Isis 3 Programmer Reference
LoMediumCamera.cpp
Go to the documentation of this file.
1 
21 #include "LoMediumCamera.h"
22 #include "LoMediumDistortionMap.h"
23 #include "LoCameraFiducialMap.h"
24 
25 #include <QString>
26 
27 #include "Affine.h"
28 #include "CameraDetectorMap.h"
29 #include "CameraDistortionMap.h"
30 #include "CameraFocalPlaneMap.h"
31 #include "CameraGroundMap.h"
32 #include "CameraSkyMap.h"
33 #include "IString.h"
34 #include "iTime.h"
35 #include "NaifStatus.h"
36 
37 using namespace std;
38 namespace Isis {
52  LoMediumCamera::LoMediumCamera(Cube &cube) : FramingCamera(cube) {
54 
55  m_instrumentNameLong = "Medium Resolution Camera";
56  m_instrumentNameShort = "Medium";
57 
58  // L03 Medium instrument kernel code = -533002
59  if (naifIkCode() == -533002) {
60  m_spacecraftNameLong = "Lunar Orbiter 3";
61  m_spacecraftNameShort = "LO3";
62  }
63  // LO4 Medium instrument kernel code = -534002
64  else if (naifIkCode() == -534002) {
65  m_spacecraftNameLong = "Lunar Orbiter 4";
66  m_spacecraftNameShort = "LO4";
67  }
68  // LO5 Medium instrument kernel code = -535002
69  else if (naifIkCode() == -535002) {
70  m_spacecraftNameLong = "Lunar Orbiter 5";
71  m_spacecraftNameShort = "LO5";
72  }
73  else {
74  QString msg = "File does not appear to be a Lunar Orbiter image: ";
75  msg += QString::number(naifIkCode());
76  msg += " is not a supported instrument kernel code for Lunar Orbiter.";
78  }
79 
80  // Get the Instrument label information needed to define the camera for this frame
81  Pvl &lab = *cube.label();
82  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
83  QString spacecraft = inst["SpacecraftName"];
84  QString instId = inst["InstrumentId"];
85 
87  if(inst.hasKeyword("FiducialSamples")) {
88  type = Fiducial;
89  }
90  else if(inst.hasKeyword("BoresightSample")) {
91  type = Boresight;
92  }
93  else {
94  string msg = "Unknown focal plane map type: ";
95  msg += "Labels must include fiducials or boresight";
97  }
98 
99  // Turn off the aberration corrections for the instrument position object
101 
102  // Get the camera characteristics
103  SetFocalLength();
104  SetPixelPitch();
105 
106  // Get the start time in et
107  double time = iTime((QString)inst["StartTime"]).Et();
108 
109  // Setup focal plane map
110  if(type == Fiducial) {
111  LoCameraFiducialMap fid(inst, naifIkCode());
112  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
113  // Try (0.,0.)
114  focalMap->SetDetectorOrigin(0.0, 0.0);
115 
116  }
117  else {
118  // Read boresight
119  double boresightSample = inst["BoresightSample"];
120  double boresightLine = inst["BoresightLine"];
121  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
122  focalMap->SetDetectorOrigin(boresightSample, boresightLine);
123  }
124 
125  // Setup detector map
126  new CameraDetectorMap(this);
127 
128  // Setup distortion map
129  LoMediumDistortionMap *distortionMap = new LoMediumDistortionMap(this);
130  distortionMap->SetDistortion(naifIkCode());
131  // Setup the ground and sky map
132  new CameraGroundMap(this);
133  new CameraSkyMap(this);
134 
135  // Determine the NAIF ID for the CK frame reference.
136  if ( spacecraft.contains("3") ) {
137  m_ckFrameId = -533000;
138  }
139  else if ( spacecraft.contains("4") ) {
140  m_ckFrameId = -534000;
141  }
142  else if ( spacecraft.contains("5") ) {
143  m_ckFrameId = -535000;
144  }
145  else {
146  QString msg = "File does not appear to be an LunarOrbiter 3,4,5 image";
148  }
149 
150 
151  setTime(time);
152  LoadCache();
154  }
155 
156 
179  pair<iTime, iTime> LoMediumCamera::ShutterOpenCloseTimes(double time,
180  double exposureDuration) {
181  pair<iTime, iTime> shuttertimes;
182  // To get shutter start (open) time, subtract half the exposure duration from the center time
183  shuttertimes.first = time - (exposureDuration / 2);
184  // To get shutter end (close) time, add half the exposure duration to the center time
185  shuttertimes.second = time + (exposureDuration / 2);
186  return shuttertimes;
187  }
188 }
189 
190 
203  return new Isis::LoMediumCamera(cube);
204 }
SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition: Spice.cpp:1467
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
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.
Parse and return pieces of a time string.
Definition: iTime.h:78
virtual void SetAberrationCorrection(const QString &correction)
Set the aberration correction (light time)
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
int m_ckFrameId
LO 3,4,5 CK frame id.
Convert between distorted focal plane and detector coordinates.
Fiducial Focal Plane Map.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Defines the Lunar Orbiter Medium Resolution camera class.
Distort/undistort focal plane coordinates.
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
FocalPlaneMapType
This enum defines the types of focal plane maps supported in this class.
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Computes map from image coordinates to focal plane based on fiducials.
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
Isis::Camera * LoMediumCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a LoMediumCamera object.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void SetDistortion(const int naifIkCode)
Load LO Medium Resolution Camera perspective & distortion coefficients.
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
Boresight Focal Plane Map.
Generic class for Framing Cameras.
Definition: FramingCamera.h:48
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
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