USGS

Isis 3.0 Object Programmers' Reference

Home

MsiCamera.cpp
Go to the documentation of this file.
1 
20 #include "MsiCamera.h"
21 
22 #include <QString>
23 
24 #include "CameraDetectorMap.h"
25 #include "CameraFocalPlaneMap.h"
26 #include "CameraGroundMap.h"
27 #include "CameraSkyMap.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "NaifStatus.h"
31 #include "Plugin.h"
32 #include "RadialDistortionMap.h"
33 
34 using namespace std;
35 namespace Isis {
48  MsiCamera::MsiCamera(Cube &cube) : FramingCamera(cube) {
49 
50  Pvl &lab = *cube.label();
53  SetPixelPitch();
55 
56  // Get the start time in et
57  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
58 
59  double et = iTime((QString)inst["StartTime"]).Et();
60 
61  // divide exposure duration keyword value by 1000 to convert to seconds
62  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
63  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
64 
65  //correct time for center of exposure duration
66  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
67 
68  // Setup detector map. These images are full summing.
69  new CameraDetectorMap(this);
70 
71  // Setup focal plane map
72  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
73 
74  QString sample = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
75  QString line = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
76  focalMap->SetDetectorOrigin(Spice::getDouble(sample), Spice::getDouble(line));
77 
78  // Setup distortion map
79  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
80  new RadialDistortionMap(this, k1, 1);
81 
82  // Setup the ground and sky map
83  new CameraGroundMap(this);
84  new CameraSkyMap(this);
85  setTime(centerTime);
86  // Note: If the temperature-dependent instrument kernel is used,
87  // the following LoadCache() command should be replaced with the
88  // commented lines at the end of this file.
89  LoadCache();
91  }
92 
95 
121  pair<iTime, iTime> MsiCamera::ShutterOpenCloseTimes(double time,
122  double exposureDuration) {
123  return FramingCamera::ShutterOpenCloseTimes(time, exposureDuration);
124  }
125 
134  int MsiCamera::CkFrameId() const { return -93000; }
135 
144  int MsiCamera::CkReferenceId() const { return 1; }
145 
154 // int MsiCamera::SpkTargetId() const { return -93; }
155 
163  int MsiCamera::SpkReferenceId() const { return 1; }
164 
165 }
166 
176  return new Isis::MsiCamera(cube);
177 }
178 
179 // Comment: 2013-03-08 Jeannie Backer - The following code will adjust the
180 // camera model using the temperature dependent
181 // instrument kernel. Currently, we have decided not to
182 // implement this adjustment since it does not appear to
183 // have been applied in ISIS2. (Code exists for this in
184 // ISIS2, but without SCLK or CK, it could not have been
185 // applied).
186 
187 // if (instrumentRotation()->IsCached()) {
188 // LoadCache();
189 // }
190 // else {
191 // double toCelcius = -273.15;
192 // SpiceDouble tempCelcius = toDouble(inst["DpuDeckTemperature"][0])+toCelcius;
193 // ConstSpiceChar *nearMsiTimeDependentFrame;
194 // iTime originalTempDependencyDate("1999-12-20T00:00:00");
195 //
196 // if (centerTime.Et() <= originalTempDependencyDate.Et() ) {
197 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0000";
198 // }
199 // else {
200 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0001";
201 // }
202 //
203 // // get transformation matrix based on temperature, from spacecraft to MSI
204 // SpiceDouble sc2msiMatrix[3][3];
205 // pxform_c("J2000", nearMsiTimeDependentFrame,tempCelcius, sc2msiMatrix);
206 // NaifStatus::CheckErrors();
207 // // get current TC matrix, from j2000 to spacecraft
208 // vector<double> originalCJ = instrumentRotation()->TimeBasedMatrix();
209 // // get new CJ matrix based on temperatureBasedRotation x originalTC
210 // // now we have transformation from j2000 to msi
211 // vector<double> newCJ(9);
212 // mxm_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalCJ[0],
213 // (SpiceDouble( *)[3]) &newCJ[0]);
214 // NaifStatus::CheckErrors();
215 // // mxmg_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalTC[0],
216 // // 6, 6, 6, (SpiceDouble( *)[3]) &newCJ[0]);
217 // // set new CJ matrix
218 // instrumentRotation()->SetTimeBasedMatrix(newCJ);
219 // LoadCache();
220 // }
221