Loading [MathJax]/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
IssNACamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 // $Id: IssNACamera.cpp,v 1.6 2009/08/31 15:12:29 slambright Exp $
9 #include "IssNACamera.h"
10 
11 #include <QString>
12 
13 #include "CameraDetectorMap.h"
14 #include "CameraFocalPlaneMap.h"
15 #include "CameraGroundMap.h"
16 #include "CameraSkyMap.h"
17 #include "IString.h"
18 #include "iTime.h"
19 #include "NaifStatus.h"
20 #include "RadialDistortionMap.h"
21 #include "iTime.h"
22 
23 using namespace std;
24 namespace Isis {
34  IssNACamera::IssNACamera(Cube &cube) : FramingCamera(cube) {
35  m_instrumentNameLong = "Imaging Science Subsystem Narrow Angle";
36  m_instrumentNameShort = "ISSNA";
37  m_spacecraftNameLong = "Cassini Huygens";
38  m_spacecraftNameShort = "Cassini";
39 
40  Pvl &lab = *cube.label();
41 
42  // Get the filter wheels positions dependent focal length.
43  // If we can not get the focal length for this specific filter wheel combination then
44  // use the default.
45  double focalLength = 0.0;
46  try {
47  PvlGroup bandBin = lab.findGroup("BandBin", Pvl::Traverse);
48  QString key = QString("INS%1_%2_FOCAL_LENGTH").
49  arg(naifIkCode()).arg(bandBin["FilterName"][0]);
50  key = key.replace("/", "_");
51  focalLength = getDouble(key);
52  }
53  catch (IException &firstException) {
54  try {
55  QString key = "INS-82360_DEFAULT_FOCAL_LENGTH";
56  focalLength = getDouble(key);
57  }
58  catch (IException &secondException) {
59  PvlGroup bandBin = lab.findGroup("BandBin", Pvl::Traverse);
61  QString("Unable to find a focal length for the requested Cassini ISS NA "
62  "filter combination [%1] or the default focal length")
63  .arg(bandBin["FilterName"][0]),
64  _FILEINFO_);
65  finalError.append(firstException);
66  finalError.append(secondException);
67  throw finalError;
68  }
69  }
70 
72 
73  SetFocalLength(focalLength);
74  SetPixelPitch();
75  instrumentRotation()->SetFrame(Spice::getInteger("INS_" + toString(naifIkCode()) + "_FRAME_ID"));
76 
77  // Get the start time in et
78  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
79 
80  double et = iTime((QString)inst["StartTime"]).Et();
81 
82  // divide exposure duration keyword value by 1000 to convert to seconds
83  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
84  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
85 
86  //correct time for center of exposure duration
87  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
88 
89  // Setup detector map
90  int summingMode = inst["SummingMode"];
91  CameraDetectorMap *detectorMap = new CameraDetectorMap(this);
92  detectorMap->SetDetectorLineSumming(summingMode);
93  detectorMap->SetDetectorSampleSumming(summingMode);
94 
95  // Setup focal plane map
96  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
97 
98  focalMap->SetDetectorOrigin(Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"),
99  Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"));
100 
101  // Setup distortion map
102  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
103  new RadialDistortionMap(this, k1);
104 
105  // Setup the ground and sky map
106  new CameraGroundMap(this);
107  new CameraSkyMap(this);
108 
109  setTime(centerTime);
110  LoadCache();
112  }
113 
137  pair<iTime, iTime> IssNACamera::ShutterOpenCloseTimes(double time,
138  double exposureDuration) {
140  }
141 }
142 
143 
155 extern "C" Isis::Camera *IssNACameraPlugin(Isis::Cube &cube) {
156  return new Isis::IssNACamera(cube);
157 }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Camera::exposureDuration
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3063
Isis::Spice::time
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition: Spice.cpp:884
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::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::CameraDetectorMap::SetDetectorSampleSumming
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Definition: CameraDetectorMap.h:108
Isis::Spice::getInteger
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1025
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::FramingCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Definition: FramingCamera.cpp:42
Isis::IssNACamera
Cassini ISS Narrow Angle Camera Model.
Definition: IssNACamera.h:63
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::FramingCamera
Generic class for Framing Cameras.
Definition: FramingCamera.h:32
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::IException::append
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
Definition: IException.cpp:409
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
Isis::Spice::instrumentRotation
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1622
Isis::CameraDetectorMap::SetDetectorLineSumming
void SetDetectorLineSumming(const double summing)
Set line summing mode.
Definition: CameraDetectorMap.h:123
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
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:97
Isis::RadialDistortionMap
Definition: RadialDistortionMap.h:18
Isis::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::IssNACamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: IssNACamera.cpp:137
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::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
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::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
Isis::Spice::getDouble
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1039
Isis::SpiceRotation::SetFrame
void SetFrame(int frameCode)
Change the frame to the given frame code.
Definition: SpiceRotation.cpp:214
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:16:43