Isis 3 Programmer Reference
StatisticsTool.cpp
1 #include "StatisticsTool.h"
2 
3 #include <QAction>
4 #include <QCheckBox>
5 #include <QDebug>
6 #include <QDialog>
7 #include <QGroupBox>
8 #include <QHBoxLayout>
9 #include <QIntValidator>
10 #include <QLabel>
11 #include <QLineEdit>
12 #include <QMouseEvent>
13 #include <QPainter>
14 #include <QRadioButton>
15 #include <QScrollArea>
16 #include <QScrollBar>
17 #include <QStackedWidget>
18 #include <QSlider>
19 #include <QToolButton>
20 
21 #include "Brick.h"
22 #include "MdiCubeViewport.h"
23 #include "ToolPad.h"
24 
25 namespace Isis {
26 
33  p_boxSamps = 3;
34  p_boxLines = 3;
35 
36  p_ulSamp = -1;
37  p_ulLine = -1;
38 
39  p_set = false;
40 
41  p_dialog = new QDialog(parent);
42  p_dialog->setWindowTitle("Statistics");
43 
44  p_visualBox = new QGroupBox("Visual Display");
45 
46  p_visualScroll = new QScrollArea;
47  p_visualScroll->setBackgroundRole(QPalette::Dark);
48 
50  p_visualDisplay->setObjectName("dnDisplay");
51 
52  QCheckBox *checkBox = new QCheckBox("Hide Display");
53  connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(hideDisplay(bool)));
54 
55  QLabel *boxLabel = new QLabel("Box Size:");
56  p_boxLabel = new QLabel;
57  QString samps, lines;
58  samps.setNum(p_boxSamps);
59  lines.setNum(p_boxLines);
60  p_boxLabel->setText(samps + "x" + lines);
61 
62  QHBoxLayout *boxLabelLayout = new QHBoxLayout;
63 
64  boxLabelLayout->addWidget(checkBox);
65  boxLabelLayout->addStretch(1);
66  boxLabelLayout->addWidget(boxLabel);
67  boxLabelLayout->addWidget(p_boxLabel);
68 
69  QSlider *slider = new QSlider(Qt::Vertical);
70  slider->setRange(2, 18);
71  slider->setSliderPosition(10);
72  slider->setSingleStep(1);
73  slider->setTickInterval(1);
74  slider->setTickPosition(QSlider::TicksBelow);
75  connect(slider, SIGNAL(valueChanged(int)), p_visualDisplay, SLOT(setBoxSize(int)));
76  connect(slider, SIGNAL(valueChanged(int)), this, SLOT(resizeScrollbars()));
77  p_visualScroll->setWidget(p_visualDisplay);
78 
79  QGroupBox *displayMode = new QGroupBox("Display Mode");
80  QRadioButton *displayText = new QRadioButton("Show Text");
81  displayText->setToolTip("Display the pixels of a region as text");
82  QRadioButton *displayPixels = new QRadioButton("Show Pixel Values");
83  displayPixels->setToolTip("Display the pixels of a region");
84  QRadioButton *displayDeviation = new QRadioButton("Show Deviation");
85  displayDeviation->setToolTip("Display standard deviation over a region,\n where red denotes a larger deviation");
86 
87  QHBoxLayout *displayModeLayout = new QHBoxLayout;
88  displayModeLayout->addWidget(displayText);
89  displayModeLayout->addWidget(displayPixels);
90  displayModeLayout->addWidget(displayDeviation);
91 
92  displayMode->setLayout(displayModeLayout);
93 
94  connect(displayText, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showText(bool)));
95  connect(displayText, SIGNAL(toggled(bool)), slider, SLOT(setDisabled(bool)));
96  connect(displayPixels, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showPixels(bool)));
97  connect(displayDeviation, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showDeviation(bool)));
98 
99  displayText->setChecked(true);
100 
101  QHBoxLayout *visualHBoxLayout = new QHBoxLayout;
102  visualHBoxLayout->addWidget(p_visualScroll);
103  visualHBoxLayout->addWidget(slider);
104 
105  QVBoxLayout *visualVBoxLayout = new QVBoxLayout;
106  visualVBoxLayout->addLayout(visualHBoxLayout);
107  visualVBoxLayout->addWidget(displayMode);
108 
109  p_visualBox->setLayout(visualVBoxLayout);
110 
111  QGroupBox *statsBox = new QGroupBox("Statistics");
112 
113  p_minLabel = new QLabel("Minimum: n/a");
114  p_minLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
115  p_minLabel->setLineWidth(1);
116  p_minLabel->setMargin(10);
117  p_minLabel->setAlignment(Qt::AlignLeft);
118 
119  p_maxLabel = new QLabel("Maximum: n/a");
120  p_maxLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
121  p_maxLabel->setLineWidth(1);
122  p_maxLabel->setMargin(10);
123  p_maxLabel->setAlignment(Qt::AlignLeft);
124 
125  p_avgLabel = new QLabel("Average: n/a");
126  p_avgLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
127  p_avgLabel->setLineWidth(1);
128  p_avgLabel->setMargin(10);
129  p_avgLabel->setAlignment(Qt::AlignLeft);
130 
131  p_stdevLabel = new QLabel("Standard Dev: n/a");
132  p_stdevLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
133  p_stdevLabel->setLineWidth(1);
134  p_stdevLabel->setMargin(10);
135  p_stdevLabel->setAlignment(Qt::AlignLeft);
136 
137  p_dnLabel = new QLabel("DN: n/a");
138  QFont labelFont = p_dnLabel->font();
139  labelFont.setPointSize(8);
140  p_dnLabel->setFont(labelFont);
141  p_dnLabel->setAlignment(Qt::AlignRight);
142  connect(p_visualDisplay, SIGNAL(setDn(QString)), p_dnLabel, SLOT(setText(QString)));
143 
144  p_sampLabel = new QLabel("Sample: n/a");
145  p_sampLabel->setFont(labelFont);
146  p_sampLabel->setAlignment(Qt::AlignLeft);
147  connect(p_visualDisplay, SIGNAL(setSample(QString)), p_sampLabel, SLOT(setText(QString)));
148 
149  p_lineLabel = new QLabel("Line: n/a");
150  p_lineLabel->setFont(labelFont);
151  p_lineLabel->setAlignment(Qt::AlignCenter);
152  connect(p_visualDisplay, SIGNAL(setLine(QString)), p_lineLabel, SLOT(setText(QString)));
153 
154  QGridLayout *statsLayout = new QGridLayout;
155  statsLayout->addWidget(p_minLabel, 0, 0, 1, 2);
156  statsLayout->addWidget(p_maxLabel, 1, 0, 1, 2);
157  statsLayout->addWidget(p_avgLabel, 0, 2, 1, 2);
158  statsLayout->addWidget(p_stdevLabel, 1, 2, 1, 2);
159  statsLayout->addWidget(p_sampLabel, 2, 0);
160  statsLayout->addWidget(p_lineLabel, 2, 1, 1, 2);
161  statsLayout->addWidget(p_dnLabel, 2, 3);
162 
163  statsBox->setLayout(statsLayout);
164 
165  QVBoxLayout *dialogLayout = new QVBoxLayout;
166  dialogLayout->addLayout(boxLabelLayout);
167  dialogLayout->addWidget(p_visualBox);
168  dialogLayout->addWidget(statsBox);
169 
170  p_dialog->setLayout(dialogLayout);
171 
172  checkBox->setChecked(true);
173  }
174 
183  QAction *action = new QAction("Statistics", toolpad);
184  action->setIcon(QPixmap(toolIconDir() + "/statistics.png"));
185  action->setToolTip("Statistics");
186  QObject::connect(action, SIGNAL(triggered()), p_dialog, SLOT(show()));
187 
188  QString text = "";
189 
190  action->setWhatsThis(text);
191  return action;
192  }
193 
201  QWidget *StatisticsTool::createToolBarWidget(QStackedWidget *parent) {
202  QWidget *hbox = new QWidget(parent);
203 
204  QIntValidator *ival = new QIntValidator(hbox);
205  ival->setRange(1, 100);
206 
207  QLabel *sampleLabel = new QLabel("Box Samples:");
208  p_sampsEdit = new QLineEdit(hbox);
209  p_sampsEdit->setValidator(ival);
210  p_sampsEdit->setMaximumWidth(50);
211 
212  QString samps;
213  samps.setNum(p_boxSamps);
214 
215  p_sampsEdit->setText(samps);
216  connect(p_sampsEdit, SIGNAL(editingFinished()), this, SLOT(changeBoxSamples()));
217 
218  QLabel *lineLabel = new QLabel("Box Lines:");
219  p_linesEdit = new QLineEdit(hbox);
220  p_linesEdit->setValidator(ival);
221  p_linesEdit->setMaximumWidth(50);
222 
223  QString lines;
224  lines.setNum(p_boxLines);
225 
226  p_linesEdit->setText(lines);
227  connect(p_linesEdit, SIGNAL(editingFinished()), this, SLOT(changeBoxLines()));
228 
229  QToolButton *showButton = new QToolButton();
230  showButton->setText("Show");
231  showButton->setToolTip("");
232  QString text = "";
233  showButton->setWhatsThis(text);
234 
235  connect(showButton, SIGNAL(clicked()), p_dialog, SLOT(show()));
236 
237  QHBoxLayout *layout = new QHBoxLayout;
238  layout->setMargin(0);
239  layout->addWidget(sampleLabel);
240  layout->addWidget(p_sampsEdit);
241  layout->addWidget(lineLabel);
242  layout->addWidget(p_linesEdit);
243  layout->addWidget(showButton);
244  layout->addStretch(1);
245  hbox->setLayout(layout);
246  return hbox;
247  }
248 
255  void StatisticsTool::mouseButtonRelease(QPoint p, Qt::MouseButton s) {
256  if(s == Qt::LeftButton) {
257  getStatistics(p);
258  }
259  }
260 
266  void StatisticsTool::hideDisplay(bool hide) {
267  if(hide) {
268  p_visualBox->hide();
269  p_sampLabel->hide();
270  p_lineLabel->hide();
271  p_dnLabel->hide();
272 
273  p_dialog->setMinimumSize(350, 165);
274  p_dialog->resize(350, 165);
275  }
276  else {
277  p_visualBox->show();
278  p_sampLabel->show();
279  p_lineLabel->show();
280  p_dnLabel->show();
281 
282  p_dialog->setMinimumSize(565, 765);
283  p_dialog->resize(565, 765);
284  }
285  }
286 
294  MdiCubeViewport *cvp = cubeViewport();
295  if(cvp == NULL) return;
296 
297  double sample, line;
298  cvp->viewportToCube(p.x(), p.y(), sample, line);
299 
300  // If we are outside of the cube, do nothing
301  if((sample < 0.5) || (line < 0.5) ||
302  (sample > cvp->cubeSamples() + 0.5) || (line > cvp->cubeLines() + 0.5)) {
303  return;
304  }
305 
306  int isamp = (int)(sample + 0.5);
307  int iline = (int)(line + 0.5);
308 
309  Statistics stats;
310  Brick *brick = new Brick(1, 1, 1, cvp->cube()->pixelType());
311 
312 
314 
315  double lineDiff = p_boxLines / 2.0;
316  double sampDiff = p_boxSamps / 2.0;
317 
318  p_ulSamp = isamp - (int)floor(sampDiff);
319  p_ulLine = iline - (int)floor(lineDiff);
320 
321  int x, y;
322 
323  y = p_ulLine;
324 
325  for(int i = 0; i < p_boxLines; i++) {
326  x = p_ulSamp;
327  if(y < 1 || y > cvp->cubeLines()) {
328  y++;
329  continue;
330  }
331  for(int j = 0; j < p_boxSamps; j++) {
332  if(x < 1 || x > cvp->cubeSamples()) {
333  x++;
334  continue;
335  }
336  brick->SetBasePosition(x, y, cvp->grayBand());
337  cvp->cube()->read(*brick);
338  stats.AddData(brick->at(0));
339  pixelData[i][j] = brick->at(0);
340 
341  x++;
342  }
343  y++;
344  }
345 
347 
348  if (stats.ValidPixels()) {
349  p_minLabel->setText(QString("Minimum: %1").arg(stats.Minimum()));
350  p_maxLabel->setText(QString("Maximum: %1").arg(stats.Maximum()));
351  p_avgLabel->setText(QString("Average: %1").arg(stats.Average()));
352  p_stdevLabel->setText(QString("Standard Dev: %1").arg(stats.StandardDeviation(), 0, 'f', 6));
353  }
354  else {
355  p_minLabel->setText(QString("Minimum: n/a"));
356  p_maxLabel->setText(QString("Maximum: n/a"));
357  p_avgLabel->setText(QString("Average: n/a"));
358  p_stdevLabel->setText(QString("Standard Dev: n/a"));
359  }
360 
361  p_set = true;
362 
364  }
365 
371  QString samps = p_sampsEdit->text();
372  if(samps != "" && samps.toInt() != p_boxSamps && samps.toInt() > 0) {
373  p_boxSamps = samps.toInt();
374  QString lines;
375  lines.setNum(p_boxLines);
376  p_boxLabel->setText(samps + "x" + lines);
377 
379 
380  p_set = false;
381 
383  }
384  }
385 
391  QString lines = p_linesEdit->text();
392  if(lines != "" && lines.toInt() != p_boxLines && lines.toInt() > 0) {
393  p_boxLines = lines.toInt();
394  QString samps;
395  samps.setNum(p_boxSamps);
396  p_boxLabel->setText(samps + "x" + lines);
397 
399 
400  p_set = false;
401 
403  }
404  }
405 
411  QScrollBar *hbar = p_visualScroll->horizontalScrollBar();
412  QScrollBar *vbar = p_visualScroll->verticalScrollBar();
413  hbar->setSliderPosition((hbar->maximum() + hbar->minimum()) / 2);
414  vbar->setSliderPosition((vbar->maximum() + vbar->minimum()) / 2);
415  }
416 
423  p_boxSamps(3),
424  p_boxLines(3),
425  p_boxWidth(20),
426  p_boxHeight(20),
427  p_oldWidth(20),
428  p_oldHeight(20),
429  p_ulSamp(-1),
430  p_ulLine(-1),
431  p_set(false),
432  p_showText(true),
433  p_showPixels(false),
434  p_showDeviation(false) {
435 
436  p_stretch.SetNull(0.0);
437  p_stretch.SetLis(0.0);
438  p_stretch.SetLrs(0.0);
439  p_stretch.SetHis(255.0);
440  p_stretch.SetHrs(255.0);
441  p_stretch.SetMinimum(0.0);
442  p_stretch.SetMaximum(255.0);
444  paintPixmap();
445  setMouseTracking(true);
446  setBackgroundRole(QPalette::Dark);
447  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
448  }
449 
456  QSize VisualDisplay::sizeHint() const {
457  return QSize(460, 460);
458  }
459 
465  void VisualDisplay::setSamples(int samps) {
466  p_boxSamps = samps;
468  p_stats.Reset();
469 
470  p_set = false;
471  updateSize();
472  }
473 
479  void VisualDisplay::setLines(int lines) {
480  p_boxLines = lines;
482  p_stats.Reset();
483 
484  p_set = false;
485  updateSize();
486  }
487 
493  void VisualDisplay::setBoxSize(int size) {
494  p_boxWidth = 2 * size;
495  p_boxHeight = 2 * size;
498  updateSize();
499  }
500 
506  if(p_boxSamps > this->sizeHint().width() / p_boxWidth) {
507  resize(this->sizeHint().width() + (p_boxWidth * (p_boxSamps - this->sizeHint().width() / p_boxWidth)), this->size().height());
508  }
509  else {
510  resize(this->sizeHint().width(), this->size().height());
511  }
512 
513  if(p_boxLines > this->sizeHint().height() / p_boxHeight) {
514  resize(this->size().width(), this->sizeHint().height() + (p_boxHeight * (p_boxLines - this->sizeHint().height() / p_boxHeight)));
515  }
516  else {
517  resize(this->size().width(), this->sizeHint().height());
518  }
519 
520  paintPixmap();
521  update();
522  }
523 
529  void VisualDisplay::showText(bool b) {
530  p_showText = b;
531  if(b) {
534  p_boxWidth = 100;
535  p_boxHeight = 20;
536  updateSize();
537  }
538  }
539 
540 
547  p_showPixels = b;
548  if(b) {
552  }
553  updateSize();
554  }
555  }
556 
563  p_showDeviation = b;
564  if(b) {
568  }
569  updateSize();
570  }
571  }
572 
580  void VisualDisplay::setPixelData(QVector<QVector<double> > data, int samp, int line) {
581  p_pixelData = data;
582  p_ulSamp = samp;
583  p_ulLine = line;
584 
585  p_stats.Reset();
586 
587  for(int i = 0; i < data.size(); i++) {
588  for(int j = 0; j < data[i].size(); j++) {
589  if(p_ulSamp + j < 0 || p_ulLine + i < 0) continue;
590  p_stats.AddData(data[i][j]);
591  }
592  }
593 
594  if(fabs(p_stats.BestMinimum()) < DBL_MAX && fabs(p_stats.BestMaximum()) < DBL_MAX) {
596  for(int i = 0; i < data.size(); i++) {
597  hist.AddData(data[i].data(), data[i].size());
598  }
599 
601  if(hist.Percent(0.5) != hist.Percent(99.5)) {
602  p_stretch.AddPair(hist.Percent(0.5), 0.0);
603  p_stretch.AddPair(hist.Percent(99.5), 255.0);
604  }
605  else {
606  p_stretch.AddPair(-DBL_MAX, 0.0);
607  p_stretch.AddPair(DBL_MAX, 255.0);
608  }
609  }
610  else {
612  p_stretch.AddPair(-DBL_MAX, 0.0);
613  p_stretch.AddPair(DBL_MAX, 255.0);
614  }
615 
616  p_set = true;
617  paintPixmap();
618  }
619 
626  p_pixmap.fill();
627  QPainter p(&p_pixmap);
628  QRect rect(0, 0, p_boxWidth, p_boxHeight);
629 
630  int midX = p_pixmap.width() / 2 - ((p_boxWidth / 2) * (p_boxSamps % 2));
631  int midY = p_pixmap.height() / 2 - ((p_boxHeight / 2) * (p_boxLines % 2));
632 
633  int x, y;
634  y = 0;
635 
636  for(int i = 0; i < p_boxLines; i++) {
637  x = 0;
638  for(int j = 0; j < p_boxSamps; j++) {
639  double dn = p_pixelData[i][j];
640  QColor c;
642  if(p_showDeviation) {
643  if(!IsSpecial(dn) && p_stats.TotalPixels() > 0 && p_stats.StandardDeviation() != 0) {
644  double diff;
645 
646  if(dn < p_stats.Average()) {
647  diff = p_stats.Average() - dn;
648  diff /= p_stats.Average() - p_stats.Minimum();
649  }
650  else {
651  diff = dn - p_stats.Average();
652  diff /= p_stats.Maximum() - p_stats.Average();
653  }
654 
655  int i = (int)(diff * 255.0);
656  c = QColor(i, 255 - i, 0);
657  }
658  else {
659  c = QColor(0, 0, 0);
660  }
661  }
662  else {
663  double visualValue = p_stretch.Map(dn);
664 
665  c = QColor(visualValue, visualValue, visualValue);
666  }
667  }
668  p.save();
669  p.translate(x, y);
670 
671  if(p_showText) {
672  p.drawRect(rect);
673 
674  if (!IsSpecial(dn))
675  p.drawText(rect, Qt::AlignCenter, QString::number(dn));
676  else
677  p.drawText(rect, Qt::AlignCenter, PixelToString(dn));
678  }
679  else {
680  p.fillRect(rect, c);
681  }
682 
683  p.restore();
684  x += p_boxWidth;
685  }
686  y += p_boxHeight;
687  }
688 
689  p.setPen(QPen(Qt::red, 1));
690  p.save();
691  p.translate(midX, midY);
692  p.drawRect(rect);
693  p.restore();
694  update();
695  }
696 
702  void VisualDisplay::paintEvent(QPaintEvent *event) {
703 
704  QPainter painter(this);
705 
706  int midX = width() / 2 - (p_boxWidth * (int)floor(p_boxSamps / 2) + (p_boxWidth / 2));
707  int midY = height() / 2 - (p_boxHeight * (int)floor(p_boxLines / 2) + (p_boxHeight / 2));
708 
709  painter.drawPixmap(midX, midY, p_pixmap);
710  }
711 
717  void VisualDisplay::mouseMoveEvent(QMouseEvent *event) {
718  double startX = width() / 2 - (p_boxWidth * (int)floor(p_boxSamps / 2) + (p_boxWidth / 2));
719  double startY = height() / 2 - (p_boxHeight * (int)floor(p_boxLines / 2) + (p_boxHeight / 2));
720 
721  int x = (int)ceil((event->x() - startX) / p_boxWidth);
722  int y = (int)ceil((event->y() - startY) / p_boxHeight);
723 
724  if(!p_set || x < 1 || y < 1 || x > p_boxSamps || y > p_boxLines) {
725  emit setSample("Sample: n/a");
726  emit setLine("Line: n/a");
727  emit setDn("DN: n/a");
728  }
729  else {
730  emit setSample(QString("Sample: %1").arg(p_ulSamp + x - 1));
731  emit setLine(QString("Line: %1").arg(p_ulLine + y - 1));
732  double dn = p_pixelData[y-1][x-1];
733  if(IsSpecial(dn))
734  emit setDn(QString("DN: %1").arg(PixelToString(dn)));
735  else
736  emit setDn(QString("DN: %1").arg(dn));
737  }
738  }
739 
745  void VisualDisplay::leaveEvent(QEvent *event) {
746  emit setSample("Sample: n/a");
747  emit setLine("Line: n/a");
748  emit setDn("DN: n/a");
749  }
750 }
Cube display widget for certain Isis MDI applications.
void changeBoxSamples()
Change the box sample size.
QDialog * p_dialog
Dialog to show pixel data and statistics.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the histogram counters.
Definition: Histogram.cpp:453
QWidget * createToolBarWidget(QStackedWidget *parent)
Attaches this tool to the toolbar.
bool p_showPixels
Display pixels?
int cubeLines() const
Return the number of lines in the cube.
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
int p_oldWidth
Previous box width in pixels.
Cube * cube() const
Definition: CubeViewport.h:348
int p_ulSamp
Upper left sample of region captured.
QLabel * p_avgLabel
Average label.
bool p_showDeviation
Display deviation?
int p_oldHeight
Previous box height in pixels.
QSize sizeHint() const
Size hint for this widget.
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:325
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
Definition: Statistics.cpp:395
QLabel * p_boxLabel
Box label.
QLabel * p_maxLabel
Maximum label.
double Map(const double value) const
Maps an input value to an output value based on the stretch pairs and/or special pixel mappings...
Definition: Stretch.cpp:84
VisualDisplay * p_visualDisplay
Visual display.
int p_boxWidth
Box width in pixels.
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
Called when a mouse button is released.
Stretch p_stretch
Stretch used to display pixels.
QVector< QVector< double > > p_pixelData
Stored pixel values.
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
Definition: Statistics.cpp:634
QAction * toolPadAction(ToolPad *toolpad)
Attaches this tool to the toolpad.
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition: Stretch.h:119
Buffer for containing a three dimensional section of an image.
Definition: Brick.h:61
int p_boxSamps
Sample size for box.
double at(const int index) const
Returns the value in the shape buffer at the given index.
Definition: Buffer.cpp:247
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
QLabel * p_sampLabel
Sample label.
void mouseMoveEvent(QMouseEvent *event)
Called when the mouse moves over this widget.
int p_boxSamps
Sample size for box.
QLabel * p_lineLabel
Line label.
BigInt ValidPixels() const
Returns the total number of valid pixels processed.
Definition: Statistics.cpp:446
void changeBoxLines()
Change the box line size.
QGroupBox * p_visualBox
Visual group box to hold visual display.
QLabel * p_stdevLabel
Std Dev label.
void paintPixmap()
Paint the pixmap.
void hideDisplay(bool hide)
Hide/Show the visual display.
BigInt TotalPixels() const
Returns the total number of pixels processed (valid and invalid).
Definition: Statistics.cpp:433
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
Definition: Statistics.cpp:416
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
Definition: Stretch.cpp:63
void setSample(const QString st)
Signal to set the Sample label to st.
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
Definition: Statistics.cpp:611
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition: Stretch.h:152
bool p_showText
Display text?
Container of a cube histogram.
Definition: Histogram.h:86
void setSamples(int samps)
Set box sample size.
int p_boxLines
Line size for box.
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition: Stretch.h:130
bool p_set
Boolean to see if data is set.
int grayBand() const
Definition: CubeViewport.h:204
void leaveEvent(QEvent *event)
Mouse left widget, update labels.
void Reset()
Reset all accumulators and counters to zero.
Definition: Statistics.cpp:126
QLabel * p_dnLabel
DN label.
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition: Stretch.h:141
void setDn(const QString st)
Signal to set the DN label to st.
Tool to visualize statistics in an n * m box.
void setBoxSize(int size)
Set box size in pixels.
int p_ulSamp
Upper left sample of region.
int p_ulLine
Upper left line of region.
int p_boxHeight
Box height in pixels.
int p_ulLine
Upper left line of region captured.
QLabel * p_minLabel
Minimum label.
void setLine(const QString st)
Signal to set the Line label to st.
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
void getStatistics(QPoint p)
Retrieve the statistics based on the box size and point on the cube.
QPixmap p_pixmap
Pixmap used for drawing.
PixelType pixelType() const
Definition: Cube.cpp:1403
void updateSize()
Update the size of the box.
void showDeviation(bool b)
Show/Hide deviation.
void setPixelData(QVector< QVector< double > > data, int samp, int line)
Set pixel data and upper left sample/line.
QScrollArea * p_visualScroll
Scroll area to house visual display.
QLineEdit * p_linesEdit
Line size line edit.
QLineEdit * p_sampsEdit
Sample size line edit.
int cubeSamples() const
Return the number of samples in the cube.
void paintEvent(QPaintEvent *event)
Paint pixmap to the widget.
void ClearPairs()
Clears the stretch pairs.
Definition: Stretch.h:184
void setLines(int lines)
Set box line size.
void resizeScrollbars()
Resize the scroll bars and center the point clicked.
bool p_set
Boolean to see if data is set.
QString PixelToString(double d)
Takes a double pixel value and returns the name of the pixel type as a string.
Definition: SpecialPixel.h:386
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int p_boxLines
Line size for box.
Base class for the Qisis tools.
Definition: Tool.h:81
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:211
void showText(bool b)
Show/Hide text.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:154
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition: Stretch.h:108
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
void showPixels(bool b)
Show/Hide pixels.
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:313
StatisticsTool(QWidget *parent)
Constructor, creates and sets up widgets for this tool.
Statistics p_stats
Stats used for calculating stretch and deviation.
VisualDisplay(QWidget *parent=0)
Constructor for visual display.