Isis 3 Programmer Reference
KaguyaTcCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "KaguyaTcCamera.h"
10 #include "KaguyaTcCameraDistortionMap.h"
11 
12 #include <QString>
13 
14 #include "LineScanCameraDetectorMap.h"
15 #include "CameraFocalPlaneMap.h"
16 #include "LineScanCameraGroundMap.h"
17 #include "LineScanCameraSkyMap.h"
18 #include "IException.h"
19 #include "IString.h"
20 #include "iTime.h"
21 #include "NaifStatus.h"
22 
23 using namespace std;
24 namespace Isis {
33  KaguyaTcCamera::KaguyaTcCamera(Cube &cube) : LineScanCamera(cube) {
34  m_instrumentNameLong = "Terrain Camera";
35  m_instrumentNameShort = "TC";
36  m_spacecraftNameLong = "Kaguya";
37  m_spacecraftNameShort = "Kaguya";
38 
40  // Get the camera characteristics
42  SetPixelPitch();
43 
44  // Get the start time in et
45  Pvl &lab = *cube.label();
46  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
47 
48  QString clockCount = inst["SpacecraftClockStartCount"];
49  double time = getClockTime(clockCount, -1, true).Et();
50 
51  // Setup detector map
52  double lineRate = (double) inst["LineSamplingInterval"] / 1000.0;
53 
54  // Convert between parent image coordinates and detector coordinates (detector coordinate line, detector coordinate sample)
55  LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, time, lineRate);
56 
57  // Detetermine what to set the starting detector sample to, based on swath mode
58  QString swathMode = inst["SwathModeId"];
59 
60  double startingDetectorSample = 1;
61  if (swathMode.compare("FULL") == 0) {
62  startingDetectorSample = 1;
63  }
64  else if (swathMode.compare("NOMINAL") == 0) {
65  startingDetectorSample = 297;
66  }
67  else if (swathMode.compare("HALF") == 0) {
68  startingDetectorSample = 1172;
69  }
70 
71  detectorMap->SetStartingDetectorSample(startingDetectorSample);
72 
73  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
74 
75  // This sets the origin of the detector (not image samp,line). It is zero bassed.
76  // The detector offsets are 0,0 because the borsight is in the center of the array
77  // The origin of the detector does not depend on swath mode.
78  QString key;
79  key = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
80  double sampleBoreSight = getDouble(key);
81 
82  key = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
83  double lineBoreSight = getDouble(key);
84  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
85 
86  // Setup distortion map
88 
89  // Setup the ground and sky map
90  new LineScanCameraGroundMap(this);
91  new LineScanCameraSkyMap(this);
92 
93  setTime(time);
94  LoadCache();
96  }
97 
100  }
101 
102 
110  return (-131000);
111  }
112 
120  return (1);
121  }
122 
130  return (1);
131  }
132 
133 }
134 
135 
144 extern "C" Isis::Camera *KaguyaTcCameraPlugin(Isis::Cube &cube) {
145  return new Isis::KaguyaTcCamera(cube);
146 }
Isis::LineScanCameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: LineScanCameraSkyMap.h:34
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Spice::time
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition: Spice.cpp:884
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::Spice::getClockTime
virtual iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:1053
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::Camera
Definition: Camera.h:236
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
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:97
Isis::KaguyaTcCamera::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID - J2000.
Definition: KaguyaTcCamera.cpp:119
Isis::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::LineScanCamera
Generic class for Line Scan Cameras.
Definition: LineScanCamera.h:36
Isis::LineScanCameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: LineScanCameraGroundMap.h:49
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::KaguyaTcCamera::SpkReferenceId
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Definition: KaguyaTcCamera.cpp:129
Isis::CameraDetectorMap::SetStartingDetectorSample
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
Definition: CameraDetectorMap.h:79
Isis::KaguyaTcCamera::~KaguyaTcCamera
~KaguyaTcCamera()
Destroys the KaguyaTcCamera object.
Definition: KaguyaTcCamera.cpp:99
std
Namespace for the standard library.
Isis::Camera::LoadCache
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2420
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::CameraFocalPlaneMap
Convert between distorted focal plane and detector coordinates.
Definition: CameraFocalPlaneMap.h:85
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::Spice::getDouble
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1039
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::KaguyaTcCamera::CkFrameId
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Definition: KaguyaTcCamera.cpp:109
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::LineScanCameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: LineScanCameraDetectorMap.h:37
Isis::KaguyaTcCamera
This is the camera model for the Kaguya Terrain Cameras TC1 and TC2.
Definition: KaguyaTcCamera.h:29
Isis::KaguyaTcCameraDistortionMap
Distort/undistort focal plane coordinates for Kaguya's TC cameras.
Definition: KaguyaTcCameraDistortionMap.h:30