23 #include "pybind11/pybind11.h" 
   29 using namespace py::literals;
 
   36 template <
typename PixelT>
 
   38     using Class = ImageSlice<PixelT>;
 
   40     py::module::import(
"lsst.afw.image.image");
 
   42     py::class_<Class, std::shared_ptr<Class>, Image<PixelT>> 
cls(mod, (
"ImageSlice" + suffix).c_str());
 
   44     cls.def(
py::init<Image<PixelT> 
const &>(), 
"img"_a);
 
   46     py::enum_<typename Class::ImageSliceType>(
cls, 
"ImageSliceType")
 
   47             .value(
"ROW", Class::ImageSliceType::ROW)
 
   48             .value(
"COLUMN", Class::ImageSliceType::COLUMN)
 
   51     cls.def(
"getImageSliceType", &Class::getImageSliceType);
 
   53     cls.def(
"__add__", [](ImageSlice<PixelT> &
self, Image<PixelT> 
const &
other) { 
return self + 
other; },
 
   55     cls.def(
"__mul__", [](ImageSlice<PixelT> &
self, Image<PixelT> 
const &
other) { 
return self * 
other; },
 
   57     cls.def(
"__iadd__", [](ImageSlice<PixelT> &
self, Image<PixelT> 
const &
other) {
 
   61     cls.def(
"__imul__", [](ImageSlice<PixelT> &
self, Image<PixelT> 
const &
other) {
 
   67             [](Image<PixelT> 
const &
self, ImageSlice<PixelT> 
const &
other) { 
return self + 
other; },
 
   70             [](Image<PixelT> 
const &
self, ImageSlice<PixelT> 
const &
other) { 
return self - 
other; },
 
   73             [](Image<PixelT> 
const &
self, ImageSlice<PixelT> 
const &
other) { 
return self * 
other; },
 
   75     cls.def(
"__truediv__",
 
   76             [](Image<PixelT> 
const &
self, ImageSlice<PixelT> 
const &
other) { 
return self / 
other; },
 
   78     cls.def(
"__iadd__", [](Image<PixelT> &
self, ImageSlice<PixelT> 
const &
other) {
 
   82     cls.def(
"__isub__", [](Image<PixelT> &
self, ImageSlice<PixelT> 
const &
other) {
 
   86     cls.def(
"__imul__", [](Image<PixelT> &
self, ImageSlice<PixelT> 
const &
other) {
 
   90     cls.def(
"__itruediv__", [](Image<PixelT> &
self, ImageSlice<PixelT> 
const &
other) {
 
   97     py::module::import(
"lsst.afw.image.image");
 
   99     declareImageSlice<float>(mod, 
"F");
 
  100     declareImageSlice<double>(mod, 
"D");