File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
VimsCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "VimsCamera.h"
10 #include "VimsGroundMap.h"
11 #include "VimsSkyMap.h"
12 
13 #include <fstream>
14 #include <iostream>
15 #include <iomanip>
16 
17 #include <QDebug>
18 #include <QList>
19 #include <QPointF>
20 #include <QString>
21 
22 #include "CameraDetectorMap.h"
23 #include "CameraDistortionMap.h"
24 #include "CameraFocalPlaneMap.h"
25 #include "Constants.h"
26 #include "FileName.h"
27 #include "IException.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "NaifStatus.h"
31 #include "SpecialPixel.h"
32 
33 using namespace std;
34 
35 namespace Isis {
53  VimsCamera::VimsCamera(Cube &cube) : Camera(cube) {
54  m_instrumentNameLong = "Visible and Infrared Mapping Spectrometer";
55  m_instrumentNameShort = "VIMS";
56  m_spacecraftNameLong = "Cassini Huygens";
57  m_spacecraftNameShort = "Cassini";
58 
60 
61  Pvl &lab = *cube.label();
62  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
63  QString channel = (QString) inst ["Channel"];
64 
65  // Vims pixel pitch is not always square, but ISISdoes not have the ability to store
66  // more than a single value for pixel pitch. Member variables for pixelPitch x and y
67  // were created for proper calculation of ifov.
68  if (channel == "VIS") {
69  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_V");
70 
71  SetFocalLength(143.0);
72  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
73  SetPixelPitch(3 * .024);
74  // Should this .506? According to 2002 paper ground calibration shows .506 +/- .003 mrad
75  m_pixelPitchX = 0.024 * 3;
76  m_pixelPitchY = 0.024 * 3;
77  }
78  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
79  SetPixelPitch(.024);
80  m_pixelPitchX = 0.024;
81  m_pixelPitchY = 0.024;
82  }
83  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
84  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
85  throw IException(IException::Programmer, msg, _FILEINFO_);
86  }
87  else {
88  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
89  throw IException(IException::Programmer, msg, _FILEINFO_);
90  }
91  }
92  else if (channel == "IR") {
93  //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_IR");
94 
95  SetFocalLength(426.0);
96  SetPixelPitch(.2);
97  if (QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") {
98  m_pixelPitchX = 0.2;
99  m_pixelPitchY = 0.2;
100  }
101  else if (QString((QString)inst["SamplingMode"]).toUpper() == "HI-RES") {
102  m_pixelPitchX = 0.103;
103  m_pixelPitchY = 0.2;
104  }
105  else if (QString((QString)inst["SamplingMode"]).toUpper() == "UNDER") {
106  QString msg = "Isis cannot process images with a SamplingMode = \"UNDER\" (or NYQUIST)";
107  throw IException(IException::Programmer, msg, _FILEINFO_);
108  }
109  else {
110  QString msg = "Unknown SamplingMode [" + (QString) inst["SamplingMode"] + "]";
111  throw IException(IException::Programmer, msg, _FILEINFO_);
112  }
113  }
114 
115  // Get the start time in et
116  QString stime = inst ["NativeStartTime"][0];
117  QString intTime = stime.split(".").first();
118  stime = stime.split(".").last();
119 
120  double etStart = getClockTime(intTime).Et();
121 
122  // Add 2 seconds to either side of time range because the time are for IR
123  // channel, the VIS may actually start integrating before NATIVE_START_TIME.
124  // This insures the cache is large enough.
125  etStart += toDouble(stime) / 15959.0 - 2.;
126 
127  // Get the end time in et
128  QString etime = (QString) inst ["NativeStopTime"];
129  intTime = etime.split(".").first();
130  etime = etime.split(".").last();
131 
132  double etStop = 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  etStop += toDouble(stime) / 15959.0 + 2.;
138 
139  // Setup detector map
140  new CameraDetectorMap(this);
141 
142  // Setup focal plane map
143  new CameraFocalPlaneMap(this, naifIkCode());
144 
145  // Setup distortion map
146  new CameraDistortionMap(this);
147 
148  // Setup the ground and sky map
149  new VimsGroundMap(this, lab);
150  new VimsSkyMap(this, lab);
151 
152  ((VimsGroundMap *)GroundMap())->Init(lab);
153  ((VimsSkyMap *)SkyMap())->Init(lab);
154 
155  LoadCache();
156 
157  IgnoreProjection(true);
158  SetImage(1, 1);
159  IgnoreProjection(false);
161  return;
162  }
163 
164 
174 
175  QList<QPointF> offsets;
176 
177  // Create 100 pts on each edge of pixel
178  int npts = 100;
179 
180  // Top edge of pixel
181  for (double x = -m_pixelPitchX / 2.0; x <= m_pixelPitchX / 2.0; x += m_pixelPitchX / (npts-1)) {
182  offsets.append(QPointF(x, -m_pixelPitchY / 2.0));
183  }
184  // Right edge of pixel
185  for (double y = -m_pixelPitchY / 2.0; y <= m_pixelPitchY / 2.0; y += m_pixelPitchY / (npts-1)) {
186  offsets.append(QPointF(m_pixelPitchX / 2.0, y));
187  }
188  // Bottom edge of pixel
189  for (double x = m_pixelPitchX / 2.0; x >= -m_pixelPitchX / 2.0; x -= m_pixelPitchX / (npts-1)) {
190  offsets.append(QPointF(x, m_pixelPitchY / 2.0));
191  }
192  // Left edge of pixel
193  for (double y = m_pixelPitchY / 2.0; y >= -m_pixelPitchY / 2.0; y -= m_pixelPitchY / (npts-1)) {
194  offsets.append(QPointF(-m_pixelPitchX / 2.0, y));
195  }
196 
197  return offsets;
198  }
199 }
200 
201 // Plugin
212 extern "C" Isis::Camera *VimsCameraPlugin(Isis::Cube &cube) {
213  return new Isis::VimsCamera(cube);
214 }
Isis::Camera::IgnoreProjection
void IgnoreProjection(bool ignore)
Set whether or not the camera should ignore the Projection.
Definition: Camera.cpp:2925
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::Camera::SkyMap
CameraSkyMap * SkyMap()
Returns a pointer to the CameraSkyMap object.
Definition: Camera.cpp:2866
QList< QPointF >
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::Camera::SetImage
virtual 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:154
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::Spice::getClockTime
virtual iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:1053
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::Camera
Definition: Camera.h:236
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::VimsSkyMap
Convert between undistorted focal plane and ground coordinates.
Definition: VimsSkyMap.h:46
Isis::VimsCamera::PixelIfovOffsets
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel.
Definition: VimsCamera.cpp:173
Isis::CameraDistortionMap
Distort/undistort focal plane coordinates.
Definition: CameraDistortionMap.h:41
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
Isis::Camera::LoadCache
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2420
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::CameraFocalPlaneMap
Convert between distorted focal plane and detector coordinates.
Definition: CameraFocalPlaneMap.h:85
Isis::Camera::GroundMap
CameraGroundMap * GroundMap()
Returns a pointer to the CameraGroundMap object.
Definition: Camera.cpp:2856
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::VimsCamera
Cassini Vims camera model.
Definition: VimsCamera.h:76
Isis::VimsGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: VimsGroundMap.h:77
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

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 USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:17:27