Isis 3 Programmer Reference
PushFrameCameraDetectorMap.cpp
Go to the documentation of this file.
1 
24 
25 #include <QDebug>
26 
27 #include <iomanip>
28 
29 #include "CameraFocalPlaneMap.h"
30 #include "iTime.h"
31 
32 namespace Isis {
45  const double frameletRate, int frameletHeight):
46  CameraDetectorMap(parent) {
47  p_etStart = etStart;
48  p_exposureDuration = 0.0;
49  p_frameletRate = frameletRate;
51  p_frameletOffset = 0;
52  p_flippedFramelets = true;
54  p_nframelets = 0;
56  }
57 
60  }
61 
62 
63 
75  bool PushFrameCameraDetectorMap::SetDetector(const double sample,
76  const double line) {
77  // Sometime folks want to write the framelets flipped in the EDR so
78  // features match. Take care of this.
79  double unsummedFrameletLine;
80  // first we need to determine the cube line number for the framelet that contains the given line
81  // ??? comment this section...
82  if (p_flippedFramelets) {
83  unsummedFrameletLine = p_bandStartDetector + p_frameletHeight - line;
84  }
85  else {
86  unsummedFrameletLine = line - p_bandStartDetector;
87  }
88 
89  double unsummedFrameletSample = sample;
90 
91  // Convert framelet sample/line to summed framelet sample/line,
92  // parent sample will be computed correctly
93  if (!CameraDetectorMap::SetDetector(unsummedFrameletSample, unsummedFrameletLine)) {
94  return false;
95  }
96 
99 
100  // Compute the height of a framelet taking into account the summing mode
101  int actualFrameletHeight = (int)(p_frameletHeight / LineScaleFactor());
102 
103  p_parentLine = (p_framelet - 1) * actualFrameletHeight + p_parentLine;
104 
105  // Save the detector sample/line
106  p_detectorSample = sample;
107  p_detectorLine = line;
108 
109  // Didn't succeed if framelet line doesn't make sense
110  if (p_frameletLine > p_frameletHeight + 0.5) {
111  return false;
112  }
113 
114  if (p_frameletLine < 0.5) {
115  return false;
116  }
117 
118  return true;
119  }
120 
121 
133  bool PushFrameCameraDetectorMap::SetParent(const double sample, const double line) {
134  return SetParent(sample, line, 0.0);
135  }
136 
137 
150  bool PushFrameCameraDetectorMap::SetParent(const double sample,
151  const double line,
152  const double deltaT) {
153  // Compute the height of a framelet taking into account the summing mode
154  int actualFrameletHeight = (int)(p_frameletHeight / LineScaleFactor());
155 
156  // Compute the framelet number. We could have padded with null framelets
157  // at the top of the image so take that into account. Setting the framelet
158  // changes the time for the observation. Line starts at 0.5 (top of first framelet)
159  // and framelet needs to start at 1.
160  int framelet = (int)((line - 0.5) / actualFrameletHeight) + 1;
161  SetFramelet(framelet, deltaT);
162 
163  // Convert the parent line/sample to a framelet line/sample
164  p_frameletLine = line - actualFrameletHeight * (framelet - 1);
165  p_frameletSample = sample;
166 
167  // Convert the framelet line/sample to an unsummed framelet line/sample
168  if (!CameraDetectorMap::SetParent(p_frameletSample, p_frameletLine, deltaT)) return false;
169  double unsummedFrameletLine = p_detectorLine;
170 
171  // Sometime folks want to write the framelets flipped in the EDR so
172  // features match. Take care of this. p_bandStartDetector is 0-based and
173  // unsummedFrameletLine is the correct base for p_detectorLine so these calculations
174  // are valid.
175  if (p_flippedFramelets) {
176  p_detectorLine = p_bandStartDetector + p_frameletHeight - unsummedFrameletLine;
177  }
178  else {
179  p_detectorLine = p_bandStartDetector + unsummedFrameletLine;
180  }
181 
182  // Save the parent line/sample
183  p_parentSample = sample;
184  p_parentLine = line;
185 
186  return true;
187  }
188 
189 
190 
198  void PushFrameCameraDetectorMap::SetFramelet(int framelet, const double deltaT) {
199  p_framelet = framelet;
200 
201  // We can add framelet padding to each band. Compute the adjusted framelet
202  // number
203  int adjustedFramelet = (int) framelet - p_frameletOffset;
204  double etTime = 0.0;
205 
206  // Use this information to compute the time of the framelet
208  etTime = p_etStart + (adjustedFramelet - 1) * p_frameletRate;
209  }
210  else {
211  etTime = p_etStart + (p_nframelets - adjustedFramelet) * p_frameletRate;
212  }
213 
214  etTime += p_exposureDuration / 2.0;
215  p_camera->setTime(etTime + deltaT);
216  }
217 
218 
219 
231  void PushFrameCameraDetectorMap::SetStartTime(const double etStart) {
232  p_etStart = etStart;
233  }
234 
235 
236 
245  void PushFrameCameraDetectorMap::SetExposureDuration(double exposureDuration) {
247  }
248 
249 
250 
260  void PushFrameCameraDetectorMap::SetFrameletRate(const double frameletRate) {
261  p_frameletRate = frameletRate;
262  }
263 
264 
265 
273  return p_frameletRate;
274  }
275 
276 
277 
287  p_frameletOffset = frameletOffset;
288  }
289 
290 
291 
298  return p_frameletOffset;
299  }
300 
301 
309  return p_framelet;
310  }
311 
312 
313 
325  p_bandStartDetector = firstLine;
326  }
327 
328 
329 
336  return p_bandStartDetector;
337  }
338 
339 
340 
356  void PushFrameCameraDetectorMap::SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets) {
357  p_timeAscendingFramelets = !frameletOrderReversed;
358  p_nframelets = nframelets;
359  }
360 
361 
362 
376  p_flippedFramelets = frameletsFlipped;
377  }
378 
379 
380 
387  return p_etStart;
388  }
389 
390 
391 
398  return (int)(p_camera->ParentLines() / (p_frameletHeight / LineScaleFactor()));
399  }
400 
401 
402 
409  return p_frameletSample;
410  }
411 
412 
413 
420  return p_frameletLine;
421  }
422 
423 
424 
431  return p_frameletHeight;
432  }
433 
434 
435 
443  }
444 
445 
456  const double line,
457  const int band) const {
458  if (p_exposureDuration > 0) {
459  return p_exposureDuration;
460  }
461  return p_frameletRate;
462  }
463 
464 }
bool p_flippedFramelets
Indicates whether the geometry in a framelet is flipped.
void SetBandFirstDetectorLine(int firstLine)
Change the starting line in the detector based on band.
int Framelet()
This method returns the current framelet.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
void SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets)
Changes the direction of the framelets.
void SetFrameletOffset(int frameletOffset)
Reset the frame offset.
int FrameletOffset() const
Return the frame offset.
void SetFramelet(int framelet, const double deltaT=0)
This method changes the current framelet.
double p_etStart
Starting time at the top of the first parent line.
double FrameletRate() const
Return the time in seconds between framelets.
void SetFrameletsGeometricallyFlipped(bool frameletsFlipped)
Mirrors the each framelet in the file.
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
int frameletHeight() const
This returns how many lines are considered a single framelet.
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition: Camera.cpp:2818
int GetBandFirstDetectorLine()
Return the starting line in the detector for the current band.
Convert between parent image coordinates and detector coordinates.
void SetFrameletRate(const double frameletRate)
Reset the frame rate.
double p_parentSample
The parent sample calculated from the detector.
int p_bandStartDetector
The first detector line of current band.
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.
int p_frameletHeight
Height of a framelet in detector lines.
int p_nframelets
If flipped framelets, the number of framelets in this band.
double p_frameletLine
The line in the current framelet.
double p_frameletRate
iTime between framelets in parent cube.
double p_detectorLine
Detector coordinate line value.
double p_exposureDuration
Exposure duration in secs.
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:112
double frameletSample() const
This returns the calculated framelet sample.
double frameletLine() const
This returns the calculated framelet line.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
void SetStartTime(const double etStart)
Reset the starting ephemeris time.
bool p_timeAscendingFramelets
Are framelets reversed from top-to-bottom in file.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
void SetExposureDuration(double exposureDuration)
Change the exposure duration in seconds.
virtual double LineScaleFactor() const
Return scaling factor for computing line resolution.
double StartEphemerisTime() const
This returns the starting ET of this band.
Camera * p_camera
Pointer to the camera.
double p_detectorSample
Detector coordinate sample value.
bool timeAscendingFramelets()
Returns if the framelets are reversed from top-to-bottom.
int p_frameletOffset
The numner of framelets padding the top of the band.
double p_parentLine
The parent line calculated from the detector.
PushFrameCameraDetectorMap(Camera *parent, const double etStart, const double frameletRate, int frameletHeight)
Construct a detector map for push frame cameras.
double p_frameletSample
The sample in the current framelet.
int TotalFramelets() const
Return the total number of framelets including padding.