Isis 3.0 Programmer Reference
Back | Home
OsirisRexOcamsCamera.cpp
Go to the documentation of this file.
1 
21 #include "OsirisRexOcamsCamera.h"
22 
23 #include <QString>
24 
25 #include "CameraDetectorMap.h"
26 #include "CameraDistortionMap.h"
27 #include "CameraFocalPlaneMap.h"
28 #include "CameraGroundMap.h"
29 #include "CameraSkyMap.h"
30 #include "IString.h"
31 #include "iTime.h"
32 #include "NaifStatus.h"
33 
34 using namespace std;
35 
36 namespace Isis {
37 
44  OsirisRexOcamsCamera::OsirisRexOcamsCamera(Cube &cube) : FramingCamera(cube) {
45 
47 
48  m_spacecraftNameLong = "OSIRIS-REx";
49  m_spacecraftNameShort = "OSIRIS-REx";
50 
51  int ikCode = naifIkCode();
52 
53  if (ikCode == -64361) {
54  m_instrumentNameLong = "Mapping Camera";
55  m_instrumentNameShort = "MapCam";
56  }
57  else if (ikCode <= -64362) {
58  m_instrumentNameLong = "Sampling Camera";
59  m_instrumentNameShort = "SamCam";
60  }
61  else if (ikCode <= -64360) {
62  m_instrumentNameLong = "PolyMath Camera";
63  m_instrumentNameShort = "PolyCam";
64  }
65 
66 
68 
69  // The instrument kernel contains pixel pitch in microns, so convert it to mm.
70  QString pitch = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
71  SetPixelPitch(getDouble(pitch) / 1000.0);
72 
73  // Get the start time in et
74  Pvl &lab = *cube.label();
75  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
76 
77  // Set the observation time and exposure duration
78  QString clockCount = inst["SpacecraftClockStartCount"];
79  double startTime = getClockTime(clockCount).Et();
80  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
81  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(startTime, exposureDuration);
82 
83  // Add half exposure duration to get time at center of image
84  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
85 
86  // Setup detector map
87  new CameraDetectorMap(this);
88 
89  // Setup focal plane map
90  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
91 
92  // The instrument kernel contains a CCD_CENTER keyword instead of BORESIGHT_LINE
93  // and BORESIGHT_SAMPLE keywords.
94  focalMap->SetDetectorOrigin(
95  Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER", 0) + 1.0,
96  Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER", 1) + 1.0);
97 
98  // Setup distortion map
99  new CameraDistortionMap(this);
100 
101  // Setup the ground and sky map
102  new CameraGroundMap(this);
103  new CameraSkyMap(this);
104 
105  setTime(centerTime);
106  LoadCache();
108  }
109 
110 
113  }
114 
115 
124  return -64000;
125  }
126 
127 
137  return 1;
138  }
139 
140 
147  return 1;
148  }
149 
150 
173  pair<iTime, iTime> OsirisRexOcamsCamera::ShutterOpenCloseTimes(double time,
174  double exposureDuration) {
175  return FramingCamera::ShutterOpenCloseTimes(time, exposureDuration);
176  }
177 
178 }
179 
180 
190  return new Isis::OsirisRexOcamsCamera(cube);
191 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1485
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
This class models the behavior and attributes of the OSIRIS-REx Cameras: Mapping Camera, PolyMath Camera, and Sample Camera.
Parse and return pieces of a time string.
Definition: iTime.h:74
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:494
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1298
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1492
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.
virtual int SpkReferenceId() const
The reference frame ID for the Spacecraft Kernel is 1, representing J2000.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:135
~OsirisRexOcamsCamera()
Destroys the MapCamera object.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3113
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:495
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
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
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2489
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:496
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
virtual int CkFrameId() const
The frame ID for the spacecraft (or instrument) used by the Camera-matrix Kernel. ...
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:888
iTime getClockTime(QString clockValue, int sclkCode=-1)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:969
Isis::Camera * OsirisRexOcamsCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a MapCamera object.
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:47
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:497
virtual int CkReferenceId() const
The frame ID for the reference coordinate system used by the Camera-matrix Kernel.
Generic class for Framing Cameras.
Definition: FramingCamera.h:48
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:958
IO Handler for Isis Cubes.
Definition: Cube.h:158

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:25:08