Isis 3 Programmer Reference
HayabusaAmicaCamera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "HayabusaAmicaCamera.h"
10
11#include <QString>
12
13#include "CameraDetectorMap.h"
14#include "CameraDistortionMap.h"
15#include "CameraFocalPlaneMap.h"
16#include "CameraGroundMap.h"
17#include "CameraSkyMap.h"
18#include "IString.h"
19#include "iTime.h"
20#include "NaifStatus.h"
21
22using namespace std;
23
24namespace Isis {
33 m_instrumentNameLong = "Amica";
34 m_instrumentNameShort = "Amica";
35 m_spacecraftNameLong = "Hayabusa";
36 m_spacecraftNameShort = "Hayabusa";
37
39 Pvl &lab = *cube.label();
40 // Get the camera characteristics
41 QString filter = (QString)(lab.findGroup("BandBin", Pvl::Traverse))["Name"];
42 filter = filter.toUpper();
43
44 SetFocalLength(); // Retrives from IK stored in units of meters
45 SetFocalLength(FocalLength() * 1000.0); // Convert from meters to mm
46
47 // Get from IAK
49
50 // Get the start time in et
51 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
52
53 // set variables startTime and exposureDuration
54 QString stime = inst["SpacecraftClockStartCount"];
55 iTime etStart = getClockTime(stime);
56
57 double exposureDuration = ((double) inst["ExposureDuration"]);
58 iTime centerTime = etStart + (exposureDuration / 2.0);
59
60 // Setup focal plane map
61 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
62
63 // lines and samples added to the pvl in the order you
64 // call getDouble()
65 double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
66 double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
67
68 focalMap->SetDetectorOrigin(bSamples, bLines);
69
70 // Setup detector map. FirstSample is zero-based indexing, Detector is one-based.
71 CameraDetectorMap *detMap = new CameraDetectorMap(this);
72 detMap->SetStartingDetectorSample((int) inst["FirstSample"] + 1);
73
74 // We flip the image over the horizontal axis on ingestion to
75 // match fits viewers. So for cubes that are for subframes, first/last line
76 // values in the label are flipped about the detector's x-axis. We need to
77 // compensate to set the detector's first line. FirstLine is zero-based
78 // indexing and there are 1024 lines on the detector so the Detector last
79 // line index is 1023.
80 int actualFirstLine = 1023 - ((int) inst["LastLine"]);
81
82 //The detector line indexing is one-based.
83 detMap->SetStartingDetectorLine(actualFirstLine + 1);
84
85 // Handle summing
86 int binning = inst["Binning"];
87 detMap->SetDetectorLineSumming(binning);
88 detMap->SetDetectorSampleSumming(binning);
89
90 // Setup distortion map
92 dmap->SetDistortion(-130102);
93
94 // Setup the ground and sky map
95 new CameraGroundMap(this);
96 new CameraSkyMap(this);
97
98 setTime(centerTime);
99 LoadCache();
101 }
102
103
109
110
133 pair<iTime, iTime> HayabusaAmicaCamera::ShutterOpenCloseTimes(double time,
134 double exposureDuration) {
136 }
137
138
146 return (-130000);
147 }
148
149
157 return (1);
158 }
159
160
168 return (1);
169 }
170}
171
172
183extern "C" Isis::Camera *HayabusaAmicaCameraPlugin(Isis::Cube &cube) {
184 return new Isis::HayabusaAmicaCamera(cube);
185}
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
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 AMICA camera.
HayabusaAmicaCamera(Cube &cube)
Constructs a Hayabusa HayabusaAmicaCamera object using the image labels.
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
virtual int CkReferenceId() const
CK Reference ID - J2000.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
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.