Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
Chandrayaan2TmcCamera.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "Chandrayaan2TmcCamera.h"
10
11#include <QString>
12
13#include "Affine.h"
14#include "CameraDistortionMap.h"
15#include "CameraFocalPlaneMap.h"
16#include "IException.h"
17#include "iTime.h"
18#include "IString.h"
19#include "LineScanCameraDetectorMap.h"
20#include "LineScanCameraGroundMap.h"
21#include "LineScanCameraSkyMap.h"
22#include "NaifStatus.h"
23
24using namespace std;
25namespace Isis {
31 m_instrumentNameLong = "Terrain Mapping Camera-2";
32 m_instrumentNameShort = "TMC-2";
33 m_spacecraftNameLong = "Chandrayaan 2";
34 m_spacecraftNameShort = "Chan2";
35
37 // Set up the camera info from ik/iak kernels
39 //Chandrayaan2 iak uses INS-152???_PIXEL_SIZE instead of PIXEL_PITCH
40 QString ikernKey = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
41 // Pixel size is specified in meters, we need it in mm
42 SetPixelPitch(getDouble(ikernKey)*1000);
43
44 // Get the start time from labels
45 Pvl &lab = *cube.label();
46 PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
47 QString stime = (QString)inst["StartTime"];
48 SpiceDouble etStart=0;
49 etStart = iTime(stime).Et();
50
51 double csum = 1;
52 if (inst.hasKeyword("SpatialSumming")){
53 csum = inst["SpatialSumming"];
54 }
55 double lineRate = (double) inst["LineExposureDuration"] / 1000;
56
57 // Setup detector map
58 LineScanCameraDetectorMap *detectorMap =
59 new LineScanCameraDetectorMap(this, etStart, lineRate);
60 detectorMap->SetDetectorSampleSumming(csum);
61
62 // Setup focal plane map
63 CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
64
65 // Retrieve boresight location from instrument kernel (IK) (addendum?)
66 QString centerKey = "INS" + toString((int)naifIkCode()) + "_CENTER";
67 double sampleCenter = getDouble(centerKey, 0);
68 double lineCenter = getDouble(centerKey, 1);
69
70 focalMap->SetDetectorOrigin(sampleCenter, lineCenter);
71 focalMap->SetDetectorOffset(0.0, 0.0);
72
73 // @TODO set no distortion? No values in IK
74 // Setup distortion map
75 CameraDistortionMap *distMap = new CameraDistortionMap(this);
76 distMap->SetDistortion(naifIkCode());
77
78 // Setup the ground and sky map
80 new LineScanCameraSkyMap(this);
81
82 QString errorMsg = "Cube [" + cube.fileName() + "] has instrument [" + inst["InstrumentId"] + "]. "
83 "Support for AFT or FORE cubes is not available in the Chandrayaan2 TMC-2 ISIS camera model. Please use the CSM camera model by running csminit."
84 "For more information, see: "
85 "https://astrogeology.usgs.gov/docs/concepts/missions/chandrayaan2/";
86
87
88 // Set proper end frame
89 int tmcFrame(0);
90 if (naifIkCode() == -152210) {
91 tmcFrame = -152220;
92 }
93 else if (naifIkCode() == -152211) {
94 throw IException(IException::User, errorMsg, _FILEINFO_);
95 tmcFrame = -152221;
96 }
97 else if (naifIkCode() == -152212) {
98 throw IException(IException::User, errorMsg, _FILEINFO_);
99 tmcFrame = -152222;
100 }
101 else {
102 QString msg = "Unknown frame code [" + toString(naifIkCode()) + "] for Chandrayaan2 TMC Camera.";
103 throw IException(IException::Programmer, msg, _FILEINFO_);
104 }
105
106 instrumentRotation()->SetFrame(tmcFrame);
107
108 LoadCache();
110 }
111}
112
113
122extern "C" Isis::Camera *Chandrayaan2TmcCameraPlugin(Isis::Cube &cube) {
123 return new Isis::Chandrayaan2TmcCamera(cube);
124}
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Distort/undistort focal plane coordinates.
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOffset(const double sampleOffset, const double lineOffset)
Set the detector offset.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
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
Chandrayaan2 TMC (Terrain Mapping Camera) Camera Model.
Chandrayaan2TmcCamera(Cube &cube)
Constructs a Chandrayaan 2 TMC Camera object using the image labels.
IO Handler for Isis Cubes.
Definition Cube.h:168
virtual QString fileName() const
Returns the opened cube's filename.
Definition Cube.cpp:1837
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1975
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
LineScanCamera(Isis::Cube &cube)
Constructs the LineScanCamera object.
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.
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition Spice.cpp:1844
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition Spice.cpp:1185
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition Spice.cpp:1256
void SetFrame(int frameCode)
Change the frame to the given frame code.
Parse and return pieces of a time string.
Definition iTime.h:65
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition iTime.h:126
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.