Isis 3 Programmer Reference
NirCamera.cpp
Go to the documentation of this file.
1 
20 #include "NirCamera.h"
21 
22 #include <QString>
23 
24 #include "CameraDetectorMap.h"
25 #include "CameraFocalPlaneMap.h"
26 #include "CameraGroundMap.h"
27 #include "CameraSkyMap.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "NaifStatus.h"
31 #include "RadialDistortionMap.h"
32 
33 using namespace std;
34 
35 namespace Isis {
48  NirCamera::NirCamera(Cube &cube) : FramingCamera(cube) {
49  m_instrumentNameLong = "Near Infrared Camera";
50  m_instrumentNameShort = "NIR";
51  m_spacecraftNameLong = "Clementine 1";
52  m_spacecraftNameShort = "Clementine1";
53 
55  // Get the camera characteristics
56 
57  Pvl &lab = *cube.label();
58  QString filter = (QString)(lab.findGroup("BandBin", Pvl::Traverse))["FilterName"];
59 
60  filter = filter.toUpper();
61 
62  if(filter.compare("A") == 0) {
63  SetFocalLength(2548.2642 * 0.038);
64  }
65  else if(filter.compare("B") == 0) {
66  SetFocalLength(2530.8958 * 0.038);
67  }
68  else if(filter.compare("C") == 0) {
69  SetFocalLength(2512.6589 * 0.038);
70  }
71  else if(filter.compare("D") == 0) {
72  SetFocalLength(2509.0536 * 0.038);
73  }
74  else if(filter.compare("E") == 0) {
75  SetFocalLength(2490.7378 * 0.038);
76  }
77  else if(filter.compare("F") == 0) {
78  SetFocalLength(2487.8694 * 0.038);
79  }
80 
81  SetPixelPitch();
82 
83  // Get the start time in et
84  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
85 
86  // set variables startTime and exposureDuration
87  double et = iTime((QString)inst["StartTime"]).Et();
88 
89  // divide exposure duration keyword value by 1000 to convert to seconds
90  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
91  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
92 
93  /************************************************************************
94  * The following line was uncommented to maintain consistency within all
95  * clementine camera models. Not sure why the following was originally
96  * commented out:
97  * 2010-08-05 Jeannie Walldren
98  ***********************************************************************/
99  // Do not correct time for center of the exposure duration. This is because
100  // the kernels were built to accept the start times of the images.
101  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
102 
103  // Setup detector map
104  new CameraDetectorMap(this);
105 
106  // Setup focal plane map
107  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
108 
109  focalMap->SetDetectorOrigin(
111  "_BORESIGHT_SAMPLE"),
113  "_BORESIGHT_LINE"));
114 
115  // Setup distortion map
116  new RadialDistortionMap(this, -0.0006364);
117 
118  // Setup the ground and sky map
119  new CameraGroundMap(this);
120  new CameraSkyMap(this);
121 
122  setTime(centerTime);
123  LoadCache();
125  }
126 
150  pair<iTime, iTime> NirCamera::ShutterOpenCloseTimes(double time,
151  double exposureDuration) {
153  }
154 }
155 
168  return new Isis::NirCamera(cube);
169 }
Isis::Camera * NirCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a NirCamera object.
Definition: NirCamera.cpp:167
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Parse and return pieces of a time string.
Definition: iTime.h:78
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.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: NirCamera.cpp:150
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This is the camera model for the Clementine Near Infrared Camera.
Definition: NirCamera.h:75
Convert between distorted focal plane and detector coordinates.
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
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
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
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
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