LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Related Symbols | List of all members
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
bool getWeightedIsSet() const noexcept
Definition Statistics.h:130
void setWeighted(bool useWeights) noexcept
Definition Statistics.h:151
bool getWeighted() const noexcept
Definition Statistics.h:129

◆ 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 1093 of file Statistics.cc.

1096 : _flags(flags),
1097 _mean(NaN, NaN),
1098 _variance(NaN, NaN),
1099 _min(NaN),
1100 _max(NaN),
1101 _meanclip(NaN, NaN),
1102 _varianceclip(NaN, NaN),
1103 _median(NaN, NaN),
1104 _nClipped(0),
1105 _iqrange(NaN),
1106 _sctrl(sctrl) {
1107 if ((flags & ~(NPOINT | SUM)) != 0x0) {
1109 "Statistics<Mask> only supports NPOINT and SUM");
1110 }
1111
1112 using Mask = image::Mask<>;
1113
1114 _n = msk.getWidth() * msk.getHeight();
1115 if (_n == 0) {
1116 throw LSST_EXCEPT(pexExceptions::InvalidParameterError, "Image contains no pixels");
1117 }
1118
1119 // Check that an int's large enough to hold the number of pixels
1120 assert(msk.getWidth() * static_cast<double>(msk.getHeight()) < std::numeric_limits<int>::max());
1121
1122 image::MaskPixel sum = 0x0;
1123 for (int y = 0; y != msk.getHeight(); ++y) {
1124 for (Mask::x_iterator ptr = msk.row_begin(y), end = msk.row_end(y); ptr != end; ++ptr) {
1125 sum |= (*ptr)[0];
1126 }
1127 }
1128 _sum = sum;
1129}
int end
std::uint64_t * ptr
Definition RangeSet.cc:95
int y
Definition SpanSet.cc:48
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
Represent a 2-dimensional array of bitmask pixels.
Definition Mask.h:81
Reports invalid arguments.
Definition Runtime.h:66
@ 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 1081 of file Statistics.cc.

1081{ 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 954 of file Statistics.cc.

954 {
955 // if iProp == NOTHING try to return their heart's delight, as specified in the constructor
956 Property const prop = static_cast<Property>(((iProp == NOTHING) ? _flags : iProp) & ~ERRORS);
957
958 if (!(prop & _flags)) { // we didn't calculate it
960 (boost::format("You didn't ask me to calculate %d") % prop).str());
961 }
962
963 Value ret(NaN, NaN);
964 switch (prop) {
965 case NPOINT:
966 ret.first = static_cast<double>(_n);
967 if (_flags & ERRORS) {
968 ret.second = 0;
969 }
970 break;
971
972 case NCLIPPED:
973 ret.first = static_cast<double>(_nClipped);
974 if (_flags & ERRORS) {
975 ret.second = 0;
976 }
977 break;
978
979 case NMASKED:
980 ret.first = static_cast<double>(_nMasked);
981 if (_flags & ERRORS) {
982 ret.second = 0;
983 }
984 break;
985
986 case SUM:
987 ret.first = static_cast<double>(_sum);
988 if (_flags & ERRORS) {
989 ret.second = 0;
990 }
991 break;
992
993 // == means ==
994 case MEAN:
995 ret.first = _mean.first;
996 if (_flags & ERRORS) {
997 ret.second = ::sqrt(_mean.second);
998 }
999 break;
1000 case MEANCLIP:
1001 ret.first = _meanclip.first;
1002 if (_flags & ERRORS) {
1003 ret.second = ::sqrt(_meanclip.second);
1004 }
1005 break;
1006
1007 // == stdevs & variances ==
1008 case VARIANCE:
1009 ret.first = _variance.first;
1010 if (_flags & ERRORS) {
1011 ret.second = ::sqrt(_variance.second);
1012 }
1013 break;
1014 case STDEV:
1015 ret.first = sqrt(_variance.first);
1016 if (_flags & ERRORS) {
1017 ret.second = 0.5 * ::sqrt(_variance.second) / ret.first;
1018 }
1019 break;
1020 case VARIANCECLIP:
1021 ret.first = _varianceclip.first;
1022 if (_flags & ERRORS) {
1023 ret.second = ret.second;
1024 }
1025 break;
1026 case STDEVCLIP:
1027 ret.first = sqrt(_varianceclip.first);
1028 if (_flags & ERRORS) {
1029 ret.second = 0.5 * ::sqrt(_varianceclip.second) / ret.first;
1030 }
1031 break;
1032
1033 case MEANSQUARE:
1034 ret.first = (_n - 1) / static_cast<double>(_n) * _variance.first + ::pow(_mean.first, 2);
1035 if (_flags & ERRORS) {
1036 ret.second = ::sqrt(2 * ::pow(ret.first / _n, 2)); // assumes Gaussian
1037 }
1038 break;
1039
1040 // == other stats ==
1041 case MIN:
1042 ret.first = _min;
1043 if (_flags & ERRORS) {
1044 ret.second = 0;
1045 }
1046 break;
1047 case MAX:
1048 ret.first = _max;
1049 if (_flags & ERRORS) {
1050 ret.second = 0;
1051 }
1052 break;
1053 case MEDIAN:
1054 ret.first = _median.first;
1055 if (_flags & ERRORS) {
1056 ret.second = sqrt(geom::HALFPI * _variance.first / _n); // assumes Gaussian
1057 }
1058 break;
1059 case IQRANGE:
1060 ret.first = _iqrange;
1061 if (_flags & ERRORS) {
1062 ret.second = NaN; // we're not estimating this properly
1063 }
1064 break;
1065
1066 // no-op to satisfy the compiler
1067 case ERRORS:
1068 break;
1069 // default: redundant as 'ret' is initialized to NaN, NaN
1070 default: // we must have set prop to _flags
1071 assert(iProp == 0);
1072 throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
1073 "getValue() may only be called without a parameter"
1074 " if you asked for only one statistic");
1075 }
1076 return ret;
1077}
std::pair< double, double > Value
The type used to report (value, error) for desired statistics.
Definition Statistics.h:225
@ 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 1079 of file Statistics.cc.

1079{ 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 1136 of file Statistics.cc.

1137 {
1138 return Statistics(msk, msk, msk, flags, sctrl);
1139}

◆ 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: