Isis 3 Programmer Reference
Mariner10Camera.cpp
Go to the documentation of this file.
1 
23 #include "Mariner10Camera.h"
24 
25 #include <iostream>
26 #include <iomanip>
27 
28 #include <SpiceUsr.h>
29 #include <SpiceZfc.h>
30 #include <SpiceZmc.h>
31 
32 #include <QString>
33 
34 #include "CameraDetectorMap.h"
35 #include "CameraFocalPlaneMap.h"
36 #include "CameraGroundMap.h"
37 #include "CameraSkyMap.h"
38 #include "IString.h"
39 #include "iTime.h"
40 #include "FileName.h"
41 #include "NaifStatus.h"
42 #include "Pvl.h"
43 #include "ReseauDistortionMap.h"
44 
45 using namespace std;
46 namespace Isis {
59  Mariner10Camera::Mariner10Camera(Cube &cube) : FramingCamera(cube) {
61 
62  m_spacecraftNameLong = "Mariner 10";
63  m_spacecraftNameShort = "Mariner10";
64 
65  // Turn off the aberration corrections for instrument position object
67  instrumentRotation()->SetFrame(-76000);
68 
69  // Set camera parameters
71  SetPixelPitch();
72 
73  Pvl &lab = *cube.label();
74  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
75  // Get utc start time
76  QString stime = inst["StartTime"];
77 
78  iTime startTime;
79  startTime.setUtc((QString)inst["StartTime"]);
80  setTime(startTime);
81 
82  // Setup detector map
83  new CameraDetectorMap(this);
84 
85  // Setup focal plane map, and detector origin
86  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
87 
88  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE";
89  double sampleBoresight = getDouble(ikernKey);
90  ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE";
91  double lineBoresight = getDouble(ikernKey);
92 
93  focalMap->SetDetectorOrigin(sampleBoresight, lineBoresight);
94 
95  // Setup distortion map which is dependent on encounter, use start time
96  // MOON: 1973-11-08T03:16:26.350
97  QString spacecraft = (QString)inst["SpacecraftName"];
98  QString instId = (QString)inst["InstrumentId"];
99  QString cam;
100  if(instId == "M10_VIDICON_A") {
101  cam = "a";
102  m_instrumentNameLong = "Mariner 10 Vidicon A";
103  m_instrumentNameShort = "VIDICON A";
104  }
105  else if(instId == "M10_VIDICON_B") {
106  cam = "b";
107  m_instrumentNameLong = "Mariner 10 Vidicon B";
108  m_instrumentNameShort = "VIDICON B";
109  }
110  else {
111  QString msg = "File does not appear to be a Mariner10 image. InstrumentId ["
112  + instId + "] is invalid Mariner 10 value.";
114  }
115 
116  QString fname = FileName("$mariner10/reseaus/mar10" + cam
117  + "MasterReseaus.pvl").expanded();
118 
119  try {
120  new ReseauDistortionMap(this, lab, fname);
121  }
122  catch(IException &e) {
123  string msg = "Unable to create distortion map.";
125  }
126 
127  // Setup the ground and sky map
128  new CameraGroundMap(this);
129  new CameraSkyMap(this);
130 
131  LoadCache();
133  }
134 
135 
157  pair<iTime, iTime> Mariner10Camera::ShutterOpenCloseTimes(double time,
158  double exposureDuration) {
159  pair<iTime, iTime> shuttertimes;
160  // To get shutter start (open) time, subtract half exposure duration
161  shuttertimes.first = time - (exposureDuration / 2.0);
162  // To get shutter end (close) time, add half exposure duration
163  shuttertimes.second = time + (exposureDuration / 2.0);
164  return shuttertimes;
165  }
166 }
167 
168 
178  return new Isis::Mariner10Camera(cube);
179 }
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
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Isis::Camera * Mariner10CameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a Mariner10Camera object.
File name manipulation and expansion.
Definition: FileName.h:116
Parse and return pieces of a time string.
Definition: iTime.h:78
virtual void SetAberrationCorrection(const QString &correction)
Set the aberration correction (light time)
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.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Convert between parent image coordinates and detector coordinates.
void SetFrame(int frameCode)
Change the frame to the given frame code.
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:508
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
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:212
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 exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1489
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
Mariner10 Camera Model.
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