USGS

Isis 3.0 Object Programmers' Reference

Home

IssWACamera.cpp
Go to the documentation of this file.
1 
20 // $Id: IssWACamera.cpp,v 1.6 2009/08/31 15:12:29 slambright Exp $
21 #include "IssWACamera.h"
22 
23 #include "CameraDetectorMap.h"
24 #include "CameraFocalPlaneMap.h"
25 #include "CameraGroundMap.h"
26 #include "CameraSkyMap.h"
27 #include "IString.h"
28 #include "iTime.h"
29 #include "NaifStatus.h"
30 #include "RadialDistortionMap.h"
31 
32 using namespace std;
33 
34 namespace Isis {
44  IssWACamera::IssWACamera(Cube &cube) : FramingCamera(cube) {
46  Pvl &lab = *cube.label();
47  PvlGroup &bandBin = lab.findGroup("BandBin", Pvl::Traverse);
48  // Get the camera characteristics
49  QString key = "INS" + toString(naifIkCode()) + "_" + bandBin["FilterName"][0] + "_FOCAL_LENGTH";
50  key = key.replace("/", "_");
51  double focalLength = Spice::getDouble(key);
52 
53  SetFocalLength(focalLength);
54  SetPixelPitch();
55  instrumentRotation()->SetFrame(Spice::getInteger("INS_" + toString(naifIkCode()) + "_FRAME_ID"));
56 
57 
58  // Get the start time in et
59  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
60 
61  double et = iTime((QString)inst["StartTime"]).Et();
62 
63  // divide exposure duration keyword value by 1000 to convert to seconds
64  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
65  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
66 
67  //correct time for center of exposure duration
68  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
69 
70  // Setup detector map
71  int summingMode = inst["SummingMode"];
72  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
73  detectorMap->SetDetectorLineSumming(summingMode);
74  detectorMap->SetDetectorSampleSumming(summingMode);
75 
76  // Setup focal plane map
77  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
78 
79  focalMap->SetDetectorOrigin(Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"),
80  Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"));
81 
82  // Setup distortion map
83  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
84  new RadialDistortionMap(this, k1);
85 
86  // Setup the ground and sky map
87  new CameraGroundMap(this);
88  new CameraSkyMap(this);
89 
90  setTime(centerTime);
91  LoadCache();
93  }
94 
118  pair<iTime, iTime> IssWACamera::ShutterOpenCloseTimes(double time,
119  double exposureDuration) {
120  return FramingCamera::ShutterOpenCloseTimes(time, exposureDuration);
121  }
122 }
123 
136  return new Isis::IssWACamera(cube);
137 }