28#ifndef LSST_AFW_IMAGE_IMAGE_ALGORITHM_H
29#define LSST_AFW_IMAGE_IMAGE_ALGORITHM_H
37#include "boost/format.hpp"
48template <
typename ValT>
57template <
typename ValT>
66template <
typename ValT>
75template <
typename LhsT,
typename RhsT>
84template <
typename LhsT,
typename RhsT>
87 virtual LhsT
operator()(
int x,
int y, LhsT lhs, RhsT rhs)
const = 0;
93template <
typename LhsT>
99 lhsPtr != lhsEnd; ++lhsPtr) {
108template <
typename LhsT>
114 lhsPtr != lhsEnd; ++lhsPtr) {
115 *lhsPtr = func(*lhsPtr);
125template <
typename LhsT>
132 lhsPtr != lhsEnd; ++lhsPtr, ++
x) {
133 *lhsPtr = func(
x,
y + lhs.
getY0(), *lhsPtr);
141template <
typename LhsT,
typename RhsT>
148 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
157 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr) {
158 *lhsPtr = func(*rhsPtr);
166template <
typename LhsT,
typename RhsT>
173 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
182 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr) {
183 *lhsPtr = func(*lhsPtr, *rhsPtr);
192template <
typename LhsT,
typename RhsT>
199 (boost::format(
"Images are of different size, %dx%d v %dx%d") % lhs.
getWidth() %
208 lhsPtr != lhsEnd; ++rhsPtr, ++lhsPtr, ++
x) {
209 *lhsPtr = func(
x,
y + lhs.
getY0(), *lhsPtr, *rhsPtr);
#define LSST_EXCEPT(type,...)
int getX0() const
Return the image's column-origin.
typename _const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
int getWidth() const
Return the number of columns in the image.
int getY0() const
Return the image's row-origin.
lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
int getHeight() const
Return the number of rows in the image.
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
typename _view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
A class to represent a 2-dimensional array of pixels.
void for_each_pixel(Image< LhsT > &lhs, pixelOp0< LhsT > const &func)
Set each pixel in an Image<LhsT> to func()
A functor class equivalent to std::function<ValT ()>, but with a virtual operator()
virtual ValT operator()() const =0
A functor class equivalent to std::function<ValT (ValT)>, but with a virtual operator()
virtual ValT operator()(ValT lhs) const =0
A functor class equivalent to std::function<ValT (int, int, ValT)>, but with a virtual operator()
virtual ValT operator()(int x, int y, ValT lhs) const =0
A functor class equivalent to std::function<LhsT (LhsT, RhsT)>, but with a virtual operator()
virtual LhsT operator()(LhsT lhs, RhsT rhs) const =0
A functor class equivalent to std::function<LhsT (int, int, LhsT, RhsT)>, but with a virtual operator...
virtual LhsT operator()(int x, int y, LhsT lhs, RhsT rhs) const =0