File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
MsiCamera.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "MsiCamera.h"
10 
11 #include <QString>
12 
13 #include "CameraDetectorMap.h"
14 #include "CameraFocalPlaneMap.h"
15 #include "CameraGroundMap.h"
16 #include "CameraSkyMap.h"
17 #include "IString.h"
18 #include "iTime.h"
19 #include "NaifStatus.h"
20 #include "Plugin.h"
21 #include "RadialDistortionMap.h"
22 
23 using namespace std;
24 namespace Isis {
37  MsiCamera::MsiCamera(Cube &cube) : FramingCamera(cube) {
38  m_instrumentNameLong = "Multi-Spectral Imager";
39  m_instrumentNameShort = "MSI";
40  m_spacecraftNameLong = "Near Earth Asteroid Rendezvous";
41  m_spacecraftNameShort = "NEAR";
42 
43  Pvl &lab = *cube.label();
46  SetPixelPitch();
48 
49  // Get the start time in et
50  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
51 
52  double et = iTime((QString)inst["StartTime"]).Et();
53 
54  // divide exposure duration keyword value by 1000 to convert to seconds
55  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
56  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
57 
58  //correct time for center of exposure duration
59  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
60 
61  // Setup detector map. These images are full summing.
62  new CameraDetectorMap(this);
63 
64  // Setup focal plane map
65  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
66 
67  // Make sure to grab lines and samples in the correct order.
68  double line = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
69  double sample = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
70  focalMap->SetDetectorOrigin(sample, line);
71 
72  // Setup distortion map
73  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
74  new RadialDistortionMap(this, k1, 1);
75 
76  // Setup the ground and sky map
77  new CameraGroundMap(this);
78  new CameraSkyMap(this);
79  setTime(centerTime);
80  // Note: If the temperature-dependent instrument kernel is used,
81  // the following LoadCache() command should be replaced with the
82  // commented lines at the end of this file.
83  LoadCache();
85  }
86 
89 
115  pair<iTime, iTime> MsiCamera::ShutterOpenCloseTimes(double time,
116  double exposureDuration) {
118  }
119 
128  int MsiCamera::CkFrameId() const { return -93000; }
129 
138  int MsiCamera::CkReferenceId() const { return 1; }
139 
148 // int MsiCamera::SpkTargetId() const { return -93; }
149 
157  int MsiCamera::SpkReferenceId() const { return 1; }
158 }
159 
168 extern "C" Isis::Camera *MsiCameraPlugin(Isis::Cube &cube) {
169  return new Isis::MsiCamera(cube);
170 }
171 
172 // Comment: 2013-03-08 Jeannie Backer - The following code will adjust the
173 // camera model using the temperature dependent
174 // instrument kernel. Currently, we have decided not to
175 // implement this adjustment since it does not appear to
176 // have been applied in ISIS2. (Code exists for this in
177 // ISIS2, but without SCLK or CK, it could not have been
178 // applied).
179 
180 // if (instrumentRotation()->IsCached()) {
181 // LoadCache();
182 // }
183 // else {
184 // double toCelcius = -273.15;
185 // SpiceDouble tempCelcius = toDouble(inst["DpuDeckTemperature"][0])+toCelcius;
186 // ConstSpiceChar *nearMsiTimeDependentFrame;
187 // iTime originalTempDependencyDate("1999-12-20T00:00:00");
188 //
189 // if (centerTime.Et() <= originalTempDependencyDate.Et() ) {
190 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0000";
191 // }
192 // else {
193 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0001";
194 // }
195 //
196 // // get transformation matrix based on temperature, from spacecraft to MSI
197 // SpiceDouble sc2msiMatrix[3][3];
198 // pxform_c("J2000", nearMsiTimeDependentFrame,tempCelcius, sc2msiMatrix);
199 // NaifStatus::CheckErrors();
200 // // get current TC matrix, from j2000 to spacecraft
201 // vector<double> originalCJ = instrumentRotation()->TimeBasedMatrix();
202 // // get new CJ matrix based on temperatureBasedRotation x originalTC
203 // // now we have transformation from j2000 to msi
204 // vector<double> newCJ(9);
205 // mxm_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalCJ[0],
206 // (SpiceDouble( *)[3]) &newCJ[0]);
207 // NaifStatus::CheckErrors();
208 // // mxmg_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalTC[0],
209 // // 6, 6, 6, (SpiceDouble( *)[3]) &newCJ[0]);
210 // // set new CJ matrix
211 // instrumentRotation()->SetTimeBasedMatrix(newCJ);
212 // LoadCache();
213 // }
Isis::CameraFocalPlaneMap::SetDetectorOrigin
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
Definition: CameraFocalPlaneMap.cpp:293
Isis::Camera::exposureDuration
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3063
Isis::Spice::time
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition: Spice.cpp:884
Isis::MsiCamera::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID - Reference Frame value for J2000 from spacit run on CK.
Definition: MsiCamera.cpp:138
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::MsiCamera::SpkReferenceId
virtual int SpkReferenceId() const
SPK Target ID - Target Body value for NEAR Shoemaker from spacit run on SPK.
Definition: MsiCamera.cpp:157
Isis::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::MsiCamera
NEAR Shoemaker MSI Camera Model.
Definition: MsiCamera.h:42
Isis::MsiCamera::~MsiCamera
~MsiCamera()
Destroys the MsiCamera object.
Definition: MsiCamera.cpp:88
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::FramingCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Definition: FramingCamera.cpp:42
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::FramingCamera
Generic class for Framing Cameras.
Definition: FramingCamera.h:32
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::CameraGroundMap
Convert between undistorted focal plane and ground coordinates.
Definition: CameraGroundMap.h:73
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Sensor::setTime
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition: Sensor.cpp:97
Isis::RadialDistortionMap
Definition: RadialDistortionMap.h:18
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::MsiCamera::ShutterOpenCloseTimes
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: MsiCamera.cpp:115
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::MsiCamera::CkFrameId
virtual int CkFrameId() const
CK frame ID - Instrument Code from spacit run on CK For more details, read the Camera class documenta...
Definition: MsiCamera.cpp:128
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::CameraSkyMap
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:31
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

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