Isis 3 Programmer 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:
194 
195  QToolButton *m_copyButton;
196  QToolButton *m_globalButton;
197  QToolButton *m_stretchRegionalButton;
198  QPushButton *m_flashButton;
199 
204 
206 
207  QLineEdit *m_stretchMinEdit;
208  QLineEdit *m_stretchMaxEdit;
209 
211 
214 
216  };
217 };
218 
219 #endif
220 
Stretch * m_preGlobalStretches
Stretches before global button pressed.
Definition: StretchTool.h:213
Cube display widget for certain Isis MDI applications.
void setCubeViewport(CubeViewport *)
This updates the advanced stretch to use the given viewport.
void stretchGlobal()
Does a global stretch for the active viewport.
Reads and stores visible DN values.
static Stretch stretchBuffer(ViewportBuffer *buffer, QRect rect)
This method computes the stretch over a region using the viewport buffer.
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget to add to the tool bar.
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.
void stretchGlobalAllBands()
This resets the stretch across all bands.
~StretchTool()
Destructor.
Definition: StretchTool.cpp:82
Stretch image edit tool.
Definition: StretchTool.h:99
QAction * m_stretchRegional
Regional stretch action.
Definition: StretchTool.h:201
QComboBox * m_stretchBandComboBox
Stretch combo box.
Definition: StretchTool.h:205
void screenPixelsChanged()
This is called when the visible area changes.
static Statistics statsFromBuffer(ViewportBuffer *buffer, QRect rect)
This method will calculate and return the statistics for a given region and viewport buffer...
static Stretch stretchBand(CubeViewport *cvp, StretchBand band)
This method computes the stretch over the entire cube.
void warningSignal(std::string &pStr, const std::string pExStr)
Shows a warning.
void stretchRect(CubeViewport *cvp, QRect rect)
stretch the specified CubeViewport with the given rect
QAction * m_stretchGlobal
Global stretch action.
Definition: StretchTool.h:200
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:132
QAction * m_stretchManual
Manual stretch action.
Definition: StretchTool.h:202
void showAdvancedDialog()
This methods shows and updates the advanced dialog.
void setStretchAcrossBands()
Sets the stretch for all the bands in the active viewport to the current stretch. ...
QPushButton * m_flashButton
Button to press for global stretch.
Definition: StretchTool.h:198
static Histogram histFromBuffer(ViewportBuffer *buffer)
Given a viewport buffer, this calculates a histogram.
Stretch * m_chipViewportStretch
ChipViewport's stretch.
Definition: StretchTool.h:215
Advanced Stretch Dialog.
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
StretchBand m_stretchBand
Current stretch band.
Definition: StretchTool.h:210
void changeStretch()
This method is called when the stretch has changed and sets the min/max text fields to the correct va...
void advancedStretchChanged()
This is called when one of the advanced stretches changed.
QToolButton * m_stretchRegionalButton
Regional Stretch Button.
Definition: StretchTool.h:197
AdvancedStretchDialog * m_advancedStretch
The advanced dialog.
Definition: StretchTool.h:193
Container of a cube histogram.
Definition: Histogram.h:86
void enableRubberBandTool()
This method enables the RubberBandTool.
void updateAdvStretchDialogforAll(void)
Update the streches and corresponding histograms for all the colors Red, Green and Blue for Stretch A...
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.
Pixel value mapper.
Definition: Stretch.h:72
void rubberBandComplete()
This method is called when the RubberBandTool is complete.
QToolButton * m_copyButton
Copy Button.
Definition: StretchTool.h:195
void stretchRequested(MdiCubeViewport *cvp, int bandId)
The cube viewport requested a stretch at this time, give it to the viewport.
QToolButton * m_globalButton
Global Button.
Definition: StretchTool.h:196
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.
StretchBand
Enum to store the bands.
Definition: StretchTool.h:110
void addTo(QMenu *menu)
Adds the stretch action to the given menu.
QLineEdit * m_stretchMinEdit
Min. line edit.
Definition: StretchTool.h:207
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
QLineEdit * m_stretchMaxEdit
Max. line edit.
Definition: StretchTool.h:208
static Statistics statsFromCube(Cube *cube, int band)
This method will calculate and return the statistics for a given cube and band.
void updateTool()
Updates the stretch tool.
void stretchGlobalAllViewports()
Does a global stretch for all the viewports.
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
This method will call a global stretch if the right mouse button is released.
QAction * m_copyBands
Copy band stretch action.
Definition: StretchTool.h:203
void setStretchAllViewports()
Sets the stretch for all the viewports to the current stretch in the active viewport.
void stretchBandChanged(int)
The selected band for stretching changed.
void stretchChanged()
This method is called when the stretch has changed and sets the min/max text fields to the correct va...
IO Handler for Isis Cubes.
Definition: Cube.h:170