Isis 3 Programmer Reference
TgoCassisCamera.cpp
1 
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 
28 using namespace std;
29 
30 namespace Isis {
37  TgoCassisCamera::TgoCassisCamera(Cube &cube) : FramingCamera(cube) {
38 
39  m_instrumentNameLong = "Colour and Stereo Surface Imaging System";
40  m_instrumentNameShort = "CaSSIS";
41 
42  m_spacecraftNameLong = "Trace Gas Orbiter";
43  m_spacecraftNameShort = "TGO";
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);
58  SetPixelPitch();
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 
119  }
120 
121 
142  pair <iTime, iTime> TgoCassisCamera::ShutterOpenCloseTimes(double time,
143  double exposureDuration) {
145  }
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 
201 extern "C" Isis::Camera *TgoCassisCameraPlugin(Isis::Cube &cube) {
202  return new Isis::TgoCassisCamera(cube);
203 }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Camera::exposureDuration
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3063
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::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::TgoCassisCamera::~TgoCassisCamera
~TgoCassisCamera()
Destroys the TgoCassisCamera object.
Definition: TgoCassisCamera.cpp:118
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::TgoCassisCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: TgoCassisCamera.cpp:142
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::TgoCassisCamera::SpkTargetId
virtual int SpkTargetId() const
SPK Target Body ID - TGO spacecraft -143.
Definition: TgoCassisCamera.cpp:176
Isis::CameraDetectorMap::SetDetectorSampleSumming
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Definition: CameraDetectorMap.h:108
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::FramingCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Definition: FramingCamera.cpp:42
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::TgoCassisCamera::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID - J2000.
Definition: TgoCassisCamera.cpp:165
Isis::Camera
Definition: Camera.h:236
Isis::FramingCamera
Generic class for Framing Cameras.
Definition: FramingCamera.h:32
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
Isis::Spice::instrumentRotation
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1622
Isis::CameraDetectorMap::SetDetectorLineSumming
void SetDetectorLineSumming(const double summing)
Set line summing mode.
Definition: CameraDetectorMap.h:123
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::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::TgoCassisCamera::SpkReferenceId
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Definition: TgoCassisCamera.cpp:187
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
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::TgoCassisDistortionMap
Distort/undistort focal plane coordinates.
Definition: TgoCassisDistortionMap.h:45
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
Isis::TgoCassisCamera::CkFrameId
virtual int CkFrameId() const
CK frame ID - TGO CaSSIS instrument code (TGO_CASSIS_FSA)
Definition: TgoCassisCamera.cpp:154
Isis::TgoCassisCamera
TGO Cassis camera model.
Definition: TgoCassisCamera.h:66
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::SpiceRotation::SetFrame
void SetFrame(int frameCode)
Change the frame to the given frame code.
Definition: SpiceRotation.cpp:214
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
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::Camera::SetDistortionMap
void SetDistortionMap(CameraDistortionMap *map, bool deleteExisting=true)
Sets the Distortion Map.
Definition: Camera.cpp:2342