USGS

Isis 3.0 Object Programmers' Reference

Home

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 
97  p_frameletSample = p_detectorSample;
98  p_frameletLine = p_detectorLine;
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 
122 
134  bool PushFrameCameraDetectorMap::SetParent(const double sample,
135  const double line) {
136  // Compute the height of a framelet taking into account the summing mode
137  int actualFrameletHeight = (int)(p_frameletHeight / LineScaleFactor());
138 
139  // Compute the framelet number. We could have padded with null framelets
140  // at the top of the image so take that into account. Setting the framelet
141  // changes the time for the observation. Line starts at 0.5 (top of first framelet)
142  // and framelet needs to start at 1.
143  int framelet = (int)((line - 0.5) / actualFrameletHeight) + 1;
144  SetFramelet(framelet);
145 
146  // Convert the parent line/sample to a framelet line/sample
147  p_frameletLine = line - actualFrameletHeight * (framelet - 1);
148  p_frameletSample = sample;
149 
150  // Convert the framelet line/sample to an unsummed framelet line/sample
151  if (!CameraDetectorMap::SetParent(p_frameletSample, p_frameletLine)) return false;
152  double unsummedFrameletLine = p_detectorLine;
153 
154  // Sometime folks want to write the framelets flipped in the EDR so
155  // features match. Take care of this. p_bandStartDetector is 0-based and
156  // unsummedFrameletLine is the correct base for p_detectorLine so these calculations
157  // are valid.
158  if (p_flippedFramelets) {
159  p_detectorLine = p_bandStartDetector + p_frameletHeight - unsummedFrameletLine;
160  }
161  else {
162  p_detectorLine = p_bandStartDetector + unsummedFrameletLine;
163  }
164 
165  // Save the parent line/sample
166  p_parentSample = sample;
167  p_parentLine = line;
168 
169  return true;
170  }
171 
172 
173 
181  p_framelet = framelet;
182 
183  // We can add framelet padding to each band. Compute the adjusted framelet
184  // number
185  int adjustedFramelet = (int) framelet - p_frameletOffset;
186  double etTime = 0.0;
187 
188  // Use this information to compute the time of the framelet
190  etTime = p_etStart + (adjustedFramelet - 1) * p_frameletRate;
191  }
192  else {
193  etTime = p_etStart + (p_nframelets - adjustedFramelet) * p_frameletRate;
194  }
195 
196  etTime += p_exposureDuration / 2.0;
197  p_camera->setTime(etTime);
198  }
199 
200 
201 
213  void PushFrameCameraDetectorMap::SetStartTime(const double etStart) {
214  p_etStart = etStart;
215  }
216 
217 
218 
226  void PushFrameCameraDetectorMap::SetExposureDuration(double exposureDuration) {
227  p_exposureDuration = exposureDuration;
228  }
229 
230 
231 
241  void PushFrameCameraDetectorMap::SetFrameletRate(const double frameletRate) {
242  p_frameletRate = frameletRate;
243  }
244 
245 
246 
249  return p_frameletRate;
250  }
251 
252 
253 
263  p_frameletOffset = frameletOffset;
264  }
265 
266 
267 
270  return p_frameletOffset;
271  }
272 
273 
281  return p_framelet;
282  }
283 
284 
285 
297  p_bandStartDetector = firstLine;
298  }
299 
300 
301 
304  return p_bandStartDetector;
305  }
306 
307 
308 
324  void PushFrameCameraDetectorMap::SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets) {
325  p_timeAscendingFramelets = !frameletOrderReversed;
326  p_nframelets = nframelets;
327  }
328 
329 
330 
344  p_flippedFramelets = frameletsFlipped;
345  }
346 
347 
348 
356  return p_etStart;
357  }
358 
359 
360 
367  return (int)(p_camera->ParentLines() / (p_frameletHeight / LineScaleFactor()));
368  }
369 
370 
371 
378  return p_frameletSample;
379  }
380 
381 
382 
389  return p_frameletLine;
390  }
391 
392 
393 
400  return p_frameletHeight;
401  }
402 
403 
404 
405  bool PushFrameCameraDetectorMap::timeAscendingFramelets() {
407  }
408 
409 }