USGS

Isis 3.0 Object Programmers' Reference

Home

SsiCamera.cpp
Go to the documentation of this file.
1 
22 #include "SsiCamera.h"
23 
24 #include <QString>
25 
26 #include "CameraDetectorMap.h"
27 #include "CameraDistortionMap.h"
28 #include "CameraFocalPlaneMap.h"
29 #include "CameraGroundMap.h"
30 #include "CameraSkyMap.h"
31 #include "IString.h"
32 #include "iTime.h"
33 #include "NaifStatus.h"
34 #include "Pvl.h"
35 #include "PvlObject.h"
36 #include "RadialDistortionMap.h"
37 #include "Spice.h"
38 
39 using namespace std;
40 
41 namespace Isis {
51  SsiCamera::SsiCamera(Cube &cube) : FramingCamera(cube) {
52  m_instrumentNameLong = "Solid State Imaging System";
53  m_instrumentNameShort = "SSI";
54  m_spacecraftNameLong = "Galileo Orbiter";
55  m_spacecraftNameShort = "Galileo";
56 
58  // Get the camera characteristics
59  double k1;
60 
61  Pvl &lab = *cube.label();
62  iTime removeCoverDate("1994/04/01 00:00:00");
63  iTime imageDate(lab.findKeyword("StartTime", PvlObject::Traverse)[0]);
64  /*
65  * Change the Focal Length and K1 constant based on whether or not the protective cover is on
66  * See "The Direction of the North Pole and the Control Network of Asteroid 951 Gaspra" Icarus 107, 18-22 (1994)
67  */
68  if(imageDate < removeCoverDate) {
69  int code = naifIkCode();
70  QString key = "INS" + toString(code) + "_FOCAL_LENGTH_COVER";
72  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1_COVER");
73  }
74  else {
76  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
77  }
78 
79  SetPixelPitch();
80 
81  // Get the start time in et
82  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
83 
84  double et = iTime((QString)inst["StartTime"]).Et();
85 
86  //?????????? NEED THESE??????
87  // exposure duration keyword value is measured in seconds
88  double exposureDuration = ((double) inst["ExposureDuration"]);
89  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
90 
91  // Get summation mode
92  double sumMode = inst["Summing"];
93 
94  // Setup detector map
95  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
96  detectorMap->SetDetectorSampleSumming(sumMode);
97  detectorMap->SetDetectorLineSumming(sumMode);
98 
99  // Setup focal plane map
100  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
101 
102  focalMap->SetDetectorOrigin(
103  Spice::getDouble("INS" + toString(naifIkCode()) +
104  "_BORESIGHT_SAMPLE"),
105  Spice::getDouble("INS" + toString(naifIkCode()) +
106  "_BORESIGHT_LINE"));
107 
108  // Setup distortion map
109  new RadialDistortionMap(this, k1);
110 
111  // Setup the ground and sky map
112  new CameraGroundMap(this);
113  new CameraSkyMap(this);
114 
115  setTime(et);
116  LoadCache();
118  }
119 
141  pair<iTime, iTime> SsiCamera::ShutterOpenCloseTimes(double time,
142  double exposureDuration) {
143  pair <iTime, iTime> shuttertimes;
144  // To get shutter start (open) time, subtract half exposure duration
145  shuttertimes.first = time - (exposureDuration / 2.0);
146  // To get shutter end (close) time, add half exposure duration
147  shuttertimes.second = time + (exposureDuration / 2.0);
148  return shuttertimes;
149  }
150 }
151 
152 
165  return new Isis::SsiCamera(cube);
166 }