Isis 3 Programmer Reference
LoHighCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "LoHighCamera.h"
10 #include "LoHighDistortionMap.h"
11 #include "LoCameraFiducialMap.h"
12 
13 #include <QString>
14 
15 #include "Affine.h"
16 #include "CameraDetectorMap.h"
17 #include "CameraFocalPlaneMap.h"
18 #include "CameraGroundMap.h"
19 #include "CameraSkyMap.h"
20 #include "IException.h"
21 #include "IString.h"
22 #include "iTime.h"
23 #include "NaifStatus.h"
24 
25 using namespace std;
26 namespace Isis {
38  LoHighCamera::LoHighCamera(Cube &cube) : FramingCamera(cube) {
40 
41  m_instrumentNameLong = "High Resolution Camera";
42  m_instrumentNameShort = "High";
43 
44  // LO3 High instrument kernel code = -533001
45  if (naifIkCode() == -533001) {
46  m_spacecraftNameLong = "Lunar Orbiter 3";
47  m_spacecraftNameShort = "LO3";
48  }
49  // L04 High instrument kernel code = -534001
50  else if (naifIkCode() == -534001) {
51  m_spacecraftNameLong = "Lunar Orbiter 4";
52  m_spacecraftNameShort = "LO4";
53  }
54  // LO5 High instrument kernel code = -535001
55  else if (naifIkCode() == -535001) {
56  m_spacecraftNameLong = "Lunar Orbiter 5";
57  m_spacecraftNameShort = "LO5";
58  }
59  else {
60  QString msg = "File does not appear to be a Lunar Orbiter image: ";
61  msg += QString::number(naifIkCode());
62  msg += " is not a supported instrument kernel code for Lunar Orbiter.";
63  throw IException(IException::Programmer, msg, _FILEINFO_);
64  }
65 
66  // Get the Instrument label information needed to define the camera for this frame
67  Pvl &lab = *cube.label();
68  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
69  QString spacecraft = (QString)inst["SpacecraftName"];
70  QString instId = (QString)inst["InstrumentId"];
71 
72  // Turn off the aberration corrections for the instrument position object
74 
75  // Get the camera characteristics
77  SetPixelPitch();
78 
79  // Get the start time in et
80  double time = iTime((QString)inst["StartTime"]).Et();
81 
82  // Setup focal plane map
83  LoCameraFiducialMap fid(inst, naifIkCode());
84 
85  // Setup detector map
86  new CameraDetectorMap(this);
87 
88  // Setup focalplane map
89  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
90  // Try (0.,0.)
91  focalMap->SetDetectorOrigin(0.0, 0.0);
92 
93  // Setup distortion map
94  LoHighDistortionMap *distortionMap = new LoHighDistortionMap(this);
95  distortionMap->SetDistortion(naifIkCode());
96  // Setup the ground and sky map
97  new CameraGroundMap(this);
98  new CameraSkyMap(this);
99 
100  // Determine the NAIF ID for the CK frame reference.
101  if ( spacecraft.contains("3") ) {
102  m_ckFrameId = -533000;
103  }
104  else if ( spacecraft.contains("4") ) {
105  m_ckFrameId = -534000;
106  }
107  else if ( spacecraft.contains("5") ) {
108  m_ckFrameId = -535000;
109  }
110  else {
111  QString msg = "File does not appear to be an LunarOrbiter 3,4,5 image";
112  throw IException(IException::User, msg, _FILEINFO_);
113  }
114 
115  setTime(time);
116  LoadCache();
118  }
119 
120 
143  pair<iTime, iTime> LoHighCamera::ShutterOpenCloseTimes(double time,
144  double exposureDuration) {
145  pair<iTime, iTime> shuttertimes;
146  // To get shutter start (open) time, subtract half the exposure duration from the center time
147  shuttertimes.first = time - (exposureDuration / 2);
148  // To get shutter end (close) time, add half the exposure duration to the center time
149  shuttertimes.second = time + (exposureDuration / 2);
150  return shuttertimes;
151  }
152 }
153 
154 
166 extern "C" Isis::Camera *LoHighCameraPlugin(Isis::Cube &cube) {
167  return new Isis::LoHighCamera(cube);
168 }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Camera::exposureDuration
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3063
Isis::Spice::time
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition: Spice.cpp:884
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::LoHighDistortionMap
Distort/undistort focal plane coordinates.
Definition: LoHighDistortionMap.h:52
Isis::Spice::instrumentPosition
virtual SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition: Spice.cpp:1600
Isis::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::SpicePosition::SetAberrationCorrection
virtual void SetAberrationCorrection(const QString &correction)
Set the aberration correction (light time)
Definition: SpicePosition.cpp:186
Isis::LoHighCamera
Defines the Lunar Orbiter High Resolution camera class.
Definition: LoHighCamera.h:56
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::Camera
Definition: Camera.h:236
Isis::LoHighCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: LoHighCamera.cpp:143
Isis::FramingCamera
Generic class for Framing Cameras.
Definition: FramingCamera.h:32
Isis::LoHighCamera::m_ckFrameId
int m_ckFrameId
LO 3,4,5 CK frame id.
Definition: LoHighCamera.h:88
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
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::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
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::LoCameraFiducialMap
Computes map from image coordinates to focal plane based on fiducials.
Definition: LoCameraFiducialMap.h:44
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::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
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::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
Isis::LoHighDistortionMap::SetDistortion
void SetDistortion(const int naifIkCode)
Load LO High Resolution Camera perspective & distortion coefficients.
Definition: LoHighDistortionMap.cpp:84
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
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