24 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
32 using namespace py::literals;
40 template <
typename PixelT,
typename PyClass>
52 HeavyFootprintCtrl
const *)) &
53 FootprintSet::makeHeavy<PixelT, image::MaskPixel>,
54 "mimg"_a,
"ctrl"_a =
nullptr);
57 template <
typename PixelT,
typename PyClass>
61 FootprintSet::setMask<PixelT>,
62 "mask"_a,
"planeName"_a);
65 template <
typename PixelT,
typename PyClass>
69 "threshold"_a,
"npixMin"_a = 1,
"setPeaks"_a =
true);
72 "img"_a,
"threshold"_a,
"planeName"_a =
"",
"npixMin"_a = 1,
"setPeaks"_a =
true);
75 declareMakeHeavy<int>(
cls);
76 declareMakeHeavy<float>(
cls);
77 declareMakeHeavy<double>(
cls);
78 declareMakeHeavy<std::uint16_t>(
cls);
80 declareSetMask<image::MaskPixel>(
cls);
90 [](
auto &mod,
auto &
cls) {
91 declareTemplatedMembers<std::uint16_t>(cls);
92 declareTemplatedMembers<int>(cls);
93 declareTemplatedMembers<float>(cls);
94 declareTemplatedMembers<double>(cls);
96 cls.def(py::init<image::Mask<image::MaskPixel> const &, Threshold const &, int const>(),
97 "img"_a,
"threshold"_a,
"npixMin"_a = 1);
99 cls.def(py::init<lsst::geom::Box2I>(),
"region"_a);
100 cls.def(py::init<FootprintSet const &>(),
"set"_a);
101 cls.def(py::init<FootprintSet const &, int, FootprintControl const &>(),
"set"_a,
"rGrow"_a,
103 cls.def(py::init<FootprintSet const &, int, bool>(),
"set"_a,
"rGrow"_a,
"isotropic"_a);
104 cls.def(py::init<FootprintSet const &, FootprintSet const &, bool>(),
"footprints1"_a,
105 "footprints2"_a,
"includePeaks"_a);
107 cls.def(
"swap", &FootprintSet::swap);
110 cls.def(
"setFootprints", [](FootprintSet &self, FootprintSet::FootprintList footList) {
111 self.setFootprints(std::make_shared<FootprintSet::FootprintList>(std::move(footList)));
113 cls.def(
"getFootprints", [](
FootprintSet &
self) {
return *(
self.getFootprints()); });
114 cls.def(
"makeSources", &FootprintSet::makeSources);
115 cls.def(
"setRegion", &FootprintSet::setRegion);
116 cls.def(
"getRegion", &FootprintSet::getRegion);
117 cls.def(
"insertIntoImage", &FootprintSet::insertIntoImage);
120 FootprintSet::setMask<lsst::afw::image::MaskPixel>);
124 FootprintSet::setMask<lsst::afw::image::MaskPixel>);
125 cls.def(
"merge", &FootprintSet::merge,
"rhs"_a,
"tGrow"_a = 0,
"rGrow"_a = 0,
126 "isotropic"_a =
true);