USGS

Isis 3.0 Object Programmers' Reference

Home

CTXCamera.cpp
Go to the documentation of this file.
1 
21 #include "CTXCamera.h"
22 
23 #include "CameraDistortionMap.h"
24 #include "CameraFocalPlaneMap.h"
25 #include "IException.h"
26 #include "iTime.h"
27 #include "IString.h"
30 #include "LineScanCameraSkyMap.h"
31 #include "NaifStatus.h"
32 
33 using namespace std;
34 namespace Isis {
43  CTXCamera::CTXCamera(Cube &cube) : LineScanCamera(cube) {
45  // Set up the camera info from ik/iak kernels
47  SetPixelPitch();
48 
49  Pvl &lab = *cube.label();
50  // Get the start time from labels
51  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
52  QString stime = inst["SpacecraftClockCount"];
53  double etStart = getClockTime(stime).Et();
54 
55  // Get other info from labels
56  double csum = inst["SpatialSumming"];
57  double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
58  lineRate *= csum;
59  double ss = inst["SampleFirstPixel"];
60  ss += 1.0;
61 
62  // Setup detector map
63  LineScanCameraDetectorMap *detectorMap =
64  new LineScanCameraDetectorMap(this, etStart, lineRate);
65  detectorMap->SetDetectorSampleSumming(csum);
66  detectorMap->SetStartingDetectorSample(ss);
67 
68  // Setup focal plane map
69  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
70 
71  // Retrieve boresight location from instrument kernel (IK) (addendum?)
72  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE";
73  double sampleBoreSight = getDouble(ikernKey);
74 
75  ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE";
76  double lineBoreSight = getDouble(ikernKey);
77 
78  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
79  focalMap->SetDetectorOffset(0.0, 0.0);
80 
81  // Setup distortion map
82  CameraDistortionMap *distMap = new CameraDistortionMap(this);
83  distMap->SetDistortion(naifIkCode());
84 
85  // Setup the ground and sky map
86  new LineScanCameraGroundMap(this);
87  new LineScanCameraSkyMap(this);
88 
89  LoadCache();
91  }
92 }
93 
106  return new Isis::CTXCamera(cube);
107 }