File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
TgoCassisCamera.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "TgoCassisCamera.h"
10
11#include <cmath>
12
13#include <QByteArray>
14#include <QString>
15#include <QVariant>
16
17#include "CameraDetectorMap.h"
18#include "CameraFocalPlaneMap.h"
19#include "CameraGroundMap.h"
20#include "CameraSkyMap.h"
21#include "EndianSwapper.h"
22#include "IException.h"
23#include "IString.h"
24#include "iTime.h"
25#include "NaifStatus.h"
26#include "TgoCassisDistortionMap.h"
27
28using namespace std;
29
30namespace Isis {
38
39 m_instrumentNameLong = "Colour and Stereo Surface Imaging System";
40 m_instrumentNameShort = "CaSSIS";
41
42 m_spacecraftNameLong = "Trace Gas Orbiter";
44
46
47 // CaSSIS codes
48 int cassisCode = naifIkCode();
49 QString cassis = toString(cassisCode);
50
51 // Get all the necessary stuff from the labels
52 Pvl &lab = *cube.label();
53 const PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
54
55 // Set up the camera characteristics
56 instrumentRotation()->SetFrame(-143420);
59
60 // Get the Start time from the labels
61 // TODO: This is currently using UTC time. Once the timestamp is figured out,
62 // this will change to use SCLK. JAM 2017-02-06
63 QString stime = inst["SpacecraftClockStartCount"];
64 QString startT = inst["StartTime"];
65 iTime et(startT);
66
67 // Get summing mode
68 // Summing modes are:
69 // 0 = 1x1 (No summing)
70 // 1 = 2x2
71 // 2 = 4x4
72 int sumMode = toInt(inst["SummingMode"][0]);
73 int summing = sumMode * 2;
74
75 // Setup camera detector map
76 CameraDetectorMap *detMap = new CameraDetectorMap(this);
77 if ( summing > 0 ) {
78 detMap->SetDetectorSampleSumming(summing);
79 detMap->SetDetectorLineSumming(summing);
80 }
81
82 // Setup focal plane map
83 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, cassisCode);
84
85 // Get CASSIS detector boresight
86 double bsSample = getDouble("INS" + cassis + "_BORESIGHT_SAMPLE");
87 double bsLine = getDouble("INS" + cassis + "_BORESIGHT_LINE");
88 focalMap->SetDetectorOrigin(bsSample, bsLine);
89
90 // Setup distortion map
91 try {
93 }
94 catch (IException &e) {
95 // Set NULL so that cameras destructor wont seg fault trying to delete
96 SetDistortionMap(NULL, false);
97 QString msg = "Unable to Create TgoCassisDistortionMap";
98 throw IException(e, IException::Unknown, msg, _FILEINFO_);
99 }
100 // Setup the ground and sky map
101 new CameraGroundMap(this);
102 new CameraSkyMap(this);
103
104 // Set start time to center of exposure time to ensure
105 // the proper SPICE data is cached.
106 double p_exposureDur = toDouble(inst["ExposureDuration"]);
107 iTime p_etStart = et + ( p_exposureDur / 2.0);
108
109 setTime(p_etStart);
110 LoadCache();
112 }
113
114
120
121
146
147
155 return (-143000);
156 }
157
158
166 return (1);
167 }
168
169
177 return (-143);
178 }
179
180
188 return (1);
189 }
190
191}
192
201extern "C" Isis::Camera *TgoCassisCameraPlugin(Isis::Cube &cube) {
202 return new Isis::TgoCassisCamera(cube);
203}
Convert between parent image coordinates and detector coordinates.
void SetDetectorLineSumming(const double summing)
Set line summing mode.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Convert between undistorted focal plane and ground coordinates.
QString m_spacecraftNameLong
Full spacecraft name.
Definition Camera.h:499
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition Camera.cpp:3093
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition Camera.cpp:1422
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition Camera.cpp:1429
void LoadCache()
This loads the spice cache big enough for this image.
Definition Camera.cpp:2450
QString m_instrumentNameShort
Shortened instrument name.
Definition Camera.h:498
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition Camera.h:500
void SetDistortionMap(CameraDistortionMap *map, bool deleteExisting=true)
Sets the Distortion Map.
Definition Camera.cpp:2372
QString m_instrumentNameLong
Full instrument name.
Definition Camera.h:497
Convert between undistorted focal plane and ra/dec coordinates.
IO Handler for Isis Cubes.
Definition Cube.h:168
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1734
FramingCamera(Cube &cube)
Constructs the FramingCamera object.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
@ Traverse
Search child objects.
Definition PvlObject.h:158
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition PvlObject.h:129
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:99
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition Spice.cpp:1634
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition Spice.cpp:1046
void SetFrame(int frameCode)
Change the frame to the given frame code.
TGO Cassis camera model.
virtual int CkReferenceId() const
CK Reference ID - J2000.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
virtual int CkFrameId() const
CK frame ID - TGO CaSSIS instrument code (TGO_CASSIS_FSA)
virtual int SpkTargetId() const
SPK Target Body ID - TGO spacecraft -143.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
TgoCassisCamera(Cube &cube)
Initialize the CaSSIS camera model.
~TgoCassisCamera()
Destroys the TgoCassisCamera object.
Distort/undistort focal plane coordinates.
Parse and return pieces of a time string.
Definition iTime.h:65
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition IString.cpp:93
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149
Namespace for the standard library.