LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Classes | Functions
lsst::afw::image::pixel Namespace Reference

Classes

class  BinaryExpr
 Class for representing binary 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  bitwise_or
 bitwise_or doesn't seem to be in std:: More...
 
struct  exprTraits
 A traits class to return the types of the image/mask/variance. 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...
 
class  Pixel
 A pixel of a MaskedImage. More...
 
struct  PixelTypeTraits
 Pixel type traits. More...
 
struct  PixelTypeTraits< SinglePixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > >
 Specialization for a pixel of a MaskedImage. More...
 
class  SinglePixel
 A single pixel of the same type as a MaskedImage. More...
 
class  UnaryExpr
 Class for representing Unary operations. 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...
 
struct  variance_plus_covar
 The variance of the sum of a pair of correlated pixels. More...
 

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 >
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 for (e1 + e2) More...
 
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:49

◆ 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 608 of file Pixel.h.

608  {
609  return BinaryExpr<ExprT1, ExprT2, std::multiplies<typename exprTraits<ExprT1>::ImagePixelT>,
610  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
611  variance_multiplies<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
612 }

◆ operator*=()

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

Template to evaluate e1 *= e2.

Definition at line 616 of file Pixel.h.

616  {
617  e1 = BinaryExpr<ExprT1, ExprT2, std::multiplies<typename exprTraits<ExprT1>::ImagePixelT>,
618  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
619  variance_multiplies<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
620  return e1;
621 }

◆ operator+()

template<typename ExprT1 , typename ExprT2 >
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 
)

Template for (e1 + e2)

Definition at line 535 of file Pixel.h.

535  {
536  return BinaryExpr<ExprT1, ExprT2, std::plus<typename exprTraits<ExprT1>::ImagePixelT>,
537  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
538  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
539 }

◆ operator+=()

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

template for e1 += e2

Definition at line 543 of file Pixel.h.

543  {
544  e1 = BinaryExpr<ExprT1, ExprT2, std::plus<typename exprTraits<ExprT1>::ImagePixelT>,
545  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
546  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
547  return e1;
548 }

◆ 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 587 of file Pixel.h.

587  {
588  return BinaryExpr<ExprT1, ExprT2, std::minus<typename exprTraits<ExprT1>::ImagePixelT>,
589  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
590  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
591 }

◆ operator-=()

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

Template to evaluate e1 -= e2.

Definition at line 595 of file Pixel.h.

595  {
596  e1 = BinaryExpr<ExprT1, ExprT2, std::minus<typename exprTraits<ExprT1>::ImagePixelT>,
597  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
598  variance_plus<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
599  return e1;
600 }

◆ 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 629 of file Pixel.h.

629  {
630  return BinaryExpr<ExprT1, ExprT2, std::divides<typename exprTraits<ExprT1>::ImagePixelT>,
631  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
632  variance_divides<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
633 }

◆ operator/=()

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

Template to evaluate e1 /= e2.

Definition at line 637 of file Pixel.h.

637  {
638  e1 = BinaryExpr<ExprT1, ExprT2, std::divides<typename exprTraits<ExprT1>::ImagePixelT>,
639  bitwise_or<typename exprTraits<ExprT1>::MaskPixelT>,
640  variance_divides<typename exprTraits<ExprT1>::VariancePixelT> >(e1, e2);
641  return e1;
642 }

◆ operator<<() [1/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 646 of file Pixel.h.

646  {
647  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
648 }

◆ 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 652 of file Pixel.h.

652  {
653  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
654 }

◆ operator<<() [3/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 658 of file Pixel.h.

658  {
659  return os << "(" << v.image() << ", " << v.mask() << ", " << v.variance() << ")";
660 }

◆ 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 573 of file Pixel.h.

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

◆ PYBIND11_MODULE()

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

Definition at line 61 of file pixel.cc.

61  {
62  declareSinglePixel<float>(mod, "SinglePixelF");
63  declareSinglePixel<double>(mod, "SinglePixelD");
64  declareSinglePixel<int>(mod, "SinglePixelI");
65  declareSinglePixel<std::uint16_t>(mod, "SinglePixelU");
66  declareSinglePixel<std::uint64_t>(mod, "SinglePixelL");
67 }