Isis 3 Programmer Reference
HrscCamera.cpp
Go to the documentation of this file.
1 
23 #include "HrscCamera.h"
24 
25 #include <string>
26 
27 #include <QString>
28 
29 #include "CameraDistortionMap.h"
30 #include "CameraFocalPlaneMap.h"
31 #include "iTime.h"
33 #include "LineScanCameraSkyMap.h"
34 #include "NaifStatus.h"
35 #include "Statistics.h"
37 
38 using namespace std;
39 namespace Isis {
47  HrscCamera::HrscCamera(Cube &cube) : LineScanCamera(cube) {
48  m_instrumentNameLong = "High Resolution Stereo Camera";
49  m_instrumentNameShort = "HRSC";
50  m_spacecraftNameLong = "Mars Express";
51  m_spacecraftNameShort = "MEX";
52 
54  // Setup camera characteristics from instrument and frame kernel
56  SetPixelPitch(0.007);
57  instrumentRotation()->SetFrame(-41210);
58 
59  // Get required keywords from instrument group
60  Pvl &lab = *cube.label();
61  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
62 
63  ReadLineRates(lab.fileName());
64 
65  // Setup detector map for transform of image pixels to detector position
67  DetectorMap()->SetDetectorSampleSumming(inst["Summing"]);
68 
69  // Setup focal plane map for transform of detector position to
70  // focal plane x/y. This will read the appropriate CCD
71  // transformation coefficients from the instrument kernel
72 
73  new CameraFocalPlaneMap(this, naifIkCode());
74 
75  QString ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE";
76  double sampleBoresight = getDouble(ikernKey);
77 
78  ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE";
79  double lineBoresight = getDouble(ikernKey);
80 
81  FocalPlaneMap()->SetDetectorOrigin(sampleBoresight, lineBoresight);
82 
83  // Setup distortion map. This will read the optical distortion
84  // coefficients from the instrument kernel
85  new CameraDistortionMap(this);
86 
87  // Setup the ground and sky map to transform undistorted focal
88  // plane x/y to lat/lon or ra/dec respectively.
89  new LineScanCameraGroundMap(this);
90  new LineScanCameraSkyMap(this);
91 
92  LoadCache();
94  }
95 
96 
99  }
100 
101 
108  int HrscCamera::CkFrameId() const {
109  return (-41001);
110  }
111 
112 
120  return (1);
121  }
122 
123 
131  return (1);
132  }
133 
134 
138  void HrscCamera::ReadLineRates(QString filename) {
139  Table timesTable("LineScanTimes", filename);
140 
141  if(timesTable.Records() <= 0) {
142  QString msg = "Table [LineScanTimes] in [";
143  msg += filename + "] must not be empty";
145  }
146 
147  for(int i = 0; i < timesTable.Records(); i++) {
148  p_lineRates.push_back(LineRateChange((int)timesTable[i][2],
149  (double)timesTable[i][0],
150  timesTable[i][1]));
151  }
152 
153  if(p_lineRates.size() <= 0) {
154  QString msg = "There is a problem with the data within the Table ";
155  msg += "[LineScanTimes] in [" + filename + "]";
157  }
158  }
159 }
160 
161 
173  return new Isis::HrscCamera(cube);
174 }
int Records() const
Returns the number of records.
Definition: Table.cpp:224
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Definition: HrscCamera.cpp:108
HRSC Camera Model.
Definition: HrscCamera.h:71
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
void ReadLineRates(QString filename)
Definition: HrscCamera.cpp:138
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Generic class for Line Scan Cameras.
virtual int CkReferenceId() const
CK Reference ID - J2000.
Definition: HrscCamera.cpp:119
Search child objects.
Definition: PvlObject.h:170
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
Isis::Camera * HrscCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a HrscCamera object.
Definition: HrscCamera.cpp:172
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Definition: HrscCamera.cpp:130
Convert between undistorted focal plane and ground coordinates.
Container class for storing timing information for a section of an image.
void SetFrame(int frameCode)
Change the frame to the given frame code.
Convert between distorted focal plane and detector coordinates.
std::vector< LineRateChange > p_lineRates
Vector of the variable line rates for this camera model.
Definition: HrscCamera.h:86
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
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
~HrscCamera()
Destroys the HiriseCamera object.
Definition: HrscCamera.cpp:98
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
Distort/undistort focal plane coordinates.
Convert between parent image coordinates and detector coordinates.
Container for cube-like labels.
Definition: Pvl.h:135
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition: Camera.cpp:2848
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
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
Class for storing Table blobs information.
Definition: Table.h:77
LineScanCameraDetectorMap * DetectorMap()
Returns a pointer to the LineScanCameraDetectorMap object.
QString fileName() const
Returns the filename used to initialise the Pvl object.
Definition: PvlContainer.h:246
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1489
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
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