Isis 3 Programmer Reference
HayabusaNirsCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "HayabusaNirsCamera.h"
10
11#include <QString>
12
13#include "CameraDistortionMap.h"
14#include "CameraFocalPlaneMap.h"
15#include "CameraGroundMap.h"
16#include "CameraSkyMap.h"
17#include "IString.h"
18#include "iTime.h"
19#include "NaifStatus.h"
20#include "NirsDetectorMap.h"
21
22using namespace std;
23
24namespace Isis {
33 m_instrumentNameLong = "Near InfraRed Spectrometer";
34 m_instrumentNameShort = "NIRS";
35 m_spacecraftNameLong = "Hayabusa";
36 m_spacecraftNameShort = "Hayabusa";
37
39 Pvl &lab = *cube.label();
40
41 // Get focal length and pixel pitch from IAK
43 SetFocalLength(FocalLength() * 1000.0); // Convert from meters to mm
45
46 // Get the start time in et
47 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
48
49 // get the start and stop times
50 QString startTime = inst["SpacecraftClockStartCount"];
51 QString stopTime = inst["SpacecraftClockStopCount"];
52 iTime etStart = getClockTime(startTime);
53 iTime etStop = getClockTime(stopTime);
54
55 double exposureDuration = etStop - etStart;
56 iTime centerTime = etStart + (exposureDuration / 2.0);
57
58 // Setup focal plane map
59 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
60
61 // lines and samples added to the pvl in the order you
62 // call getDouble()
63 double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
64 double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
65
66 focalMap->SetDetectorOrigin(bSamples, bLines);
67
68 // Setup detector map
70 detMap->SetStartingDetectorSample(0);
71 detMap->SetStartingDetectorLine(0);
72
73 // Setup distortion map
74 new CameraDistortionMap(this);
75
76 // Setup the ground and sky map
77 new CameraGroundMap(this);
78 new CameraSkyMap(this);
79
80 setTime(centerTime);
81 LoadCache();
83 }
84
85
92
93
116 pair<iTime, iTime> HayabusaNirsCamera::ShutterOpenCloseTimes(double time,
117 double exposureDuration) {
119 }
120
121
133
134 QList<QPointF> offsets;
135
136 // Create 8 pts on each edge of pixel
137 int npts = 8;
138
139 // Top edge of pixel
140 for (double x = -PixelPitch() / 2.0; x <= PixelPitch() / 2.0; x += PixelPitch() / (npts-1)) {
141 offsets.append(QPointF(x, -PixelPitch() / 2.0));
142 }
143 // Right edge of pixel
144 for (double y = -PixelPitch() / 2.0; y <= PixelPitch() / 2.0; y += PixelPitch() / (npts-1)) {
145 offsets.append(QPointF(PixelPitch() / 2.0, y));
146 }
147 // Bottom edge of pixel
148 for (double x = PixelPitch() / 2.0; x >= -PixelPitch() / 2.0; x -= PixelPitch() / (npts-1)) {
149 offsets.append(QPointF(x, PixelPitch() / 2.0));
150 }
151 // Left edge of pixel
152 for (double y = PixelPitch() / 2.0; y >= -PixelPitch() / 2.0; y -= PixelPitch() / (npts-1)) {
153 offsets.append(QPointF(-PixelPitch() / 2.0, y));
154 }
155
156 return offsets;
157 }
158}
159
160
171extern "C" Isis::Camera *HayabusaNirsCameraPlugin(Isis::Cube &cube) {
172 return new Isis::HayabusaNirsCamera(cube);
173}
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
double PixelPitch() const
Returns the pixel pitch.
Definition Camera.cpp:2772
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
double FocalLength() const
Returns the focal length.
Definition Camera.cpp:2762
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 Hayabusa NIRS camera.
HayabusaNirsCamera(Cube &cube)
Constructs a HayabusaNirsCamera object using the image labels.
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
~HayabusaNirsCamera()
Destroys a HayabusaNirsCamera object.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
The detector map class for the Hayabusa NIRS camera.
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.