USGS

Isis 3.0 Object Programmers' Reference

Home

HrscCamera.cpp
Go to the documentation of this file.
1 
23 #include "HrscCamera.h"
24 
25 #include <string>
26 
27 #include "CameraDistortionMap.h"
28 #include "CameraFocalPlaneMap.h"
29 #include "iTime.h"
31 #include "LineScanCameraSkyMap.h"
32 #include "NaifStatus.h"
33 #include "Statistics.h"
35 
36 using namespace std;
37 namespace Isis {
45  HrscCamera::HrscCamera(Cube &cube) : LineScanCamera(cube) {
47  // Setup camera characteristics from instrument and frame kernel
49  SetPixelPitch(0.007);
50  instrumentRotation()->SetFrame(-41210);
51 
52  // Get required keywords from instrument group
53  Pvl &lab = *cube.label();
54  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
55 
56  ReadLineRates(lab.fileName());
57 
58  // Setup detector map for transform of image pixels to detector position
59  new VariableLineScanCameraDetectorMap(this, p_lineRates);
60  DetectorMap()->SetDetectorSampleSumming(inst["Summing"]);
61 
62  // Setup focal plane map for transform of detector position to
63  // focal plane x/y. This will read the appropriate CCD
64  // transformation coefficients from the instrument kernel
65 
66  new CameraFocalPlaneMap(this, naifIkCode());
67 
68  QString ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
69  double sampleBoresight = getDouble(ikernKey);
70 
71  ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
72  double lineBoresight = getDouble(ikernKey);
73 
74  FocalPlaneMap()->SetDetectorOrigin(sampleBoresight, lineBoresight);
75 
76  // Setup distortion map. This will read the optical distortion
77  // coefficients from the instrument kernel
78  new CameraDistortionMap(this);
79 
80  // Setup the ground and sky map to transform undistorted focal
81  // plane x/y to lat/lon or ra/dec respectively.
82  new LineScanCameraGroundMap(this);
83  new LineScanCameraSkyMap(this);
84 
85  LoadCache();
87  }
88 
91 
92 
96  void HrscCamera::ReadLineRates(QString filename) {
97  Table timesTable("LineScanTimes", filename);
98 
99  if(timesTable.Records() <= 0) {
100  QString msg = "Table [LineScanTimes] in [";
101  msg += filename + "] must not be empty";
103  }
104 
105  for(int i = 0; i < timesTable.Records(); i++) {
106  p_lineRates.push_back(LineRateChange((int)timesTable[i][2],
107  (double)timesTable[i][0],
108  timesTable[i][1]));
109  }
110 
111  if(p_lineRates.size() <= 0) {
112  QString msg = "There is a problem with the data within the Table ";
113  msg += "[LineScanTimes] in [" + filename + "]";
115  }
116  }
117 }
118 
119 
131  return new Isis::HrscCamera(cube);
132 }