Isis 3 Programmer Reference
SpectralPlotTool.cpp
1 #include "IsisDebug.h"
2 
3 #include "SpectralPlotTool.h"
4 
5 #include <iostream>
6 
7 #include "geos/geom/Polygon.h"
8 #include "geos/geom/CoordinateArraySequence.h"
9 #include "geos/geom/Point.h"
10 
11 #include <QAction>
12 #include <QCheckBox>
13 #include <QHBoxLayout>
14 #include <QGridLayout>
15 #include <QLabel>
16 #include <QMenu>
17 #include <QMessageBox>
18 #include <QPushButton>
19 
20 #include "Brick.h"
21 #include "Cube.h"
22 #include "CubePlotCurve.h"
23 #include "InterestOperator.h"
24 #include "MdiCubeViewport.h"
25 #include "SpectralPlotTool.h"
26 #include "SpectralPlotWindow.h"
27 #include "PolygonTools.h"
28 #include "Pvl.h"
29 #include "RubberBandComboBox.h"
30 #include "RubberBandTool.h"
31 #include "Statistics.h"
32 #include "ToolPad.h"
33 
34 using std::cerr;
35 
36 namespace Isis {
37 
46  AbstractPlotTool(parent),
47  m_maxCurves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
48  m_minCurves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
49  m_avgCurves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
50  m_stdDev1Curves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
51  m_stdDev2Curves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
52  m_stdErr1Curves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >),
53  m_stdErr2Curves(new QMap< MdiCubeViewport *, QPointer<CubePlotCurve> >) {
54  connect(this, SIGNAL(viewportChanged()), this, SLOT(viewportSelected()));
55 
57  }
58 
59 
65  //m_autoScale->setChecked(true);
66  }
67 
68 
75  {
76  ASSERT(m_displayCombo);
77  return m_displayCombo;
78  }
79 
80 
88  if (m_rubberBandCombo) {
89  m_rubberBandCombo->reset();
90  rubberBandTool()->setDrawActiveViewportOnly(false);
91 
92  m_rubberBandCombo->setEnabled(true);
93  m_rubberBandCombo->setVisible(true);
94  }
95  }
96 
97 
103  QDialog *selectCurvesDialog = new QDialog;
104  selectCurvesDialog->setWindowTitle("Select Curves to Plot");
105 
106  QGridLayout *layout = new QGridLayout;
107 
108  QLabel *header = new QLabel("Select which curves to plot when new data is "
109  "selected");
110  layout->addWidget(header, 0, 0, 1, 2, Qt::AlignHCenter);
111 
112  QList<QAction *> actions;
113  actions.append(m_plotAvgAction);
114  actions.append(m_plotMinAction);
115  actions.append(m_plotMaxAction);
116  actions.append(m_plotStdDev1Action);
117  actions.append(m_plotStdDev2Action);
118  actions.append(m_plotStdErr1Action);
119  actions.append(m_plotStdErr2Action);
120 
121  int row = 2;
122  foreach (QAction *action, actions) {
123  QLabel *label = new QLabel(action->text());
124  layout->addWidget(label, row, 0, 1, 1);
125 
126  QCheckBox *actionCheckbox = new QCheckBox;
127  actionCheckbox->setChecked(action->isChecked());
128  connect(actionCheckbox, SIGNAL(stateChanged(int)),
129  action, SLOT(toggle()));
130  layout->addWidget(actionCheckbox, row, 1, 1, 1, Qt::AlignRight);
131  row++;
132  }
133 
134  row++;
135  QPushButton *okButton = new QPushButton("Ok");
136  connect(okButton, SIGNAL(clicked()),
137  selectCurvesDialog, SLOT(close()));
138  layout->addWidget(okButton, row, 0, 1, 2);
139 
140  selectCurvesDialog->setLayout(layout);
141  selectCurvesDialog->exec();
142  }
143 
144 
153  m_toolPadAction = new QAction(toolpad);
154  m_toolPadAction->setText("Spectral Plot Tool");
155  m_toolPadAction->setIcon(QPixmap(toolIconDir() + "/spectral_plot.png"));
156  QString text = "<b>Function:</b> Create a spectral plot using statistics across a spectrum "
157  "(bands).";
158  m_toolPadAction->setWhatsThis(text);
159  return m_toolPadAction;
160  }
161 
162 
172  QWidget *wrapper = new QWidget;
173  wrapper->setContextMenuPolicy(Qt::ActionsContextMenu);
174 
175  m_plotAvgAction = new QAction("Average", this);
176  m_plotAvgAction->setCheckable(true);
177  m_plotAvgAction->setChecked(true);
178 
179  m_plotMinAction = new QAction("Minimum", this);
180  m_plotMinAction->setCheckable(true);
181  m_plotMinAction->setChecked(false);
182 
183  m_plotMaxAction = new QAction("Maximum", this);
184  m_plotMaxAction->setCheckable(true);
185  m_plotMaxAction->setChecked(false);
186 
187  m_plotStdDev1Action = new QAction("+ Sigma", this);
188  m_plotStdDev1Action->setCheckable(true);
189  m_plotStdDev1Action->setChecked(false);
190 
191  m_plotStdDev2Action = new QAction("- Sigma", this);
192  m_plotStdDev2Action->setCheckable(true);
193  m_plotStdDev2Action->setChecked(false);
194 
195  m_plotStdErr1Action = new QAction("+ Std Error", this);
196  m_plotStdErr1Action->setCheckable(true);
197  m_plotStdErr1Action->setChecked(false);
198 
199  m_plotStdErr2Action = new QAction("- Std Error", this);
200  m_plotStdErr2Action->setCheckable(true);
201  m_plotStdErr2Action->setChecked(false);
202 
203  wrapper->addAction(m_plotAvgAction);
204  wrapper->addAction(m_plotMinAction);
205  wrapper->addAction(m_plotMaxAction);
206  wrapper->addAction(m_plotStdDev1Action);
207  wrapper->addAction(m_plotStdDev2Action);
208  wrapper->addAction(m_plotStdErr1Action);
209  wrapper->addAction(m_plotStdErr2Action);
210 
215  );
216 
217  QWidget *abstractToolWidgets =
219 
220  QPushButton *plotCurvesButton = new QPushButton("Select Curves to Plot");
221  connect(plotCurvesButton, SIGNAL(clicked()),
222  this, SLOT(selectCurvesToPlot()));
223 
224  QHBoxLayout *layout = new QHBoxLayout(wrapper);
225  layout->setMargin(0);
226  layout->addWidget(m_rubberBandCombo);
227  layout->addWidget(spectralDisplayCombo());
228  layout->addWidget(plotCurvesButton);
229  layout->addWidget(abstractToolWidgets);
230  layout->addStretch(1);
231  wrapper->setLayout(layout);
232 
233  return wrapper;
234  }
235 
236 
244  menu->addAction(m_toolPadAction);
245  }
246 
247 
254 
255  PlotCurve::Units preferredUnits =
256  (PlotCurve::Units)m_displayCombo->itemData(
257  m_displayCombo->currentIndex()).toInt();
258 
259  while (m_displayCombo->count())
260  m_displayCombo->removeItem(0);
261 
262  m_displayCombo->addItem("Band Number", PlotCurve::Band);
263 
264  bool supportsWavelength = true;
265 
266  foreach (MdiCubeViewport *cvp, viewportsToPlot()) {
267  int bandCount = cvp->cube()->bandCount();
268 
269  // if single band then disable spectral plot
270  Pvl &pvl = *cvp->cube()->label();
271  supportsWavelength = supportsWavelength &&
272  pvl.findObject("IsisCube").hasGroup("BandBin");
273 
274  if (supportsWavelength) {
275  PvlGroup &bandBin = pvl.findObject("IsisCube").findGroup("BandBin");
276  supportsWavelength = supportsWavelength &&
277  bandBin.hasKeyword("Center") &&
278  bandBin["Center"].size() == bandCount;
279  }
280  }
281 
282  if (supportsWavelength) {
283  m_displayCombo->addItem("Wavelength", PlotCurve::Wavelength);
284  }
285 
286  if (m_displayCombo->findData(preferredUnits) != -1) {
287  m_displayCombo->setCurrentIndex(
288  m_displayCombo->findData(preferredUnits));
289  }
290 
291  m_displayCombo->setVisible(m_displayCombo->count() > 1);
292  }
293 
294 
301  PlotWindow *window = new SpectralPlotWindow(
302  (PlotCurve::Units)m_displayCombo->itemData(
303  m_displayCombo->currentIndex()).toInt(),
304  qobject_cast<QWidget *>(parent()));
305  window->setWindowTitle("Spectral " + PlotWindow::defaultWindowTitle());
306 
307  return window;
308  }
309 
310 
317  m_minCurves->clear();
318  m_maxCurves->clear();
319  m_avgCurves->clear();
320  m_stdDev1Curves->clear();
321  m_stdDev2Curves->clear();
322  m_stdErr1Curves->clear();
323  m_stdErr2Curves->clear();
324  }
325 
326 
334  if (selectedWindow()) {
335  selectedWindow()->raise();
336  }
337 
338  if (rubberBandTool()->isValid()) {
339  refreshPlot();
340  }
341  else {
342  QMessageBox::information(NULL, "Error",
343  "The selected Area contains no valid pixels",
344  QMessageBox::Ok);
345  }
346  }
347 
348 
353  MdiCubeViewport *activeViewport = cubeViewport();
354 
355  if (activeViewport && rubberBandTool()->isValid()) {
356  // Find which window we want to paste into
357  PlotWindow *targetWindow = selectedWindow(true);
358 
359  // if the selected window won't work, create a new one
360  if (targetWindow->xAxisUnits() !=
361  m_displayCombo->itemData(m_displayCombo->currentIndex()).toInt()) {
362  targetWindow = addWindow();
363  }
364 
365  // get curves for active viewport and also for any linked viewports
366  foreach (MdiCubeViewport *viewport, viewportsToPlot()) {
367  /* We'll need X-Axis labels and a xMax to scale to.*/
368  QVector<double> labels;
369  Statistics wavelengthStats;
370 
371  QVector<QPointF> avgData, minData, maxData, std1Data, std2Data,
372  stdErr1Data, stdErr2Data, wavelengthData;
373  QVector<Statistics> plotStats;
374 
375  getSpectralStatistics(labels, plotStats, viewport);
376 
377  for (int index = 0; index < labels.size(); index++) {
378  if (!IsSpecial(plotStats[index].Average()) &&
379  !IsSpecial(plotStats[index].Minimum()) &&
380  !IsSpecial(plotStats[index].Maximum())) {
381  avgData.append(QPointF(labels[index], plotStats[index].Average()));
382  minData.append(QPointF(labels[index], plotStats[index].Minimum()));
383  maxData.append(QPointF(labels[index], plotStats[index].Maximum()));
384 
385  if (!IsSpecial(plotStats[index].StandardDeviation())) {
386  std1Data.append(QPointF(labels[index],
387  plotStats[index].Average() +
388  plotStats[index].StandardDeviation()));
389  std2Data.append(QPointF(labels[index],
390  plotStats[index].Average() -
391  plotStats[index].StandardDeviation()));
392 
393  double standardError = plotStats[index].StandardDeviation() /
394  sqrt(plotStats[index].ValidPixels());
395 
396  stdErr1Data.append(QPointF(labels[index],
397  plotStats[index].Average() +
398  standardError));
399  stdErr2Data.append(QPointF(labels[index],
400  plotStats[index].Average() -
401  standardError));
402  }
403  }
404  } /*end for loop*/
405 
406  if (labels.size() > 0) {
407  QList<QPoint> rubberBandPoints = rubberBandTool()->vertices();
408 
410  if (m_plotAvgAction->isChecked()) {
411  (*m_avgCurves)[viewport]->setData(new QwtPointSeriesData(avgData));
412  (*m_avgCurves)[viewport]->setSource(viewport, rubberBandPoints);
413  }
414 
415  if (m_plotMinAction->isChecked()) {
416  (*m_minCurves)[viewport]->setData(new QwtPointSeriesData(minData));
417  (*m_minCurves)[viewport]->setSource(viewport, rubberBandPoints);
418  }
419 
420  if (m_plotMaxAction->isChecked()) {
421  (*m_maxCurves)[viewport]->setData(new QwtPointSeriesData(maxData));
422  (*m_maxCurves)[viewport]->setSource(viewport, rubberBandPoints);
423  }
424 
425  if (m_plotStdDev1Action->isChecked()) {
426  (*m_stdDev1Curves)[viewport]->setData(
427  new QwtPointSeriesData(std1Data));
428  (*m_stdDev1Curves)[viewport]->setSource(viewport,
429  rubberBandPoints);
430  }
431 
432  if (m_plotStdDev2Action->isChecked()) {
433  (*m_stdDev2Curves)[viewport]->setData(
434  new QwtPointSeriesData(std2Data));
435  (*m_stdDev2Curves)[viewport]->setSource(viewport,
436  rubberBandPoints);
437  }
438 
439  if (m_plotStdErr1Action->isChecked()) {
440  (*m_stdErr1Curves)[viewport]->setData(
441  new QwtPointSeriesData(stdErr1Data));
442  (*m_stdErr1Curves)[viewport]->setSource(viewport,
443  rubberBandPoints);
444  }
445 
446  if (m_plotStdErr2Action->isChecked()) {
447  (*m_stdErr2Curves)[viewport]->setData(
448  new QwtPointSeriesData(stdErr2Data));
449  (*m_stdErr2Curves)[viewport]->setSource(viewport,
450  rubberBandPoints);
451  }
452  }
453  }
454 
455  targetWindow->replot();
456  updateTool();
457  }
458  }
459 
460 
466  PlotWindow *targetWindow = selectedWindow();
467 
468  if (targetWindow) {
469  PlotCurve::Units targetUnits = (PlotCurve::Units)m_displayCombo->itemData(
470  m_displayCombo->currentIndex()).toInt();
471 
472  QPen avgPen(Qt::white);
473  avgPen.setWidth(1);
474  avgPen.setStyle(Qt::SolidLine);
475 
476  QPen minMaxPen(Qt::cyan);
477 // minMaxPen.setStyle(Qt::DashLine);
478  minMaxPen.setWidth(1);
479  minMaxPen.setStyle(Qt::SolidLine);
480 
481  QPen stdDevPen(Qt::red);
482  stdDevPen.setWidth(1);
483 // stdDevPen.setStyle(Qt::DotLine);
484  stdDevPen.setStyle(Qt::SolidLine);
485 
486  QPen stdErrPen(Qt::green);
487  stdErrPen.setWidth(1);
488 // stdErrPen.setStyle(Qt::DotLine);
489  stdErrPen.setStyle(Qt::SolidLine);
490 
491  foreach (MdiCubeViewport *viewport, viewportsToPlot()) {
492  if (m_plotAvgAction->isChecked() &&
493  (!(*m_avgCurves)[viewport] ||
494  (*m_avgCurves)[viewport]->xUnits() != targetUnits)) {
495  CubePlotCurve *plotCurve = createCurve("Average", avgPen,
496  targetUnits, CubePlotCurve::CubeDN);
497  m_avgCurves->insert(viewport, plotCurve);
498  targetWindow->add(plotCurve);
499  }
500 
501  if (m_plotMinAction->isChecked() &&
502  (!(*m_minCurves)[viewport] ||
503  (*m_minCurves)[viewport]->xUnits() != targetUnits)) {
504  CubePlotCurve *plotCurve = createCurve("Minimum", minMaxPen,
505  targetUnits, CubePlotCurve::CubeDN);
506  m_minCurves->insert(viewport, plotCurve);
507  targetWindow->add(plotCurve);
508  }
509 
510  if (m_plotMaxAction->isChecked() &&
511  (!(*m_maxCurves)[viewport] ||
512  (*m_maxCurves)[viewport]->xUnits() != targetUnits)) {
513  CubePlotCurve *plotCurve = createCurve("Maximum", minMaxPen,
514  targetUnits, CubePlotCurve::CubeDN);
515  m_maxCurves->insert(viewport, plotCurve);
516  targetWindow->add(plotCurve);
517  }
518 
519  if (m_plotStdDev1Action->isChecked() &&
520  (!(*m_stdDev1Curves)[viewport] ||
521  (*m_stdDev1Curves)[viewport]->xUnits() != targetUnits)) {
522  CubePlotCurve *plotCurve = createCurve("+ Sigma", stdDevPen,
523  targetUnits, CubePlotCurve::CubeDN);
524  m_stdDev1Curves->insert(viewport, plotCurve);
525  targetWindow->add(plotCurve);
526  }
527 
528  if (m_plotStdDev2Action->isChecked() &&
529  (!(*m_stdDev2Curves)[viewport] ||
530  (*m_stdDev2Curves)[viewport]->xUnits() != targetUnits)) {
531  CubePlotCurve *plotCurve = createCurve("- Sigma", stdDevPen,
532  targetUnits, CubePlotCurve::CubeDN);
533  m_stdDev2Curves->insert(viewport, plotCurve);
534  targetWindow->add(plotCurve);
535  }
536 
537  if (m_plotStdErr1Action->isChecked() &&
538  (!(*m_stdErr1Curves)[viewport] ||
539  (*m_stdErr1Curves)[viewport]->xUnits() != targetUnits)) {
540  CubePlotCurve *plotCurve = createCurve("+ Std Error", stdErrPen,
541  targetUnits, CubePlotCurve::CubeDN);
542  m_stdErr1Curves->insert(viewport, plotCurve);
543  targetWindow->add(plotCurve);
544  }
545 
546  if (m_plotStdErr2Action->isChecked() &&
547  (!(*m_stdErr2Curves)[viewport] ||
548  (*m_stdErr2Curves)[viewport]->xUnits() != targetUnits)) {
549  CubePlotCurve *plotCurve = createCurve("- Std Error", stdErrPen,
550  targetUnits, CubePlotCurve::CubeDN);
551  m_stdErr2Curves->insert(viewport, plotCurve);
552  targetWindow->add(plotCurve);
553  }
554  }
555  }
556  }
557 
558 
570  QVector<Statistics> &data,
571  MdiCubeViewport *viewport) {
572  QList<QPoint> vertices = rubberBandTool()->vertices();
573 
574  if (vertices.size() < 1) return;
575 
576  double ss, sl, es, el, x, y;
577  std::vector <int> x_contained, y_contained;
578 
579  // Convert vertices to their sub-pixel sample/line values
580  viewport->viewportToCube(vertices[0].x(), vertices[0].y(), ss, sl);
581  viewport->viewportToCube(vertices[2].x(), vertices[2].y(), es, el);
582 
583  // round the start and end sample/line sub-pixel points to the nearest int (pixel)
584  ss = round(ss);
585  sl = round(sl);
586  es = round(es);
587  el = round(el);
588 
589  // calculate number of samples will be in Brick's shape buffer with absolute value
590  // in case user makes a rectangle from right to left
591  int samps = ( std::abs(es - ss) + 1) ;
592  Cube *cube = viewport->cube();
593  Brick *brick = new Brick(*cube, samps, 1, 1);
594  Pvl &pvl = *viewport->cube()->label();
595 
596  if (rubberBandTool()->currentMode() == RubberBandTool::PolygonMode) {
597 // samps = 1;
598  geos::geom::CoordinateSequence *pts = new geos::geom::CoordinateArraySequence();
599  for (int i = 0; i < vertices.size(); i++) {
600  viewport->viewportToCube(vertices[i].x(), vertices[i].y(), x, y);
601  // add the x,y vertices (double) to the pts CoordinateSequence
602  pts->add(geos::geom::Coordinate(x, y));
603  }/*end for*/
604 
605  /*Add the first point again in order to make a closed line string*/
606  viewport->viewportToCube(vertices[0].x(), vertices[0].y(), x, y);
607  pts->add(geos::geom::Coordinate(x, y));
608 
609  geos::geom::Polygon *poly = globalFactory.createPolygon(
610  globalFactory.createLinearRing(pts), NULL);
611 
612  const geos::geom::Envelope *envelope = poly->getEnvelopeInternal();
613 
614  // round the (double) max x's and y's and min x's and y's to the nearest pixel
615  for (int y = (int)round(envelope->getMinY());
616  y <= (int)round(envelope->getMaxY()); y++) {
617  for (int x = (int)round(envelope->getMinX());
618  x <= (int)round(envelope->getMaxX()); x++) {
619  // create a point at the center of the pixel
620  geos::geom::Coordinate c(x, y);
621  geos::geom::Point *p = globalFactory.createPoint(c);
622  // check if the center of the pixel is in the polygon's envelope (the selection)
623  bool contains = p->within(poly);
624  delete p;
625  if (contains) {
626  // these pixels will be used for computing statistics
627  x_contained.push_back(x);
628  y_contained.push_back(y);
629  }
630 
631  } /*end x*/
632  }/*end y*/
633 
634  delete poly;
635  poly = NULL;
636  }
637 
638 
639  for (int band = 1; band <= cube->bandCount(); band++) {
640  Statistics stats;
641 
642  /*Rectangle*/
643  if (rubberBandTool()->currentMode() == RubberBandTool::RectangleMode) {
644  for (int line = (int)std::min(sl, el); line <= (int)std::max(sl, el); line++) {
645  // set Brick's base position at left-most endpoint
646  brick->SetBasePosition(std::min(ss, es), line, band);
647  cube->read(*brick);
648  stats.AddData(brick->DoubleBuffer(), samps);
649  }
650  }
651 
652  /*Polygon*/
653  if (rubberBandTool()->currentMode() == RubberBandTool::PolygonMode) {
654  for (unsigned int j = 0; j < x_contained.size(); j++) {
655 
656  brick->SetBasePosition(x_contained[j], y_contained[j], band);
657  cube->read(*brick);
658  stats.AddData(*brick->DoubleBuffer());
659 
660  }
661  }
662 
663 
664  PlotCurve::Units targetUnits = (PlotCurve::Units)m_displayCombo->itemData(
665  m_displayCombo->currentIndex()).toInt();
666  if (targetUnits == PlotCurve::Band) {
667  labels.push_back(band);
668  }
669  else if (targetUnits == PlotCurve::Wavelength) {
670  if (pvl.findObject("IsisCube").hasGroup("BandBin")) {
671  PvlGroup &bandBin = pvl.findObject("IsisCube").findGroup("BandBin");
672  if (bandBin.hasKeyword("Center")) {
673  PvlKeyword &wavelength = bandBin.findKeyword("Center");
674  if (wavelength.size() > (band - 1)) {
675  labels.push_back(toDouble(wavelength[band-1]));
676  }
677  }
678  }
679  }
680 
681  if (stats.Average() == Null) {
682  data.push_back(stats);
683  }
684  else {
685  data.push_back(stats);
686  }
687  }
688 
689  delete brick;
690  }
691 }
Cube display widget for certain Isis MDI applications.
virtual void rubberBandComplete()
Called when the user has finished drawing with the rubber band.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
double * DoubleBuffer() const
Returns the value of the shape buffer.
Definition: Buffer.h:154
void enableRubberBandTool()
This method is called when the tool is activated by the parent, or when the plot mode is changed...
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:127
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
Cube * cube() const
Definition: CubeViewport.h:348
virtual PlotWindow * createWindow()
Creates a new plot window compatible with the curves in this tool.
QPointer< QAction > m_plotStdErr1Action
This QAction actives/deactivates plotting the avg+std dev values.
The data is a Cube DN value.
Definition: PlotCurve.h:67
QList< QPoint > vertices()
This method returns the vertices.
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_maxCurves
Plot curves for max values.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:286
Combo box for choosing a rubber band type.
void addTo(QMenu *menu)
Adds the plot tool to the menu.
Buffer for containing a three dimensional section of an image.
Definition: Brick.h:61
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
SpectralPlotTool(QWidget *parent)
This constructs a spectral plot tool.
void SetBasePosition(const int start_sample, const int start_line, const int start_band)
This method is used to set the base position of the shape buffer.
Definition: Brick.h:136
void setDrawActiveViewportOnly(bool activeOnly=false)
This called to set whether rubber band is drawn on active viewport only rather than all linked viewpo...
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdErr1Curves
Plot curves for avg. + std. err.
QAction * toolPadAction(ToolPad *pad)
This method configures the QAction for this tool.
The data is a wavelength.
Definition: PlotCurve.h:92
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
QPointer< QComboBox > m_displayCombo
wavelength vs band #
QWidget * createToolBarWidget(QStackedWidget *parent)
This provides the standard plot tool options, such as selecting an active plot window.
void refreshPlot()
This method replots the data, with current settings and rubber band, in the plot window.
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_minCurves
Plot curves for min values.
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:141
virtual void updateTool()
This forwards all update calls to the plot windows.
void getSpectralStatistics(QVector< double > &labels, QVector< Statistics > &data, MdiCubeViewport *viewport)
This method processes the spectral plot tool&#39;s selection and creates statistics for the selected pixe...
QPointer< RubberBandComboBox > m_rubberBandCombo
Combo box with all rubber banding types.
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdDev2Curves
Plot curves for avg. - std. dev.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
This is a plot curve with information relating it to a particular cube or region of a cube...
Definition: CubePlotCurve.h:68
PlotWindow * addWindow()
This creates and initializes everything about a plot window.
QPointer< QAction > m_plotMinAction
This QAction actives/deactivates plotting the min values.
virtual void detachCurves()
Forget about all existing plot curves.
A single keyword-value pair.
Definition: PvlKeyword.h:98
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves&#39; x data in this plot window.
Definition: PlotWindow.cpp:266
void read(Blob &blob) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:724
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
QPointer< QAction > m_plotStdDev1Action
This QAction actives/deactivates plotting the avg+std dev values.
QPointer< QAction > m_plotMaxAction
This QAction actives/deactivates plotting the max values.
void updateTool()
Updates plot tool.
Container for cube-like labels.
Definition: Pvl.h:135
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdDev1Curves
Plot curves for avg. + std. dev.
static CubePlotCurve * createCurve(QString name, QPen pen, PlotCurve::Units xUnits, PlotCurve::Units yUnits)
This is a helper method for children.
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdErr2Curves
Plot curves for avg. - std. err.
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_avgCurves
Plot curves for average values.
QPointer< QAction > m_toolPadAction
Plot tool&#39;s action.
void validatePlotCurves()
This method sets up the names, line style, and color of the all the CubePlotCurves that will be used ...
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
QPointer< QAction > m_plotStdErr2Action
This QAction actives/deactivates plotting the avg-std dev values.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
QPointer< QAction > m_plotStdDev2Action
This QAction actives/deactivates plotting the avg-std dev values.
PlotWindow * selectedWindow(bool createIfNeeded=true)
Get the &#39;active&#39; plot window (the window selected by the user to contain new curves).
static QString defaultWindowTitle()
This is the typical suffix for plot windows, it&#39;s here in case we want to update all plot windows to ...
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual int bandCount() const
Returns the number of virtual bands for the cube.
Definition: Cube.cpp:1125
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:211
QList< MdiCubeViewport * > viewportsToPlot()
Get a list of linked viewports that should be plotting when a new plot is requested.
void replot()
Reset the scale of the plot, replot it and emit plot changed.
The data is a band number.
Definition: PlotCurve.h:63
Parent class for plotting tools which provides common functionality.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:154
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
Definition: PlotWindow.cpp:436
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
void viewportSelected()
This protected slot is called when user selects a viewport.
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:313
Units
These are all the possible units for the x or y data in a plot curve.
Definition: PlotCurve.h:54
QPointer< QAction > m_plotAvgAction
This QAction actives/deactivates plotting the average values.
void selectCurvesToPlot()
This prompts the user for which curves they want to plot.
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widgets for the tool bar.
Functor for reduce using average functionality.
Definition: Reduce.h:102
QComboBox * spectralDisplayCombo() const
Get the combo box which toggles between units of wavelength and band number.
IO Handler for Isis Cubes.
Definition: Cube.h:170