Isis 3 Programmer Reference
SsiCamera.cpp
Go to the documentation of this file.
1 
22 #include "SsiCamera.h"
23 
24 #include <QString>
25 
26 #include "CameraDetectorMap.h"
27 #include "CameraDistortionMap.h"
28 #include "CameraFocalPlaneMap.h"
29 #include "CameraGroundMap.h"
30 #include "CameraSkyMap.h"
31 #include "IString.h"
32 #include "iTime.h"
33 #include "NaifStatus.h"
34 #include "Pvl.h"
35 #include "PvlObject.h"
36 #include "RadialDistortionMap.h"
37 #include "Spice.h"
38 
39 using namespace std;
40 
41 namespace Isis {
51  SsiCamera::SsiCamera(Cube &cube) : FramingCamera(cube) {
52  m_instrumentNameLong = "Solid State Imaging System";
53  m_instrumentNameShort = "SSI";
54  m_spacecraftNameLong = "Galileo Orbiter";
55  m_spacecraftNameShort = "Galileo";
56 
58  // Get the camera characteristics
59  double k1;
60 
61  Pvl &lab = *cube.label();
62  iTime removeCoverDate("1994/04/01 00:00:00");
63  iTime imageDate(lab.findKeyword("StartTime", PvlObject::Traverse)[0]);
64  /*
65  * Change the Focal Length and K1 constant based on whether or not the protective cover is on
66  * See "The Direction of the North Pole and the Control Network of Asteroid 951 Gaspra" Icarus 107, 18-22 (1994)
67  */
68  if(imageDate < removeCoverDate) {
69  int code = naifIkCode();
70  QString key = "INS" + toString(code) + "_FOCAL_LENGTH_COVER";
72  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1_COVER");
73  }
74  else {
76  k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
77  }
78 
79  SetPixelPitch();
80 
81  // Get the start time in et
82  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
83 
84  double et = iTime((QString)inst["StartTime"]).Et();
85 
86  //?????????? NEED THESE??????
87  // exposure duration keyword value is measured in seconds
88  double exposureDuration = ((double) inst["ExposureDuration"]);
89  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
90 
91  // Get summation mode
92  double sumMode = inst["Summing"];
93 
94  // Setup detector map
95  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
96  detectorMap->SetDetectorSampleSumming(sumMode);
97  detectorMap->SetDetectorLineSumming(sumMode);
98 
99  // Setup focal plane map
100  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
101 
102  focalMap->SetDetectorOrigin(
103  Spice::getDouble("INS" + toString(naifIkCode()) +
104  "_BORESIGHT_SAMPLE"),
105  Spice::getDouble("INS" + toString(naifIkCode()) +
106  "_BORESIGHT_LINE"));
107 
108  // Setup distortion map
109  new RadialDistortionMap(this, k1);
110 
111  // Setup the ground and sky map
112  new CameraGroundMap(this);
113  new CameraSkyMap(this);
114 
115  setTime(et);
116  LoadCache();
118  }
119 
141  pair<iTime, iTime> SsiCamera::ShutterOpenCloseTimes(double time,
142  double exposureDuration) {
143  pair <iTime, iTime> shuttertimes;
144  // To get shutter start (open) time, subtract half exposure duration
145  shuttertimes.first = time - (exposureDuration / 2.0);
146  // To get shutter end (close) time, add half exposure duration
147  shuttertimes.second = time + (exposureDuration / 2.0);
148  return shuttertimes;
149  }
150 }
151 
152 
165  return new Isis::SsiCamera(cube);
166 }
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
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: SsiCamera.cpp:141
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
void SetDetectorLineSumming(const double summing)
Set line summing mode.
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
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Definition: PvlObject.cpp:148
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Isis::Camera * SsiCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a SsiCamera object.
Definition: SsiCamera.cpp:164
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
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
This is the camera model for the Galileo Solid State Imaging Camera.
Definition: SsiCamera.h:64
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
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
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
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