File Pixel.h

template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
struct hash<lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT>>

Public Types

template<>
using argument_type = lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT>
template<>
using result_type = size_t

Public Functions

size_t operator()(argument_type const &obj) const
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
struct hash<lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT>>

Public Types

template<>
using argument_type = lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT>
template<>
using result_type = size_t

Public Functions

size_t operator()(argument_type const &obj) const
namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

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.

namespace afw
namespace image
namespace pixel

Functions

template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> 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()

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.

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)

template<typename ExprT1, typename ExprT2>
ExprT1 operator+=(ExprT1 &e1, ExprT2 e2)

template for e1 += e2

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)

Parameters
  • lhs: Left hand value

  • rhs: Right hand value

  • covariance: Assume that covariance is 2*alpha*sqrt(vx*vy) (if variances are known)

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)

template<typename ExprT1, typename ExprT2>
ExprT1 operator-=(ExprT1 &e1, ExprT2 e2)

Template to evaluate e1 -= e2.

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)

template<typename ExprT1, typename ExprT2>
ExprT1 operator*=(ExprT1 &e1, ExprT2 e2)

Template to evaluate e1 *= e2.

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)

template<typename ExprT1, typename ExprT2>
ExprT1 operator/=(ExprT1 &e1, ExprT2 e2)

Template to evaluate e1 /= e2.

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

Print a SinglePixel.

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

Print a Pixel.

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

Evaluate and print a BinaryExpr.

template<typename ExprT1, typename ExprT2, typename ImageBinOp, typename MaskBinOp, typename VarianceBinOp>
class BinaryExpr
#include <Pixel.h>

Class for representing binary operations.

Public Types

typedef exprTraits<ExprT1>::ImagePixelT ImagePixelT
typedef exprTraits<ExprT1>::MaskPixelT MaskPixelT
typedef exprTraits<ExprT1>::VariancePixelT VariancePixelT

Public Functions

BinaryExpr(ExprT1 e1, ExprT2 e2, ImageBinOp imageOp = ImageBinOp(), MaskBinOp maskOp = MaskBinOp(), VarianceBinOp varOp = VarianceBinOp())

A binary operation, with three functors to represent the image/mask/variance operations.

BinaryExpr(ExprT1 e1, ExprT2 e2, double const alpha, ImageBinOp imageOp = ImageBinOp(), MaskBinOp maskOp = MaskBinOp(), VarianceBinOp = VarianceBinOp())

A binary operation, with three functors to represent the image/mask/variance operations and an extra double argument

ImagePixelT image() const

evaluate the image part of the expression

MaskPixelT mask() const

evaluate the mask part of the expression

VariancePixelT variance() const

evaluate the variance part of the expression

Private Members

exprTraits<ExprT1>::expr_type _expr1
exprTraits<ExprT2>::expr_type _expr2
ImageBinOp _imageOp
MaskBinOp _maskOp
VarianceBinOp _varOp
template<typename ExprT1, typename ImageBinOp, typename MaskBinOp, typename VarianceBinOp>
class BinaryExpr<ExprT1, double, ImageBinOp, MaskBinOp, VarianceBinOp>
#include <Pixel.h>

Partial specialization of BinaryExpr when ExprT2 is a double (i.e no mask/variance part)

Public Types

typedef exprTraits<ExprT1>::ImagePixelT ImagePixelT
typedef exprTraits<ExprT1>::MaskPixelT MaskPixelT
typedef exprTraits<ExprT1>::VariancePixelT VariancePixelT

Public Functions

BinaryExpr(ExprT1 e1, double e2, ImageBinOp imageOp = ImageBinOp(), MaskBinOp maskOp = MaskBinOp(), VarianceBinOp varOp = VarianceBinOp())

A binary operation, with three functors to represent the image/mask/variance operations.

BinaryExpr(ExprT1 e1, double e2, double const alpha, ImageBinOp imageOp = ImageBinOp(), MaskBinOp maskOp = MaskBinOp(), VarianceBinOp = VarianceBinOp())

A binary operation, with three functors to represent the image/mask/variance operations and an extra double argument

ImagePixelT image() const

evaluate the image part of the expression

MaskPixelT mask() const

evaluate the mask part of the expression

VariancePixelT variance() const

evaluate the variance part of the expression

Private Members

exprTraits<ExprT1>::expr_type _expr1
double _expr2
ImageBinOp _imageOp
MaskBinOp _maskOp
VarianceBinOp _varOp
template<typename T1>
struct bitwise_or : public std::binary_function<T1, T1, T1>
#include <Pixel.h>

bitwise_or doesn’t seem to be in std::

Note

We provide a single-operand version for when the right-hand-side of an expression is a scalar, not a masked pixel,

Public Functions

T1 operator()(const T1 &x, const T1 &y) const
T1 operator()(const T1 &x) const
template<typename ExprT>
struct exprTraits
#include <Pixel.h>

A traits class to return the types of the image/mask/variance.

Public Types

typedef ExprT expr_type
typedef ExprT::ImagePixelT ImagePixelT
typedef ExprT::MaskPixelT MaskPixelT
typedef ExprT::VariancePixelT VariancePixelT
template<>
struct exprTraits<double>
#include <Pixel.h>

A specialisation of exprTraits for double

Public Types

typedef double ImagePixelT
typedef int MaskPixelT
typedef double VariancePixelT
typedef SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> expr_type
template<>
struct exprTraits<float>
#include <Pixel.h>

A specialisation of exprTraits for float

Public Types

typedef float ImagePixelT
typedef exprTraits<double>::MaskPixelT MaskPixelT
typedef exprTraits<double>::VariancePixelT VariancePixelT
typedef SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> expr_type
template<>
struct exprTraits<int>
#include <Pixel.h>

A specialisation of exprTraits for int

Public Types

typedef int ImagePixelT
typedef exprTraits<double>::MaskPixelT MaskPixelT
typedef exprTraits<double>::VariancePixelT VariancePixelT
typedef SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> expr_type
template<>
struct exprTraits<unsigned short>
#include <Pixel.h>

A specialisation of exprTraits for unsigned short

Public Types

typedef int ImagePixelT
typedef exprTraits<double>::MaskPixelT MaskPixelT
typedef exprTraits<double>::VariancePixelT VariancePixelT
typedef SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> expr_type
template<typename T1>
struct noop : public std::unary_function<T1, T1>
#include <Pixel.h>

A noop functor (useful for e.g. masks and variances when changing the sign of the image)

Public Functions

T1 operator()(const T1 &x) const
template<typename _ImagePixelT, typename _MaskPixelT, typename _VariancePixelT = double>
class Pixel : public lsst::afw::image::detail::MaskedImagePixel_tag
#include <Pixel.h>

A pixel of a MaskedImage.

Public Types

typedef _ImagePixelT ImagePixelT
typedef _MaskPixelT MaskPixelT
typedef _VariancePixelT VariancePixelT

Public Functions

Pixel(ImagePixelT const &image, MaskPixelT const &mask = 0x0, VariancePixelT const &variance = 0)

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

Pixel(SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> &rhs)
Pixel(Pixel const &rhs)
Pixel(Pixel &&rhs)
~Pixel()
Pixel operator=(Pixel const &rhs)
template<typename rhsExpr>
Pixel operator=(rhsExpr const &rhs)

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

Pixel operator=(Pixel &&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)

Pixel operator=(int const &rhs_image)

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

ImagePixelT image() const

Return the image part of a Pixel.

MaskPixelT mask() const

Return the mask part of a Pixel.

VariancePixelT variance() const

Return the variance part of a Pixel.

std::size_t hash_value() const

Return a hash of this object.

Private Members

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)

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)

template<typename ExprT>
Pixel operator+=(Pixel const &e1, ExprT const &e2)

Evaluate e1 += e2, and return e1.

template<typename ExprT>
Pixel operator-=(Pixel const &e1, ExprT const &e2)

Evaluate e1 -= e2, and return e1.

template<typename ExprT>
Pixel operator*=(Pixel const &e1, ExprT const &e2)

Evaluate e1 *= e2, and return e1.

template<typename ExprT>
Pixel operator/=(Pixel const &e1, ExprT const &e2)

Evaluate e1 /= e2, and return e1.

template<typename PixelT>
struct PixelTypeTraits
#include <Pixel.h>

Pixel type traits.

Public Static Functions

static const PixelT padValue()

The quantity to use when a pixel value is undefined.

template<typename _ImagePixelT, typename _MaskPixelT, typename _VariancePixelT>
struct PixelTypeTraits<SinglePixel<_ImagePixelT, _MaskPixelT, _VariancePixelT>>
#include <Pixel.h>

Specialization for a pixel of a MaskedImage.

Public Types

typedef SinglePixel<_ImagePixelT, _MaskPixelT, _VariancePixelT> PixelT

Public Static Functions

static const PixelT padValue()

The quantity to use when a pixel value is undefined.

template<typename _ImagePixelT, typename _MaskPixelT, typename _VariancePixelT = double>
class SinglePixel : public lsst::afw::image::detail::MaskedImagePixel_tag
#include <Pixel.h>

A single pixel of the same type as a MaskedImage.

Public Types

typedef _ImagePixelT ImagePixelT
typedef _MaskPixelT MaskPixelT
typedef _VariancePixelT VariancePixelT

Public Functions

SinglePixel(ImagePixelT image, MaskPixelT mask = 0, VariancePixelT variance = 0)
template<typename rhsExpr>
SinglePixel(rhsExpr const &rhs, typename std::enable_if<!std::is_fundamental<rhsExpr>::value, void *>::type dummy = nullptr)
ImagePixelT image() const
MaskPixelT mask() const
VariancePixelT variance() const

Private Functions

SinglePixel()

Default Ctor

Can be called by PixelTypeTraits<SinglePixel>::padValue()

Private Members

ImagePixelT _image
MaskPixelT _mask
VariancePixelT _variance

Friends

friend lsst::afw::image::pixel::Pixel

Typedefs to be used for pixel values

friend lsst::afw::image::pixel::PixelTypeTraits
template<typename ExprT1, typename ImageBinOp, typename MaskBinOp, typename VarianceBinOp>
class UnaryExpr
#include <Pixel.h>

Class for representing Unary operations.

Public Types

typedef exprTraits<ExprT1>::ImagePixelT ImagePixelT
typedef exprTraits<ExprT1>::MaskPixelT MaskPixelT
typedef exprTraits<ExprT1>::VariancePixelT VariancePixelT

Public Functions

UnaryExpr(ExprT1 e1, ImageBinOp imageOp = ImageBinOp(), MaskBinOp maskOp = MaskBinOp(), VarianceBinOp varOp = VarianceBinOp())

a unary expression, with three functors to represent the image/mask/variance operations

ImagePixelT image() const

evaluate the image part of the expression

MaskPixelT mask() const

evaluate the mask part of the expression

VariancePixelT variance() const

evaluate the variance part of the expression

Private Members

exprTraits<ExprT1>::expr_type _expr1
ImageBinOp _imageOp
MaskBinOp _maskOp
VarianceBinOp _varOp
template<typename T1>
struct variance_divides
#include <Pixel.h>

Calculate the variance when we divide two Pixels

Note

We provide a single-operand version for when the right-hand-side of an expression is a scalar, not a masked pixel,

Public Functions

T1 operator()(T1 const &x, T1 const &y, T1 const &vx, T1 const &vy) const
T1 operator()(T1 const&, T1 const &y, T1 const &vx) const
template<typename T1>
struct variance_multiplies
#include <Pixel.h>

Calculate the variance when we multiply two Pixels

Note

We provide a single-operand version for when the right-hand-side of an expression is a scalar, not a masked pixel,

Public Functions

T1 operator()(T1 const &x, T1 const &y, T1 const &vx, T1 const &vy) const
T1 operator()(T1 const&, T1 const &y, T1 const &vx) const
template<typename T1>
struct variance_plus
#include <Pixel.h>

Calculate the variance when we add (or subtract) two Pixels

Note

We provide a single-operand version for when the right-hand-side of an expression is a scalar, not a masked pixel,

Public Functions

T1 operator()(T1 const&, T1 const&, T1 const &vx, T1 const &vy) const
T1 operator()(T1 const&, T1 const&, T1 const &vx) const
template<typename T1>
struct variance_plus_covar
#include <Pixel.h>

The variance of the sum of a pair of correlated pixels

The covariance is modelled as alpha*sqrt(var_x*var_y)

Note

We provide a single-operand version for when the right-hand-side of an expression is a scalar, not a masked pixel,

Public Functions

variance_plus_covar(double alpha = 0)
T1 operator()(T1 const&, T1 const&, T1 const &vx, T1 const &vy) const
T1 operator()(T1 const&, T1 const&, T1 const &vx) const

Private Members

double _alpha
namespace std
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
struct hash<lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT>>

Public Types

template<>
using argument_type = lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT>
template<>
using result_type = size_t

Public Functions

size_t operator()(argument_type const &obj) const
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
struct hash<lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT>>

Public Types

template<>
using argument_type = lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT>
template<>
using result_type = size_t

Public Functions

size_t operator()(argument_type const &obj) const