Isis 3.0 Object Programmers' Reference
Home
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
();
55
NaifStatus::CheckErrors
();
56
SetFocalLength
();
57
SetPixelPitch
();
58
NaifStatus::CheckErrors
();
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
QString sample =
"INS"
+
toString
(
naifIkCode
()) +
"_BORESIGHT_SAMPLE"
;
79
QString line =
"INS"
+
toString
(
naifIkCode
()) +
"_BORESIGHT_LINE"
;
80
focalMap->
SetDetectorOrigin
(
Spice::getDouble
(sample),
Spice::getDouble
(line));
81
82
// Setup distortion map
83
double
k1 =
Spice::getDouble
(
"INS"
+
toString
(
naifIkCode
()) +
"_K1"
);
84
new
RadialDistortionMap
(
this
, k1, 1);
85
86
// Setup the ground and sky map
87
new
CameraGroundMap
(
this
);
88
new
CameraSkyMap
(
this
);
89
setTime
(centerTime);
90
// Note: If the temperature-dependent instrument kernel is used,
91
// the following LoadCache() command should be replaced with the
92
// commented lines at the end of this file.
93
LoadCache
();
94
NaifStatus::CheckErrors
();
95
}
96
98
MsiCamera::~MsiCamera
(){}
99
125
pair<iTime, iTime>
MsiCamera::ShutterOpenCloseTimes
(
double
time,
126
double
exposureDuration) {
127
return
FramingCamera::ShutterOpenCloseTimes
(time, exposureDuration);
128
}
129
138
int
MsiCamera::CkFrameId
()
const
{
return
-93000; }
139
148
int
MsiCamera::CkReferenceId
()
const
{
return
1; }
149
158
// int MsiCamera::SpkTargetId() const { return -93; }
159
167
int
MsiCamera::SpkReferenceId
()
const
{
return
1; }
168
}
169
178
extern
"C"
Isis::Camera
*
MsiCameraPlugin
(
Isis::Cube
&cube) {
179
return
new
Isis::MsiCamera
(cube);
180
}
181
182
// Comment: 2013-03-08 Jeannie Backer - The following code will adjust the
183
// camera model using the temperature dependent
184
// instrument kernel. Currently, we have decided not to
185
// implement this adjustment since it does not appear to
186
// have been applied in ISIS2. (Code exists for this in
187
// ISIS2, but without SCLK or CK, it could not have been
188
// applied).
189
190
// if (instrumentRotation()->IsCached()) {
191
// LoadCache();
192
// }
193
// else {
194
// double toCelcius = -273.15;
195
// SpiceDouble tempCelcius = toDouble(inst["DpuDeckTemperature"][0])+toCelcius;
196
// ConstSpiceChar *nearMsiTimeDependentFrame;
197
// iTime originalTempDependencyDate("1999-12-20T00:00:00");
198
//
199
// if (centerTime.Et() <= originalTempDependencyDate.Et() ) {
200
// nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0000";
201
// }
202
// else {
203
// nearMsiTimeDependentFrame = "NEAR_MSI_TEMP_DEP0001";
204
// }
205
//
206
// // get transformation matrix based on temperature, from spacecraft to MSI
207
// SpiceDouble sc2msiMatrix[3][3];
208
// pxform_c("J2000", nearMsiTimeDependentFrame,tempCelcius, sc2msiMatrix);
209
// NaifStatus::CheckErrors();
210
// // get current TC matrix, from j2000 to spacecraft
211
// vector<double> originalCJ = instrumentRotation()->TimeBasedMatrix();
212
// // get new CJ matrix based on temperatureBasedRotation x originalTC
213
// // now we have transformation from j2000 to msi
214
// vector<double> newCJ(9);
215
// mxm_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalCJ[0],
216
// (SpiceDouble( *)[3]) &newCJ[0]);
217
// NaifStatus::CheckErrors();
218
// // mxmg_c(sc2msiMatrix, (SpiceDouble( *)[3]) &originalTC[0],
219
// // 6, 6, 6, (SpiceDouble( *)[3]) &newCJ[0]);
220
// // set new CJ matrix
221
// instrumentRotation()->SetTimeBasedMatrix(newCJ);
222
// LoadCache();
223
// }
224