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 }
Isis::AbstractPlotTool::addWindow
PlotWindow * addWindow()
This creates and initializes everything about a plot window.
Definition: AbstractPlotTool.cpp:303
Isis::SpectralPlotTool::m_maxCurves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_maxCurves
Plot curves for max values.
Definition: SpectralPlotTool.h:115
Isis::Brick::SetBasePosition
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:120
Isis::AbstractPlotTool::updateTool
virtual void updateTool()
This forwards all update calls to the plot windows.
Definition: AbstractPlotTool.cpp:118
Isis::SpectralPlotTool::m_plotAvgAction
QPointer< QAction > m_plotAvgAction
This QAction actives/deactivates plotting the average values.
Definition: SpectralPlotTool.h:99
Isis::SpectralPlotTool::createWindow
virtual PlotWindow * createWindow()
Creates a new plot window compatible with the curves in this tool.
Definition: SpectralPlotTool.cpp:300
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
QWidget
Isis::SpectralPlotTool::m_plotStdErr1Action
QPointer< QAction > m_plotStdErr1Action
This QAction actives/deactivates plotting the avg+std dev values.
Definition: SpectralPlotTool.h:109
Isis::Statistics
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:94
Isis::PlotCurve::CubeDN
@ CubeDN
The data is a Cube DN value.
Definition: PlotCurve.h:67
Isis::Statistics::AddData
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:141
Isis::RubberBandComboBox
Combo box for choosing a rubber band type.
Definition: RubberBandComboBox.h:26
Isis::SpectralPlotTool::SpectralPlotTool
SpectralPlotTool(QWidget *parent)
This constructs a spectral plot tool.
Definition: SpectralPlotTool.cpp:45
Isis::RubberBandTool::setDrawActiveViewportOnly
void setDrawActiveViewportOnly(bool activeOnly=false)
This called to set whether rubber band is drawn on active viewport only rather than all linked viewpo...
Definition: RubberBandTool.cpp:333
Isis::AbstractPlotTool::createCurve
static CubePlotCurve * createCurve(QString name, QPen pen, PlotCurve::Units xUnits, PlotCurve::Units yUnits)
This is a helper method for children.
Definition: AbstractPlotTool.cpp:233
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Average
Functor for reduce using average functionality.
Definition: Reduce.h:107
QList< QAction * >
Isis::CubePlotCurve
This is a plot curve with information relating it to a particular cube or region of a cube.
Definition: CubePlotCurve.h:53
Isis::SpectralPlotTool::addTo
void addTo(QMenu *menu)
Adds the plot tool to the menu.
Definition: SpectralPlotTool.cpp:243
Isis::Cube::read
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:807
Isis::Buffer::DoubleBuffer
double * DoubleBuffer() const
Returns the value of the shape buffer.
Definition: Buffer.h:138
QMenu
Isis::Tool::toolIconDir
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:113
Isis::RubberBandComboBox::Polygon
@ Polygon
Polygon.
Definition: RubberBandComboBox.h:41
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::AbstractPlotTool::viewportsToPlot
QList< MdiCubeViewport * > viewportsToPlot()
Get a list of linked viewports that should be plotting when a new plot is requested.
Definition: AbstractPlotTool.cpp:133
Isis::RubberBandComboBox::Rectangle
@ Rectangle
Rectangle.
Definition: RubberBandComboBox.h:39
Isis::SpectralPlotTool::m_displayCombo
QPointer< QComboBox > m_displayCombo
wavelength vs band #
Definition: SpectralPlotTool.h:90
Isis::PlotWindow::defaultWindowTitle
static QString defaultWindowTitle()
This is the typical suffix for plot windows, it's here in case we want to update all plot windows to ...
Definition: PlotWindow.cpp:1810
Isis::AbstractPlotTool::selectedWindow
PlotWindow * selectedWindow(bool createIfNeeded=true)
Get the 'active' plot window (the window selected by the user to contain new curves).
Definition: AbstractPlotTool.cpp:256
Isis::PlotCurve::Units
Units
These are all the possible units for the x or y data in a plot curve.
Definition: PlotCurve.h:54
Isis::SpectralPlotTool::m_stdDev2Curves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdDev2Curves
Plot curves for avg. - std. dev.
Definition: SpectralPlotTool.h:131
Isis::PlotWindow::add
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
Definition: PlotWindow.cpp:436
Isis::Brick
Buffer for containing a three dimensional section of an image.
Definition: Brick.h:45
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
QComboBox
Isis::PlotWindow::xAxisUnits
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves' x data in this plot window.
Definition: PlotWindow.cpp:266
Isis::SpectralPlotTool::m_plotStdDev1Action
QPointer< QAction > m_plotStdDev1Action
This QAction actives/deactivates plotting the avg+std dev values.
Definition: SpectralPlotTool.h:105
Isis::SpectralPlotTool::toolPadAction
QAction * toolPadAction(ToolPad *pad)
This method configures the QAction for this tool.
Definition: SpectralPlotTool.cpp:152
Isis::SpectralPlotTool::m_stdErr1Curves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdErr1Curves
Plot curves for avg. + std. err.
Definition: SpectralPlotTool.h:135
Isis::SpectralPlotTool::refreshPlot
void refreshPlot()
This method replots the data, with current settings and rubber band, in the plot window.
Definition: SpectralPlotTool.cpp:352
Isis::PlotCurve::Band
@ Band
The data is a band number.
Definition: PlotCurve.h:63
Isis::SpectralPlotTool::m_plotMinAction
QPointer< QAction > m_plotMinAction
This QAction actives/deactivates plotting the min values.
Definition: SpectralPlotTool.h:101
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::SpectralPlotTool::validatePlotCurves
void validatePlotCurves()
This method sets up the names, line style, and color of the all the CubePlotCurves that will be used ...
Definition: SpectralPlotTool.cpp:465
Isis::SpectralPlotTool::getSpectralStatistics
void getSpectralStatistics(QVector< double > &labels, QVector< Statistics > &data, MdiCubeViewport *viewport)
This method processes the spectral plot tool's selection and creates statistics for the selected pixe...
Definition: SpectralPlotTool.cpp:569
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::SpectralPlotTool::m_plotMaxAction
QPointer< QAction > m_plotMaxAction
This QAction actives/deactivates plotting the max values.
Definition: SpectralPlotTool.h:103
Isis::SpectralPlotTool::updateTool
void updateTool()
Updates plot tool.
Definition: SpectralPlotTool.cpp:252
Isis::SpectralPlotTool::m_minCurves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_minCurves
Plot curves for min values.
Definition: SpectralPlotTool.h:119
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::SpectralPlotTool::m_toolPadAction
QPointer< QAction > m_toolPadAction
Plot tool's action.
Definition: SpectralPlotTool.h:96
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::SpectralPlotTool::m_rubberBandCombo
QPointer< RubberBandComboBox > m_rubberBandCombo
Combo box with all rubber banding types.
Definition: SpectralPlotTool.h:93
Isis::PlotCurve::Wavelength
@ Wavelength
The data is a wavelength.
Definition: PlotCurve.h:92
Isis::Cube::bandCount
virtual int bandCount() const
Returns the number of virtual bands for the cube.
Definition: Cube.cpp:1410
Isis::SpectralPlotTool::m_plotStdErr2Action
QPointer< QAction > m_plotStdErr2Action
This QAction actives/deactivates plotting the avg-std dev values.
Definition: SpectralPlotTool.h:111
Isis::AbstractPlotTool
Parent class for plotting tools which provides common functionality.
Definition: AbstractPlotTool.h:43
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::Statistics::Average
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:300
Isis::SpectralPlotTool::detachCurves
virtual void detachCurves()
Forget about all existing plot curves.
Definition: SpectralPlotTool.cpp:316
Isis::ToolPad
Definition: ToolPad.h:14
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::SpectralPlotWindow
Definition: SpectralPlotWindow.h:29
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::PvlKeyword::size
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:125
Isis::SpectralPlotTool::m_plotStdDev2Action
QPointer< QAction > m_plotStdDev2Action
This QAction actives/deactivates plotting the avg-std dev values.
Definition: SpectralPlotTool.h:107
Isis::SpectralPlotTool::m_stdDev1Curves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdDev1Curves
Plot curves for avg. + std. dev.
Definition: SpectralPlotTool.h:127
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::SpectralPlotTool::spectralDisplayCombo
QComboBox * spectralDisplayCombo() const
Get the combo box which toggles between units of wavelength and band number.
Definition: SpectralPlotTool.cpp:74
Isis::SpectralPlotTool::m_stdErr2Curves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_stdErr2Curves
Plot curves for avg. - std. err.
Definition: SpectralPlotTool.h:139
Isis::SpectralPlotTool::m_avgCurves
QScopedPointer< QMap< MdiCubeViewport *, QPointer< CubePlotCurve > > > m_avgCurves
Plot curves for average values.
Definition: SpectralPlotTool.h:123
QDialog
Isis::CubeViewport::viewportToCube
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
Definition: CubeViewport.cpp:815
Isis::SpectralPlotTool::rubberBandComplete
virtual void rubberBandComplete()
Called when the user has finished drawing with the rubber band.
Definition: SpectralPlotTool.cpp:333
Isis::PvlContainer::findKeyword
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Definition: PvlContainer.cpp:62
Isis::SpectralPlotTool::viewportSelected
void viewportSelected()
This protected slot is called when user selects a viewport.
Definition: SpectralPlotTool.cpp:64
QVector< double >
Isis::SpectralPlotTool::selectCurvesToPlot
void selectCurvesToPlot()
This prompts the user for which curves they want to plot.
Definition: SpectralPlotTool.cpp:102
Isis::SpectralPlotTool::createToolBarWidget
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widgets for the tool bar.
Definition: SpectralPlotTool.cpp:171
Isis::SpectralPlotTool::enableRubberBandTool
void enableRubberBandTool()
This method is called when the tool is activated by the parent, or when the plot mode is changed.
Definition: SpectralPlotTool.cpp:87
Isis::PlotWindow::replot
void replot()
Reset the scale of the plot, replot it and emit plot changed.
Definition: PlotWindow.cpp:1797
Isis::PlotWindow
Definition: PlotWindow.h:88
QAction
Isis::CubeViewport::cube
Cube * cube() const
Definition: CubeViewport.h:338
Isis::AbstractPlotTool::createToolBarWidget
QWidget * createToolBarWidget(QStackedWidget *parent)
This provides the standard plot tool options, such as selecting an active plot window.
Definition: AbstractPlotTool.cpp:103
Isis::Tool::cubeViewport
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:197
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::RubberBandTool::vertices
QList< QPoint > vertices()
This method returns the vertices.
Definition: RubberBandTool.cpp:672