Isis 3 Programmer Reference
IssWACamera.cpp
Go to the documentation of this file.
1 
20 // $Id: IssWACamera.cpp,v 1.6 2009/08/31 15:12:29 slambright Exp $
21 #include "IssWACamera.h"
22 
23 #include <QString>
24 
25 #include "CameraDetectorMap.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 "RadialDistortionMap.h"
33 
34 using namespace std;
35 
36 namespace Isis {
46  IssWACamera::IssWACamera(Cube &cube) : FramingCamera(cube) {
47  m_instrumentNameLong = "Imaging Science Subsystem Wide Angle";
48  m_instrumentNameShort = "ISSWA";
49  m_spacecraftNameLong = "Cassini Huygens";
50  m_spacecraftNameShort = "Cassini";
51 
53  Pvl &lab = *cube.label();
54  PvlGroup &bandBin = lab.findGroup("BandBin", Pvl::Traverse);
55  // Get the camera characteristics
56  QString key = "INS" + toString(naifIkCode()) + "_" + bandBin["FilterName"][0] + "_FOCAL_LENGTH";
57  key = key.replace("/", "_");
58  double focalLength = Spice::getDouble(key);
59 
60  SetFocalLength(focalLength);
61  SetPixelPitch();
62  instrumentRotation()->SetFrame(Spice::getInteger("INS_" + toString(naifIkCode()) + "_FRAME_ID"));
63 
64 
65  // Get the start time in et
66  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
67 
68  double et = iTime((QString)inst["StartTime"]).Et();
69 
70  // divide exposure duration keyword value by 1000 to convert to seconds
71  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
72  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
73 
74  //correct time for center of exposure duration
75  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
76 
77  // Setup detector map
78  int summingMode = inst["SummingMode"];
79  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
80  detectorMap->SetDetectorLineSumming(summingMode);
81  detectorMap->SetDetectorSampleSumming(summingMode);
82 
83  // Setup focal plane map
84  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
85 
86  focalMap->SetDetectorOrigin(Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"),
87  Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"));
88 
89  // Setup distortion map
90  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
91  new RadialDistortionMap(this, k1);
92 
93  // Setup the ground and sky map
94  new CameraGroundMap(this);
95  new CameraSkyMap(this);
96 
97  setTime(centerTime);
98  LoadCache();
100  }
101 
102 
126  pair<iTime, iTime> IssWACamera::ShutterOpenCloseTimes(double time,
127  double exposureDuration) {
129  }
130 }
131 
132 
145  return new Isis::IssWACamera(cube);
146 }
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
Cassini ISS Wide Angle Camera Model.
Definition: IssWACamera.h:73
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:949
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.
Isis::Camera * IssWACameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a IssWACamera 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.
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.
void SetFrame(int frameCode)
Change the frame to the given frame code.
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
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
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1489
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