Isis 3 Programmer Reference
JunoCamera.cpp
Go to the documentation of this file.
1 
22 #include "JunoCamera.h"
23 
24 #include <QDebug>
25 #include <QString>
26 
27 #include "CameraDetectorMap.h"
28 #include "CameraFocalPlaneMap.h"
29 #include "CameraGroundMap.h"
30 #include "CameraSkyMap.h"
31 #include "iTime.h"
32 #include "JunoDistortionMap.h"
33 #include "NaifStatus.h"
34 
35 using namespace std;
36 
37 namespace Isis {
44  JunoCamera::JunoCamera(Cube &cube) : FramingCamera(cube) {
45 
46  m_instrumentNameLong = "Juno EPO Camera";
47  m_instrumentNameShort = "JNC"; // or JunoCam?
48 
49  m_spacecraftNameLong = "Juno";
50  m_spacecraftNameShort = "Juno";
51 
53 
54  // Set up the camera characteristics
57  SetPixelPitch();
58 
59  // Get all the necessary stuff from the labels
60  Pvl &lab = *cube.label();
61  const PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
62 
63  // Get summing mode
64  // Summing modes are:
65  // 1 = 1x1 (No summing)
66  // 2 = 2x2
67  int sumMode = (int) inst["SummingMode"];
68  int summing = sumMode;
69 
70  // Setup camera detector map
71  CameraDetectorMap *detMap = new CameraDetectorMap(this);
72  if ( summing > 0 ) {
73  detMap->SetDetectorSampleSumming(summing);
74  detMap->SetDetectorLineSumming(summing);
75  }
76 
77  // Juno codes
78  int junoCode = naifIkCode();
79  QString juno = toString(junoCode);
80 
81  // Setup focal plane map and set Juno detector boresight
82  new CameraFocalPlaneMap(this, junoCode);
83  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, junoCode);
84  double bsSample = getDouble("INS" + juno + "_BORESIGHT_SAMPLE");
85  double bsLine = getDouble("INS" + juno + "_BORESIGHT_LINE");
86  focalMap->SetDetectorOrigin(bsSample, bsLine);
87 
88  // Set starting filter location on the detector
89  const PvlGroup &bandBin = lab.findGroup("BandBin", Pvl::Traverse);
90  QString filterIkCode = bandBin.findKeyword("NaifIkCode")[0];
91  detMap->SetStartingDetectorLine(getDouble("INS" + filterIkCode + "_FILTER_OFFSET"));
92 
93  // Set up distortion map, keeping z-direction positive JunoDistortion map defaults to z+
94  JunoDistortionMap *distortionMap = new JunoDistortionMap(this);
95  distortionMap->SetDistortion(CkFrameId());
96 
97  // Setup the ground and sky map
98  new CameraGroundMap(this);
99  new CameraSkyMap(this);
100 
101  // Set time based on clock count, frame number, exposure duration, and interframe delay
102  QString startClockCount = inst["SpacecraftClockStartCount"];
103  double observationStartEt = getClockTime(startClockCount).Et(); // in seconds
104  double frameNumber = (double) inst["FrameNumber"];
105  double interFrameDelay = (double) inst["InterFrameDelay"]; // in seconds
106  double exposureDur = ((double) inst["ExposureDuration"]) / 1000.0; // in seconds
107 
108  // Get the fixed time biases
109  double startTimeBias = getDouble("INS" + juno + "_START_TIME_BIAS");
110  double interFrameDelayBias = getDouble("INS" + juno + "_INTERFRAME_DELTA");
111 
112  // get start et for this frame, in seconds
113  double frameStartEt = observationStartEt + startTimeBias + (frameNumber - 1)
114  * (interFrameDelay + interFrameDelayBias);
115  // Set start time to center of exposure time to ensure the proper SPICE data is cached.
116  setTime(frameStartEt + exposureDur / 2.0);
117 
118  LoadCache();
120  }
121 
122 
127  }
128 
129 
147  pair <iTime, iTime> JunoCamera::ShutterOpenCloseTimes(double time,
148  double exposureDuration) {
149 
151  }
152 
153 
160  int JunoCamera::CkFrameId() const {
161  return -61500;
162  }
163 
164 
172  return 1;
173  }
174 
175 
183  return -61;
184  }
185 
186 
194  return 1;
195  }
196 
197 }
198 
208  return new Isis::JunoCamera(cube);
209 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
virtual int SpkReferenceId() const
Retrieves the J2000 SPK Reference ID for the JunoCam instrument.
Definition: JunoCamera.cpp:193
virtual int SpkTargetId() const
Retrieves the SPK Target Body ID for the JunoCam instrument.
Definition: JunoCamera.cpp:182
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: JunoCamera.cpp:147
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients for JunoCam.
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
virtual int CkFrameId() const
Retrieves the CK frame ID for the JunoCam instrument.
Definition: JunoCamera.cpp:160
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.
~JunoCamera()
Destroys the JunoCamera object.
Definition: JunoCamera.cpp:126
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.
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
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
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
Distort/undistort focal plane coordinates for Juno&#39;s JunoCam camera.
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
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
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
Isis::Camera * JunoCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a JunoCamera object.
Definition: JunoCamera.cpp:207
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
Juno&#39;s JNC (JunoCam) camera model.
Definition: JunoCamera.h:47
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
virtual int CkReferenceId() const
Retrieves the J2000 CK Reference ID for the JunoCam instrument.
Definition: JunoCamera.cpp:171
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