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>
44 : public StatsDataProvider<typename NumericTraits<T>::PrecisionType, const T*, const Bool*> {
45 public:
47
48 // estimated number of steps to iterate through the the lattice
49 virtual uInt estimatedSteps() const = 0;
50
51 virtual void finalize();
52
53 // Get the stride for the current mask (only called if hasMask() returns True).
55
56 // Get the associated range(s) of the current dataset. Only called if hasRanges() returns True;
57 std::vector<
58 std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType>>
60
61 // Get the stride for the current data set.
63
64 // Returns NULL; lattices do not have associated weights.
65 const T* getWeights();
66
67 // Does the current data set have associated range(s)?
68 Bool hasRanges() const;
69
70 // returns False; lattices do not have associated weights.
72
73 // If the associated data set has ranges, are these include (return True) or
74 // exclude (return False) ranges?
75 Bool isInclude() const;
76
77 // get the positions of the min and max
78 void minMaxPos(IPosition& minpos, IPosition& maxpos) const;
79
80 virtual void reset();
81
82 void setProgressMeter(std::shared_ptr<LattStatsProgress> pm);
83
84 // set the data ranges
85 void setRanges(const std::vector<std::pair<typename NumericTraits<T>::PrecisionType,
86 typename NumericTraits<T>::PrecisionType>>& ranges,
88
89 protected:
91
92 void _updateMaxPos(const IPosition& maxPos) { _maxPos = maxPos; }
93
94 void _updateMinPos(const IPosition& minPos) { _minPos = minPos; }
95
97
98 private:
100 std::vector<
101 std::pair<typename NumericTraits<T>::PrecisionType, typename NumericTraits<T>::PrecisionType>>
103 std::shared_ptr<LattStatsProgress> _progressMeter;
105};
106
107} // namespace casacore
108
109#ifndef CASACORE_NO_AUTO_TEMPLATES
110#include <casacore/lattices/LatticeMath/LatticeStatsDataProviderBase.tcc>
111#endif // # CASACORE_NO_AUTO_TEMPLATES
112
113#endif
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.
uInt getMaskStride()
Get the stride for the current mask (only called if hasMask() returns True).
std::vector< std::pair< typename NumericTraits< T >::PrecisionType, typename NumericTraits< T >::PrecisionType > > _ranges
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).
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40