File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
VoyagerCamera.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9
10#include "VoyagerCamera.h"
11
12#include <SpiceUsr.h>
13
14#include <QString>
15
16#include "CameraDetectorMap.h"
17#include "CameraFocalPlaneMap.h"
18#include "CameraGroundMap.h"
19#include "CameraSkyMap.h"
20#include "FileName.h"
21#include "IString.h"
22#include "iTime.h"
23#include "NaifStatus.h"
24#include "ReseauDistortionMap.h"
25#include "Spice.h"
26
27using namespace std;
28
29namespace Isis {
54
55 // Set the pixel pitch
58 // Find out what camera is being used, and set the focal length, altinstcode,
59 // and camera
60 Pvl &lab = *cube.label();
61 PvlGroup &inst = lab.findGroup ("Instrument",Pvl::Traverse);
62 QString spacecraft = (QString)inst["SpacecraftName"];
63 QString instId = (QString)inst["InstrumentId"];
64
65 QString reseauFileName = "";
66
67 // These set up which kernel and other files to access,
68 if (spacecraft == "VOYAGER_1") {
69 p_ckFrameId = -31100;
70 p_spkTargetId = -31;
71 m_spacecraftNameLong = "Voyager 1";
72 m_spacecraftNameShort = "Voyager1";
73
74 reseauFileName += "1/reseaus/vg1";
75
76 if (instId == "NARROW_ANGLE_CAMERA") {
77 reseauFileName += "na";
78 m_instrumentNameLong = "Narrow Angle Camera";
80 }
81 else if (instId == "WIDE_ANGLE_CAMERA") {
82 reseauFileName += "wa";
83 m_instrumentNameLong = "Wide Angle Camera";
85 }
86 else {
87 QString msg = "File does not appear to be a Voyager image. InstrumentId ["
88 + instId + "] is invalid Voyager value.";
89 throw IException(IException::User, msg, _FILEINFO_);
90 }
91 }
92 else if (spacecraft == "VOYAGER_2") {
93 p_ckFrameId = -32100;
94 p_spkTargetId = -32;
95 m_spacecraftNameLong = "Voyager 2";
96 m_spacecraftNameShort = "Voyager2";
97
98 reseauFileName += "2/reseaus/vg2";
99
100 if (instId == "NARROW_ANGLE_CAMERA") {
101 reseauFileName += "na";
102 m_instrumentNameLong = "Narrow Angle Camera";
103 m_instrumentNameShort = "NAC";
104 }
105 else if (instId == "WIDE_ANGLE_CAMERA") {
106 reseauFileName += "wa";
107 m_instrumentNameLong = "Wide Angle Camera";
108 m_instrumentNameShort = "WAC";
109 }
110 else {
111 QString msg = "File does not appear to be a Voyager image. InstrumentId ["
112 + instId + "] is invalid Voyager value.";
113 throw IException(IException::User, msg, _FILEINFO_);
114 }
115 }
116 else {
117 QString msg = "File does not appear to be a Voyager image. SpacecraftName ["
118 + spacecraft + "] is invalid Voyager value.";
119 throw IException(IException::User, msg, _FILEINFO_);
120 }
121
122 new CameraDetectorMap(this);
123
124 // Setup focal plane map, and detector origin
125 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
126 focalMap->SetDetectorOrigin(500.0, 500.0);
127
128 // Master reseau location file
129 reseauFileName = "$voyager" + reseauFileName + "MasterReseaus.pvl";
130 FileName masterReseaus(reseauFileName);
131 try {
132 new ReseauDistortionMap(this, lab, masterReseaus.expanded());
133 } catch (IException &e) {
134 e.print();
135 }
136
137 // Setup the ground and sky map
138 new CameraGroundMap(this);
139 new CameraSkyMap(this);
140
141 // StartTime is the most accurate time available because in voy2isis the
142 // StartTime is modified to be highly accurate.
143 // exposure duration keyword value is measured in seconds
144 double exposureDuration = inst["ExposureDuration"];
145 iTime startTime;
146 startTime.setUtc((QString)inst["StartTime"]);
147
148 // set the start (shutter open) and end (shutter close) times for the image
149 /*****************************************************************************
150 * AS NOTED IN ISIS2 PROGRAM lev1u_vgr_routines.c:
151 * StartTime (FDS count) from the labels calculated to correspond the true spacecraft
152 * clock count for the frame. The true spacecraft clock count is readout
153 * time of the frame, which occurred 2 seconds after shutter close.
154 *****************************************************************************/
155 pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(startTime.Et(),
157
158 // add half the exposure duration to the start time to get the center if the image
159 iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
160 setTime(centerTime);
161
162 LoadCache();
164 }
165
166
190 double exposureDuration) {
191 pair<iTime, iTime> shuttertimes;
192 // To get shutter end (close) time, subtract 2 seconds from the StartTime keyword value
193 shuttertimes.second = time - 2;
194 // To get shutter start (open) time, take off the exposure duration from the end time.
195 shuttertimes.first = shuttertimes.second.Et() - exposureDuration;
196 return shuttertimes;
197 }
198}
199
211extern "C" Isis::Camera *VoyagerCameraPlugin(Isis::Cube &cube) {
212 return new Isis::VoyagerCamera(cube);
213}
Convert between parent image coordinates and detector coordinates.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Convert between undistorted focal plane and ground coordinates.
QString m_spacecraftNameLong
Full spacecraft name.
Definition Camera.h:499
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition Camera.cpp:3093
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition Camera.cpp:1422
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition Camera.cpp:1429
void LoadCache()
This loads the spice cache big enough for this image.
Definition Camera.cpp:2450
QString m_instrumentNameShort
Shortened instrument name.
Definition Camera.h:498
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition Camera.h:500
QString m_instrumentNameLong
Full instrument name.
Definition Camera.h:497
Convert between undistorted focal plane and ra/dec coordinates.
IO Handler for Isis Cubes.
Definition Cube.h:168
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1734
File name manipulation and expansion.
Definition FileName.h:100
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition FileName.cpp:196
FramingCamera(Cube &cube)
Constructs the FramingCamera object.
Isis exception class.
Definition IException.h:91
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
void print() const
Prints a string representation of this exception to stderr.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
@ Traverse
Search child objects.
Definition PvlObject.h:158
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition PvlObject.h:129
Distort/undistort focal plane coordinates.
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:99
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
Voyager Camera Model.
int p_ckFrameId
"Camera-matrix" Kernel Frame ID
int p_spkTargetId
Spacecraft Kernel Target ID.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
VoyagerCamera(Cube &cube)
Constructs a Voyager Camera Model using the image labels.
Parse and return pieces of a time string.
Definition iTime.h:65
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition iTime.h:126
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.