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 "CameraDetectorMap.h"
25 #include "CameraDistortionMap.h"
26 #include "CameraFocalPlaneMap.h"
27 #include "CameraGroundMap.h"
28 #include "CameraSkyMap.h"
29 #include "IString.h"
30 #include "iTime.h"
31 #include "NaifStatus.h"
32 #include "Pvl.h"
33 #include "PvlObject.h"
34 #include "RadialDistortionMap.h"
35 #include "Spice.h"
36 
37 using namespace std;
38 
39 namespace Isis {
49  SsiCamera::SsiCamera(Cube &cube) : FramingCamera(cube) {
51  // Get the camera characteristics
52  double k1;
53 
54  Pvl &lab = *cube.label();
55  iTime removeCoverDate("1994/04/01 00:00:00");
56  iTime imageDate(lab.findKeyword("StartTime", PvlObject::Traverse)[0]);
57  /*
58  * Change the Focal Length and K1 constant based on whether or not the protective cover is on
59  * See "The Direction of the North Pole and the Control Network of Asteroid 951 Gaspra" Icarus 107, 18-22 (1994)
60  */
61  if(imageDate < removeCoverDate) {
62  int code = naifIkCode();
63  QString key = "INS" + toString(code) + "_FOCAL_LENGTH_COVER";
65  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1_COVER");
66  }
67  else {
69  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
70  }
71 
72  SetPixelPitch();
73 
74  // Get the start time in et
75  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
76 
77  double et = iTime((QString)inst["StartTime"]).Et();
78 
79  //?????????? NEED THESE??????
80  // exposure duration keyword value is measured in seconds
81  double exposureDuration = ((double) inst["ExposureDuration"]);
82  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
83 
84  // Get summation mode
85  double sumMode = inst["Summing"];
86 
87  // Setup detector map
88  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
89  detectorMap->SetDetectorSampleSumming(sumMode);
90  detectorMap->SetDetectorLineSumming(sumMode);
91 
92  // Setup focal plane map
93  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
94 
95  focalMap->SetDetectorOrigin(
97  "_BORESIGHT_SAMPLE"),
99  "_BORESIGHT_LINE"));
100 
101  // Setup distortion map
102  new RadialDistortionMap(this, k1);
103 
104  // Setup the ground and sky map
105  new CameraGroundMap(this);
106  new CameraSkyMap(this);
107 
108  setTime(et);
109  LoadCache();
111  }
112 
134  pair<iTime, iTime> SsiCamera::ShutterOpenCloseTimes(double time,
135  double exposureDuration) {
136  pair <iTime, iTime> shuttertimes;
137  // To get shutter start (open) time, subtract half exposure duration
138  shuttertimes.first = time - (exposureDuration / 2.0);
139  // To get shutter end (close) time, add half exposure duration
140  shuttertimes.second = time + (exposureDuration / 2.0);
141  return shuttertimes;
142  }
143 }
144 
157  return new Isis::SsiCamera(cube);
158 }