Isis 3 Programmer Reference
Hyb2OncCamera.cpp
Go to the documentation of this file.
1 
21 #include "Hyb2OncCamera.h"
22 
23 #include <QString>
24 #include <QtMath>
25 
26 #include "CameraDetectorMap.h"
27 #include "CameraFocalPlaneMap.h"
28 #include "CameraGroundMap.h"
29 #include "CameraSkyMap.h"
30 #include "Hyb2OncDistortionMap.h"
31 #include "IString.h"
32 #include "iTime.h"
33 #include "NaifStatus.h"
34 
35 using namespace std;
36 
37 namespace Isis {
45  Hyb2OncCamera::Hyb2OncCamera(Cube &cube) : FramingCamera(cube) {
46  m_spacecraftNameLong = "Hayabusa2";
47  m_spacecraftNameShort = "Hayabusa2";
48 
49  // Set the correct instrument name based on NaifFrameCode in kernels group
50 
51  // ONC-T
52  if (naifIkCode() == -37100) {
53  m_instrumentNameLong = "Optical Navigation Camera - Telescopic Camera";
54  m_instrumentNameShort = "ONC-T";
55  }
56  // ONC-W1
57  else if (naifIkCode() == -37110) {
58  m_instrumentNameLong = "Optical Navigation Camera - W1 Camera";
59  m_instrumentNameShort = "ONC-W1";
60  }
61  // ONC-W2
62  else if (naifIkCode() == -37120) {
63  m_instrumentNameLong = "Optical Navigation Camera - W2 Camera";
64  m_instrumentNameShort = "ONC-W2";
65  }
66  else {
67  QString msg = "File does not appear to be a Hayabusa2 image";
69  }
70 
72 
73  SetFocalLength(); // Retrives from IK stored in units of mm
74  SetPixelPitch(); // Get from IAK
75 
76  // Get the start time in et
77  Pvl &lab = *cube.label();
78  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
79 
80  // set variables startTime and exposureDuration
81  QString stime = inst["SpacecraftClockStartCount"];
82  iTime etStart = getClockTime(stime);
83 
84  double exposureDuration = ((double) inst["ExposureDuration"]);
85  iTime centerTime = etStart + (exposureDuration / 2.0);
86 
87  // Setup focal plane map
88  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
89 
90  // BORESIGHT SAMPLE AND LINE still need to be added to the IAK
91  double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
92  double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
93 
94  focalMap->SetDetectorOrigin(bSamples, bLines);
95 
96  // Setup detector map (use default for now)
97  CameraDetectorMap *detMap = new CameraDetectorMap(this);
98 
99  // Handle summing
100  int binning = inst["Binning"];
101  detMap->SetDetectorLineSumming(binning);
102  detMap->SetDetectorSampleSumming(binning);
103 
104  // Setup distortion map (use default for now)
105  CameraDistortionMap *distortionMap = new Hyb2OncDistortionMap(this);
106  distortionMap->SetDistortion(naifIkCode());
107 
108  // Setup the ground and sky map
109  new CameraGroundMap(this);
110  new CameraSkyMap(this);
111 
112  setTime(centerTime);
113  LoadCache();
115  }
116 
117 
122  }
123 
124 
143  pair<iTime, iTime> Hyb2OncCamera::ShutterOpenCloseTimes(double time,
144  double exposureDuration) {
146  }
147 
148 
156  return (-37000);
157  }
158 
159 
167  return (1);
168  }
169 
170 
178  return (1);
179  }
180 }
181 
182 
192  return new Isis::Hyb2OncCamera(cube);
193 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
~Hyb2OncCamera()
Default Destructor.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Parse and return pieces of a time string.
Definition: iTime.h:78
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Search child objects.
Definition: PvlObject.h:170
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Isis::Camera * Hyb2OncCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate an Hyb2OncCamera object.
void SetDetectorLineSumming(const double summing)
Set line summing mode.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
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
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:977
virtual int CkReferenceId() const
CK Reference ID - J2000.
Distort/undistort focal plane coordinates.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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:112
Container for cube-like labels.
Definition: Pvl.h:135
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
This is the camera model for the Hayabusa2 ONC camera.
Definition: Hyb2OncCamera.h:39
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
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
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:48
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
Distort/undistort focal plane coordinates for Hayabusa 2&#39;s ONC cameras.
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3075
Generic class for Framing Cameras.
Definition: FramingCamera.h:48
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
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809