Loading [MathJax]/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
HiriseCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "HiriseCamera.h"
10 
11 #include <string>
12 #include <iomanip>
13 
14 #include <QString>
15 
16 #include "CameraDistortionMap.h"
17 #include "CameraFocalPlaneMap.h"
18 #include "iTime.h"
19 #include "LineScanCameraDetectorMap.h"
20 #include "LineScanCameraGroundMap.h"
21 #include "LineScanCameraSkyMap.h"
22 #include "NaifStatus.h"
23 
24 using namespace std;
25 namespace Isis {
33  HiriseCamera::HiriseCamera(Cube &cube) : LineScanCamera(cube) {
34  m_instrumentNameLong = "High Resolution Imaging Science Experiment";
35  m_instrumentNameShort = "HiRISE";
36  m_spacecraftNameLong = "Mars Reconnaissance Orbiter";
37  m_spacecraftNameShort = "MRO";
38 
40  // Setup camera characteristics from instrument and frame kernel
42  SetPixelPitch();
43  //LoadFrameMounting("MRO_SPACECRAFT", "MRO_HIRISE_OPTICAL_AXIS");
44  instrumentRotation()->SetFrame(-74690);
45 
46  // Get required keywords from instrument group
47  Pvl &lab = *cube.label();
48  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
49  int tdiMode = inst["Tdi"];
50  double binMode = inst["Summing"];
51  int chan = inst["ChannelNumber"];
52  int cpmm = inst["CpmmNumber"];
53  double deltaLineTimerCount = inst["DeltaLineTimerCount"];
54  QString stime = inst["SpacecraftClockStartCount"];
55 
56  // Convert CPMM number to CCD number
57  static int cpmm2ccd[] = {0, 1, 2, 3, 12, 4, 10, 11, 5, 13, 6, 7, 8, 9};
58  int ccd = cpmm2ccd[cpmm];
59 
60  // Compute the line rate, convert to seconds, and multiply by the
61  // downtrack summing
62  double unBinnedRate = (74.0 + (deltaLineTimerCount / 16.0)) / 1000000.0;
63  double lineRate = unBinnedRate * binMode;
64 
65  // Convert the spacecraft clock count to ephemeris time
66  SpiceDouble et;
67  // The -74999 is the code to select the transformation from
68  // high-precision MRO SCLK to ET
69  et = getClockTime(stime, -74999).Et();
70 
71  // Adjust the start time so that it is the effective time for
72  // the first line in the image file. Note that on 2006-03-29, this
73  // time is now subtracted as opposed to adding it. The computed start
74  // time in the EDR is at the first serial line.
75  et -= unBinnedRate * (((double) tdiMode / 2.0) - 0.5);
76  // Effective observation
77  // time for all the TDI lines used for the
78  // first line before doing binning
79  et += unBinnedRate * (((double) binMode / 2.0) - 0.5);
80  // Effective observation time of the first line
81  // in the image file, which is possibly binned
82 
83  // Compute effective line number within the CCD (in pixels) for the
84  // given TDI mode.
85  // This is the "centered" 0-based line number, where line 0 is the
86  // center of the detector array and line numbers decrease going
87  // towards the serial readout. Line number +64 sees a spot
88  // on the ground before line number 0 or -64.
89  double ccdLine_c = -64.0 + ((double) tdiMode / 2.0);
90 
91  // Setup detector map for transform of image pixels to detector position
92  // CameraDetectorMap *detectorMap =
93  // new LineScanCameraDetectorMap(this,et,lineRate);
94  LineScanCameraDetectorMap *detectorMap =
95  new LineScanCameraDetectorMap(this, et, lineRate);
96  detectorMap->SetDetectorSampleSumming(binMode);
97  detectorMap->SetDetectorLineSumming(binMode);
98  if(chan == 0) {
99  detectorMap->SetStartingDetectorSample(1025.0);
100  }
101 
102  // Setup focal plane map for transform of detector position to
103  // focal plane x/y. This will read the appropriate CCD
104  // transformation coefficients from the instrument kernel
105  CameraFocalPlaneMap *focalMap =
106  new CameraFocalPlaneMap(this, -74600 - ccd);
107  focalMap->SetDetectorOrigin(1024.5, 0.0);
108  focalMap->SetDetectorOffset(0.0, ccdLine_c);
109 
110  // Setup distortion map. This will read the optical distortion
111  // coefficients from the instrument kernel
112  CameraDistortionMap *distortionMap = new CameraDistortionMap(this);
113  distortionMap->SetDistortion(naifIkCode());
114 
115  // Setup the ground and sky map to transform undistorted focal
116  // plane x/y to lat/lon or ra/dec respectively.
117  new LineScanCameraGroundMap(this);
118  new LineScanCameraSkyMap(this);
119 
120  LoadCache();
122  }
123 
126 }
127 
128 
139 extern "C" Isis::Camera *HiriseCameraPlugin(Isis::Cube &cube) {
140  return new Isis::HiriseCamera(cube);
141 }
Isis::LineScanCameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: LineScanCameraSkyMap.h:34
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::CameraDistortionMap::SetDistortion
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
Definition: CameraDistortionMap.cpp:58
Isis::HiriseCamera
Hirise Camera Model.
Definition: HiriseCamera.h:47
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::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
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::CameraDetectorMap::SetDetectorSampleSumming
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Definition: CameraDetectorMap.h:108
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::CameraFocalPlaneMap::SetDetectorOffset
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
Definition: CameraFocalPlaneMap.cpp:324
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::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::HiriseCamera::~HiriseCamera
~HiriseCamera()
Destroys the HiriseCamera object.
Definition: HiriseCamera.cpp:125
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::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::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::CameraDetectorMap::SetStartingDetectorSample
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
Definition: CameraDetectorMap.h:79
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::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
Isis::LineScanCameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: LineScanCameraDetectorMap.h:37

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