27 #ifndef LSST_AFW_GEOM_SPANSETFUNCTORGETTERS_H 28 #define LSST_AFW_GEOM_SPANSETFUNCTORGETTERS_H 30 #include <type_traits> 55 template <
typename T,
typename... Args>
63 x.checkExtents(box, area);
66 template <
typename T,
typename... Args>
77 template <
typename T,
typename... Args>
121 template <
typename T>
137 T
get()
const {
return _const; }
143 template <
typename T,
int N,
int C>
147 using Reference =
typename ndarray::Array<T, N, C>::Reference::Reference;
150 : _array(array), _xy0(xy0) {}
155 geom::Extent2I(_array.template getSize<1>(), _array.template getSize<0>()));
158 "SpanSet bounding box lands outside array");
163 auto _iterY = _array.begin() + (span.
getY() - _xy0.getY());
164 _iterX = (*_iterY).begin() + (span.
getMinX() - _xy0.getX());
172 ndarray::Array<T, N, C> _array;
174 typename ndarray::Array<T, N, C>::Reference::Iterator _iterX;
177 template <
typename T,
int inA,
int inC>
181 using Reference =
typename ndarray::Array<T, inA, inC>::Reference;
183 explicit FlatNdGetter(ndarray::Array<T, inA, inC>
const& array) : _array(array), _iter(_array.begin()) {}
188 auto shape = _array.getShape();
189 if (area > static_cast<int>(shape[0])) {
191 "SpanSet has dimensionality greater than array");
202 ndarray::Array<T, inA, inC> _array;
203 typename ndarray::Array<T, inA, inC>::Iterator _iter;
215 template <
typename T,
int inA,
int inC>
221 template <
typename T,
int inA,
int inB>
227 template <
typename T>
233 template <
typename T>
239 template <
typename T>
245 template <
typename T>
251 template <
typename T>
262 template <
typename T,
typename =
void>
265 template <
typename T>
267 !std::is_same<typename std::iterator_traits<T>::value_type, void>::value>
::type>
270 template <
typename T>
286 template <
typename T,
int inA,
int inB>
310 template <
typename T,
int inA,
int inB>
318 #endif // LSST_AFW_GEOM_SPANSETFUNCTORGETTERS_H
void variadicSpanSetter(Span const spn, T &x)
void setSpan(Span const &span)
void checkExtents(Box2I const &bbox, int area) const
void setSpan(Span const &span)
A range of pixels within one row of an Image.
typename ndarray::Array< T, N, C >::Reference::Reference Reference
ConstantGetter(T constant)
FlatNdGetter(ndarray::Array< T, inA, inC > const &array)
typename ndarray::Array< T, inA, inC >::Reference Reference
ImageNdGetter(ndarray::Array< T, N, C > const &array, geom::Point2I const &xy0)
An integer coordinate rectangle.
typename std::iterator_traits< T >::value_type type
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
details::FlatNdGetter< T, inA, inB > ndFlat(ndarray::Array< T, inA, inB > const &array)
Marks a ndarray to be interpreted as a 1D vector when applying a functor from a SpanSet.
FlatNdGetter< T, inA, inC > makeGetter(FlatNdGetter< T, inA, inC > &getter)
bool contains(Point2I const &point) const
Return true if the box contains the point.
void variadicBoundChecker(Box2I const box, int area, T const &x)
details::ImageNdGetter< T, inA, inB > ndImage(ndarray::Array< T, inA, inB > const &array, afwGeom::Point2I xy0=afwGeom::Point2I())
Marks a ndarray to be interpreted as an image when applying a functor from a SpanSet.
void checkExtents(Box2I const &bbox, int area) const
#define LSST_EXCEPT(type,...)
void checkExtents(Box2I const &bbox, int area) const
void variadicIncrementPosition(T &x)
void setSpan(Span const &span)
void setSpan(Span const &span)
int getY() const
Return the y-value.
int getMinX() const
Minimum x-value.
A class to represent a 2-dimensional array of pixels.
void checkExtents(Box2I const &bbox, int area) const
geom::Point2I getXY0() const
Return the image's origin.