LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Classes | Functions
lsst::afw::image::pixel Namespace Reference

Classes

class  BinaryExpr
 Class for representing binary operations. More...
 
struct  exprTraits
 A traits class to return the types of the image/mask/variance. More...
 
struct  bitwise_or
 bitwise_or doesn't seem to be in std:: More...
 
struct  variance_divides
 Calculate the variance when we divide two Pixels. More...
 
struct  variance_multiplies
 Calculate the variance when we multiply two Pixels. More...
 
struct  variance_plus
 Calculate the variance when we add (or subtract) two Pixels. More...
 
class  SinglePixel
 A single pixel of the same type as a MaskedImage. More...
 
struct  PixelTypeTraits
 Pixel type traits. More...
 
struct  PixelTypeTraits< SinglePixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > >
 Specialization for a pixel of a MaskedImage. More...
 
class  Pixel
 A pixel of a MaskedImage. More...
 
struct  exprTraits< double >
 A specialisation of exprTraits for double More...
 
struct  exprTraits< float >
 A specialisation of exprTraits for float More...
 
struct  exprTraits< int >
 A specialisation of exprTraits for int More...
 
struct  exprTraits< unsigned short >
 A specialisation of exprTraits for unsigned short More...
 
struct  noop
 A noop functor (useful for e.g. masks and variances when changing the sign of the image) More...
 
struct  variance_plus_covar
 The variance of the sum of a pair of correlated pixels. More...
 
class  UnaryExpr
 Class for representing Unary operations. More...
 
class  BinaryExpr< ExprT1, double, ImageBinOp, MaskBinOp, VarianceBinOp >
 Partial specialization of BinaryExpr when ExprT2 is a double (i.e no mask/variance part) More...
 
struct  is_specialization
 Template for (e1 + e2) More...
 
struct  is_specialization< Template< Args... >, Template >
 

Functions

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > makeSinglePixel (ImagePixelT x, MaskPixelT m, VariancePixelT v)
 Return a SinglePixel. More...
 
template<typename ExprT1 >
UnaryExpr< ExprT1, std::negate< typename exprTraits< ExprT1 >::ImagePixelT >, noop< typename exprTraits< ExprT1 >::MaskPixelT >, noop< typename exprTraits< ExprT1 >::VariancePixelT > > operator- (ExprT1 e1)
 Template for -e1. More...
 
template<typename ExprT1 , typename ExprT2 , typename = std::enable_if_t < ( std::is_integral<ExprT1>::value || is_specialization<ExprT1,BinaryExpr>{} || is_specialization<ExprT1,SinglePixel>{} || is_specialization<ExprT1,Pixel>{}) && ( std::is_integral<ExprT2>::value || is_specialization<ExprT2,BinaryExpr>{} || is_specialization<ExprT2,SinglePixel>{} || is_specialization<ExprT2,Pixel>{} ) >>
BinaryExpr< ExprT1, ExprT2, std::plus< typename exprTraits< ExprT1 >::ImagePixelT >, bitwise_or< typename exprTraits< ExprT1 >::MaskPixelT >, variance_plus< typename exprTraits< ExprT1 >::VariancePixelT > > operator+ (ExprT1 e1, ExprT2 e2)
 
template<typename ExprT1 , typename ExprT2 >
ExprT1 operator+= (ExprT1 &e1, ExprT2 e2)
 template for e1 += e2 More...
 
template<typename ExprT1 , typename ExprT2 >
ExprT1 plus (ExprT1 &lhs, ExprT2 const &rhs, float covariance)
 Like operator+(), but assume that covariance's 2*alpha*sqrt(vx*vy) More...
 
template<typename ExprT1 , typename ExprT2 >
BinaryExpr< ExprT1, ExprT2, std::minus< typename exprTraits< ExprT1 >::ImagePixelT >, bitwise_or< typename exprTraits< ExprT1 >::MaskPixelT >, variance_plus< typename exprTraits< ExprT1 >::VariancePixelT > > operator- (ExprT1 e1, ExprT2 e2)
 Template to evaluate (e1 - e2) More...
 
template<typename ExprT1 , typename ExprT2 >
ExprT1 operator-= (ExprT1 &e1, ExprT2 e2)
 Template to evaluate e1 -= e2. More...
 
template<typename ExprT1 , typename ExprT2 >
BinaryExpr< ExprT1, ExprT2, std::multiplies< typename exprTraits< ExprT1 >::ImagePixelT >, bitwise_or< typename exprTraits< ExprT1 >::MaskPixelT >, variance_multiplies< typename exprTraits< ExprT1 >::VariancePixelT > > operator* (ExprT1 e1, ExprT2 e2)
 Template to evaluate (e1 * e2) More...
 
template<typename ExprT1 , typename ExprT2 >
ExprT1 operator*= (ExprT1 &e1, ExprT2 e2)
 Template to evaluate e1 *= e2. More...
 
template<typename ExprT1 , typename ExprT2 >
BinaryExpr< ExprT1, ExprT2, std::divides< typename exprTraits< ExprT1 >::ImagePixelT >, bitwise_or< typename exprTraits< ExprT1 >::MaskPixelT >, variance_divides< typename exprTraits< ExprT1 >::VariancePixelT > > operator/ (ExprT1 e1, ExprT2 e2)
 Template to evaluate (e1 / e2) More...
 
template<typename ExprT1 , typename ExprT2 >
ExprT1 operator/= (ExprT1 &e1, ExprT2 e2)
 Template to evaluate e1 /= e2. More...
 
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
std::ostreamoperator<< (std::ostream &os, SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > const &v)
 Print a SinglePixel. More...
 
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
std::ostreamoperator<< (std::ostream &os, Pixel< ImagePixelT, MaskPixelT, VariancePixelT > const &v)
 Print a Pixel. More...
 
template<typename ExprT1 , typename ExprT2 , typename BinOp , typename MaskBinOp , typename VarBinOp >
std::ostreamoperator<< (std::ostream &os, BinaryExpr< ExprT1, ExprT2, BinOp, MaskBinOp, VarBinOp > const &v)
 Evaluate and print a BinaryExpr. More...
 
 PYBIND11_MODULE (_pixel, mod)
 

Function Documentation

◆ makeSinglePixel()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> lsst::afw::image::pixel::makeSinglePixel ( ImagePixelT  x,
MaskPixelT  m,
VariancePixelT  v 
)

Return a SinglePixel.

This function is useful as function overloading will choose the correct return type (cf. std::make_pair()

Definition at line 141 of file Pixel.h.

142  {
143  return SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT>(x, m, v);
144 }
double x
int m
Definition: SpanSet.cc:48

◆ operator*()

template<typename ExprT1 , typename ExprT2 >
BinaryExpr<ExprT1, ExprT2, std::multiplies<typename exprTraits<ExprT1>::ImagePixelT>, bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>, variance_multiplies<typename exprTraits<ExprT1>::VariancePixelT> > lsst::afw::image::pixel::operator* ( ExprT1  e1,
ExprT2  e2 
)

Template to evaluate (e1 * e2)

Definition at line 626 of file Pixel.h.

626  {
627  return BinaryExpr<ExprT1, ExprT2, std::multiplies<typename exprTraits<ExprT1>::ImagePixelT>,
628  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
629  variance_multiplies<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
630 }

◆ operator*=()

template<typename ExprT1 , typename ExprT2 >
ExprT1 lsst::afw::image::pixel::operator*= ( ExprT1 &  e1,
ExprT2  e2 
)

Template to evaluate e1 *= e2.

Definition at line 634 of file Pixel.h.

634  {
635  e1 = BinaryExpr<ExprT1, ExprT2, std::multiplies<typename exprTraits<ExprT1>::ImagePixelT>,
636  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
637  variance_multiplies<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
638  return e1;
639 }

◆ operator+()

template<typename ExprT1 , typename ExprT2 , typename = std::enable_if_t < ( std::is_integral<ExprT1>::value || is_specialization<ExprT1,BinaryExpr>{} || is_specialization<ExprT1,SinglePixel>{} || is_specialization<ExprT1,Pixel>{}) && ( std::is_integral<ExprT2>::value || is_specialization<ExprT2,BinaryExpr>{} || is_specialization<ExprT2,SinglePixel>{} || is_specialization<ExprT2,Pixel>{} ) >>
BinaryExpr<ExprT1, ExprT2, std::plus<typename exprTraits<ExprT1>::ImagePixelT>, bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>, variance_plus<typename exprTraits<ExprT1>::VariancePixelT> > lsst::afw::image::pixel::operator+ ( ExprT1  e1,
ExprT2  e2 
)

Definition at line 553 of file Pixel.h.

553  {
554  return BinaryExpr<ExprT1, ExprT2, std::plus<typename exprTraits<ExprT1>::ImagePixelT>,
555  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
556  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
557 }

◆ operator+=()

template<typename ExprT1 , typename ExprT2 >
ExprT1 lsst::afw::image::pixel::operator+= ( ExprT1 &  e1,
ExprT2  e2 
)

template for e1 += e2

Definition at line 561 of file Pixel.h.

561  {
562  e1 = BinaryExpr<ExprT1, ExprT2, std::plus<typename exprTraits<ExprT1>::ImagePixelT>,
563  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
564  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
565  return e1;
566 }

◆ operator-() [1/2]

template<typename ExprT1 >
UnaryExpr<ExprT1, std::negate<typename exprTraits<ExprT1>::ImagePixelT>, noop<typename exprTraits<ExprT1>::MaskPixelT>, noop<typename exprTraits<ExprT1>::VariancePixelT> > lsst::afw::image::pixel::operator- ( ExprT1  e1)

Template for -e1.

Definition at line 523 of file Pixel.h.

523  {
524  return UnaryExpr<ExprT1, std::negate<typename exprTraits<ExprT1>::ImagePixelT>,
525  noop<typename exprTraits<ExprT1>::MaskPixelT>,
526  noop<typename exprTraits<ExprT1>::VariancePixelT> >(e1);
527 }

◆ operator-() [2/2]

template<typename ExprT1 , typename ExprT2 >
BinaryExpr<ExprT1, ExprT2, std::minus<typename exprTraits<ExprT1>::ImagePixelT>, bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>, variance_plus<typename exprTraits<ExprT1>::VariancePixelT> > lsst::afw::image::pixel::operator- ( ExprT1  e1,
ExprT2  e2 
)

Template to evaluate (e1 - e2)

Definition at line 605 of file Pixel.h.

605  {
606  return BinaryExpr<ExprT1, ExprT2, std::minus<typename exprTraits<ExprT1>::ImagePixelT>,
607  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
608  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
609 }

◆ operator-=()

template<typename ExprT1 , typename ExprT2 >
ExprT1 lsst::afw::image::pixel::operator-= ( ExprT1 &  e1,
ExprT2  e2 
)

Template to evaluate e1 -= e2.

Definition at line 613 of file Pixel.h.

613  {
614  e1 = BinaryExpr<ExprT1, ExprT2, std::minus<typename exprTraits<ExprT1>::ImagePixelT>,
615  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
616  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
617  return e1;
618 }

◆ operator/()

template<typename ExprT1 , typename ExprT2 >
BinaryExpr<ExprT1, ExprT2, std::divides<typename exprTraits<ExprT1>::ImagePixelT>, bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>, variance_divides<typename exprTraits<ExprT1>::VariancePixelT> > lsst::afw::image::pixel::operator/ ( ExprT1  e1,
ExprT2  e2 
)

Template to evaluate (e1 / e2)

Definition at line 647 of file Pixel.h.

647  {
648  return BinaryExpr<ExprT1, ExprT2, std::divides<typename exprTraits<ExprT1>::ImagePixelT>,
649  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
650  variance_divides<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
651 }

◆ operator/=()

template<typename ExprT1 , typename ExprT2 >
ExprT1 lsst::afw::image::pixel::operator/= ( ExprT1 &  e1,
ExprT2  e2 
)

Template to evaluate e1 /= e2.

Definition at line 655 of file Pixel.h.

655  {
656  e1 = BinaryExpr<ExprT1, ExprT2, std::divides<typename exprTraits<ExprT1>::ImagePixelT>,
657  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
658  variance_divides<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
659  return e1;
660 }

◆ operator<<() [1/3]

template<typename ExprT1 , typename ExprT2 , typename BinOp , typename MaskBinOp , typename VarBinOp >
std::ostream& lsst::afw::image::pixel::operator<< ( std::ostream os,
BinaryExpr< ExprT1, ExprT2, BinOp, MaskBinOp, VarBinOp > const &  v 
)

Evaluate and print a BinaryExpr.

Definition at line 676 of file Pixel.h.

676  {
677  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
678 }
std::ostream * os
Definition: Schema.cc:557

◆ operator<<() [2/3]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
std::ostream& lsst::afw::image::pixel::operator<< ( std::ostream os,
Pixel< ImagePixelT, MaskPixelT, VariancePixelT > const &  v 
)

Print a Pixel.

Definition at line 670 of file Pixel.h.

670  {
671  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
672 }

◆ operator<<() [3/3]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
std::ostream& lsst::afw::image::pixel::operator<< ( std::ostream os,
SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > const &  v 
)

Print a SinglePixel.

Definition at line 664 of file Pixel.h.

664  {
665  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
666 }

◆ plus()

template<typename ExprT1 , typename ExprT2 >
ExprT1 lsst::afw::image::pixel::plus ( ExprT1 &  lhs,
ExprT2 const &  rhs,
float  covariance 
)
inline

Like operator+(), but assume that covariance's 2*alpha*sqrt(vx*vy)

Parameters
lhsLeft hand value
rhsRight hand value
covarianceAssume that covariance is 2*alpha*sqrt(vx*vy) (if variances are known)

Definition at line 591 of file Pixel.h.

595  {
596  return doPlus(lhs, rhs, covariance, typename std::is_arithmetic<ExprT1>::type());
597 }
MatrixQ covariance
Definition: simpleShape.cc:152

◆ PYBIND11_MODULE()

lsst::afw::image::pixel::PYBIND11_MODULE ( _pixel  ,
mod   
)

Definition at line 65 of file _pixel.cc.

65  {
66  lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image.pixel");
67  declareSinglePixel<float>(wrappers, "SinglePixelF");
68  declareSinglePixel<double>(wrappers, "SinglePixelD");
69  declareSinglePixel<int>(wrappers, "SinglePixelI");
70  declareSinglePixel<std::uint16_t>(wrappers, "SinglePixelU");
71  declareSinglePixel<std::uint64_t>(wrappers, "SinglePixelL");
72  wrappers.finish();
73 }