Isis 3 Programmer Reference
PushFrameCameraDetectorMap.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "PushFrameCameraDetectorMap.h"
8
9#include <QDebug>
10
11#include <iomanip>
12
13#include "CameraFocalPlaneMap.h"
14#include "iTime.h"
15
16namespace Isis {
29 const double frameletRate, int frameletHeight):
30 CameraDetectorMap(parent) {
31 p_etStart = etStart;
33 p_frameletRate = frameletRate;
36 p_flippedFramelets = true;
38 p_nframelets = 0;
40 }
41
45
46
47
60 const double line) {
61 // Sometime folks want to write the framelets flipped in the EDR so
62 // features match. Take care of this.
63 double unsummedFrameletLine;
64 // first we need to determine the cube line number for the framelet that contains the given line
65 // ??? comment this section...
67 unsummedFrameletLine = p_bandStartDetector + p_frameletHeight - line;
68 }
69 else {
70 unsummedFrameletLine = line - p_bandStartDetector;
71 }
72
73 double unsummedFrameletSample = sample;
74
75 // Convert framelet sample/line to summed framelet sample/line,
76 // parent sample will be computed correctly
77 if (!CameraDetectorMap::SetDetector(unsummedFrameletSample, unsummedFrameletLine)) {
78 return false;
79 }
80
83
84 // Compute the height of a framelet taking into account the summing mode
85 int actualFrameletHeight = (int)(p_frameletHeight / LineScaleFactor());
86
87 p_parentLine = (p_framelet - 1) * actualFrameletHeight + p_parentLine;
88
89 // Save the detector sample/line
90 p_detectorSample = sample;
91 p_detectorLine = line;
92
93 // Didn't succeed if framelet line doesn't make sense
94 if (p_frameletLine > p_frameletHeight + 0.5) {
95 return false;
96 }
97
98 if (p_frameletLine < 0.5) {
99 return false;
100 }
101
102 return true;
103 }
104
105
117 bool PushFrameCameraDetectorMap::SetParent(const double sample, const double line) {
118 return SetParent(sample, line, 0.0);
119 }
120
121
135 const double line,
136 const double deltaT) {
137 // Compute the height of a framelet taking into account the summing mode
138 int actualFrameletHeight = (int)(p_frameletHeight / LineScaleFactor());
139
140 // Compute the framelet number. We could have padded with null framelets
141 // at the top of the image so take that into account. Setting the framelet
142 // changes the time for the observation. Line starts at 0.5 (top of first framelet)
143 // and framelet needs to start at 1.
144 int framelet = (int)((line - 0.5) / actualFrameletHeight) + 1;
145 SetFramelet(framelet, deltaT);
146
147 // Convert the parent line/sample to a framelet line/sample
148 p_frameletLine = line - actualFrameletHeight * (framelet - 1);
149 p_frameletSample = sample;
150
151 // Convert the framelet line/sample to an unsummed framelet line/sample
153 double unsummedFrameletLine = p_detectorLine;
154
155 // Sometime folks want to write the framelets flipped in the EDR so
156 // features match. Take care of this. p_bandStartDetector is 0-based and
157 // unsummedFrameletLine is the correct base for p_detectorLine so these calculations
158 // are valid.
159 if (p_flippedFramelets) {
160 p_detectorLine = p_bandStartDetector + p_frameletHeight - unsummedFrameletLine;
161 }
162 else {
163 p_detectorLine = p_bandStartDetector + unsummedFrameletLine;
164 }
165
166 // Save the parent line/sample
167 p_parentSample = sample;
168 p_parentLine = line;
169
170 return true;
171 }
172
173
174
182 void PushFrameCameraDetectorMap::SetFramelet(int framelet, const double deltaT) {
183 p_framelet = framelet;
184
185 // We can add framelet padding to each band. Compute the adjusted framelet
186 // number
187 int adjustedFramelet = (int) framelet - p_frameletOffset;
188 double etTime = 0.0;
189
190 // Use this information to compute the time of the framelet
192 etTime = p_etStart + (adjustedFramelet - 1) * p_frameletRate;
193 }
194 else {
195 etTime = p_etStart + (p_nframelets - adjustedFramelet) * p_frameletRate;
196 }
197
198 etTime += p_exposureDuration / 2.0;
199 p_camera->setTime(etTime + deltaT);
200 }
201
202
203
215 void PushFrameCameraDetectorMap::SetStartTime(const double etStart) {
216 p_etStart = etStart;
217 }
218
219
220
232
233
234
244 void PushFrameCameraDetectorMap::SetFrameletRate(const double frameletRate) {
245 p_frameletRate = frameletRate;
246 }
247
248
249
259
260
261
271 p_frameletOffset = frameletOffset;
272 }
273
274
275
284
285
295
296
297
311
312
313
322
323
324
340 void PushFrameCameraDetectorMap::SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets) {
341 p_timeAscendingFramelets = !frameletOrderReversed;
342 p_nframelets = nframelets;
343 }
344
345
346
360 p_flippedFramelets = frameletsFlipped;
361 }
362
363
364
373
374
375
384
385
386
395
396
397
406
407
408
417
418
419
428
429
440 const double line,
441 const int band) const {
442 if (p_exposureDuration > 0) {
443 return p_exposureDuration;
444 }
445 return p_frameletRate;
446 }
447
448}
Convert between parent image coordinates and detector coordinates.
double p_parentLine
The parent line calculated from the detector.
virtual double LineScaleFactor() const
Return scaling factor for computing line resolution.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
double p_parentSample
The parent sample calculated from the detector.
double p_detectorSample
Detector coordinate sample value.
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.
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition Camera.cpp:2836
PushFrameCameraDetectorMap(Camera *parent, const double etStart, const double frameletRate, int frameletHeight)
Construct a detector map for push frame cameras.
bool p_flippedFramelets
Indicates whether the geometry in a framelet is flipped.
int p_frameletHeight
Height of a framelet in detector lines.
double p_exposureDuration
Exposure duration in secs.
bool p_timeAscendingFramelets
Are framelets reversed from top-to-bottom in file.
void SetFrameletRate(const double frameletRate)
Reset the frame rate.
int TotalFramelets() const
Return the total number of framelets including padding.
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.
void SetFrameletsGeometricallyFlipped(bool frameletsFlipped)
Mirrors the each framelet in the file.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
void SetBandFirstDetectorLine(int firstLine)
Change the starting line in the detector based on band.
double frameletLine() const
This returns the calculated framelet line.
int GetBandFirstDetectorLine()
Return the starting line in the detector for the current band.
void SetFrameletOffset(int frameletOffset)
Reset the frame offset.
bool timeAscendingFramelets()
Returns if the framelets are reversed from top-to-bottom.
void SetStartTime(const double etStart)
Reset the starting ephemeris time.
int frameletHeight() const
This returns how many lines are considered a single framelet.
double p_frameletSample
The sample in the current framelet.
double p_etStart
Starting time at the top of the first parent line.
int Framelet()
This method returns the current framelet.
void SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets)
Changes the direction of the framelets.
int FrameletOffset() const
Return the frame offset.
void SetExposureDuration(double exposureDuration)
Change the exposure duration in seconds.
double p_frameletRate
iTime between framelets in parent cube.
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
double frameletSample() const
This returns the calculated framelet sample.
int p_nframelets
If flipped framelets, the number of framelets in this band.
double StartEphemerisTime() const
This returns the starting ET of this band.
int p_bandStartDetector
The first detector line of current band.
double p_frameletLine
The line in the current framelet.
void SetFramelet(int framelet, const double deltaT=0)
This method changes the current framelet.
double FrameletRate() const
Return the time in seconds between framelets.
int p_frameletOffset
The numner of framelets padding the top of the band.
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
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16