Isis 3 Programmer Reference
KaguyaTcCamera.cpp
Go to the documentation of this file.
1 
20 #include "KaguyaTcCamera.h"
22 
23 #include <QString>
24 
26 #include "CameraFocalPlaneMap.h"
28 #include "LineScanCameraSkyMap.h"
29 #include "IException.h"
30 #include "IString.h"
31 #include "iTime.h"
32 #include "NaifStatus.h"
33 
34 using namespace std;
35 namespace Isis {
44  KaguyaTcCamera::KaguyaTcCamera(Cube &cube) : LineScanCamera(cube) {
45  m_instrumentNameLong = "Terrain Camera";
46  m_instrumentNameShort = "TC";
47  m_spacecraftNameLong = "Kaguya";
48  m_spacecraftNameShort = "Kaguya";
49 
51  // Get the camera characteristics
53  SetPixelPitch();
54 
55  // Get the start time in et
56  Pvl &lab = *cube.label();
57  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
58 
59  QString clockCount = inst["SpacecraftClockStartCount"];
60  double time = getClockTime(clockCount, -1, true).Et();
61 
62  // Setup detector map
63  double lineRate = (double) inst["LineSamplingInterval"] / 1000.0;
64 
65  // Convert between parent image coordinates and detector coordinates (detector coordinate line, detector coordinate sample)
66  LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, time, lineRate);
67 
68  // Detetermine what to set the starting detector sample to, based on swath mode
69  QString swathMode = inst["SwathModeId"];
70 
71  double startingDetectorSample = 1;
72  if (swathMode.compare("FULL") == 0) {
73  startingDetectorSample = 1;
74  }
75  else if (swathMode.compare("NOMINAL") == 0) {
76  startingDetectorSample = 297;
77  }
78  else if (swathMode.compare("HALF") == 0) {
79  startingDetectorSample = 1172;
80  }
81 
82  detectorMap->SetStartingDetectorSample(startingDetectorSample);
83 
84  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
85 
86  // This sets the origin of the detector (not image samp,line). It is zero bassed.
87  // The detector offsets are 0,0 because the borsight is in the center of the array
88  // The origin of the detector does not depend on swath mode.
89  QString key;
90  key = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
91  double sampleBoreSight = getDouble(key);
92 
93  key = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
94  double lineBoreSight = getDouble(key);
95  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
96 
97  // Setup distortion map
99 
100  // Setup the ground and sky map
101  new LineScanCameraGroundMap(this);
102  new LineScanCameraSkyMap(this);
103 
104  setTime(time);
105  LoadCache();
107  }
108 
111  }
112 
113 
121  return (-131000);
122  }
123 
131  return (1);
132  }
133 
141  return (1);
142  }
143 
144 }
145 
146 
156  return new Isis::KaguyaTcCamera(cube);
157 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
~KaguyaTcCamera()
Destroys the KaguyaTcCamera object.
virtual int CkReferenceId() const
CK Reference ID - J2000.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Generic class for Line Scan Cameras.
Search child objects.
Definition: PvlObject.h:170
Isis::Camera * KaguyaTcCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a KaguyaCamera object.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
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.
Distort/undistort focal plane coordinates for Kaguya&#39;s TC cameras.
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
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition: Sensor.cpp:112
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
This is the camera model for the Kaguya Terrain Cameras TC1 and TC2.
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
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
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809