Isis 3 Developer Reference
StretchTool.h
Go to the documentation of this file.
1 #ifndef StretchTool_h
2 #define StretchTool_h
3 
4 // This is the only include allowed in this file!
5 #include "Tool.h"
6 
7 class QComboBox;
8 class QPushButton;
9 class QLineEdit;
10 class QRect;
11 class QToolButton;
12 
35 namespace Isis {
36  class AdvancedStretchDialog;
37  class Cube;
38  class CubeViewport;
39  class Histogram;
40  class Statistics;
41  class Stretch;
42  class ViewportBuffer;
43 
99  class StretchTool : public Tool {
100  Q_OBJECT
101 
102  public:
103  StretchTool(QWidget *parent);
104  ~StretchTool();
105  void addTo(QMenu *menu);
106 
110  enum StretchBand {
112  Red,
116  };
117 
118  static Stretch stretchBuffer(ViewportBuffer *buffer, QRect rect);
119  static Stretch stretchBand(CubeViewport *cvp, StretchBand band);
120 
121  static Statistics statsFromCube(Cube *cube, int band);
122  static Statistics statsFromBuffer(ViewportBuffer *buffer, QRect rect);
123  static Histogram histFromCube(Cube *cube, int band,
124  double min, double max);
125  static Histogram histFromBuffer(ViewportBuffer *buffer);
126  static Histogram histFromBuffer(ViewportBuffer *buffer, QRect rect,
127  double min, double max);
128  void updateAdvStretchDialogforAll(void);
129 
137  QString menuName() const {
138  return "&View";
139  }
140 
141  signals:
147 
156  void warningSignal(std::string &pStr, const std::string pExStr);
157 
158  public slots:
159  void stretchGlobal();
160  void stretchGlobal(CubeViewport *);
161  void stretchGlobalAllBands();
163  void stretchRegional();
165 
166  protected:
168  QWidget *createToolBarWidget(QStackedWidget *parent);
169  void updateTool();
170  void stretchRequested(MdiCubeViewport *cvp, int bandId);
171 
172  protected slots:
173  void mouseButtonRelease(QPoint p, Qt::MouseButton s);
174  void enableRubberBandTool();
175  void screenPixelsChanged();
176  void updateHistograms();
177  void rubberBandComplete();
179 
180  private slots:
181  void stretchChanged();
182  void advancedStretchChanged();
183  void changeStretch();
184  void showAdvancedDialog();
185  void setStretchAcrossBands();
186  void setStretchAllViewports();
187  void stretchBandChanged(int);
188 
189  private:
190  void stretchRect(CubeViewport *cvp, QRect rect);
191 
192  private:
193  AdvancedStretchDialog *m_advancedStretch;
194 
195  QToolButton *m_copyButton;
196  QToolButton *m_globalButton;
197  QToolButton *m_stretchRegionalButton;
198  QPushButton *m_flashButton;
199 
200  QAction *m_stretchGlobal;
201  QAction *m_stretchRegional;
202  QAction *m_stretchManual;
203  QAction *m_copyBands;
204 
205  QComboBox *m_stretchBandComboBox;
206 
207  QLineEdit *m_stretchMinEdit;
208  QLineEdit *m_stretchMaxEdit;
209 
210  StretchBand m_stretchBand;
211 
213  Stretch *m_preGlobalStretches;
214 
215  Stretch *m_chipViewportStretch;
216  };
217 };
218 
219 #endif
220 
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:53
void setCubeViewport(CubeViewport *)
This updates the advanced stretch to use the given viewport.
Definition: StretchTool.cpp:386
void stretchGlobal()
Does a global stretch for the active viewport.
Definition: StretchTool.cpp:741
Reads and stores visible DN values.
Definition: ViewportBuffer.h:78
static Stretch stretchBuffer(ViewportBuffer *buffer, QRect rect)
This method computes the stretch over a region using the viewport buffer.
Definition: StretchTool.cpp:1018
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget to add to the tool bar.
Definition: StretchTool.cpp:133
void stretchChipViewport(Stretch *, CubeViewport *)
when a viewport is stretched, send the stretch and the viewport associated with it to any ChipViewpor...
void updateHistograms()
This updates the visible histograms in the advanced stretch, if present.
Definition: StretchTool.cpp:302
Gray Band.
Definition: StretchTool.h:111
void stretchGlobalAllBands()
This resets the stretch across all bands.
Definition: StretchTool.cpp:752
~StretchTool()
Destructor.
Definition: StretchTool.cpp:82
Stretch image edit tool.
Definition: StretchTool.h:99
void screenPixelsChanged()
This is called when the visible area changes.
Definition: StretchTool.cpp:376
static Statistics statsFromBuffer(ViewportBuffer *buffer, QRect rect)
This method will calculate and return the statistics for a given region and viewport buffer...
Definition: StretchTool.cpp:1114
static Stretch stretchBand(CubeViewport *cvp, StretchBand band)
This method computes the stretch over the entire cube.
Definition: StretchTool.cpp:1048
void warningSignal(std::string &pStr, const std::string pExStr)
Shows a warning.
Green Band.
Definition: StretchTool.h:113
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:132
static Histogram histFromBuffer(ViewportBuffer *buffer)
Given a viewport buffer, this calculates a histogram.
Definition: StretchTool.cpp:1171
Red Band.
Definition: StretchTool.h:112
Advanced Stretch Dialog.
Definition: AdvancedStretchDialog.h:29
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
Container of a cube histogram.
Definition: Histogram.h:86
void enableRubberBandTool()
This method enables the RubberBandTool.
Definition: StretchTool.cpp:912
void updateAdvStretchDialogforAll(void)
Update the streches and corresponding histograms for all the colors Red, Green and Blue for Stretch A...
Definition: StretchTool.cpp:349
static Histogram histFromCube(Cube *cube, int band, double min, double max)
This method will calculate and return the histogram for a given cube and band.
Definition: StretchTool.cpp:1149
Pixel value mapper.
Definition: Stretch.h:72
void rubberBandComplete()
This method is called when the RubberBandTool is complete.
Definition: StretchTool.cpp:819
void stretchRequested(MdiCubeViewport *cvp, int bandId)
The cube viewport requested a stretch at this time, give it to the viewport.
Definition: StretchTool.cpp:477
All Bands.
Definition: StretchTool.h:115
QString menuName() const
This let's Tool know which Menu the actions this class has should be added to.
Definition: StretchTool.h:137
void stretchRegional()
Does a regional stretch for the active viewport.
Definition: StretchTool.cpp:788
StretchBand
Enum to store the bands.
Definition: StretchTool.h:110
void addTo(QMenu *menu)
Adds the stretch action to the given menu.
Definition: StretchTool.cpp:119
StretchTool(QWidget *parent)
StretchTool constructor.
Definition: StretchTool.cpp:42
QAction * toolPadAction(ToolPad *pad)
Adds the stretch action to the toolpad.
Definition: StretchTool.cpp:99
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Base class for the Qisis tools.
Definition: Tool.h:81
static Statistics statsFromCube(Cube *cube, int band)
This method will calculate and return the statistics for a given cube and band.
Definition: StretchTool.cpp:1091
void updateTool()
Updates the stretch tool.
Definition: StretchTool.cpp:424
void stretchGlobalAllViewports()
Does a global stretch for all the viewports.
Definition: StretchTool.cpp:775
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
This method will call a global stretch if the right mouse button is released.
Definition: StretchTool.cpp:888
Blue Band.
Definition: StretchTool.h:114
Definition: ToolPad.h:14
IO Handler for Isis Cubes.
Definition: Cube.h:170