USGS

Isis 3.0 Object Programmers' Reference

Home

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 }