casacore
Loading...
Searching...
No Matches
LatticeStatsDataProviderBase.h
Go to the documentation of this file.
1//# Copyright (C) 2000,2001
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: casa-feedback@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#ifndef LATTICES_LATTICESTATSDATAPROVIDERBASE_H
26#define LATTICES_LATTICESTATSDATAPROVIDERBASE_H
27
28#include <casacore/scimath/StatsFramework/StatsDataProvider.h>
29
30#include <casacore/scimath/Mathematics/NumericTraits.h>
31#include <casacore/lattices/Lattices/LatticeIterator.h>
32#include <casacore/lattices/LatticeMath/LattStatsProgress.h>
33
34#include <casacore/casa/aips.h>
35
36namespace casacore {
37
38class LatticeProgress;
39
40// Abstract base class of data providers which allows stats framework to iterate through a lattice.
41
42template <class T> class LatticeStatsDataProviderBase
43 : public StatsDataProvider<typename NumericTraits<T>::PrecisionType, const T*, const Bool*> {
44
45public:
46
48
49 // estimated number of steps to iterate through the the lattice
50 virtual uInt estimatedSteps() const = 0;
51
52 virtual void finalize();
53
54 // Get the stride for the current mask (only called if hasMask() returns True).
56
57 // Get the associated range(s) of the current dataset. Only called if hasRanges() returns True;
58 std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> > getRanges();
59
60 // Get the stride for the current data set.
62
63 // Returns NULL; lattices do not have associated weights.
64 const T* getWeights();
65
66 // Does the current data set have associated range(s)?
67 Bool hasRanges() const;
68
69 // returns False; lattices do not have associated weights.
71
72 // If the associated data set has ranges, are these include (return True) or
73 // exclude (return False) ranges?
74 Bool isInclude() const;
75
76 // get the positions of the min and max
77 void minMaxPos(IPosition& minpos, IPosition& maxpos) const;
78
79 virtual void reset();
80
81 void setProgressMeter(std::shared_ptr<LattStatsProgress> pm);
82
83 // set the data ranges
85 const std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> >& ranges,
87 );
88
89protected:
91
92 void _updateMaxPos(const IPosition& maxPos) { _maxPos = maxPos; }
93
94 void _updateMinPos(const IPosition& minPos) { _minPos = minPos; }
95
97
98private:
100 std::vector<std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType> > _ranges;
101 std::shared_ptr<LattStatsProgress> _progressMeter;
103};
104
105}
106
107#ifndef CASACORE_NO_AUTO_TEMPLATES
108#include <casacore/lattices/LatticeMath/LatticeStatsDataProviderBase.tcc>
109#endif //# CASACORE_NO_AUTO_TEMPLATES
110
111#endif
Abstract base class of data providers which allows stats framework to iterate through a lattice.
Bool isInclude() const
If the associated data set has ranges, are these include (return True) or exclude (return False) rang...
virtual void finalize()
Take any actions necessary to finalize the provider.
void setRanges(const std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > &ranges, Bool isInclude)
set the data ranges
std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > getRanges()
Get the associated range(s) of the current dataset.
std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > _ranges
uInt getMaskStride()
Get the stride for the current mask (only called if hasMask() returns True).
void minMaxPos(IPosition &minpos, IPosition &maxpos) const
get the positions of the min and max
virtual void reset()
reset the provider to point to the beginning of the first data set it manages.
void setProgressMeter(std::shared_ptr< LattStatsProgress > pm)
Bool hasRanges() const
Does the current data set have associated range(s)?
uInt getStride()
Get the stride for the current data set.
virtual uInt estimatedSteps() const =0
estimated number of steps to iterate through the the lattice
const T * getWeights()
Returns NULL; lattices do not have associated weights.
Bool hasWeights() const
returns False; lattices do not have associated weights.
std::shared_ptr< LattStatsProgress > _progressMeter
Char PrecisionType
Higher precision type (Float->Double)
Abstract base class which defines interface for providing "datasets" to the statistics framework in c...
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40