LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > Class Template Reference

A pixel of a MaskedImage. More...

#include <Pixel.h>

Inheritance diagram for lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >:
lsst::afw::image::detail::MaskedImagePixel_tag

Public Types

typedef _ImagePixelT ImagePixelT
 
typedef _MaskPixelT MaskPixelT
 
typedef _VariancePixelT VariancePixelT
 

Public Member Functions

 Pixel (ImagePixelT const &image, MaskPixelT const &mask=0x0, VariancePixelT const &variance=0)
 Construct a Pixel from references to its image/mask/variance components. More...
 
 Pixel (SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > &rhs)
 
Pixel operator= (Pixel const &rhs)
 
template<typename rhsExpr >
Pixel operator= (rhsExpr const &rhs)
 
Pixel operator= (double const &rhs_image)
 set the image part of a Pixel to rhs_image (the mask and variance are set to 0) More...
 
Pixel operator= (int const &rhs_image)
 set the image part of a Pixel to rhs_image (the mask and variance are set to 0) More...
 
ImagePixelT image () const
 Return the image part of a Pixel. More...
 
MaskPixelT mask () const
 Return the mask part of a Pixel. More...
 
VariancePixelT variance () const
 Return the variance part of a Pixel. More...
 

Private Attributes

ImagePixelT_image
 
MaskPixelT_mask
 
VariancePixelT_variance
 

Friends

template<typename T1 >
bool operator== (Pixel const &lhs, T1 const &rhs)
 Return true iff two pixels are equal (in all three of image, mask, and variance) More...
 
template<typename T1 >
bool operator!= (Pixel const &lhs, T1 const &rhs)
 Return true iff two pixels are unequal (in at least one of image, mask, and variance) More...
 
template<typename ExprT >
Pixel operator+= (Pixel const &e1, ExprT const &e2)
 Evaluate e1 += e2, and return e1. More...
 
template<typename ExprT >
Pixel operator-= (Pixel const &e1, ExprT const &e2)
 Evaluate e1 -= e2, and return e1. More...
 
template<typename ExprT >
Pixel operator*= (Pixel const &e1, ExprT const &e2)
 Evaluate e1 *= e2, and return e1. More...
 
template<typename ExprT >
Pixel operator/= (Pixel const &e1, ExprT const &e2)
 Evaluate e1 /= e2, and return e1. More...
 

Detailed Description

template<typename _ImagePixelT, typename _MaskPixelT, typename _VariancePixelT = double>
class lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >

A pixel of a MaskedImage.

Definition at line 137 of file Pixel.h.

Member Typedef Documentation

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
typedef _ImagePixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::ImagePixelT

Definition at line 139 of file Pixel.h.

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
typedef _MaskPixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::MaskPixelT

Definition at line 140 of file Pixel.h.

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
typedef _VariancePixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::VariancePixelT

Definition at line 141 of file Pixel.h.

Constructor & Destructor Documentation

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::Pixel ( ImagePixelT const &  image,
MaskPixelT const &  mask = 0x0,
VariancePixelT const &  variance = 0 
)
inline

Construct a Pixel from references to its image/mask/variance components.

Definition at line 151 of file Pixel.h.

151  :
152  _image(const_cast<ImagePixelT&>(image)),
153  _mask(const_cast<MaskPixelT&>(mask)),
154  _variance(const_cast<VariancePixelT&>(variance)) {
155  }
VariancePixelT variance() const
Return the variance part of a Pixel.
Definition: Pixel.h:203
MaskPixelT mask() const
Return the mask part of a Pixel.
Definition: Pixel.h:201
ImagePixelT image() const
Return the image part of a Pixel.
Definition: Pixel.h:199
VariancePixelT & _variance
Definition: Pixel.h:262
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::Pixel ( SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > &  rhs)
inline

Definition at line 158 of file Pixel.h.

158  :
159  _image(rhs._image), _mask(rhs._mask), _variance(rhs._variance) {}
VariancePixelT & _variance
Definition: Pixel.h:262

Member Function Documentation

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
ImagePixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::image ( ) const
inline

Return the image part of a Pixel.

Definition at line 199 of file Pixel.h.

199 { return _image; }
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
MaskPixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::mask ( ) const
inline

Return the mask part of a Pixel.

Definition at line 201 of file Pixel.h.

201 { return _mask; }
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
Pixel lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::operator= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  rhs)
inline

Definition at line 161 of file Pixel.h.

161  { // the following template won't stop the compiler trying to generate operator=
162  _variance = rhs.variance(); // evaluate before we update image()
163  _image = rhs.image();
164  _mask = rhs.mask();
165 
166  return *this;
167  }
VariancePixelT & _variance
Definition: Pixel.h:262
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename rhsExpr >
Pixel lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::operator= ( rhsExpr const &  rhs)
inline

Assign a Pixel by evaluating an expression

We use C++ template expressions to build a compile-time parse tree to evaluate Pixel expressions; this is where we evaluate the rhs and set the Pixel's values

Definition at line 173 of file Pixel.h.

173  {
174  _variance = rhs.variance(); // evaluate before we update image()
175  _image = rhs.image();
176  _mask = rhs.mask();
177 
178  return *this;
179  }
VariancePixelT & _variance
Definition: Pixel.h:262
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
Pixel lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::operator= ( double const &  rhs_image)
inline

set the image part of a Pixel to rhs_image (the mask and variance are set to 0)

Definition at line 182 of file Pixel.h.

182  {
183  _image = rhs_image;
184  _mask = 0;
185  _variance = 0;
186 
187  return *this;
188  }
VariancePixelT & _variance
Definition: Pixel.h:262
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
Pixel lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::operator= ( int const &  rhs_image)
inline

set the image part of a Pixel to rhs_image (the mask and variance are set to 0)

Definition at line 191 of file Pixel.h.

191  {
192  _image = rhs_image;
193  _mask = 0;
194  _variance = 0;
195 
196  return *this;
197  }
VariancePixelT & _variance
Definition: Pixel.h:262
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
VariancePixelT lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::variance ( ) const
inline

Return the variance part of a Pixel.

Definition at line 203 of file Pixel.h.

203 { return _variance; }
VariancePixelT & _variance
Definition: Pixel.h:262

Friends And Related Function Documentation

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename T1 >
bool operator!= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  lhs,
T1 const &  rhs 
)
friend

Return true iff two pixels are unequal (in at least one of image, mask, and variance)

Definition at line 216 of file Pixel.h.

216  {
217  return !(lhs == rhs);
218  }
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename ExprT >
Pixel operator*= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  e1,
ExprT const &  e2 
)
friend

Evaluate e1 *= e2, and return e1.

Definition at line 243 of file Pixel.h.

243  {
244  Pixel tmp(e1); // n.b. shares storage with e1 but gets around "const" (which is required)
245  tmp = BinaryExpr<Pixel, ExprT,
246  std::multiplies<ImagePixelT>, bitwise_or<MaskPixelT>, variance_multiplies<VariancePixelT> >(tmp, e2);
247  return tmp;
248  }
Pixel(ImagePixelT const &image, MaskPixelT const &mask=0x0, VariancePixelT const &variance=0)
Construct a Pixel from references to its image/mask/variance components.
Definition: Pixel.h:151
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename ExprT >
Pixel operator+= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  e1,
ExprT const &  e2 
)
friend

Evaluate e1 += e2, and return e1.

Definition at line 225 of file Pixel.h.

225  {
226  Pixel tmp(e1); // n.b. shares storage with e1 but gets around "const" (which is required)
227  tmp = BinaryExpr<Pixel, ExprT,
228  std::plus<ImagePixelT>, bitwise_or<MaskPixelT>, variance_plus<VariancePixelT> >(tmp, e2);
229  return tmp;
230  }
Pixel(ImagePixelT const &image, MaskPixelT const &mask=0x0, VariancePixelT const &variance=0)
Construct a Pixel from references to its image/mask/variance components.
Definition: Pixel.h:151
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename ExprT >
Pixel operator-= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  e1,
ExprT const &  e2 
)
friend

Evaluate e1 -= e2, and return e1.

Definition at line 234 of file Pixel.h.

234  {
235  Pixel tmp(e1); // n.b. shares storage with e1 but gets around "const" (which is required)
236  tmp = BinaryExpr<Pixel, ExprT,
237  std::minus<ImagePixelT>, bitwise_or<MaskPixelT>, variance_plus<VariancePixelT> >(tmp, e2);
238  return tmp;
239  }
Pixel(ImagePixelT const &image, MaskPixelT const &mask=0x0, VariancePixelT const &variance=0)
Construct a Pixel from references to its image/mask/variance components.
Definition: Pixel.h:151
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename ExprT >
Pixel operator/= ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  e1,
ExprT const &  e2 
)
friend

Evaluate e1 /= e2, and return e1.

Definition at line 252 of file Pixel.h.

252  {
253  Pixel tmp(e1); // n.b. shares storage with e1 but gets around "const" (which is required)
254  tmp = BinaryExpr<Pixel, ExprT,
255  std::divides<ImagePixelT>, bitwise_or<MaskPixelT>, variance_divides<VariancePixelT> >(tmp, e2);
256  return tmp;
257  }
Pixel(ImagePixelT const &image, MaskPixelT const &mask=0x0, VariancePixelT const &variance=0)
Construct a Pixel from references to its image/mask/variance components.
Definition: Pixel.h:151
template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
template<typename T1 >
bool operator== ( Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT > const &  lhs,
T1 const &  rhs 
)
friend

Return true iff two pixels are equal (in all three of image, mask, and variance)

Definition at line 210 of file Pixel.h.

210  {
211  return lhs.image() == rhs.image() && lhs.mask() == rhs.mask() && lhs.variance() == rhs.variance();
212  }

Member Data Documentation

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
ImagePixelT& lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::_image
private

Definition at line 260 of file Pixel.h.

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
MaskPixelT& lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::_mask
private

Definition at line 261 of file Pixel.h.

template<typename _ImagePixelT , typename _MaskPixelT , typename _VariancePixelT = double>
VariancePixelT& lsst::afw::image::pixel::Pixel< _ImagePixelT, _MaskPixelT, _VariancePixelT >::_variance
private

Definition at line 262 of file Pixel.h.


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