Isis 3 Programmer Reference
Mariner10Camera.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "Mariner10Camera.h"
10
11#include <iostream>
12#include <iomanip>
13
14#include <SpiceUsr.h>
15#include <SpiceZfc.h>
16#include <SpiceZmc.h>
17
18#include <QString>
19
20#include "CameraDetectorMap.h"
21#include "CameraFocalPlaneMap.h"
22#include "CameraGroundMap.h"
23#include "CameraSkyMap.h"
24#include "IString.h"
25#include "iTime.h"
26#include "FileName.h"
27#include "NaifStatus.h"
28#include "Pvl.h"
29#include "ReseauDistortionMap.h"
30
31using namespace std;
32namespace Isis {
47
48 m_spacecraftNameLong = "Mariner 10";
49 m_spacecraftNameShort = "Mariner10";
50
51 // Turn off the aberration corrections for instrument position object
52 instrumentPosition()->SetAberrationCorrection("NONE");
53 instrumentRotation()->SetFrame(-76000);
54
55 // Set camera parameters
58
59 Pvl &lab = *cube.label();
60 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
61 // Get utc start time
62 QString stime = inst["StartTime"];
63
64 iTime startTime;
65 startTime.setUtc((QString)inst["StartTime"]);
66 setTime(startTime);
67
68 // Setup detector map
69 new CameraDetectorMap(this);
70
71 // Setup focal plane map, and detector origin
72 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
73
74 QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE";
75 double sampleBoresight = getDouble(ikernKey);
76 ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE";
77 double lineBoresight = getDouble(ikernKey);
78
79 focalMap->SetDetectorOrigin(sampleBoresight, lineBoresight);
80
81 // Setup distortion map which is dependent on encounter, use start time
82 // MOON: 1973-11-08T03:16:26.350
83 QString spacecraft = (QString)inst["SpacecraftName"];
84 QString instId = (QString)inst["InstrumentId"];
85 QString cam;
86 if(instId == "M10_VIDICON_A") {
87 cam = "a";
88 m_instrumentNameLong = "Mariner 10 Vidicon A";
89 m_instrumentNameShort = "VIDICON A";
90 }
91 else if(instId == "M10_VIDICON_B") {
92 cam = "b";
93 m_instrumentNameLong = "Mariner 10 Vidicon B";
94 m_instrumentNameShort = "VIDICON B";
95 }
96 else {
97 QString msg = "File does not appear to be a Mariner10 image. InstrumentId ["
98 + instId + "] is invalid Mariner 10 value.";
99 throw IException(IException::User, msg, _FILEINFO_);
100 }
101
102 QString fname = FileName("$mariner10/reseaus/mar10" + cam
103 + "MasterReseaus.pvl").expanded();
104
105 try {
106 new ReseauDistortionMap(this, lab, fname);
107 }
108 catch(IException &e) {
109 string msg = "Unable to create distortion map.";
110 throw IException(e, IException::Programmer, msg, _FILEINFO_);
111 }
112
113 // Setup the ground and sky map
114 new CameraGroundMap(this);
115 new CameraSkyMap(this);
116
117 LoadCache();
119 }
120
121
143 pair<iTime, iTime> Mariner10Camera::ShutterOpenCloseTimes(double time,
144 double exposureDuration) {
145 pair<iTime, iTime> shuttertimes;
146 // To get shutter start (open) time, subtract half exposure duration
147 shuttertimes.first = time - (exposureDuration / 2.0);
148 // To get shutter end (close) time, add half exposure duration
149 shuttertimes.second = time + (exposureDuration / 2.0);
150 return shuttertimes;
151 }
152}
153
154
163extern "C" Isis::Camera *Mariner10CameraPlugin(Isis::Cube &cube) {
164 return new Isis::Mariner10Camera(cube);
165}
Convert between parent image coordinates and detector coordinates.
Convert between distorted focal plane and detector coordinates.
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:1707
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
Generic class for Framing Cameras.
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
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Mariner10 Camera Model.
Mariner10Camera(Cube &cube)
Creates a Mariner10 Camera Model.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
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
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
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition Spice.cpp:1634
virtual SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition Spice.cpp:1612
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition Spice.cpp:1046
Parse and return pieces of a time string.
Definition iTime.h:65
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
Namespace for the standard library.