Isis 3 Programmer Reference
Hyb2OncCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "Hyb2OncCamera.h"
10
11#include <QString>
12#include <QtMath>
13
14#include "CameraDetectorMap.h"
15#include "CameraFocalPlaneMap.h"
16#include "CameraGroundMap.h"
17#include "CameraSkyMap.h"
18#include "Hyb2OncDistortionMap.h"
19#include "IString.h"
20#include "iTime.h"
21#include "NaifStatus.h"
22
23using namespace std;
24
25namespace Isis {
34 m_spacecraftNameLong = "Hayabusa2";
35 m_spacecraftNameShort = "Hayabusa2";
36
37 // Set the correct instrument name based on NaifFrameCode in kernels group
38
39 // ONC-T
40 if (naifIkCode() == -37100) {
41 m_instrumentNameLong = "Optical Navigation Camera - Telescopic Camera";
42 m_instrumentNameShort = "ONC-T";
43 }
44 // ONC-W1
45 else if (naifIkCode() == -37110) {
46 m_instrumentNameLong = "Optical Navigation Camera - W1 Camera";
47 m_instrumentNameShort = "ONC-W1";
48 }
49 // ONC-W2
50 else if (naifIkCode() == -37120) {
51 m_instrumentNameLong = "Optical Navigation Camera - W2 Camera";
52 m_instrumentNameShort = "ONC-W2";
53 }
54 else {
55 QString msg = "File does not appear to be a Hayabusa2 image";
56 throw IException(IException::User, msg, _FILEINFO_);
57 }
58
60
61 SetFocalLength(); // Retrives from IK stored in units of mm
62 SetPixelPitch(); // Get from IAK
63
64 // Get the start time in et
65 Pvl &lab = *cube.label();
66 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
67
68 // set variables startTime and exposureDuration
69 QString stime = inst["SpacecraftClockStartCount"];
70 iTime etStart = getClockTime(stime);
71
72 double exposureDuration = ((double) inst["ExposureDuration"]);
73 iTime centerTime = etStart + (exposureDuration / 2.0);
74
75 // Setup focal plane map
76 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
77
78 // BORESIGHT SAMPLE AND LINE still need to be added to the IAK
79 double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
80 double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
81
82 focalMap->SetDetectorOrigin(bSamples, bLines);
83
84 // Setup detector map (use default for now)
85 CameraDetectorMap *detMap = new CameraDetectorMap(this);
86
87 // Handle summing
88 int binning = inst["Binning"];
89 detMap->SetDetectorLineSumming(binning);
90 detMap->SetDetectorSampleSumming(binning);
91
92 // Setup distortion map (use default for now)
93 CameraDistortionMap *distortionMap = new Hyb2OncDistortionMap(this);
94 distortionMap->SetDistortion(naifIkCode());
95
96 // Setup the ground and sky map
97 new CameraGroundMap(this);
98 new CameraSkyMap(this);
99
100 setTime(centerTime);
101 LoadCache();
103 }
104
105
111
112
131 pair<iTime, iTime> Hyb2OncCamera::ShutterOpenCloseTimes(double time,
132 double exposureDuration) {
134 }
135
136
144 return (-37000);
145 }
146
147
155 return (1);
156 }
157
158
166 return (1);
167 }
168}
169
170
179extern "C" Isis::Camera *Hyb2OncCameraPlugin(Isis::Cube &cube) {
180 return new Isis::Hyb2OncCamera(cube);
181}
Convert between parent image coordinates and detector coordinates.
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
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
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:1707
Generic class for Framing Cameras.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
This is the camera model for the Hayabusa2 ONC camera.
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.
~Hyb2OncCamera()
Default Destructor.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Hyb2OncCamera(Cube &cube)
Constructs a Hayabusa2 Hyb2OncCamera object using the image labels.
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Distort/undistort focal plane coordinates for Hayabusa 2's ONC cameras.
Isis exception class.
Definition IException.h:91
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
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
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 getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition Spice.cpp:1060
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
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
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
Namespace for the standard library.