USGS

Isis 3.0 Object Programmers' Reference

Home

DawnFcCamera.cpp
Go to the documentation of this file.
1 
21 #include "DawnFcCamera.h"
22 #include "DawnFcDistortionMap.h"
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 
32 using namespace std;
33 
34 namespace Isis {
47  DawnFcCamera::DawnFcCamera(Cube &cube) : FramingCamera(cube) {
49 
50  // The focal length is dependent on wave length. The NAIF code set
51  // in the ISIS labels will read the correct focal length from the
52  // Instrument kernel (IK)
54 
55  // The pixel pitch is not square for the FC instrument. It is only
56  // slightly rectangular 14 vs 14.088 microns. ISIS only supports
57  // square CCD pixels. The impact by calling SetPixelPitch means the
58  // computation of pixel resolution (on the ground) will be slightly off.
59  // We will spread the error by setting the pixel pitch to the average of the
60  // two. The important part is the translation from detector coordinates
61  // to focal plane coordinates. Fortunately the affine transform will
62  // allow us to have different sized detector pixels. Therefore the
63  // only problem with ISIS is the pixel resolution computation. This may
64  // be something we want to refactor later in case future instrument have
65  // non-square detectors.
66  QString keyword = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
67  double pixelPitch = (Spice::getDouble(keyword, 0) + Spice::getDouble(keyword, 1)) / 2.0;
68  pixelPitch /= 1000.0;
69  SetPixelPitch(pixelPitch);
70 
71  // We have not seen images or tested images with summing mode or
72  // starting sample/line coordinates. Because of this uncertainty we will
73  // throw an error the image size is not 1024 x 1024. If in the future we
74  // encounter such an image then inputs to the detector map will need
75  // to be given
76  if ((ParentLines() != 1024) || (ParentSamples() != 1024)) {
77  string msg = "The ISIS Dawn FC model expects the image size to be 1024x1024";
78  msg += "Please contact Jeff Anderson (janderson@usgs.gov) with the Dawn FC PDS filename for further testing.";
80  }
81  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
82  detectorMap->SetDetectorSampleSumming(1);
83  detectorMap->SetDetectorLineSumming(1);
84 
85  // Setup focal plane map. The class will read the instrument addendum kernel to pull out the affine tronsforms
86  // from detector samp,line to focal plane x,y. This is where the non-square detector size are read and utilized.
87  // The boresight position recorded in the IK is zero-based and therefore needs to be adjusted for ISIS
88  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
89  double boresightSample = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",0) + 1.0;
90  double boresightLine = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",1) + 1.0;
91  focalMap->SetDetectorOrigin(boresightSample,boresightLine);
92 
93  // Setup distortion map. Start by reading the distortion coefficient from the instrument kernel. Then
94  // construct the distortion model. Note the distortion model code is copied from the RadialDistortionMap
95  // class and reversed. TODO: Check with Ken Edmundson to see if we can just read from IK and pass 1/K
96  // to the original RadialDistortionMap which would allow us to delete the DawnFcDistortionMap
97  double k = Spice::getDouble("INS" + toString(naifIkCode()) + "_RAD_DIST_COEFF");
98  new DawnFcDistortionMap(this,k);
99 
100  // Setup the ground and sky map
101  new CameraGroundMap(this);
102  new CameraSkyMap(this);
103 
104  // Get the timing information of the observation. Start by computing the
105  // beginning time of the exposure. This will be based off the
106  // spacecraft clock start count. There is a delay of 193 ms while the
107  // CCD is discharged or cleared. Finally the exporsure information
108  // needs to be obtained.
109  Pvl &lab = *cube.label();
110  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
111  QString stime = inst["SpacecraftClockStartCount"];
112  double et = getClockTime(stime).Et();
113  et += 193.0 / 1000.0;
114  double exposureDuration = (double)inst["ExposureDuration"] / 1000.0;
115  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
116  iTime centerTime = et + exposureDuration / 2.0;
117  setTime(centerTime);
118 
119  // Internalize all the NAIF SPICE information into memory.
120  LoadCache();
122  }
123 
145  pair<iTime, iTime> DawnFcCamera::ShutterOpenCloseTimes(double time,
146  double exposureDuration) {
147  return FramingCamera::ShutterOpenCloseTimes(time, exposureDuration);
148  }
149 }
150 
163  return new Isis::DawnFcCamera(cube);
164 }