Isis 3 Programmer Reference
CTXCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "CTXCamera.h"
10 
11 #include <QString>
12 
13 #include "CameraDistortionMap.h"
14 #include "CameraFocalPlaneMap.h"
15 #include "IException.h"
16 #include "iTime.h"
17 #include "IString.h"
18 #include "LineScanCameraDetectorMap.h"
19 #include "LineScanCameraGroundMap.h"
20 #include "LineScanCameraSkyMap.h"
21 #include "NaifStatus.h"
22 
23 using namespace std;
24 namespace Isis {
33  CTXCamera::CTXCamera(Cube &cube) : LineScanCamera(cube) {
34  m_instrumentNameLong = "Context Camera";
35  m_instrumentNameShort = "CTX";
36  m_spacecraftNameLong = "Mars Reconnaissance Orbiter";
37  m_spacecraftNameShort = "MRO";
38 
40  // Set up the camera info from ik/iak kernels
42  SetPixelPitch();
43 
44  Pvl &lab = *cube.label();
45  // Get the start time from labels
46  PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
47  QString stime = inst["SpacecraftClockCount"];
48  double etStart = getClockTime(stime).Et();
49 
50  // Get other info from labels
51  double csum = inst["SpatialSumming"];
52  double lineRate = (double) inst["LineExposureDuration"] / 1000.0;
53  lineRate *= csum;
54  double ss = inst["SampleFirstPixel"];
55  ss += 1.0;
56 
57  // Setup detector map
58  LineScanCameraDetectorMap *detectorMap =
59  new LineScanCameraDetectorMap(this, etStart, lineRate);
60  detectorMap->SetDetectorSampleSumming(csum);
61  detectorMap->SetStartingDetectorSample(ss);
62 
63  // Setup focal plane map
64  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
65 
66  // Retrieve boresight location from instrument kernel (IK) (addendum?)
67  QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE";
68  double sampleBoreSight = getDouble(ikernKey);
69 
70  ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE";
71  double lineBoreSight = getDouble(ikernKey);
72 
73  focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
74  focalMap->SetDetectorOffset(0.0, 0.0);
75 
76  // Setup distortion map
77  CameraDistortionMap *distMap = new CameraDistortionMap(this);
78  distMap->SetDistortion(naifIkCode());
79 
80  // Setup the ground and sky map
81  new LineScanCameraGroundMap(this);
82  new LineScanCameraSkyMap(this);
83 
84  LoadCache();
86  }
87 }
88 
100 extern "C" Isis::Camera *CTXCameraPlugin(Isis::Cube &cube) {
101  return new Isis::CTXCamera(cube);
102 }
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::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::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::CTXCamera
MRO CTX Camera Model.
Definition: CTXCamera.h:62
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::Spice::getDouble
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1039
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