Isis 3 Programmer Reference
MsiCamera.cpp
Go to the documentation of this file.
1 
20 #include "MsiCamera.h"
21 
22 #include <QString>
23 
24 #include "CameraDetectorMap.h"
25 #include "CameraFocalPlaneMap.h"
26 #include "CameraGroundMap.h"
27 #include "CameraSkyMap.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "NaifStatus.h"
31 #include "Plugin.h"
32 #include "RadialDistortionMap.h"
33 
34 using namespace std;
35 namespace Isis {
48  MsiCamera::MsiCamera(Cube &cube) : FramingCamera(cube) {
49  m_instrumentNameLong = "Multi-Spectral Imager";
50  m_instrumentNameShort = "MSI";
51  m_spacecraftNameLong = "Near Earth Asteroid Rendezvous";
52  m_spacecraftNameShort = "NEAR";
53 
54  Pvl &lab = *cube.label();
57  SetPixelPitch();
59 
60  // Get the start time in et
61  PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
62 
63  double et = iTime((QString)inst["StartTime"]).Et();
64 
65  // divide exposure duration keyword value by 1000 to convert to seconds
66  double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;
67  pair<iTime, iTime> shuttertimes = ShutterOpenCloseTimes(et, exposureDuration);
68 
69  //correct time for center of exposure duration
70  iTime centerTime = shuttertimes.first.Et() + exposureDuration / 2.0;
71 
72  // Setup detector map. These images are full summing.
73  new CameraDetectorMap(this);
74 
75  // Setup focal plane map
76  CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
77 
78  // Make sure to grab lines and samples in the correct order.
79  double line = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
80  double sample = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
81  focalMap->SetDetectorOrigin(sample, line);
82 
83  // Setup distortion map
84  double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
85  new RadialDistortionMap(this, k1, 1);
86 
87  // Setup the ground and sky map
88  new CameraGroundMap(this);
89  new CameraSkyMap(this);
90  setTime(centerTime);
91  // Note: If the temperature-dependent instrument kernel is used,
92  // the following LoadCache() command should be replaced with the
93  // commented lines at the end of this file.
94  LoadCache();
96  }
97 
100 
126  pair<iTime, iTime> MsiCamera::ShutterOpenCloseTimes(double time,
127  double exposureDuration) {
129  }
130 
139  int MsiCamera::CkFrameId() const { return -93000; }
140 
149  int MsiCamera::CkReferenceId() const { return 1; }
150 
159 // int MsiCamera::SpkTargetId() const { return -93; }
160 
168  int MsiCamera::SpkReferenceId() const { return 1; }
169 }
170 
180  return new Isis::MsiCamera(cube);
181 }
182 
183 // Comment: 2013-03-08 Jeannie Backer - The following code will adjust the
184 // camera model using the temperature dependent
185 // instrument kernel. Currently, we have decided not to
186 // implement this adjustment since it does not appear to
187 // have been applied in ISIS2. (Code exists for this in
188 // ISIS2, but without SCLK or CK, it could not have been
189 // applied).
190 
191 // if (instrumentRotation()->IsCached()) {
192 // LoadCache();
193 // }
194 // else {
195 // double toCelcius = -273.15;
196 // SpiceDouble tempCelcius = toDouble(inst["DpuDeckTemperature"][0])+toCelcius;
197 // ConstSpiceChar *nearMsiTimeDependentFrame;
198 // iTime originalTempDependencyDate("1999-12-20T00:00:00");
199 //
200 // if (centerTime.Et() <= originalTempDependencyDate.Et() ) {
201 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0000";
202 // }
203 // else {
204 // nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0001";
205 // }
206 //
207 // // get transformation matrix based on temperature, from spacecraft to MSI
208 // SpiceDouble sc2msiMatrix[3][3];
209 // pxform_c("J2000", nearMsiTimeDependentFrame,tempCelcius, sc2msiMatrix);
210 // NaifStatus::CheckErrors();
211 // // get current TC matrix, from j2000 to spacecraft
212 // vector<double> originalCJ = instrumentRotation()->TimeBasedMatrix();
213 // // get new CJ matrix based on temperatureBasedRotation x originalTC
214 // // now we have transformation from j2000 to msi
215 // vector<double> newCJ(9);
216 // mxm_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalCJ[0],
217 // (SpiceDouble( *)[3]) &newCJ[0]);
218 // NaifStatus::CheckErrors();
219 // // mxmg_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalTC[0],
220 // // 6, 6, 6, (SpiceDouble( *)[3]) &newCJ[0]);
221 // // set new CJ matrix
222 // instrumentRotation()->SetTimeBasedMatrix(newCJ);
223 // LoadCache();
224 // }
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1430
Isis::Camera * MsiCameraPlugin(Isis::Cube &cube)
This is the function that is called in order to instantiate a MsiCamera object.
Definition: MsiCamera.cpp:179
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
Parse and return pieces of a time string.
Definition: iTime.h:78
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:507
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:139
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1437
Namespace for the standard library.
Search child objects.
Definition: PvlObject.h:170
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)
Returns the shutter open and close times.
Definition: MsiCamera.cpp:126
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
virtual std::pair< iTime, iTime > ShutterOpenCloseTimes(double time, double exposureDuration)=0
Returns the shutter open and close times.
Convert between parent image coordinates and detector coordinates.
Convert between undistorted focal plane and ground coordinates.
Convert between distorted focal plane and detector coordinates.
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:508
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
virtual int CkReferenceId() const
CK Reference ID - Reference Frame value for J2000 from spacit run on CK.
Definition: MsiCamera.cpp:149
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:112
Container for cube-like labels.
Definition: Pvl.h:135
virtual int SpkReferenceId() const
SPK Target ID - Target Body value for NEAR Shoemaker from spacit run on SPK.
Definition: MsiCamera.cpp:168
void LoadCache()
This loads the spice cache big enough for this image.
Definition: Camera.cpp:2432
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:509
~MsiCamera()
Destroys the MsiCamera object.
Definition: MsiCamera.cpp:99
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:43
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Convert between undistorted focal plane and ra/dec coordinates.
Definition: CameraSkyMap.h:48
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:510
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
Definition: Camera.cpp:3075
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Generic class for Framing Cameras.
Definition: FramingCamera.h:48
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:963
IO Handler for Isis Cubes.
Definition: Cube.h:170
NEAR Shoemaker MSI Camera Model.
Definition: MsiCamera.h:52
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809