Isis Developer Reference
StatisticsTool.h
Go to the documentation of this file.
1 #ifndef StatisticsTool_h
2 #define StatisticsTool_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QAction>
13 #include <QPixmap>
14 
15 // Only includes for Parents of classes defined in this file are allowed here!
16 #include "Tool.h"
17 #include <QWidget>
18 
19 
20 // FIXME: remove these includes
21 #include "Stretch.h"
22 #include <vector>
23 
24 class QScrollArea;
25 class QLabel;
26 class QLineEdit;
27 class QCheckBox;
28 class QGroupBox;
29 
30 namespace Isis {
48  class VisualDisplay : public QWidget {
49  Q_OBJECT
50 
51  public:
52  VisualDisplay(QWidget *parent = 0);
53 
54  QSize sizeHint() const;
55 
56  void setSamples(int samps);
57  void setLines(int lines);
58 
59  void updateSize();
60 
61  void setPixelData(QVector<QVector<double> > data, int samp, int line);
62 
63  protected:
64  void paintPixmap();
65  void paintEvent(QPaintEvent *event);
66  void mouseMoveEvent(QMouseEvent *event);
67  void leaveEvent(QEvent *event);
68 
69  signals:
75  void setDn(const QString st);
81  void setSample(const QString st);
87  void setLine(const QString st);
88 
89  protected slots:
90  void setBoxSize(int size);
91  void showText(bool b);
92  void showPixels(bool b);
93  void showDeviation(bool b);
94 
95  private:
96  int p_boxSamps;
97  int p_boxLines;
98  int p_boxWidth;
99  int p_boxHeight;
100  int p_oldWidth;
101  int p_oldHeight;
102  int p_ulSamp;
103  int p_ulLine;
104  bool p_set;
105  bool p_showText;
106  bool p_showPixels;
107  bool p_showDeviation;
108 
109  QPixmap p_pixmap;
110  Stretch p_stretch;
111  Statistics p_stats;
112  QVector<QVector<double> > p_pixelData;
113  };
114 
121  class StatisticsTool : public Tool {
122  Q_OBJECT
123 
124  public:
125  StatisticsTool(QWidget *parent);
126 
127  protected:
128  QAction *toolPadAction(ToolPad *toolpad);
129  QWidget *createToolBarWidget(QStackedWidget *parent);
130 
131  protected slots:
132  void mouseButtonRelease(QPoint p, Qt::MouseButton s);
133  void hideDisplay(bool hide);
134  void resizeScrollbars();
135 
136  private:
137  void getStatistics(QPoint p);
138 
139  QAction *p_action;
140  QDialog *p_dialog;
141  QScrollArea *p_visualScroll;
142  QGroupBox *p_visualBox;
143  VisualDisplay *p_visualDisplay;
144  QLabel *p_boxLabel;
145  QLabel *p_minLabel;
146  QLabel *p_maxLabel;
147  QLabel *p_avgLabel;
148  QLabel *p_stdevLabel;
149  QLabel *p_sampLabel;
150  QLabel *p_lineLabel;
151  QLabel *p_dnLabel;
152  QLineEdit *p_sampsEdit;
153  QLineEdit *p_linesEdit;
154 
155  int p_boxSamps;
156  int p_boxLines;
157 
158  int p_ulSamp;
159  int p_ulLine;
160 
161  bool p_set;
162 
163  private slots:
164  void changeBoxSamples();
165  void changeBoxLines();
166  };
167 };
168 
169 #endif
Isis::CubeViewport::cubeLines
int cubeLines() const
Return the number of lines in the cube.
Definition: CubeViewport.cpp:439
Isis::PixelToString
QString PixelToString(double d)
Takes a double pixel value and returns the name of the pixel type as a string.
Definition: SpecialPixel.h:371
Stretch.h
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
QWidget
Isis::Statistics
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:94
Isis::Stretch::SetMinimum
void SetMinimum(const double value)
Definition: Stretch.h:142
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::Statistics::TotalPixels
BigInt TotalPixels() const
Returns the total number of pixels processed (valid and invalid).
Definition: Statistics.cpp:420
Isis::Histogram::Percent
double Percent(const double percent) const
Computes and returns the value at X percent of the histogram.
Definition: Histogram.cpp:351
MdiCubeViewport.h
Isis::Stretch::SetLis
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition: Stretch.h:105
Isis::StatisticsTool::createToolBarWidget
QWidget * createToolBarWidget(QStackedWidget *parent)
Attaches this tool to the toolbar.
Definition: StatisticsTool.cpp:201
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::Tool
Base class for the Qisis tools.
Definition: Tool.h:67
Isis::Stretch::SetMaximum
void SetMaximum(const double value)
Definition: Stretch.h:145
Isis::Stretch
Pixel value mapper.
Definition: Stretch.h:58
Isis::Tool::toolIconDir
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:113
Isis::VisualDisplay
Tool to visualize statistics in an n * m box.
Definition: StatisticsTool.h:48
Isis::VisualDisplay::VisualDisplay
VisualDisplay(QWidget *parent=0)
Constructor for visual display.
Definition: StatisticsTool.cpp:422
Isis::Statistics::Maximum
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
Definition: Statistics.cpp:403
Isis::VisualDisplay::setLine
void setLine(const QString st)
Signal to set the Line label to st.
Isis::Statistics::Reset
void Reset()
Reset all accumulators and counters to zero.
Definition: Statistics.cpp:113
Tool.h
Isis::StatisticsTool
Definition: StatisticsTool.h:121
Isis::VisualDisplay::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Called when the mouse moves over this widget.
Definition: StatisticsTool.cpp:717
Isis::Stretch::SetHrs
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition: Stretch.h:138
ToolPad.h
Isis::VisualDisplay::showDeviation
void showDeviation(bool b)
Show/Hide deviation.
Definition: StatisticsTool.cpp:562
Isis::Stretch::SetLrs
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition: Stretch.h:116
Isis::VisualDisplay::setLines
void setLines(int lines)
Set box line size.
Definition: StatisticsTool.cpp:479
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Isis::Stretch::SetHis
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition: Stretch.h:127
Isis::VisualDisplay::setSample
void setSample(const QString st)
Signal to set the Sample label to st.
Isis::VisualDisplay::setPixelData
void setPixelData(QVector< QVector< double > > data, int samp, int line)
Set pixel data and upper left sample/line.
Definition: StatisticsTool.cpp:580
Isis::CubeViewport::grayBand
int grayBand() const
Definition: CubeViewport.h:194
Isis::VisualDisplay::leaveEvent
void leaveEvent(QEvent *event)
Mouse left widget, update labels.
Definition: StatisticsTool.cpp:745
Isis::StatisticsTool::hideDisplay
void hideDisplay(bool hide)
Hide/Show the visual display.
Definition: StatisticsTool.cpp:266
Isis::Statistics::StandardDeviation
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:312
Isis::Histogram::AddData
virtual void AddData(const double *data, const unsigned int count)
Add an array of doubles to the histogram counters.
Definition: Histogram.cpp:232
Isis::Statistics::Minimum
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
Definition: Statistics.cpp:382
Isis::VisualDisplay::setDn
void setDn(const QString st)
Signal to set the DN label to st.
Isis::Stretch::AddPair
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
Definition: Stretch.cpp:48
Isis::Stretch::ClearPairs
void ClearPairs()
Clears the stretch pairs.
Definition: Stretch.h:170
Isis::Statistics::BestMaximum
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
Definition: Statistics.cpp:625
StatisticsTool.h
Isis::VisualDisplay::updateSize
void updateSize()
Update the size of the box.
Definition: StatisticsTool.cpp:505
Isis::CubeViewport::cubeSamples
int cubeSamples() const
Return the number of samples in the cube.
Definition: CubeViewport.cpp:433
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::VisualDisplay::sizeHint
QSize sizeHint() const
Size hint for this widget.
Definition: StatisticsTool.cpp:456
Isis::Statistics::Average
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:300
Brick.h
Isis::ToolPad
Definition: ToolPad.h:14
Isis::VisualDisplay::setSamples
void setSamples(int samps)
Set box sample size.
Definition: StatisticsTool.cpp:465
Isis::Stretch::SetNull
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition: Stretch.h:94
Isis::StatisticsTool::resizeScrollbars
void resizeScrollbars()
Resize the scroll bars and center the point clicked.
Definition: StatisticsTool.cpp:410
Isis::Cube::pixelType
PixelType pixelType() const
Definition: Cube.cpp:1758
Isis::Histogram
Container of a cube histogram.
Definition: Histogram.h:74
Isis::StatisticsTool::StatisticsTool
StatisticsTool(QWidget *parent)
Constructor, creates and sets up widgets for this tool.
Definition: StatisticsTool.cpp:32
Isis::Statistics::BestMinimum
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
Definition: Statistics.cpp:598
Isis::StatisticsTool::mouseButtonRelease
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
Called when a mouse button is released.
Definition: StatisticsTool.cpp:255
Isis::VisualDisplay::showText
void showText(bool b)
Show/Hide text.
Definition: StatisticsTool.cpp:529
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
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::VisualDisplay::showPixels
void showPixels(bool b)
Show/Hide pixels.
Definition: StatisticsTool.cpp:546
QAction
Isis::CubeViewport::cube
Cube * cube() const
Definition: CubeViewport.h:338
Isis::Tool::cubeViewport
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:197
Isis::VisualDisplay::paintEvent
void paintEvent(QPaintEvent *event)
Paint pixmap to the widget.
Definition: StatisticsTool.cpp:702
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::VisualDisplay::setBoxSize
void setBoxSize(int size)
Set box size in pixels.
Definition: StatisticsTool.cpp:493
Isis::StatisticsTool::toolPadAction
QAction * toolPadAction(ToolPad *toolpad)
Attaches this tool to the toolpad.
Definition: StatisticsTool.cpp:182
Isis::VisualDisplay::paintPixmap
void paintPixmap()
Paint the pixmap.
Definition: StatisticsTool.cpp:624
Isis::Stretch::Map
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:69