USGS

Isis 3.0 Object Programmers' Reference

Home

LroNarrowAngleCamera.cpp

Go to the documentation of this file.
00001 
00020 #include "LroNarrowAngleCamera.h"
00021 
00022 #include <iomanip>
00023 
00024 #include "CameraFocalPlaneMap.h"
00025 #include "IException.h"
00026 #include "IString.h"
00027 #include "iTime.h"
00028 #include "LineScanCameraDetectorMap.h"
00029 #include "LineScanCameraGroundMap.h"
00030 #include "LineScanCameraSkyMap.h"
00031 #include "LroNarrowAngleDistortionMap.h"
00032 #include "NaifStatus.h"
00033 
00034 using namespace std;
00035 namespace Isis {
00044   LroNarrowAngleCamera::LroNarrowAngleCamera(Pvl &lab) : LineScanCamera(lab) {
00045     NaifStatus::CheckErrors();
00046     // Set up the camera info from ik/iak kernels
00047     SetFocalLength();
00048     SetPixelPitch();
00049 
00050     double constantTimeOffset = 0.0,
00051            additionalPreroll = 0.0,
00052            additiveLineTimeError = 0.0,
00053            multiplicativeLineTimeError = 0.0;
00054 
00055     QString ikernKey = "INS" + toString(naifIkCode()) + "_CONSTANT_TIME_OFFSET";
00056     constantTimeOffset = getDouble(ikernKey);
00057 
00058     ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIONAL_PREROLL";
00059     additionalPreroll = getDouble(ikernKey);
00060 
00061     ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIVE_LINE_ERROR";
00062     additiveLineTimeError = getDouble(ikernKey);
00063 
00064     ikernKey = "INS" + toString(naifIkCode()) + "_MULTIPLI_LINE_ERROR";
00065     multiplicativeLineTimeError = getDouble(ikernKey);
00066 
00067     // Get the start time from labels
00068     PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse);
00069     QString stime = inst["SpacecraftClockPrerollCount"];
00070     SpiceDouble etStart;
00071 
00072     if(stime != "NULL") {
00073       etStart = getClockTime(stime).Et();
00074     }
00075     else {
00076       etStart = iTime((QString)inst["PrerollTime"]).Et();
00077     }
00078 
00079     // Get other info from labels
00080     double csum = inst["SpatialSumming"];
00081     double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
00082     double ss = inst["SampleFirstPixel"];
00083     ss += 1.0;
00084 
00085     lineRate *= 1.0 + multiplicativeLineTimeError;
00086     lineRate += additiveLineTimeError;
00087     etStart += additionalPreroll * lineRate;
00088     etStart += constantTimeOffset;
00089 
00090     setTime(etStart);
00091 
00092     // Setup detector map
00093     LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate);
00094     detectorMap->SetDetectorSampleSumming(csum);
00095     detectorMap->SetStartingDetectorSample(ss);
00096 
00097     // Setup focal plane map
00098     CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
00099 
00100     //  Retrieve boresight location from instrument kernel (IK) (addendum?)
00101     ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
00102     double sampleBoreSight = getDouble(ikernKey);
00103 
00104     ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
00105     double lineBoreSight = getDouble(ikernKey);
00106 
00107     focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
00108     focalMap->SetDetectorOffset(0.0, 0.0);
00109 
00110     // Setup distortion map
00111     LroNarrowAngleDistortionMap *distMap = new LroNarrowAngleDistortionMap(this);
00112     distMap->SetDistortion(naifIkCode());
00113 
00114     // Setup the ground and sky map
00115     new LineScanCameraGroundMap(this);
00116     new LineScanCameraSkyMap(this);
00117 
00118     LoadCache();
00119     NaifStatus::CheckErrors();
00120   }
00121 }
00122 
00133 extern "C" Isis::Camera *LroNarrowAngleCameraPlugin(Isis::Pvl &lab) {
00134   return new Isis::LroNarrowAngleCamera(lab);
00135 }