casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RangeControlsWidget.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef RANGECONTROLSWIDGET_QO_H
27 #define RANGECONTROLSWIDGET_QO_H
28 
29 #include <QWidget>
30 #include <guitools/Histogram/RangeControlsWidget.ui.h>
31 #include <casa/typeinfo.h>
33 
34 using namespace std;
35 
36 class QDoubleValidator;
37 
38 namespace casacore{
39 
40 template <class T> class ImageInterface;
41 }
42 
43 namespace casa {
44 
45 
51 public:
52  PercentageCalculator( float minValue, float maxValue, const std::shared_ptr<const casacore::ImageInterface<float> > image );
53  void work();
54  float getRangeMin() const;
55  float getRangeMax() const;
56  virtual ~PercentageCalculator();
57 
58 private:
59  float minValue;
60  float maxValue;
61  float rangeMin;
62  float rangeMax;
63  std::shared_ptr<const casacore::ImageInterface<float> > image;
64 };
65 
66 
72 class RangeControlsWidget : public QWidget {
73  Q_OBJECT
74 
75 public:
76  RangeControlsWidget(QWidget *parent = 0);
77  void setImage(const std::shared_ptr<const casacore::ImageInterface<float > > image );
78  void hideMaximum();
79  void setRange( double min, double max, bool signal=true );
80  void setDataLimits( double min, double max );
81  void setIgnoreRange( bool ignore );
82  pair<double,double> getMinMaxValues() const;
83 
85 
86 signals:
87  void minMaxChanged();
88  void rangeCleared();
89 
90 public slots:
91  void percentilesDone();
92 
93 protected:
94  virtual void keyPressEvent( QKeyEvent* event );
95 
96 private slots:
97  void clearRange();
98  void rangeModeChanged( bool percentile );
99  void percentageChanged( const QString& newPercentage );
100 
101 private:
104  QDoubleValidator* minMaxValidator;
106  Ui::RangeControlsWidgetClass ui;
107  std::shared_ptr<const casacore::ImageInterface<float > > image;
108  QString percentage;
109  double rangeMin;
110  double rangeMax;
112 };
113 }
114 #endif // RANGECONTROLSWIDGET_QO_H
115 
#define max(a, b)
Definition: hio.h:44
#define min(a, b)
Definition: hio.h:45
PtrHolder< T > & operator=(const PtrHolder< T > &other)
Designed as a separaclass so if it needs to go into a different thread, it can be put there...
Ui::RangeControlsWidgetClass ui
std::shared_ptr< const casacore::ImageInterface< float > > image
Pluggable functionality that allows users to specify a range on the histogram.
std::shared_ptr< const casacore::ImageInterface< float > > image
PercentageCalculator * percentCalculator
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42