Isis 3.0 Programmer Reference
Back | Home
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 {
62  VimsCamera::VimsCamera(Cube &cube) : Camera(cube) {
63  m_instrumentNameLong = "Visible and Infrared Mapping Spectrometer";
64  m_instrumentNameShort = "VIMS";
65  m_spacecraftNameLong = "Cassini Huygens";
66  m_spacecraftNameShort = "Cassini";
67 
69 
70  Pvl &lab = *cube.label();
71  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
72  QString channel = (QString) inst ["Channel"];
73 
74  // Vims pixel pitch is not always square, but Isis does not have the ability to store
75  // more than a single value for pixel pitch. Member variables for pixelPitch x and y
76  // were created for proper calculation of ifov.
77  if (channel == "VIS") {
78  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_V");
79 
80  SetFocalLength(143.0);
81  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
82  SetPixelPitch(3 * .024);
83  // Should this .506? According to 2002 paper ground calibration shows .506 +/- .003 mrad
84  m_pixelPitchX = 0.024 * 3;
85  m_pixelPitchY = 0.024 * 3;
86  }
87  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
88  SetPixelPitch(.024);
89  m_pixelPitchX = 0.024;
90  m_pixelPitchY = 0.024;
91  }
92  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
93  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
95  }
96  else {
97  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
99  }
100  }
101  else if (channel == "IR") {
102  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_IR");
103 
104  SetFocalLength(426.0);
105  SetPixelPitch(.2);
106  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
107  m_pixelPitchX = 0.2;
108  m_pixelPitchY = 0.2;
109  }
110  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
111  m_pixelPitchX = 0.103;
112  m_pixelPitchY = 0.2;
113  }
114  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
115  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
117  }
118  else {
119  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
121  }
122  }
123 
124  // Get the start time in et
125  QString stime = inst ["NativeStartTime"][0];
126  QString intTime = stime.split(".").first();
127  stime = stime.split(".").last();
128 
129  double etStart = getClockTime(intTime).Et();
130 
131  // Add 2 seconds to either side of time range because the time are for IR
132  // channel, the VIS may actually start integrating before NATIVE_START_TIME.
133  // This insures the cache is large enough.
134  etStart += toDouble(stime) / 15959.0 - 2.;
135 
136  // Get the end time in et
137  QString etime = (QString) inst ["NativeStopTime"];
138  intTime = etime.split(".").first();
139  etime = etime.split(".").last();
140 
141  double etStop = getClockTime(intTime).Et();
142 
143  // Add 2 seconds to either side of time range because the time are for IR
144  // channel, the VIS may actually start integrating before NATIVE_START_TIME.
145  // This insures the cache is large enough.
146  etStop += toDouble(stime) / 15959.0 + 2.;
147 
148  // Setup detector map
149  new CameraDetectorMap(this);
150 
151  // Setup focal plane map
152  new CameraFocalPlaneMap(this, naifIkCode());
153 
154  // Setup distortion map
155  new CameraDistortionMap(this);
156 
157  // Setup the ground and sky map
158  new VimsGroundMap(this, lab);
159  new VimsSkyMap(this, lab);
160 
161  ((VimsGroundMap *)GroundMap())->Init(lab);
162  ((VimsSkyMap *)SkyMap())->Init(lab);
163 
164  double tol = PixelResolution();
165 
166  if (tol < 0.) {
167  // Alternative calculation of .01*ground resolution of a pixel
168  tol = PixelPitch() * SpacecraftAltitude() / FocalLength() / 1000. / 100.;
169  }
170 
171  if (channel == "VIS") createCache(etStart, etStop, 64 * 64, tol);
172  if (channel == "IR") createCache(etStart, etStop, 64 * 64, tol);
173 
174  // Call SetImage so that the et is reset to beginning of image w/o
175  // padding.
176  IgnoreProjection(true);
177  SetImage(1, 1);
178  IgnoreProjection(false);
180  return;
181  }
182 
183 
193 
194  QList<QPointF> offsets;
195 
196  // Create 100 pts on each edge of pixel
197  int npts = 100;
198 
199  // Top edge of pixel
200  for (double x = -m_pixelPitchX / 2.0; x <= m_pixelPitchX / 2.0; x += m_pixelPitchX / (npts-1)) {
201  offsets.append(QPointF(x, -m_pixelPitchY / 2.0));
202  }
203  // Right edge of pixel
204  for (double y = -m_pixelPitchY / 2.0; y <= m_pixelPitchY / 2.0; y += m_pixelPitchY / (npts-1)) {
205  offsets.append(QPointF(m_pixelPitchX / 2.0, y));
206  }
207  // Bottom edge of pixel
208  for (double x = m_pixelPitchX / 2.0; x >= -m_pixelPitchX / 2.0; x -= m_pixelPitchX / (npts-1)) {
209  offsets.append(QPointF(x, m_pixelPitchY / 2.0));
210  }
211  // Left edge of pixel
212  for (double y = m_pixelPitchY / 2.0; y >= -m_pixelPitchY / 2.0; y -= m_pixelPitchY / (npts-1)) {
213  offsets.append(QPointF(-m_pixelPitchX / 2.0, y));
214  }
215 
216  return offsets;
217  }
218 }
219 
220 // Plugin
232  return new Isis::VimsCamera(cube);
233 }
234 
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1485
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel.
Definition: VimsCamera.cpp:192
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:231
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:494
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1298
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1492
Search child objects.
Definition: PvlObject.h:170
Convert between undistorted focal plane and ground coordinates.
Definition: VimsGroundMap.h:91
void createCache(iTime startTime, iTime endTime, const int size, double tol)
This method creates an internal cache of spacecraft and sun positions over a specified time range...
Definition: Spice.cpp:569
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:154
double FocalLength() const
Returns the focal length.
Definition: Camera.cpp:2794
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:135
CameraSkyMap * SkyMap()
Returns a pointer to the CameraSkyMap object.
Definition: Camera.cpp:2926
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:166
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:495
CameraGroundMap * GroundMap()
Returns a pointer to the CameraGroundMap object.
Definition: Camera.cpp:2916
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
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
double SpacecraftAltitude()
Returns the distance from the spacecraft to the subspacecraft point in km.
Definition: Sensor.cpp:689
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:496
double PixelPitch() const
Returns the pixel pitch.
Definition: Camera.cpp:2804
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
Definition: Camera.cpp:744
Isis exception class.
Definition: IException.h:99
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:888
iTime getClockTime(QString clockValue, int sclkCode=-1)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:969
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:497
void IgnoreProjection(bool ignore)
Set whether or not the camera should ignore the Projection.
Definition: Camera.cpp:2975
Cassini Vims camera model.
Definition: VimsCamera.h:85
IO Handler for Isis Cubes.
Definition: Cube.h:158

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:31:36