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 
22 using namespace std;
23 
24 namespace Isis {
32  HayabusaAmicaCamera::HayabusaAmicaCamera(Cube &cube) : FramingCamera(cube) {
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
48  SetPixelPitch();
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
91  CameraDistortionMap *dmap = new CameraDistortionMap(this);
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 
108  }
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 
183 extern "C" Isis::Camera *HayabusaAmicaCameraPlugin(Isis::Cube &cube) {
184  return new Isis::HayabusaAmicaCamera(cube);
185 }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Camera::exposureDuration
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3063
Isis::Spice::time
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition: Spice.cpp:884
Isis::CameraDistortionMap::SetDistortion
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
Definition: CameraDistortionMap.cpp:58
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::Spice::getClockTime
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:1053
Isis::HayabusaAmicaCamera::CkFrameId
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Definition: HayabusaAmicaCamera.cpp:145
Isis::CameraDetectorMap::SetDetectorSampleSumming
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Definition: CameraDetectorMap.h:108
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::FramingCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Definition: FramingCamera.cpp:42
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::Camera
Definition: Camera.h:236
Isis::FramingCamera
Generic class for Framing Cameras.
Definition: FramingCamera.h:32
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::HayabusaAmicaCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: HayabusaAmicaCamera.cpp:133
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
Isis::CameraDetectorMap::SetDetectorLineSumming
void SetDetectorLineSumming(const double summing)
Set line summing mode.
Definition: CameraDetectorMap.h:123
Isis::CameraDetectorMap::SetStartingDetectorLine
void SetStartingDetectorLine(const double line)
Set the starting detector line.
Definition: CameraDetectorMap.h:93
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
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:97
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::HayabusaAmicaCamera::~HayabusaAmicaCamera
~HayabusaAmicaCamera()
Destructor.
Definition: HayabusaAmicaCamera.cpp:107
Isis::CameraDistortionMap
Distort/undistort focal plane coordinates.
Definition: CameraDistortionMap.h:41
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::CameraDetectorMap::SetStartingDetectorSample
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
Definition: CameraDetectorMap.h:79
Isis::Camera::FocalLength
double FocalLength() const
Returns the focal length.
Definition: Camera.cpp:2732
std
Namespace for the standard library.
Isis::Camera::LoadCache
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2420
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::CameraFocalPlaneMap
Convert between distorted focal plane and detector coordinates.
Definition: CameraFocalPlaneMap.h:85
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
Isis::HayabusaAmicaCamera
This is the camera model for the Hayabusa AMICA camera.
Definition: HayabusaAmicaCamera.h:44
Isis::HayabusaAmicaCamera::SpkReferenceId
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Definition: HayabusaAmicaCamera.cpp:167
Isis::Spice::getDouble
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1039
Isis::HayabusaAmicaCamera::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID - J2000.
Definition: HayabusaAmicaCamera.cpp:156
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16