Isis 3 Programmer Reference
CTXCamera.cpp
Go to the documentation of this file.
1 
21 #include "CTXCamera.h"
22 
23 #include <QString>
24 
25 #include "CameraDistortionMap.h"
26 #include "CameraFocalPlaneMap.h"
27 #include "IException.h"
28 #include "iTime.h"
29 #include "IString.h"
32 #include "LineScanCameraSkyMap.h"
33 #include "NaifStatus.h"
34 
35 using namespace std;
36 namespace Isis {
45  CTXCamera::CTXCamera(Cube &cube) : LineScanCamera(cube) {
46  m_instrumentNameLong = "Context Camera";
47  m_instrumentNameShort = "CTX";
48  m_spacecraftNameLong = "Mars Reconnaissance Orbiter";
49  m_spacecraftNameShort = "MRO";
50 
52  // Set up the camera info from ik/iak kernels
54  SetPixelPitch();
55 
56  Pvl &lab = *cube.label();
57  // Get the start time from labels
58  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
59  QString stime = inst["SpacecraftClockCount"];
60  double etStart = getClockTime(stime).Et();
61 
62  // Get other info from labels
63  double csum = inst["SpatialSumming"];
64  double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
65  lineRate *= csum;
66  double ss = inst["SampleFirstPixel"];
67  ss += 1.0;
68 
69  // Setup detector map
70  LineScanCameraDetectorMap *detectorMap =
71  new LineScanCameraDetectorMap(this, etStart, lineRate);
72  detectorMap->SetDetectorSampleSumming(csum);
73  detectorMap->SetStartingDetectorSample(ss);
74 
75  // Setup focal plane map
76  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
77 
78  // Retrieve boresight location from instrument kernel (IK) (addendum?)
79  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE";
80  double sampleBoreSight = getDouble(ikernKey);
81 
82  ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE";
83  double lineBoreSight = getDouble(ikernKey);
84 
85  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
86  focalMap->SetDetectorOffset(0.0, 0.0);
87 
88  // Setup distortion map
89  CameraDistortionMap *distMap = new CameraDistortionMap(this);
90  distMap->SetDistortion(naifIkCode());
91 
92  // Setup the ground and sky map
93  new LineScanCameraGroundMap(this);
94  new LineScanCameraSkyMap(this);
95 
96  LoadCache();
98  }
99 }
100 
113  return new Isis::CTXCamera(cube);
114 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Generic class for Line Scan Cameras.
Search child objects.
Definition: PvlObject.h:170
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Convert between undistorted focal plane and ground coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:977
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Distort/undistort focal plane coordinates.
Container for cube-like labels.
Definition: Pvl.h:135
Convert between undistorted focal plane and ra/dec coordinates.
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2432
MRO CTX Camera Model.
Definition: CTXCamera.h:74
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:509
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
Isis::Camera * CTXCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a CTXCamera object.
Definition: CTXCamera.cpp:112
Convert between parent image coordinates and detector coordinates.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:963
IO Handler for Isis Cubes.
Definition: Cube.h:170