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