Isis 3 Programmer Reference
HrscCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "HrscCamera.h"
10
11#include <string>
12
13#include <QString>
14
15#include "CameraDistortionMap.h"
16#include "CameraFocalPlaneMap.h"
17#include "iTime.h"
18#include "LineScanCameraGroundMap.h"
19#include "LineScanCameraSkyMap.h"
20#include "NaifStatus.h"
21#include "Statistics.h"
22#include "VariableLineScanCameraDetectorMap.h"
23
24using namespace std;
25namespace Isis {
34 m_instrumentNameLong = "High Resolution Stereo Camera";
35 m_instrumentNameShort = "HRSC";
36 m_spacecraftNameLong = "Mars Express";
38
40 // Setup camera characteristics from instrument and frame kernel
42 SetPixelPitch(0.007);
43 instrumentRotation()->SetFrame(-41210);
44
45 // Get required keywords from instrument group
46 Pvl &lab = *cube.label();
47 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
48
49 ReadLineRates(lab.fileName());
50
51 // Setup detector map for transform of image pixels to detector position
53 DetectorMap()->SetDetectorSampleSumming(inst["Summing"]);
54
55 // Setup focal plane map for transform of detector position to
56 // focal plane x/y. This will read the appropriate CCD
57 // transformation coefficients from the instrument kernel
58
60
61 QString ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
62 double sampleBoresight = getDouble(ikernKey);
63
64 ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
65 double lineBoresight = getDouble(ikernKey);
66
67 FocalPlaneMap()->SetDetectorOrigin(sampleBoresight, lineBoresight);
68
69 // Setup distortion map. This will read the optical distortion
70 // coefficients from the instrument kernel
71 new CameraDistortionMap(this);
72
73 // Setup the ground and sky map to transform undistorted focal
74 // plane x/y to lat/lon or ra/dec respectively.
76 new LineScanCameraSkyMap(this);
77
78 LoadCache();
80 }
81
82
86
87
95 return (-41001);
96 }
97
98
106 return (1);
107 }
108
109
117 return (1);
118 }
119
120
124 void HrscCamera::ReadLineRates(QString filename) {
125 Table timesTable("LineScanTimes", filename);
126
127 if(timesTable.Records() <= 0) {
128 QString msg = "Table [LineScanTimes] in [";
129 msg += filename + "] must not be empty";
130 throw IException(IException::Unknown, msg, _FILEINFO_);
131 }
132
133 for(int i = 0; i < timesTable.Records(); i++) {
134 p_lineRates.push_back(LineRateChange((int)timesTable[i][2],
135 (double)timesTable[i][0],
136 timesTable[i][1]));
137 }
138
139 if(p_lineRates.size() <= 0) {
140 QString msg = "There is a problem with the data within the Table ";
141 msg += "[LineScanTimes] in [" + filename + "]";
142 throw IException(IException::Unknown, msg, _FILEINFO_);
143 }
144 }
145}
146
147
158extern "C" Isis::Camera *HrscCameraPlugin(Isis::Cube &cube) {
159 return new Isis::HrscCamera(cube);
160}
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
QString m_spacecraftNameLong
Full spacecraft name.
Definition Camera.h:499
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
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition Camera.cpp:2866
QString m_instrumentNameLong
Full instrument name.
Definition Camera.h:497
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:1707
HRSC Camera Model.
Definition HrscCamera.h:58
HrscCamera(Cube &cube)
Creates a HrscCamera Camera Model.
void ReadLineRates(QString filename)
~HrscCamera()
Destroys the HiriseCamera object.
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
virtual int CkReferenceId() const
CK Reference ID - J2000.
std::vector< LineRateChange > p_lineRates
Vector of the variable line rates for this camera model.
Definition HrscCamera.h:73
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
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
Container class for storing timing information for a section of an image.
Convert between undistorted focal plane and ground coordinates.
Generic class for Line Scan Cameras.
LineScanCameraDetectorMap * DetectorMap()
Returns a pointer to the LineScanCameraDetectorMap object.
Convert between undistorted focal plane and ra/dec coordinates.
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
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
Class for storing Table blobs information.
Definition Table.h:61
Convert between parent image coordinates and detector coordinates.
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
Namespace for the standard library.