casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Histogram.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 HISTOGRAM_H_
27 #define HISTOGRAM_H_
28 
29 #include <casa/aipstype.h>
30 #include <casa/vector.h>
31 #include <QTextStream>
34 
35 namespace casacore{
36 
37 template <class T> class ImageInterface;
38 template <class T> class SubImage;
39 class ImageRegion;
40 }
41 
42 namespace casa {
43 
44 template <class T> class ImageHistograms;
45 class HeightSource;
46 
51 class Histogram {
52 public:
53  Histogram( HeightSource* source );
54  int getDataCount() const;
55 
56  //Just recompute the histogram if a parameter such as bin count
57  //or intensity changes.
58  bool compute();
59 
60  //Completely reset the histogram if the image, region, or channels change
61  bool reset(FootPrintWidget::PlotMode mode );
62 
64  void defineLine( int index, QVector<double>& xVals, QVector<double>& yVals,
65  bool useLogY ) const;
66  void defineStepHorizontal( int index, QVector<double>& xVals, QVector<double>& yVals,
67  bool useLogY ) const;
68  void defineStepVertical( int index, QVector<double>& xVals, QVector<double>& yVals,
69  bool useLogY ) const;
70  std::pair<float,float> getMinMaxBinCount() const;
71  std::vector<float> getXValues() const;
72  std::vector<float> getYValues() const;
73  std::pair<float,float> getDataRange() const;
74  void toAscii( QTextStream& out ) const;
75  virtual ~Histogram();
76 
77  //common to all histograms
78  void setBinCount( int count );
81  void setChannelRange( int minChannel, int maxChannel, int spectralIndex=-1 );
82  void setIntensityRange( float minimumIntensity, float maximumIntensity );
83  void setImage( const std::shared_ptr<const casacore::ImageInterface<casacore::Float> > image );
84  static double computeYValue( double value, bool useLog );
85 
86 signals:
87  void postStatus( const QString& msg );
88 
89 private:
90  Histogram( const Histogram& other );
91  Histogram operator=( const Histogram& other );
94  std::vector<casacore::Float> xValues;
95  std::vector<casacore::Float> yValues;
98 
99  const int ALL_CHANNELS;
100  const int ALL_INTENSITIES;
101  std::shared_ptr<const casacore::ImageInterface<casacore::Float> > image;
107  int binCount;
108 
109 };
110 
111 } // end namespace casa
112 
113 #endif /* HISTOGRAM_H_ */
float intensityMax
Definition: Histogram.h:106
std::vector< casacore::Float > yValues
Definition: Histogram.h:95
casacore::ImageRegion * region
Definition: Histogram.h:97
std::shared_ptr< const casacore::ImageInterface< casacore::Float > > image
Definition: Histogram.h:101
const int ALL_INTENSITIES
Definition: Histogram.h:100
Histogram operator=(const Histogram &other)
const int ALL_CHANNELS
Definition: Histogram.h:99
HeightSource * heightSource
Definition: Histogram.h:93
void setChannelRange(int minChannel, int maxChannel, int spectralIndex=-1)
bool reset(FootPrintWidget::PlotMode mode)
Completely reset the histogram if the image, region, or channels change.
void setIntensityRangeDefault()
Generates and Manages the data corresponding to a histogram.
Definition: Histogram.h:51
void setChannelRangeDefault()
std::vector< casacore::Float > xValues
Definition: Histogram.h:94
void defineLine(int index, QVector< double > &xVals, QVector< double > &yVals, bool useLogY) const
void defineStepVertical(int index, QVector< double > &xVals, QVector< double > &yVals, bool useLogY) const
std::pair< float, float > getDataRange() const
void defineStepHorizontal(int index, QVector< double > &xVals, QVector< double > &yVals, bool useLogY) const
bool compute()
Just recompute the histogram if a parameter such as bin count or intensity changes.
static double computeYValue(double value, bool useLog)
std::vector< float > getYValues() const
std::vector< float > getXValues() const
ImageHistograms< casacore::Float > * filterByChannels(const std::shared_ptr< const casacore::ImageInterface< casacore::Float > > image)
void setRegion(casacore::ImageRegion *region)
Histogram(HeightSource *source)
virtual ~Histogram()
void setBinCount(int count)
common to all histograms
int getDataCount() const
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
std::pair< float, float > getMinMaxBinCount() const
void setImage(const std::shared_ptr< const casacore::ImageInterface< casacore::Float > > image)
void setIntensityRange(float minimumIntensity, float maximumIntensity)
ImageHistograms< casacore::Float > * histogramMaker
Definition: Histogram.h:96
void postStatus(const QString &msg)
float intensityMin
Definition: Histogram.h:105
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void toAscii(QTextStream &out) const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42