Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+aa97b6e50c,g1ec0fe41b4+f536777771,g1fd858c14a+a9301854fb,g35bb328faa+fcb1d3bbc8,g4af146b050+a5c07d5b1d,g4d2262a081+78f4f01b60,g53246c7159+fcb1d3bbc8,g56a49b3a55+9c12191793,g5a012ec0e7+3632fc3ff3,g60b5630c4e+ded28b650d,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8352419a5c+fcb1d3bbc8,g87b7deb4dc+7b42cf88bf,g8852436030+e5453db6e6,g89139ef638+ed4b5058f4,g8e3bb8577d+d38d73bdbd,g9125e01d80+fcb1d3bbc8,g94187f82dc+ded28b650d,g989de1cb63+ed4b5058f4,g9d31334357+ded28b650d,g9f33ca652e+50a8019d8c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+d9fb1f8026,gb58c049af0+f03b321e39,gb89ab40317+ed4b5058f4,gcf25f946ba+e5453db6e6,gcf6002c91b+2a0c9e9e84,gd6cbbdb0b4+bb83cc51f8,gdd1046aedd+ded28b650d,gde0f65d7ad+66b3a48cb7,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf23fb2af72+b7cae620c0,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.16
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst::afw::math::Statistics Class Referencefinal

A class to evaluate image statistics. More...

#include <Statistics.h>

Public Types

using Value = std::pair<double, double>
 The type used to report (value, error) for desired statistics.
 

Public Member Functions

template<typename ImageT, typename MaskT, typename VarianceT>
 Statistics (ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Constructor for Statistics object.
 
template<typename ImageT, typename MaskT, typename VarianceT, typename WeightT>
 Statistics (ImageT const &img, MaskT const &msk, VarianceT const &var, WeightT const &weights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 
 Statistics (Statistics const &)=default
 
 Statistics (Statistics &&)=default
 
Statisticsoperator= (Statistics const &)=default
 
Statisticsoperator= (Statistics &&)=default
 
 ~Statistics () noexcept=default
 
Value getResult (Property const prop=NOTHING) const
 Return the value and error in the specified statistic (e.g.
 
double getError (Property const prop=NOTHING) const
 Return the error in the desired property (if specified in the constructor)
 
double getValue (Property const prop=NOTHING) const
 Return the value of the desired property (if specified in the constructor)
 
lsst::afw::image::MaskPixel getOrMask () const noexcept
 
template<>
 Statistics (image::Mask< image::MaskPixel > const &msk, image::Mask< image::MaskPixel > const &msk2, image::Mask< image::MaskPixel > const &var, int const flags, StatisticsControl const &sctrl)
 

Related Symbols

(Note that these are not member symbols.)

template<typename Pixel>
Statistics makeStatistics (lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Handle a watered-down front-end to the constructor (no variance)
 
template<typename ImageT, typename MaskT, typename VarianceT>
Statistics makeStatistics (ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Handle a straight front-end to the constructor.
 
template<typename Pixel>
Statistics makeStatistics (lsst::afw::image::MaskedImage< Pixel > const &mimg, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Handle MaskedImages, just pass the getImage() and getMask() values right on through.
 
template<typename Pixel>
Statistics makeStatistics (lsst::afw::image::MaskedImage< Pixel > const &mimg, lsst::afw::image::Image< WeightPixel > const &weights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Handle MaskedImages, just pass the getImage() and getMask() values right on through.
 
Statistics makeStatistics (lsst::afw::image::Mask< lsst::afw::image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 Specialization to handle Masks.
 
template<typename Pixel>
Statistics makeStatistics (lsst::afw::image::Image< Pixel > const &img, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 The makeStatistics() overload to handle regular (non-masked) Images.
 
template<typename EntryT>
Statistics makeStatistics (std::vector< EntryT > const &v, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 The makeStatistics() overload to handle std::vector<>
 
template<typename EntryT>
Statistics makeStatistics (std::vector< EntryT > const &v, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 The makeStatistics() overload to handle std::vector<>
 
template<typename EntryT>
Statistics makeStatistics (lsst::afw::math::MaskedVector< EntryT > const &mv, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>
 
template<typename EntryT>
Statistics makeStatistics (lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
 The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>
 

Detailed Description

A class to evaluate image statistics.

The basic strategy is to construct a Statistics object from an Image and a statement of what we want to know. The desired results can then be returned using Statistics methods. A StatisticsControl object is used to pass parameters. The statistics currently implemented are listed in the enum Properties in Statistics.h.

 // sets NumSigclip (3.0), and NumIter (3) for clipping
 lsst::afw::math::StatisticsControl sctrl(3.0, 3);

 sctrl.setNumSigmaClip(4.0);            // reset number of standard deviations for N-sigma clipping
 sctrl.setNumIter(5);                   // reset number of iterations for N-sigma clipping
 sctrl.setAndMask(0x1);                 // ignore pixels with these mask bits set
 sctrl.setNanSafe(true);                // check for NaNs & Infs, a bit slower (default=true)

 lsst::afw::math::Statistics statobj =
     lsst::afw::math::makeStatistics(*img, afwMath::NPOINT |
                                           afwMath::MEAN | afwMath::MEANCLIP, sctrl);
 double const n = statobj.getValue(lsst::afw::math::NPOINT);
 std::pair<double, double> const mean =
                                  statobj.getResult(lsst::afw::math::MEAN); // Returns (value, error)
 double const meanError = statobj.getError(lsst::afw::math::MEAN);                // just the error
Note
The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.
Factory function: We used a helper function, makeStatistics, rather that the constructor directly so that the compiler could deduce the types – cf. std::make_pair()
Inputs: The class Statistics is templated, and makeStatistics() can take either: (1) an image, (2) a maskedImage, or (3) a std::vector<> Overloaded makeStatistics() functions then wrap what they were passed in Image/Mask-like classes and call the Statistics constructor.
Clipping: The clipping is done iteratively with numSigmaClip and numIter specified in the StatisticsControl object. The first clip (ie. the first iteration) is performed at: median +/- numSigmaClip*IQ_TO_STDEV*IQR, where IQ_TO_STDEV=~0.74 is the conversion factor between the IQR and sigma for a Gaussian distribution. All subsequent iterations perform clips at mean +/- numSigmaClip*stdev.

Definition at line 222 of file Statistics.h.

Member Typedef Documentation

◆ Value

The type used to report (value, error) for desired statistics.

Definition at line 225 of file Statistics.h.

Constructor & Destructor Documentation

◆ Statistics() [1/5]

template<typename ImageT, typename MaskT, typename VarianceT>
lsst::afw::math::Statistics::Statistics ( ImageT const & img,
MaskT const & msk,
VarianceT const & var,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
explicit

Constructor for Statistics object.

Parameters
imgImage whose properties we want
mskMask to control which pixels are included
varVariances corresponding to values in Image
flagsDescribe what we want to calculate
sctrlControl how things are calculated
Note
Most of the actual work is done in this constructor; the results are retrieved using getValue etc.

Definition at line 788 of file Statistics.cc.

790 : _flags(flags),
791 _mean(NaN, NaN),
792 _variance(NaN, NaN),
793 _min(NaN),
794 _max(NaN),
795 _sum(NaN),
796 _meanclip(NaN, NaN),
797 _varianceclip(NaN, NaN),
798 _median(NaN, NaN),
799 _nClipped(0),
800 _nMasked(0),
801 _iqrange(NaN),
802 _sctrl(sctrl),
803 _weightsAreMultiplicative(false) {
804 doStatistics(img, msk, var, var, _flags, _sctrl);
805}

◆ Statistics() [2/5]

template<typename ImageT, typename MaskT, typename VarianceT, typename WeightT>
lsst::afw::math::Statistics::Statistics ( ImageT const & img,
MaskT const & msk,
VarianceT const & var,
WeightT const & weights,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
explicit
Parameters
imgImage whose properties we want
mskMask to control which pixels are included
varVariances corresponding to values in Image
weightsWeights to use corresponding to values in Image
flagsDescribe what we want to calculate
sctrlControl how things are calculated

Definition at line 837 of file Statistics.cc.

839 : _flags(flags),
840 _mean(NaN, NaN),
841 _variance(NaN, NaN),
842 _min(NaN),
843 _max(NaN),
844 _sum(NaN),
845 _meanclip(NaN, NaN),
846 _varianceclip(NaN, NaN),
847 _median(NaN, NaN),
848 _nClipped(0),
849 _nMasked(0),
850 _iqrange(NaN),
851 _sctrl(sctrl),
852 _weightsAreMultiplicative(true) {
853 if (!isEmpty(weights)) {
854 if (_sctrl.getWeightedIsSet() && !_sctrl.getWeighted()) {
855 throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
856 "You must use the weights if you provide them");
857 }
858
859 _sctrl.setWeighted(true);
860 }
861 doStatistics(img, msk, var, weights, _flags, _sctrl);
862}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ Statistics() [3/5]

lsst::afw::math::Statistics::Statistics ( Statistics const & )
default

◆ Statistics() [4/5]

lsst::afw::math::Statistics::Statistics ( Statistics && )
default

◆ ~Statistics()

lsst::afw::math::Statistics::~Statistics ( )
defaultnoexcept

◆ Statistics() [5/5]

template<>
lsst::afw::math::Statistics::Statistics ( image::Mask< image::MaskPixel > const & msk,
image::Mask< image::MaskPixel > const & msk2,
image::Mask< image::MaskPixel > const & var,
int const flags,
StatisticsControl const & sctrl )

Definition at line 1099 of file Statistics.cc.

1102 : _flags(flags),
1103 _mean(NaN, NaN),
1104 _variance(NaN, NaN),
1105 _min(NaN),
1106 _max(NaN),
1107 _meanclip(NaN, NaN),
1108 _varianceclip(NaN, NaN),
1109 _median(NaN, NaN),
1110 _nClipped(0),
1111 _iqrange(NaN),
1112 _sctrl(sctrl) {
1113 if ((flags & ~(NPOINT | SUM)) != 0x0) {
1114 throw LSST_EXCEPT(pexExceptions::InvalidParameterError,
1115 "Statistics<Mask> only supports NPOINT and SUM");
1116 }
1117
1118 using Mask = image::Mask<>;
1119
1120 _n = msk.getWidth() * msk.getHeight();
1121 if (_n == 0) {
1122 throw LSST_EXCEPT(pexExceptions::InvalidParameterError, "Image contains no pixels");
1123 }
1124
1125 // Check that an int's large enough to hold the number of pixels
1126 assert(msk.getWidth() * static_cast<double>(msk.getHeight()) < std::numeric_limits<int>::max());
1127
1128 image::MaskPixel sum = 0x0;
1129 for (int y = 0; y != msk.getHeight(); ++y) {
1130 for (Mask::x_iterator ptr = msk.row_begin(y), end = msk.row_end(y); ptr != end; ++ptr) {
1131 sum |= (*ptr)[0];
1132 }
1133 }
1134 _sum = sum;
1135}
int getWidth() const
Return the number of columns in the image.
Definition ImageBase.h:294
int getHeight() const
Return the number of rows in the image.
Definition ImageBase.h:296
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
Definition ImageBase.h:401
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition ImageBase.h:404
T end(T... args)
T max(T... args)
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
@ SUM
find sum of pixels in the image
Definition Statistics.h:68
@ NPOINT
number of sample points
Definition Statistics.h:56
g2d::python::Image< bool > Mask
Definition test_image.cc:16

Member Function Documentation

◆ getError()

double lsst::afw::math::Statistics::getError ( Property const prop = NOTHING) const

Return the error in the desired property (if specified in the constructor)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property in the constructor, that property's error is returned
Note
You may have needed to specify ERROR to the ctor

Definition at line 1087 of file Statistics.cc.

1087{ return getResult(prop).second; }
Value getResult(Property const prop=NOTHING) const
Return the value and error in the specified statistic (e.g.

◆ getOrMask()

lsst::afw::image::MaskPixel lsst::afw::math::Statistics::getOrMask ( ) const
inlinenoexcept

Definition at line 290 of file Statistics.h.

290{ return _allPixelOrMask; }

◆ getResult()

std::pair< double, double > lsst::afw::math::Statistics::getResult ( Property const prop = NOTHING) const

Return the value and error in the specified statistic (e.g.

MEAN)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property (and maybe its error) in the constructor, that property is returned
Note
Only quantities requested in the constructor may be retrieved; in particular errors may not be available if you didn't specify ERROR in the constructor
See also
getValue and getError
Todo
uncertainties on MEANCLIP,STDEVCLIP are sketchy. _n != _nClip

Definition at line 960 of file Statistics.cc.

960 {
961 // if iProp == NOTHING try to return their heart's delight, as specified in the constructor
962 Property const prop = static_cast<Property>(((iProp == NOTHING) ? _flags : iProp) & ~ERRORS);
963
964 if (!(prop & _flags)) { // we didn't calculate it
965 throw LSST_EXCEPT(pexExceptions::InvalidParameterError,
966 (boost::format("You didn't ask me to calculate %d") % prop).str());
967 }
968
969 Value ret(NaN, NaN);
970 switch (prop) {
971 case NPOINT:
972 ret.first = static_cast<double>(_n);
973 if (_flags & ERRORS) {
974 ret.second = 0;
975 }
976 break;
977
978 case NCLIPPED:
979 ret.first = static_cast<double>(_nClipped);
980 if (_flags & ERRORS) {
981 ret.second = 0;
982 }
983 break;
984
985 case NMASKED:
986 ret.first = static_cast<double>(_nMasked);
987 if (_flags & ERRORS) {
988 ret.second = 0;
989 }
990 break;
991
992 case SUM:
993 ret.first = static_cast<double>(_sum);
994 if (_flags & ERRORS) {
995 ret.second = 0;
996 }
997 break;
998
999 // == means ==
1000 case MEAN:
1001 ret.first = _mean.first;
1002 if (_flags & ERRORS) {
1003 ret.second = ::sqrt(_mean.second);
1004 }
1005 break;
1006 case MEANCLIP:
1007 ret.first = _meanclip.first;
1008 if (_flags & ERRORS) {
1009 ret.second = ::sqrt(_meanclip.second);
1010 }
1011 break;
1012
1013 // == stdevs & variances ==
1014 case VARIANCE:
1015 ret.first = _variance.first;
1016 if (_flags & ERRORS) {
1017 ret.second = ::sqrt(_variance.second);
1018 }
1019 break;
1020 case STDEV:
1021 ret.first = sqrt(_variance.first);
1022 if (_flags & ERRORS) {
1023 ret.second = 0.5 * ::sqrt(_variance.second) / ret.first;
1024 }
1025 break;
1026 case VARIANCECLIP:
1027 ret.first = _varianceclip.first;
1028 if (_flags & ERRORS) {
1029 ret.second = ret.second;
1030 }
1031 break;
1032 case STDEVCLIP:
1033 ret.first = sqrt(_varianceclip.first);
1034 if (_flags & ERRORS) {
1035 ret.second = 0.5 * ::sqrt(_varianceclip.second) / ret.first;
1036 }
1037 break;
1038
1039 case MEANSQUARE:
1040 ret.first = (_n - 1) / static_cast<double>(_n) * _variance.first + ::pow(_mean.first, 2);
1041 if (_flags & ERRORS) {
1042 ret.second = ::sqrt(2 * ::pow(ret.first / _n, 2)); // assumes Gaussian
1043 }
1044 break;
1045
1046 // == other stats ==
1047 case MIN:
1048 ret.first = _min;
1049 if (_flags & ERRORS) {
1050 ret.second = 0;
1051 }
1052 break;
1053 case MAX:
1054 ret.first = _max;
1055 if (_flags & ERRORS) {
1056 ret.second = 0;
1057 }
1058 break;
1059 case MEDIAN:
1060 ret.first = _median.first;
1061 if (_flags & ERRORS) {
1062 ret.second = sqrt(geom::HALFPI * _variance.first / _n); // assumes Gaussian
1063 }
1064 break;
1065 case IQRANGE:
1066 ret.first = _iqrange;
1067 if (_flags & ERRORS) {
1068 ret.second = NaN; // we're not estimating this properly
1069 }
1070 break;
1071
1072 // no-op to satisfy the compiler
1073 case ERRORS:
1074 break;
1075 // default: redundant as 'ret' is initialized to NaN, NaN
1076 default: // we must have set prop to _flags
1077 assert(iProp == 0);
1078 throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
1079 "getValue() may only be called without a parameter"
1080 " if you asked for only one statistic");
1081 }
1082 return ret;
1083}
std::pair< double, double > Value
The type used to report (value, error) for desired statistics.
Definition Statistics.h:225
Property
control what is calculated
Definition Statistics.h:53
@ ERRORS
Include errors of requested quantities.
Definition Statistics.h:55
@ VARIANCECLIP
estimate sample N-sigma clipped variance (N set in StatisticsControl, default=3)
Definition Statistics.h:64
@ MEANSQUARE
find mean value of square of pixel values
Definition Statistics.h:69
@ MIN
estimate sample minimum
Definition Statistics.h:66
@ NCLIPPED
number of clipped points
Definition Statistics.h:71
@ NOTHING
We don't want anything.
Definition Statistics.h:54
@ STDEV
estimate sample standard deviation
Definition Statistics.h:58
@ NMASKED
number of masked points
Definition Statistics.h:72
@ STDEVCLIP
estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)
Definition Statistics.h:63
@ VARIANCE
estimate sample variance
Definition Statistics.h:59
@ MEDIAN
estimate sample median
Definition Statistics.h:60
@ MAX
estimate sample maximum
Definition Statistics.h:67
@ IQRANGE
estimate sample inter-quartile range
Definition Statistics.h:61
@ MEAN
estimate sample mean
Definition Statistics.h:57
@ MEANCLIP
estimate sample N-sigma clipped mean (N set in StatisticsControl, default=3)
Definition Statistics.h:62
double constexpr HALFPI
Definition Angle.h:42
T pow(T... args)
T sqrt(T... args)

◆ getValue()

double lsst::afw::math::Statistics::getValue ( Property const prop = NOTHING) const

Return the value of the desired property (if specified in the constructor)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property in the constructor, that property is returned

Definition at line 1085 of file Statistics.cc.

1085{ return getResult(prop).first; }

◆ operator=() [1/2]

Statistics & lsst::afw::math::Statistics::operator= ( Statistics && )
default

◆ operator=() [2/2]

Statistics & lsst::afw::math::Statistics::operator= ( Statistics const & )
default

Friends And Related Symbol Documentation

◆ makeStatistics() [1/10]

template<typename ImageT, typename MaskT, typename VarianceT>
Statistics makeStatistics ( ImageT const & img,
MaskT const & msk,
VarianceT const & var,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

Handle a straight front-end to the constructor.

Definition at line 373 of file Statistics.h.

374 {
375 return Statistics(img, msk, var, flags, sctrl);
376}
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.

◆ makeStatistics() [2/10]

template<typename Pixel>
Statistics makeStatistics ( lsst::afw::image::Image< Pixel > const & img,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

The makeStatistics() overload to handle regular (non-masked) Images.

Parameters
imgImage (or Image) whose properties we want
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 427 of file Statistics.h.

431 {
432 // make a phony mask that will be compiled out
433 MaskImposter<lsst::afw::image::MaskPixel> const msk;
434 MaskImposter<WeightPixel> const var;
435 return Statistics(img, msk, var, flags, sctrl);
436}

◆ makeStatistics() [3/10]

template<typename Pixel>
Statistics makeStatistics ( lsst::afw::image::Image< Pixel > const & img,
lsst::afw::image::Mask< image::MaskPixel > const & msk,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

Handle a watered-down front-end to the constructor (no variance)

Definition at line 361 of file Statistics.h.

363 {
364 MaskImposter<WeightPixel> var;
365 return Statistics(img, msk, var, flags, sctrl);
366}

◆ makeStatistics() [4/10]

Statistics makeStatistics ( lsst::afw::image::Mask< lsst::afw::image::MaskPixel > const & msk,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

Specialization to handle Masks.

Parameters
mskImage (or MaskedImage) whose properties we want
flagsDescribe what we want to calculate
sctrlControl how things are calculated

Definition at line 1142 of file Statistics.cc.

1143 {
1144 return Statistics(msk, msk, msk, flags, sctrl);
1145}

◆ makeStatistics() [5/10]

template<typename Pixel>
Statistics makeStatistics ( lsst::afw::image::MaskedImage< Pixel > const & mimg,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

Handle MaskedImages, just pass the getImage() and getMask() values right on through.

Definition at line 383 of file Statistics.h.

384 {
385 if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() || sctrl.getCalcErrorMosaicMode()) {
386 return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), flags, sctrl);
387 } else {
388 MaskImposter<WeightPixel> var;
389 return Statistics(*mimg.getImage(), *mimg.getMask(), var, flags, sctrl);
390 }
391}
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage's mask.
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.

◆ makeStatistics() [6/10]

template<typename Pixel>
Statistics makeStatistics ( lsst::afw::image::MaskedImage< Pixel > const & mimg,
lsst::afw::image::Image< WeightPixel > const & weights,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

Handle MaskedImages, just pass the getImage() and getMask() values right on through.

Definition at line 398 of file Statistics.h.

400 {
401 if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() || sctrl.getCalcErrorMosaicMode() ||
402 (!sctrl.getWeightedIsSet() && (weights.getWidth() != 0 && weights.getHeight() != 0))) {
403 return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), weights, flags, sctrl);
404 } else {
405 MaskImposter<WeightPixel> var;
406 return Statistics(*mimg.getImage(), *mimg.getMask(), var, weights, flags, sctrl);
407 }
408}

◆ makeStatistics() [7/10]

template<typename EntryT>
Statistics makeStatistics ( lsst::afw::math::MaskedVector< EntryT > const & mv,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>

Parameters
mvMaskedVector
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 510 of file Statistics.h.

513 {
514 if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() || sctrl.getCalcErrorMosaicMode()) {
515 return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), flags, sctrl);
516 } else {
517 MaskImposter<WeightPixel> var;
518 return Statistics(*mv.getImage(), *mv.getMask(), var, flags, sctrl);
519 }
520}
lsst::afw::image::MaskedImage< EntryT >::VariancePtr getVariance() const
lsst::afw::image::MaskedImage< EntryT >::MaskPtr getMask() const
lsst::afw::image::MaskedImage< EntryT >::ImagePtr getImage() const

◆ makeStatistics() [8/10]

template<typename EntryT>
Statistics makeStatistics ( lsst::afw::math::MaskedVector< EntryT > const & mv,
std::vector< WeightPixel > const & vweights,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>

Parameters
mvMaskedVector
vweightsweights
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 527 of file Statistics.h.

531 {
532 ImageImposter<WeightPixel> weights(vweights);
533
534 if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() || sctrl.getCalcErrorMosaicMode()) {
535 return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), weights, flags, sctrl);
536 } else {
537 MaskImposter<WeightPixel> var;
538 return Statistics(*mv.getImage(), *mv.getMask(), var, weights, flags, sctrl);
539 }
540}

◆ makeStatistics() [9/10]

template<typename EntryT>
Statistics makeStatistics ( std::vector< EntryT > const & v,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

The makeStatistics() overload to handle std::vector<>

Parameters
vImage (or MaskedImage) whose properties we want
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 476 of file Statistics.h.

479 {
480 ImageImposter<EntryT> img(v); // wrap the vector in a fake image
481 MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
482 MaskImposter<WeightPixel> var;
483 return Statistics(img, msk, var, flags, sctrl);
484}

◆ makeStatistics() [10/10]

template<typename EntryT>
Statistics makeStatistics ( std::vector< EntryT > const & v,
std::vector< WeightPixel > const & vweights,
int const flags,
StatisticsControl const & sctrl = StatisticsControl() )
related

The makeStatistics() overload to handle std::vector<>

Parameters
vImage (or MaskedImage) whose properties we want
vweightsWeights
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 491 of file Statistics.h.

495 {
496 ImageImposter<EntryT> img(v); // wrap the vector in a fake image
497 MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
498 MaskImposter<WeightPixel> var;
499
500 ImageImposter<WeightPixel> weights(vweights);
501
502 return Statistics(img, msk, var, weights, flags, sctrl);
503}

The documentation for this class was generated from the following files: