Isis 3 Programmer Reference
VariableLineScanCameraDetectorMap.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "VariableLineScanCameraDetectorMap.h"
9 #include "CameraFocalPlaneMap.h"
10 #include "iTime.h"
11 
12 namespace Isis {
24  Camera *parent,
25  std::vector< LineRateChange > &lineRates) :
27  lineRates[0].GetStartEt(),
28  lineRates[0].GetLineScanRate()),
29  p_lineRates(lineRates) {
30  }
31 
32 
37  }
38 
39 
52  const double line) {
53  // Use the parent SetDetector for the sample, which should work fine
54  if (!CameraDetectorMap::SetDetector(sample, line)) {
55  return false;
56  }
57 
58  // currEt is our known et time
59  double currEt = p_camera->time().Et();
60  int rateIndex = p_lineRates.size() - 1;
61 
62  while (rateIndex >= 0 && currEt < p_lineRates[rateIndex].GetStartEt() - 0.5) {
63  rateIndex --;
64  }
65 
66  if (rateIndex < 0) {
67  return false;
68  }
69 
70  int rateStartLine = p_lineRates[rateIndex].GetStartLine();
71  double rateStartEt = p_lineRates[rateIndex].GetStartEt();
72  double rate = p_lineRates[rateIndex].GetLineScanRate();
73 
74  double etDiff = currEt - rateStartEt;
75  p_parentLine = etDiff / rate + (rateStartLine - 0.5);
76 
77  //std::cout << "p_parentLine = " << p_parentLine << " = " << etDiff << "/" << rate << " + " << rateStartLine << std::endl;
78 
79  SetLineRate(rate);
80 
81  return true;
82  }
83 
84 
97  const double line) {
98  return SetParent(sample, line, 0.0);
99  }
100 
101 
115  const double line,
116  const double deltaT) {
117  if (!CameraDetectorMap::SetParent(sample, line, deltaT)) {
118  return false;
119  } //check to make sure we're not doubling the "DeltaT"
120 
122 
123  int rateIndex = p_lineRates.size() - 1;
124 
125  while (rateIndex >= 0 && line < p_lineRates[rateIndex].GetStartLine() - 0.5) {
126  rateIndex --;
127  }
128 
129  if (rateIndex < 0) {
130  return false;
131  }
132 
133  int rateStartLine = p_lineRates[rateIndex].GetStartLine();
134  double rateStartEt = p_lineRates[rateIndex].GetStartEt();
135  double rate = p_lineRates[rateIndex].GetLineScanRate();
136 
144  double et = rateStartEt + (line - (rateStartLine - 0.5)) * rate;
145  //printf("et = %.8f = %.8f + (%.3f - %i) * %.8f\n", et, rateStartEt, line, rateStartLine, rate);
146 
147  SetLineRate(rate);
148 
149  p_camera->setTime(et + deltaT);
150 
151  return true;
152  }
153 
154 
175  const double line,
176  const int band) const {
177  return lineRate(line).GetLineScanRate();
178  }
179 
180 
192  int rateIndex = p_lineRates.size() - 1;
193 
194  while (rateIndex >= 0 && line < p_lineRates[rateIndex].GetStartLine() - 0.5) {
195  rateIndex --;
196  }
197 
198  if (rateIndex < 0) {
199  //This may not be a good idea
200  // SetParent used to return false here
201  // exposureDuration used to throw an exception here
202  rateIndex = 0;
203  }
204 
205  return p_lineRates[rateIndex];
206  }
207 
208 }
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::CameraDetectorMap::p_parentLine
double p_parentLine
The parent line calculated from the detector.
Definition: CameraDetectorMap.h:141
Isis::VariableLineScanCameraDetectorMap::lineRate
LineRateChange & lineRate(const double line) const
Get the line rate information for a given line.
Definition: VariableLineScanCameraDetectorMap.cpp:191
Isis::CameraDetectorMap::SetParent
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
Definition: CameraDetectorMap.cpp:63
Isis::VariableLineScanCameraDetectorMap::SetParent
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
Definition: VariableLineScanCameraDetectorMap.cpp:96
Isis::VariableLineScanCameraDetectorMap::SetDetector
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Definition: VariableLineScanCameraDetectorMap.cpp:51
Isis::Camera
Definition: Camera.h:236
Isis::VariableLineScanCameraDetectorMap::VariableLineScanCameraDetectorMap
VariableLineScanCameraDetectorMap(Camera *parent, std::vector< LineRateChange > &lineRates)
Constructs a VariableLineScanCameraDetectorMap.
Definition: VariableLineScanCameraDetectorMap.cpp:23
Isis::CameraFocalPlaneMap::DetectorLineOffset
double DetectorLineOffset() const
Definition: CameraFocalPlaneMap.cpp:334
Isis::CameraDetectorMap::p_detectorLine
double p_detectorLine
Detector coordinate line value.
Definition: CameraDetectorMap.h:142
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::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::CameraDetectorMap::SetDetector
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Definition: CameraDetectorMap.cpp:43
Isis::LineScanCameraDetectorMap::SetLineRate
void SetLineRate(const double lineRate)
Reset the line rate.
Definition: LineScanCameraDetectorMap.cpp:60
Isis::VariableLineScanCameraDetectorMap::~VariableLineScanCameraDetectorMap
virtual ~VariableLineScanCameraDetectorMap()
Destructor.
Definition: VariableLineScanCameraDetectorMap.cpp:36
Isis::CameraDetectorMap::p_camera
Camera * p_camera
Pointer to the camera.
Definition: CameraDetectorMap.h:138
Isis::Camera::FocalPlaneMap
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition: Camera.cpp:2836
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
Isis::VariableLineScanCameraDetectorMap::exposureDuration
virtual double exposureDuration(const double sample, const double line, const int band) const
This virtual method is for returning the exposure duration of a given pixel.
Definition: VariableLineScanCameraDetectorMap.cpp:174
Isis::LineRateChange
Container class for storing timing information for a section of an image.
Definition: VariableLineScanCameraDetectorMap.h:83