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
24using namespace std;
25namespace Isis {
34 m_instrumentNameLong = "High Resolution Imaging Science Experiment";
35 m_instrumentNameShort = "HiRISE";
36 m_spacecraftNameLong = "Mars Reconnaissance Orbiter";
38
40 // Setup camera characteristics from instrument and frame kernel
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
139extern "C" Isis::Camera *HiriseCameraPlugin(Isis::Cube &cube) {
140 return new Isis::HiriseCamera(cube);
141}
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_spacecraftNameLong
Full spacecraft name.
Definition Camera.h:499
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
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
Hirise Camera Model.
HiriseCamera(Cube &cube)
Creates a Hirise Camera Model.
~HiriseCamera()
Destroys the HiriseCamera object.
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Generic class for Line Scan Cameras.
Convert between undistorted focal plane and ra/dec coordinates.
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
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:1060
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition Spice.cpp:1634
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:975
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.