23 #include <pybind11/pybind11.h> 25 #include <pybind11/stl.h> 38 template <
typename PixelT,
typename PyClass>
39 void declareMakeHeavy(PyClass &
cls) {
49 HeavyFootprintCtrl
const *)) &
50 FootprintSet::makeHeavy<PixelT, image::MaskPixel>,
51 "mimg"_a,
"ctrl"_a =
nullptr);
54 template <
typename PixelT,
typename PyClass>
55 void declareSetMask(PyClass &cls) {
57 FootprintSet::setMask<PixelT>,
58 "mask"_a,
"planeName"_a);
61 template <
typename PixelT,
typename PyClass>
62 void declareTemplatedMembers(PyClass &cls) {
65 "threshold"_a,
"npixMin"_a = 1,
"setPeaks"_a =
true);
68 "img"_a,
"threshold"_a,
"planeName"_a =
"",
"npixMin"_a = 1,
"setPeaks"_a =
true);
71 declareMakeHeavy<int>(
cls);
72 declareMakeHeavy<float>(
cls);
73 declareMakeHeavy<double>(
cls);
74 declareMakeHeavy<std::uint16_t>(
cls);
76 declareSetMask<image::MaskPixel>(
cls);
81 py::module::import(
"lsst.afw.detection.footprint");
86 declareTemplatedMembers<std::uint16_t>(clsFootprintSet);
87 declareTemplatedMembers<int>(clsFootprintSet);
88 declareTemplatedMembers<float>(clsFootprintSet);
89 declareTemplatedMembers<double>(clsFootprintSet);
92 "img"_a,
"threshold"_a,
"npixMin"_a = 1);
95 clsFootprintSet.def(py::init<lsst::geom::Box2I>(),
"region"_a);
96 clsFootprintSet.def(py::init<FootprintSet const &>(),
"set"_a);
97 clsFootprintSet.def(py::init<FootprintSet const &, int, FootprintControl const &>(),
"set"_a,
"rGrow"_a,
99 clsFootprintSet.def(py::init<FootprintSet const &, int, bool>(),
"set"_a,
"rGrow"_a,
"isotropic"_a);
100 clsFootprintSet.def(py::init<FootprintSet const &, FootprintSet const &, bool>(),
"footprints1"_a,
101 "footprints2"_a,
"includePeaks"_a);
107 self.setFootprints(std::make_shared<FootprintSet::FootprintList>(
std::move(footList)));
109 clsFootprintSet.def(
"getFootprints", [](
FootprintSet &
self) {
return *(
self.getFootprints()); });
110 clsFootprintSet.def(
"makeSources", &FootprintSet::makeSources);
111 clsFootprintSet.def(
"setRegion", &FootprintSet::setRegion);
112 clsFootprintSet.def(
"getRegion", &FootprintSet::getRegion);
113 clsFootprintSet.def(
"insertIntoImage", &FootprintSet::insertIntoImage);
116 FootprintSet::setMask<lsst::afw::image::MaskPixel>);
117 clsFootprintSet.def(
"setMask",
120 FootprintSet::setMask<lsst::afw::image::MaskPixel>);
121 clsFootprintSet.def(
"merge", &FootprintSet::merge,
"rhs"_a,
"tGrow"_a = 0,
"rGrow"_a = 0,
122 "isotropic"_a =
true);
A Threshold is used to pass a threshold value to detection algorithms.
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
PYBIND11_MODULE(footprintSet, mod)
A class to manipulate images, masks, and variance as a single object.
void swap(Image< PixelT > &a, Image< PixelT > &b)
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
A class to represent a 2-dimensional array of pixels.