31 #include "lsst/pex/exceptions.h"
34 namespace ex = lsst::pex::exceptions;
40 template <
typename PixelT>
44 throw LSST_EXCEPT(ex::OutOfRangeError,
"Input image must be a slice (width or height == 1)");
46 throw LSST_EXCEPT(ex::InvalidParameterError,
47 "1x1 image ambiguous (could be row or column). "
48 "Perhaps a constant would be better than a slice? ");
68 template <
typename PixelT>
70 std::shared_ptr<Image<PixelT>> retImg(
new Image<PixelT>(img,
true));
75 template <
typename PixelT>
80 template <
typename PixelT>
88 template <
typename PixelT>
90 std::shared_ptr<Image<PixelT>> retImg(
new Image<PixelT>(img,
true));
95 template <
typename PixelT>
103 template <
typename PixelT>
105 std::shared_ptr<Image<PixelT>> retImg(
new Image<PixelT>(img,
true));
110 template <
typename PixelT>
115 template <
typename PixelT>
122 template <
typename PixelT>
124 std::shared_ptr<Image<PixelT>> retImg(
new Image<PixelT>(img,
true));
129 template <
typename PixelT>
139 #define INSTANTIATE_SLICE_OP_SYM(TYPE, OP) \
140 template std::shared_ptr<Image<TYPE>> operator OP(Image<TYPE> const &img, ImageSlice<TYPE> const &slc); \
141 template std::shared_ptr<Image<TYPE>> operator OP(ImageSlice<TYPE> const &slc, Image<TYPE> const &img)
143 #define INSTANTIATE_SLICE_OP_ASYM(TYPE, OP) \
144 template std::shared_ptr<Image<TYPE>> operator OP(Image<TYPE> const &img, ImageSlice<TYPE> const &slc)
146 #define INSTANTIATE_SLICE_OPEQ(TYPE, OP) \
147 template void operator OP(Image<TYPE> &img, ImageSlice<TYPE> const &slc)
149 #define INSTANTIATE_SLICES(TYPE) \
150 template ImageSlice<TYPE>::ImageSlice(Image<TYPE> const &image); \
151 INSTANTIATE_SLICE_OP_SYM(TYPE, +); \
152 INSTANTIATE_SLICE_OP_ASYM(TYPE, -); \
153 INSTANTIATE_SLICE_OP_SYM(TYPE, *); \
154 INSTANTIATE_SLICE_OP_ASYM(TYPE, /); \
155 INSTANTIATE_SLICE_OPEQ(TYPE, +=); \
156 INSTANTIATE_SLICE_OPEQ(TYPE, -=); \
157 INSTANTIATE_SLICE_OPEQ(TYPE, *=); \
158 INSTANTIATE_SLICE_OPEQ(TYPE, /=)
160 INSTANTIATE_SLICES(
double);
161 INSTANTIATE_SLICES(
float);
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+()
ImageSliceType getImageSliceType() const
int getHeight() const
Return the number of rows in the image.
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.
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. ...
int getWidth() const
Return the number of columns in the image.
A class to represent a 2-dimensional array of pixels.
A class to specify a slice of an image.