File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
NewHorizonsLeisaCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "NewHorizonsLeisaCamera.h"
10 
11 #include <QDebug>
12 #include <QString>
13 #include <QVector>
14 
15 #include "NaifStatus.h"
16 #include "iTime.h"
17 #include "LineScanCameraGroundMap.h"
18 #include "LineScanCameraSkyMap.h"
19 #include "CameraFocalPlaneMap.h"
20 #include "LineScanCameraDetectorMap.h"
21 
22 using namespace std;
23 
24 namespace Isis {
25 
39  NewHorizonsLeisaCamera::NewHorizonsLeisaCamera(Cube &cube) : LineScanCamera(cube) {
40  m_instrumentNameLong = "Linear Etalon Imaging Spectral Array";
41  m_instrumentNameShort = "LEISA";
42  m_spacecraftNameLong = "New Horizons";
43  m_spacecraftNameShort = "NewHorizons";
44 
45  // Override the SPICE error process for SPICE calls
47 
49  SetPixelPitch();
50 
51  Pvl &lab = *cube.label();
52  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
53  QString expDuration = inst["ExposureDuration"];
54 
55  QString stime = inst["SpacecraftClockStartCount"];
56  double m_etStart = getClockTime(stime).Et();
57 
58  // The line rate is set to the time between each frame since we are treating LEASA as a linescan
59  double m_lineRate = expDuration.toDouble();
60 
61  // The detector map tells us how to convert from image coordinates to
62  // detector coordinates. In our case, a (sample,line) to a (sample,time)
63  new LineScanCameraDetectorMap(this, m_etStart, m_lineRate);
64 
65  // The focal plane map tells us how to go from detector position
66  // to focal plane x/y (distorted). That is, (sample,time) to (x,y) and back.
67  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
68  focalMap->SetDetectorOrigin(128.5, 128.5);
69 
70  // Pull out the focal plane map affine coefficients so we can use them to adjust when the band
71  // is changed. The coefficients as read from the iak are only valid for band 2. The constant
72  // terms need to be multiplied by band-1 and then put back into the focal plane map
73  m_origTransl.append(focalMap->TransL()[0]);
74  m_origTransl.append(focalMap->TransL()[1]);
75  m_origTransl.append(focalMap->TransL()[2]);
76 
77  m_origTranss.append(focalMap->TransS()[0]);
78  m_origTranss.append(focalMap->TransS()[1]);
79  m_origTranss.append(focalMap->TransS()[2]);
80 
81  m_origTransx.append(focalMap->TransX()[0]);
82  m_origTransx.append(focalMap->TransX()[1]);
83  m_origTransx.append(focalMap->TransX()[2]);
84 
85  m_origTransy.append(focalMap->TransY()[0]);
86  m_origTransy.append(focalMap->TransY()[1]);
87  m_origTransy.append(focalMap->TransY()[2]);
88 
89  // If bands have been extracted from the original image then we need to read the band bin group
90  // so we can map from the cube band number to the instrument band number
91  PvlGroup &bandBin = lab.findGroup("BandBin", Pvl::Traverse);
92  PvlKeyword &orgBand = bandBin["OriginalBand"];
93  for (int i = 0; i < orgBand.size(); i++) {
94  m_originalBand.append(toInt(orgBand[i]));
95  }
96 
97  // Use the defualt no correction distortion map.
98  new CameraDistortionMap(this);
99 
100  // Setup the ground and sky map
101  new LineScanCameraGroundMap(this);
102  new LineScanCameraSkyMap(this);
103 
104  LoadCache();
105 
106  // Check to see if there were any SPICE errors
108  }
109 
110 
119  void NewHorizonsLeisaCamera::SetBand(const int vband) {
120  if ( (vband < 1) || (vband > m_originalBand.size())) {
121  QString msg = QObject::tr("Band number out of array bounds in NewHorizonsLeisaCamera::SetBand "
122  "legal bands are [1-%1], input was [%2]").
123  arg(m_originalBand.size()).arg(vband);
124  throw IException(IException::Programmer, msg, _FILEINFO_);
125  }
126  int band;
127  band = m_originalBand[vband-1];
128  Camera::SetBand(vband);
129 
130  // Get the affine coefficients from the focal plane map and adjust the constant terms to
131  // provide the correct Y/Line offset for this band
132  QVector<double> temp;
133 
134  temp.append(m_origTransl[0] * (band - 1));
135  temp.append(m_origTransl[1]);
136  temp.append(m_origTransl[2]);
137  this->FocalPlaneMap()->SetTransL(temp);
138  temp.clear();
139 
140 
141  temp.append(m_origTranss[0] * (band - 1));
142  temp.append(m_origTranss[1]);
143  temp.append(m_origTranss[2]);
144  this->FocalPlaneMap()->SetTransS(temp);
145  temp.clear();
146 
147  temp.append(m_origTransx[0] * (band - 1));
148  temp.append(m_origTransx[1]);
149  temp.append(m_origTransx[2]);
150  this->FocalPlaneMap()->SetTransX(temp);
151  temp.clear();
152 
153  temp.append(m_origTransy[0] * (band - 1));
154  temp.append(m_origTransy[1]);
155  temp.append(m_origTransy[2]);
156  this->FocalPlaneMap()->SetTransY(temp);
157 
158  }
159 }
160 
161 
171 extern "C" Isis::Camera *NewHorizonsLeisaCameraPlugin(Isis::Cube &cube) {
172  return new Isis::NewHorizonsLeisaCamera(cube);
173 }
Isis::LineScanCameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: LineScanCameraSkyMap.h:34
Isis::Camera::SetBand
virtual void SetBand(const int band)
Virtual method that sets the band number.
Definition: Camera.cpp:2680
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::CameraFocalPlaneMap::SetTransS
void SetTransS(const QVector< double > transS)
Set the affine coefficients for converting destorted (x,y) to a detector Sample.
Definition: CameraFocalPlaneMap.cpp:364
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::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::CameraFocalPlaneMap::SetTransX
void SetTransX(const QVector< double > transX)
Set the affine coefficients for converting detector (sample,line) to a distorted X.
Definition: CameraFocalPlaneMap.cpp:376
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::NewHorizonsLeisaCamera
This is the camera model for LEISA, New Hoirzon's infrared Spectrometer.
Definition: NewHorizonsLeisaCamera.h:36
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NewHorizonsLeisaCamera::m_origTransy
QVector< double > m_origTransy
The original transy affine coefficients from the iak.
Definition: NewHorizonsLeisaCamera.h:80
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::NewHorizonsLeisaCamera::SetBand
void SetBand(const int vband)
Change the New Horizons camera parameters based on the band number.
Definition: NewHorizonsLeisaCamera.cpp:119
Isis::Camera
Definition: Camera.h:236
Isis::CameraFocalPlaneMap::TransX
const double * TransX() const
Definition: CameraFocalPlaneMap.cpp:398
Isis::NewHorizonsLeisaCamera::m_origTranss
QVector< double > m_origTranss
The original transs affine coefficients from the iak.
Definition: NewHorizonsLeisaCamera.h:81
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::CameraFocalPlaneMap::TransL
const double * TransL() const
Definition: CameraFocalPlaneMap.cpp:422
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::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::NewHorizonsLeisaCamera::m_originalBand
QVector< int > m_originalBand
Stores the band bin OriginalBand keyword values.
Definition: NewHorizonsLeisaCamera.h:77
Isis::CameraFocalPlaneMap::TransY
const double * TransY() const
Definition: CameraFocalPlaneMap.cpp:406
Isis::CameraFocalPlaneMap::SetTransY
void SetTransY(const QVector< double > transY)
Set the affine coefficients for converting detector (sample,line) to a distorted Y.
Definition: CameraFocalPlaneMap.cpp:388
Isis::LineScanCamera
Generic class for Line Scan Cameras.
Definition: LineScanCamera.h:36
Isis::LineScanCameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: LineScanCameraGroundMap.h:49
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::CameraFocalPlaneMap::TransS
const double * TransS() const
Definition: CameraFocalPlaneMap.cpp:414
Isis::Camera::FocalPlaneMap
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition: Camera.cpp:2836
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::NewHorizonsLeisaCamera::m_origTransl
QVector< double > m_origTransl
The original transl affine coefficients from the iak.
Definition: NewHorizonsLeisaCamera.h:82
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::PvlKeyword::size
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:125
Isis::CameraFocalPlaneMap::SetTransL
void SetTransL(const QVector< double > transL)
Set the affine coefficients for converting destorted (x,y) to a detector Line.
Definition: CameraFocalPlaneMap.cpp:352
QVector< double >
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
Isis::LineScanCameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: LineScanCameraDetectorMap.h:37
Isis::NewHorizonsLeisaCamera::m_origTransx
QVector< double > m_origTransx
The original transx affine coefficients from the iak.
Definition: NewHorizonsLeisaCamera.h:79

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:56