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
12namespace Isis {
24 Camera *parent,
25 std::vector< LineRateChange > &lineRates) :
27 lineRates[0].GetStartEt(),
28 lineRates[0].GetLineScanRate()),
29 p_lineRates(lineRates) {
30 }
31
32
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}
double p_parentLine
The parent line calculated from the detector.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
double p_detectorLine
Detector coordinate line value.
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Camera * p_camera
Pointer to the camera.
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition Camera.cpp:2866
Container class for storing timing information for a section of an image.
Convert between parent image coordinates and detector coordinates.
void SetLineRate(const double lineRate)
Reset the line rate.
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:99
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
LineRateChange & lineRate(const double line) const
Get the line rate information for a given line.
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.
VariableLineScanCameraDetectorMap(Camera *parent, std::vector< LineRateChange > &lineRates)
Constructs a VariableLineScanCameraDetectorMap.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16