Isis 3 Programmer Reference
HayabusaAmicaCamera.cpp
Go to the documentation of this file.
1 
21 #include "HayabusaAmicaCamera.h"
22 
23 #include <QString>
24 
25 #include "CameraDetectorMap.h"
26 #include "CameraDistortionMap.h"
27 #include "CameraFocalPlaneMap.h"
28 #include "CameraGroundMap.h"
29 #include "CameraSkyMap.h"
30 #include "IString.h"
31 #include "iTime.h"
32 #include "NaifStatus.h"
33 
34 using namespace std;
35 
36 namespace Isis {
44  HayabusaAmicaCamera::HayabusaAmicaCamera(Cube &cube) : FramingCamera(cube) {
45  m_instrumentNameLong = "Amica";
46  m_instrumentNameShort = "Amica";
47  m_spacecraftNameLong = "Hayabusa";
48  m_spacecraftNameShort = "Hayabusa";
49 
51  Pvl &lab = *cube.label();
52  // Get the camera characteristics
53  QString filter = (QString)(lab.findGroup("BandBin", Pvl::Traverse))["Name"];
54  filter = filter.toUpper();
55 
56  SetFocalLength(); // Retrives from IK stored in units of meters
57  SetFocalLength(FocalLength() * 1000.0); // Convert from meters to mm
58 
59  // Get from IAK
60  SetPixelPitch();
61 
62  // Get the start time in et
63  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
64 
65  // set variables startTime and exposureDuration
66  QString stime = inst["SpacecraftClockStartCount"];
67  iTime etStart = getClockTime(stime);
68 
69  double exposureDuration = ((double) inst["ExposureDuration"]);
70  iTime centerTime = etStart + (exposureDuration / 2.0);
71 
72  // Setup focal plane map
73  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
74 
75  // lines and samples added to the pvl in the order you
76  // call getDouble()
77  double bLines = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
78  double bSamples = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
79 
80  focalMap->SetDetectorOrigin(bSamples, bLines);
81 
82  // Setup detector map. FirstSample is zero-based indexing, Detector is one-based.
83  CameraDetectorMap *detMap = new CameraDetectorMap(this);
84  detMap->SetStartingDetectorSample((int) inst["FirstSample"] + 1);
85 
86  // We flip the image over the horizontal axis on ingestion to
87  // match fits viewers. So for cubes that are for subframes, first/last line
88  // values in the label are flipped about the detector's x-axis. We need to
89  // compensate to set the detector's first line. FirstLine is zero-based
90  // indexing and there are 1024 lines on the detector so the Detector last
91  // line index is 1023.
92  int actualFirstLine = 1023 - ((int) inst["LastLine"]);
93 
94  //The detector line indexing is one-based.
95  detMap->SetStartingDetectorLine(actualFirstLine + 1);
96 
97  // Handle summing
98  int binning = inst["Binning"];
99  detMap->SetDetectorLineSumming(binning);
100  detMap->SetDetectorSampleSumming(binning);
101 
102  // Setup distortion map
103  CameraDistortionMap *dmap = new CameraDistortionMap(this);
104  dmap->SetDistortion(-130102);
105 
106  // Setup the ground and sky map
107  new CameraGroundMap(this);
108  new CameraSkyMap(this);
109 
110  setTime(centerTime);
111  LoadCache();
113  }
114 
115 
120  }
121 
122 
145  pair<iTime, iTime> HayabusaAmicaCamera::ShutterOpenCloseTimes(double time,
146  double exposureDuration) {
148  }
149 
150 
158  return (-130000);
159  }
160 
161 
169  return (1);
170  }
171 
172 
180  return (1);
181  }
182 }
183 
184 
196  return new Isis::HayabusaAmicaCamera(cube);
197 }
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
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
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.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
virtual int CkReferenceId() const
CK Reference ID - J2000.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void SetDetectorLineSumming(const double summing)
Set line summing mode.
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.
Isis::Camera * HayabusaAmicaCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate an HayabusaAmicaCamera object...
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
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
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.
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.
This is the camera model for the Hayabusa AMICA camera.
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
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
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
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