Isis 3 Programmer Reference
VimsCamera.cpp
Go to the documentation of this file.
1 
21 #include "VimsCamera.h"
22 #include "VimsGroundMap.h"
23 #include "VimsSkyMap.h"
24 
25 #include <fstream>
26 #include <iostream>
27 #include <iomanip>
28 
29 #include <QDebug>
30 #include <QList>
31 #include <QPointF>
32 #include <QString>
33 
34 #include "CameraDetectorMap.h"
35 #include "CameraDistortionMap.h"
36 #include "CameraFocalPlaneMap.h"
37 #include "Constants.h"
38 #include "FileName.h"
39 #include "IException.h"
40 #include "IString.h"
41 #include "iTime.h"
42 #include "NaifStatus.h"
43 #include "SpecialPixel.h"
44 
45 using namespace std;
46 
47 namespace Isis {
65  VimsCamera::VimsCamera(Cube &cube) : Camera(cube) {
66  m_instrumentNameLong = "Visible and Infrared Mapping Spectrometer";
67  m_instrumentNameShort = "VIMS";
68  m_spacecraftNameLong = "Cassini Huygens";
69  m_spacecraftNameShort = "Cassini";
70 
72 
73  Pvl &lab = *cube.label();
74  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
75  QString channel = (QString) inst ["Channel"];
76 
77  // Vims pixel pitch is not always square, but Isis does not have the ability to store
78  // more than a single value for pixel pitch. Member variables for pixelPitch x and y
79  // were created for proper calculation of ifov.
80  if (channel == "VIS") {
81  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_V");
82 
83  SetFocalLength(143.0);
84  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
85  SetPixelPitch(3 * .024);
86  // Should this .506? According to 2002 paper ground calibration shows .506 +/- .003 mrad
87  m_pixelPitchX = 0.024 * 3;
88  m_pixelPitchY = 0.024 * 3;
89  }
90  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
91  SetPixelPitch(.024);
92  m_pixelPitchX = 0.024;
93  m_pixelPitchY = 0.024;
94  }
95  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
96  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
98  }
99  else {
100  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
102  }
103  }
104  else if (channel == "IR") {
105  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_IR");
106 
107  SetFocalLength(426.0);
108  SetPixelPitch(.2);
109  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
110  m_pixelPitchX = 0.2;
111  m_pixelPitchY = 0.2;
112  }
113  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
114  m_pixelPitchX = 0.103;
115  m_pixelPitchY = 0.2;
116  }
117  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
118  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
120  }
121  else {
122  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
124  }
125  }
126 
127  // Get the start time in et
128  QString stime = inst ["NativeStartTime"][0];
129  QString intTime = stime.split(".").first();
130  stime = stime.split(".").last();
131 
132  double etStart = getClockTime(intTime).Et();
133 
134  // Add 2 seconds to either side of time range because the time are for IR
135  // channel, the VIS may actually start integrating before NATIVE_START_TIME.
136  // This insures the cache is large enough.
137  etStart += toDouble(stime) / 15959.0 - 2.;
138 
139  // Get the end time in et
140  QString etime = (QString) inst ["NativeStopTime"];
141  intTime = etime.split(".").first();
142  etime = etime.split(".").last();
143 
144  double etStop = getClockTime(intTime).Et();
145 
146  // Add 2 seconds to either side of time range because the time are for IR
147  // channel, the VIS may actually start integrating before NATIVE_START_TIME.
148  // This insures the cache is large enough.
149  etStop += toDouble(stime) / 15959.0 + 2.;
150 
151  // Setup detector map
152  new CameraDetectorMap(this);
153 
154  // Setup focal plane map
155  new CameraFocalPlaneMap(this, naifIkCode());
156 
157  // Setup distortion map
158  new CameraDistortionMap(this);
159 
160  // Setup the ground and sky map
161  new VimsGroundMap(this, lab);
162  new VimsSkyMap(this, lab);
163 
164  ((VimsGroundMap *)GroundMap())->Init(lab);
165  ((VimsSkyMap *)SkyMap())->Init(lab);
166 
167  LoadCache();
168 
169  IgnoreProjection(true);
170  SetImage(1, 1);
171  IgnoreProjection(false);
173  return;
174  }
175 
176 
186 
187  QList<QPointF> offsets;
188 
189  // Create 100 pts on each edge of pixel
190  int npts = 100;
191 
192  // Top edge of pixel
193  for (double x = -m_pixelPitchX / 2.0; x <= m_pixelPitchX / 2.0; x += m_pixelPitchX / (npts-1)) {
194  offsets.append(QPointF(x, -m_pixelPitchY / 2.0));
195  }
196  // Right edge of pixel
197  for (double y = -m_pixelPitchY / 2.0; y <= m_pixelPitchY / 2.0; y += m_pixelPitchY / (npts-1)) {
198  offsets.append(QPointF(m_pixelPitchX / 2.0, y));
199  }
200  // Bottom edge of pixel
201  for (double x = m_pixelPitchX / 2.0; x >= -m_pixelPitchX / 2.0; x -= m_pixelPitchX / (npts-1)) {
202  offsets.append(QPointF(x, m_pixelPitchY / 2.0));
203  }
204  // Left edge of pixel
205  for (double y = m_pixelPitchY / 2.0; y >= -m_pixelPitchY / 2.0; y -= m_pixelPitchY / (npts-1)) {
206  offsets.append(QPointF(-m_pixelPitchX / 2.0, y));
207  }
208 
209  return offsets;
210  }
211 }
212 
213 // Plugin
225  return new Isis::VimsCamera(cube);
226 }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel.
Definition: VimsCamera.cpp:185
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Isis::Camera * VimsCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a VimsCamera object.
Definition: VimsCamera.cpp:224
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
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
Convert between undistorted focal plane and ground coordinates.
Definition: VimsGroundMap.h:91
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
CameraSkyMap * SkyMap()
Returns a pointer to the CameraSkyMap object.
Definition: Camera.cpp:2878
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Definition: Camera.cpp:170
Convert between parent image coordinates and detector coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
CameraGroundMap * GroundMap()
Returns a pointer to the CameraGroundMap object.
Definition: Camera.cpp:2868
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
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
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
Convert between undistorted focal plane and ground coordinates.
Definition: VimsSkyMap.h:60
Distort/undistort focal plane coordinates.
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
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
void IgnoreProjection(bool ignore)
Set whether or not the camera should ignore the Projection.
Definition: Camera.cpp:2937
Cassini Vims camera model.
Definition: VimsCamera.h:88
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
IO Handler for Isis Cubes.
Definition: Cube.h:170