Isis 3 Programmer Reference
HayabusaNirsCamera.cpp
Go to the documentation of this file.
1 
21 #include "HayabusaNirsCamera.h"
22 
23 #include <QString>
24 
25 #include "CameraDistortionMap.h"
26 #include "CameraFocalPlaneMap.h"
27 #include "CameraGroundMap.h"
28 #include "CameraSkyMap.h"
29 #include "IString.h"
30 #include "iTime.h"
31 #include "NaifStatus.h"
32 #include "NirsDetectorMap.h"
33 
34 using namespace std;
35 
36 namespace Isis {
44  HayabusaNirsCamera::HayabusaNirsCamera(Cube &cube) : FramingCamera(cube) {
45  m_instrumentNameLong = "Near InfraRed Spectrometer";
46  m_instrumentNameShort = "NIRS";
47  m_spacecraftNameLong = "Hayabusa";
48  m_spacecraftNameShort = "Hayabusa";
49 
51  Pvl &lab = *cube.label();
52 
53  // Get focal length and pixel pitch from IAK
55  SetFocalLength(FocalLength() * 1000.0); // Convert from meters to mm
56  SetPixelPitch();
57 
58  // Get the start time in et
59  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
60 
61  // get the start and stop times
62  QString startTime = inst["SpacecraftClockStartCount"];
63  QString stopTime = inst["SpacecraftClockStopCount"];
64  iTime etStart = getClockTime(startTime);
65  iTime etStop = getClockTime(stopTime);
66 
67  double exposureDuration = etStop - etStart;
68  iTime centerTime = etStart + (exposureDuration / 2.0);
69 
70  // Setup focal plane map
71  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
72 
73  // lines and samples added to the pvl in the order you
74  // call getDouble()
75  double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
76  double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
77 
78  focalMap->SetDetectorOrigin(bSamples, bLines);
79 
80  // Setup detector map
82  detMap->SetStartingDetectorSample(0);
83  detMap->SetStartingDetectorLine(0);
84 
85  // Setup distortion map
86  new CameraDistortionMap(this);
87 
88  // Setup the ground and sky map
89  new CameraGroundMap(this);
90  new CameraSkyMap(this);
91 
92  setTime(centerTime);
93  LoadCache();
95  }
96 
97 
102 
103  }
104 
105 
128  pair<iTime, iTime> HayabusaNirsCamera::ShutterOpenCloseTimes(double time,
129  double exposureDuration) {
131  }
132 
133 
145 
146  QList<QPointF> offsets;
147 
148  // Create 8 pts on each edge of pixel
149  int npts = 8;
150 
151  // Top edge of pixel
152  for (double x = -PixelPitch() / 2.0; x <= PixelPitch() / 2.0; x += PixelPitch() / (npts-1)) {
153  offsets.append(QPointF(x, -PixelPitch() / 2.0));
154  }
155  // Right edge of pixel
156  for (double y = -PixelPitch() / 2.0; y <= PixelPitch() / 2.0; y += PixelPitch() / (npts-1)) {
157  offsets.append(QPointF(PixelPitch() / 2.0, y));
158  }
159  // Bottom edge of pixel
160  for (double x = PixelPitch() / 2.0; x >= -PixelPitch() / 2.0; x -= PixelPitch() / (npts-1)) {
161  offsets.append(QPointF(x, PixelPitch() / 2.0));
162  }
163  // Left edge of pixel
164  for (double y = PixelPitch() / 2.0; y >= -PixelPitch() / 2.0; y -= PixelPitch() / (npts-1)) {
165  offsets.append(QPointF(-PixelPitch() / 2.0, y));
166  }
167 
168  return offsets;
169  }
170 }
171 
172 
184  return new Isis::HayabusaNirsCamera(cube);
185 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
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
The detector map class for the Hayabusa NIRS camera.
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
This is the camera model for the Hayabusa NIRS camera.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void SetStartingDetectorLine(const double line)
Set the starting detector line.
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.
~HayabusaNirsCamera()
Destroys a HayabusaNirsCamera object.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
double FocalLength() const
Returns the focal length.
Definition: Camera.cpp:2744
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
Distort/undistort focal plane coordinates.
double PixelPitch() const
Returns the pixel pitch.
Definition: Camera.cpp:2754
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
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Isis::Camera * HayabusaNirsCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a HayabusaNirsCamera object.
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:48
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
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
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
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