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 
16 namespace Isis {
29  const double frameletRate, int frameletHeight):
30  CameraDetectorMap(parent) {
31  p_etStart = etStart;
32  p_exposureDuration = 0.0;
33  p_frameletRate = frameletRate;
35  p_frameletOffset = 0;
36  p_flippedFramelets = true;
38  p_nframelets = 0;
40  }
41 
44  }
45 
46 
47 
59  bool PushFrameCameraDetectorMap::SetDetector(const double sample,
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...
66  if (p_flippedFramelets) {
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 
134  bool PushFrameCameraDetectorMap::SetParent(const double sample,
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
152  if (!CameraDetectorMap::SetParent(p_frameletSample, p_frameletLine, deltaT)) return false;
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 
229  void PushFrameCameraDetectorMap::SetExposureDuration(double exposureDuration) {
231  }
232 
233 
234 
244  void PushFrameCameraDetectorMap::SetFrameletRate(const double frameletRate) {
245  p_frameletRate = frameletRate;
246  }
247 
248 
249 
257  return p_frameletRate;
258  }
259 
260 
261 
271  p_frameletOffset = frameletOffset;
272  }
273 
274 
275 
282  return p_frameletOffset;
283  }
284 
285 
293  return p_framelet;
294  }
295 
296 
297 
309  p_bandStartDetector = firstLine;
310  }
311 
312 
313 
320  return p_bandStartDetector;
321  }
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 
371  return p_etStart;
372  }
373 
374 
375 
382  return (int)(p_camera->ParentLines() / (p_frameletHeight / LineScaleFactor()));
383  }
384 
385 
386 
393  return p_frameletSample;
394  }
395 
396 
397 
404  return p_frameletLine;
405  }
406 
407 
408 
415  return p_frameletHeight;
416  }
417 
418 
419 
427  }
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 }
Isis::PushFrameCameraDetectorMap::SetFrameletOffset
void SetFrameletOffset(int frameletOffset)
Reset the frame offset.
Definition: PushFrameCameraDetectorMap.cpp:270
Isis::PushFrameCameraDetectorMap::p_flippedFramelets
bool p_flippedFramelets
Indicates whether the geometry in a framelet is flipped.
Definition: PushFrameCameraDetectorMap.h:105
Isis::CameraDetectorMap::p_parentLine
double p_parentLine
The parent line calculated from the detector.
Definition: CameraDetectorMap.h:141
Isis::PushFrameCameraDetectorMap::p_frameletOffset
int p_frameletOffset
The numner of framelets padding the top of the band.
Definition: PushFrameCameraDetectorMap.h:98
Isis::CameraDetectorMap
Convert between parent image coordinates and detector coordinates.
Definition: CameraDetectorMap.h:47
Isis::PushFrameCameraDetectorMap::FrameletRate
double FrameletRate() const
Return the time in seconds between framelets.
Definition: PushFrameCameraDetectorMap.cpp:256
Isis::Camera::ParentLines
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition: Camera.cpp:2806
Isis::PushFrameCameraDetectorMap::TotalFramelets
int TotalFramelets() const
Return the total number of framelets including padding.
Definition: PushFrameCameraDetectorMap.cpp:381
Isis::PushFrameCameraDetectorMap::SetFrameletOrderReversed
void SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets)
Changes the direction of the framelets.
Definition: PushFrameCameraDetectorMap.cpp:340
Isis::PushFrameCameraDetectorMap::SetFramelet
void SetFramelet(int framelet, const double deltaT=0)
This method changes the current framelet.
Definition: PushFrameCameraDetectorMap.cpp:182
Isis::PushFrameCameraDetectorMap::Framelet
int Framelet()
This method returns the current framelet.
Definition: PushFrameCameraDetectorMap.cpp:292
Isis::PushFrameCameraDetectorMap::SetFrameletsGeometricallyFlipped
void SetFrameletsGeometricallyFlipped(bool frameletsFlipped)
Mirrors the each framelet in the file.
Definition: PushFrameCameraDetectorMap.cpp:359
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::PushFrameCameraDetectorMap::FrameletOffset
int FrameletOffset() const
Return the frame offset.
Definition: PushFrameCameraDetectorMap.cpp:281
Isis::PushFrameCameraDetectorMap::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: PushFrameCameraDetectorMap.cpp:439
Isis::CameraDetectorMap::p_parentSample
double p_parentSample
The parent sample calculated from the detector.
Definition: CameraDetectorMap.h:140
Isis::PushFrameCameraDetectorMap::p_bandStartDetector
int p_bandStartDetector
The first detector line of current band.
Definition: PushFrameCameraDetectorMap.h:97
Isis::PushFrameCameraDetectorMap::p_etStart
double p_etStart
Starting time at the top of the first parent line.
Definition: PushFrameCameraDetectorMap.h:93
Isis::Camera
Definition: Camera.h:236
Isis::PushFrameCameraDetectorMap::p_frameletLine
double p_frameletLine
The line in the current framelet.
Definition: PushFrameCameraDetectorMap.h:103
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::PushFrameCameraDetectorMap::p_framelet
int p_framelet
The current framelet.
Definition: PushFrameCameraDetectorMap.h:99
Isis::PushFrameCameraDetectorMap::frameletHeight
int frameletHeight() const
This returns how many lines are considered a single framelet.
Definition: PushFrameCameraDetectorMap.cpp:414
Isis::PushFrameCameraDetectorMap::SetDetector
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Definition: PushFrameCameraDetectorMap.cpp:59
Isis::PushFrameCameraDetectorMap::frameletLine
double frameletLine() const
This returns the calculated framelet line.
Definition: PushFrameCameraDetectorMap.cpp:403
Isis::PushFrameCameraDetectorMap::GetBandFirstDetectorLine
int GetBandFirstDetectorLine()
Return the starting line in the detector for the current band.
Definition: PushFrameCameraDetectorMap.cpp:319
Isis::PushFrameCameraDetectorMap::~PushFrameCameraDetectorMap
virtual ~PushFrameCameraDetectorMap()
Destructor.
Definition: PushFrameCameraDetectorMap.cpp:43
Isis::PushFrameCameraDetectorMap::p_frameletRate
double p_frameletRate
iTime between framelets in parent cube.
Definition: PushFrameCameraDetectorMap.h:95
Isis::PushFrameCameraDetectorMap::p_frameletHeight
int p_frameletHeight
Height of a framelet in detector lines.
Definition: PushFrameCameraDetectorMap.h:96
Isis::PushFrameCameraDetectorMap::SetFrameletRate
void SetFrameletRate(const double frameletRate)
Reset the frame rate.
Definition: PushFrameCameraDetectorMap.cpp:244
Isis::CameraDetectorMap::SetDetector
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Definition: CameraDetectorMap.cpp:43
Isis::CameraDetectorMap::LineScaleFactor
virtual double LineScaleFactor() const
Return scaling factor for computing line resolution.
Definition: CameraDetectorMap.cpp:183
Isis::CameraDetectorMap::p_camera
Camera * p_camera
Pointer to the camera.
Definition: CameraDetectorMap.h:138
Isis::PushFrameCameraDetectorMap::p_nframelets
int p_nframelets
If flipped framelets, the number of framelets in this band.
Definition: PushFrameCameraDetectorMap.h:100
Isis::PushFrameCameraDetectorMap::p_exposureDuration
double p_exposureDuration
Exposure duration in secs.
Definition: PushFrameCameraDetectorMap.h:94
Isis::PushFrameCameraDetectorMap::SetParent
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
Definition: PushFrameCameraDetectorMap.cpp:117
Isis::PushFrameCameraDetectorMap::p_frameletSample
double p_frameletSample
The sample in the current framelet.
Definition: PushFrameCameraDetectorMap.h:102
Isis::PushFrameCameraDetectorMap::SetBandFirstDetectorLine
void SetBandFirstDetectorLine(int firstLine)
Change the starting line in the detector based on band.
Definition: PushFrameCameraDetectorMap.cpp:308
Isis::PushFrameCameraDetectorMap::frameletSample
double frameletSample() const
This returns the calculated framelet sample.
Definition: PushFrameCameraDetectorMap.cpp:392
Isis::CameraDetectorMap::p_detectorSample
double p_detectorSample
Detector coordinate sample value.
Definition: CameraDetectorMap.h:143
Isis::PushFrameCameraDetectorMap::SetStartTime
void SetStartTime(const double etStart)
Reset the starting ephemeris time.
Definition: PushFrameCameraDetectorMap.cpp:215
Isis::PushFrameCameraDetectorMap::PushFrameCameraDetectorMap
PushFrameCameraDetectorMap(Camera *parent, const double etStart, const double frameletRate, int frameletHeight)
Construct a detector map for push frame cameras.
Definition: PushFrameCameraDetectorMap.cpp:28
Isis::PushFrameCameraDetectorMap::p_timeAscendingFramelets
bool p_timeAscendingFramelets
Are framelets reversed from top-to-bottom in file.
Definition: PushFrameCameraDetectorMap.h:106
Isis::PushFrameCameraDetectorMap::StartEphemerisTime
double StartEphemerisTime() const
This returns the starting ET of this band.
Definition: PushFrameCameraDetectorMap.cpp:370
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::PushFrameCameraDetectorMap::SetExposureDuration
void SetExposureDuration(double exposureDuration)
Change the exposure duration in seconds.
Definition: PushFrameCameraDetectorMap.cpp:229
Isis::PushFrameCameraDetectorMap::timeAscendingFramelets
bool timeAscendingFramelets()
Returns if the framelets are reversed from top-to-bottom.
Definition: PushFrameCameraDetectorMap.cpp:425