28 #ifndef LSST_AFW_IMAGE_IMAGE_ALGORITHM_H 29 #define LSST_AFW_IMAGE_IMAGE_ALGORITHM_H 37 #include "boost/mpl/bool.hpp" 52 template <
typename ValT>
61 template <
typename ValT>
70 template <
typename ValT>
73 virtual ValT
operator()(
int x,
int y, ValT lhs)
const = 0;
79 template <
typename LhsT,
typename RhsT>
82 virtual LhsT
operator()(LhsT lhs, RhsT rhs)
const = 0;
88 template <
typename LhsT,
typename RhsT>
91 virtual LhsT
operator()(
int x,
int y, LhsT lhs, RhsT rhs)
const = 0;
97 template <
typename LhsT>
101 for (
int y = 0; y != lhs.
getHeight(); ++y) {
103 lhsPtr != lhsEnd; ++lhsPtr) {
112 template <
typename LhsT>
116 for (
int y = 0; y != lhs.
getHeight(); ++y) {
118 lhsPtr != lhsEnd; ++lhsPtr) {
119 *lhsPtr = func(*lhsPtr);
129 template <
typename LhsT>
133 for (
int y = 0; y != lhs.
getHeight(); ++y) {
136 lhsPtr != lhsEnd; ++lhsPtr, ++
x) {
137 *lhsPtr = func(x, y + lhs.
getY0(), *lhsPtr);
145 template <
typename LhsT,
typename RhsT>
152 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
157 for (
int y = 0; y != lhs.
getHeight(); ++y) {
161 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr) {
162 *lhsPtr = func(*rhsPtr);
170 template <
typename LhsT,
typename RhsT>
177 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
182 for (
int y = 0; y != lhs.
getHeight(); ++y) {
186 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr) {
187 *lhsPtr = func(*lhsPtr, *rhsPtr);
196 template <
typename LhsT,
typename RhsT>
203 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
208 for (
int y = 0; y != lhs.
getHeight(); ++y) {
212 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr, ++
x) {
213 *lhsPtr = func(x, y + lhs.
getY0(), *lhsPtr, *rhsPtr);
A functor class equivalent to std::function<LhsT (LhsT, RhsT)>, but with a virtual operator() ...
A functor class equivalent to std::function<ValT (int, int, ValT)>, but with a virtual operator() ...
int getHeight() const
Return the number of rows in the image.
_const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
void for_each_pixel(Image< LhsT > &lhs, pixelOp0< LhsT > const &func)
Set each pixel in an Image<LhsT> to func()
int getX0() const
Return the image's column-origin.
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
A base class for image defects.
A functor class equivalent to std::function<LhsT (int, int, LhsT, RhsT)>, but with a virtual operator...
A functor class equivalent to std::function<ValT ()>, but with a virtual operator() ...
#define LSST_EXCEPT(type,...)
int getY0() const
Return the image's row-origin.
int getWidth() const
Return the number of columns in the image.
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
A functor class equivalent to std::function<ValT (ValT)>, but with a virtual operator() ...
virtual ValT operator()() const =0
A class to represent a 2-dimensional array of pixels.