25 #if !defined(LSST_AFW_IMAGE_SLICE_H)
26 #define LSST_AFW_IMAGE_SLICE_H
45 template <
typename PixelT>
72 template <
typename PixelT>
74 PixelT
operator()(PixelT
const imgPix, PixelT
const slcPix) {
return imgPix + slcPix; }
76 template <
typename PixelT>
78 PixelT
operator()(PixelT
const imgPix, PixelT
const slcPix) {
return imgPix - slcPix; }
80 template <
typename PixelT>
82 PixelT
operator()(PixelT
const imgPix, PixelT
const slcPix) {
return imgPix * slcPix; }
84 template <
typename PixelT>
86 PixelT
operator()(PixelT
const imgPix, PixelT
const slcPix) {
return imgPix / slcPix; }
93 template <
typename OperatorT,
typename PixelT>
99 for (
int y = 0; y < img.
getHeight(); ++y) {
102 pImg !=
end; ++pImg, ++pSlc) {
103 *pImg = op(*pImg, *pSlc);
108 for (
int y = 0; y < img.
getHeight(); ++y, ++pSlc) {
110 pImg !=
end; ++pImg) {
111 *pImg = op(*pImg, *pSlc);
128 template <
typename PixelT>
129 std::shared_ptr<Image<PixelT>>
operator+(Image<PixelT>
const &img, ImageSlice<PixelT>
const &slc);
139 template <
typename PixelT>
140 std::shared_ptr<Image<PixelT>>
operator+(ImageSlice<PixelT>
const &slc, Image<PixelT>
const &img);
150 template <
typename PixelT>
151 void operator+=(Image<PixelT> &img, ImageSlice<PixelT>
const &slc);
163 template <
typename PixelT>
164 std::shared_ptr<Image<PixelT>>
operator-(Image<PixelT>
const &img, ImageSlice<PixelT>
const &slc);
174 template <
typename PixelT>
175 void operator-=(Image<PixelT> &img, ImageSlice<PixelT>
const &slc);
187 template <
typename PixelT>
188 std::shared_ptr<Image<PixelT>>
operator*(Image<PixelT>
const &img, ImageSlice<PixelT>
const &slc);
198 template <
typename PixelT>
199 std::shared_ptr<Image<PixelT>>
operator*(ImageSlice<PixelT>
const &slc, Image<PixelT>
const &img);
209 template <
typename PixelT>
210 void operator*=(Image<PixelT> &img, ImageSlice<PixelT>
const &slc);
222 template <
typename PixelT>
223 std::shared_ptr<Image<PixelT>>
operator/(Image<PixelT>
const &img, ImageSlice<PixelT>
const &slc);
233 template <
typename PixelT>
234 void operator/=(Image<PixelT> &img, ImageSlice<PixelT>
const &slc);
std::shared_ptr< Image< PixelT > > operator/(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator/()
ImageSlice(Image< PixelT > const &img)
Constructor for ImageSlice.
Image< LhsPixelT > & operator+=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Add lhs to Image rhs (i.e. pixel-by-pixel addition) where types are different.
std::shared_ptr< Image< PixelT > > operator*(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator*()
std::shared_ptr< Image< PixelT > > operator+(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator+()
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
ImageSliceType getImageSliceType() const
PixelT operator()(PixelT const imgPix, PixelT const slcPix)
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
void operate(Image< PixelT > &img, ImageSlice< PixelT > const &slc, typename ImageSlice< PixelT >::ImageSliceType sliceType)
A function to loop over pixels and perform the requested operation.
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
int getHeight() const
Return the number of rows in the image.
PixelT operator()(PixelT const imgPix, PixelT const slcPix)
std::shared_ptr< Image< PixelT > > operator-(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator-()
Image< LhsPixelT > & operator*=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Multiply lhs by Image rhs (i.e. pixel-by-pixel multiplication) where types are different.
y_iterator col_begin(int x) const
Return an y_iterator to the start of the y'th row.
PixelT operator()(PixelT const imgPix, PixelT const slcPix)
Image< LhsPixelT > & operator-=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Subtract lhs from Image rhs (i.e. pixel-by-pixel subtraction) where types are different.
Image< LhsPixelT > & operator/=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Divide lhs by Image rhs (i.e. pixel-by-pixel division) where types are different. ...
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
A class to represent a 2-dimensional array of pixels.
PixelT operator()(PixelT const imgPix, PixelT const slcPix)
A class to specify a slice of an image.