23 #include <pybind11/pybind11.h>
24 #include <pybind11/stl.h>
26 #include "numpy/arrayobject.h"
27 #include "ndarray/pybind11.h"
28 #include "ndarray/converter.h"
34 namespace py = pybind11;
35 using namespace py::literals;
44 void declareHeavyFootprint(py::module &mod, std::string
const &suffix) {
45 using Class = HeavyFootprint<ImagePixelT>;
46 py::class_<Class, std::shared_ptr<Class>,
Footprint> clsHeavyFootprint(
47 mod, (
"HeavyFootprint" + suffix).c_str());
50 clsHeavyFootprint.def(
53 HeavyFootprintCtrl
const *>(),
54 "foot"_a,
"mimage"_a,
"ctrl"_a =
nullptr);
55 clsHeavyFootprint.def(py::init<Footprint const &, HeavyFootprintCtrl const *>(),
"foot"_a,
59 clsHeavyFootprint.def(
"isHeavy", &Class::isHeavy);
60 clsHeavyFootprint.def(
62 clsHeavyFootprint.def(
"insert",
64 clsHeavyFootprint.def(
"getImageArray",
65 (ndarray::Array<ImagePixelT, 1, 1> (Class::*)()) & Class::getImageArray);
66 clsHeavyFootprint.def(
"getMaskArray",
67 (ndarray::Array<MaskPixelT, 1, 1> (Class::*)()) & Class::getMaskArray);
68 clsHeavyFootprint.def(
"getVarianceArray",
69 (ndarray::Array<VariancePixelT, 1, 1> (Class::*)()) & Class::getVarianceArray);
70 clsHeavyFootprint.def(
"getMaskBitsSet", &Class::getMaskBitsSet);
74 mod.def(
"makeHeavyFootprint",
77 HeavyFootprintCtrl
const *))makeHeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>,
78 "foot"_a,
"img"_a,
"ctrl"_a =
nullptr);
82 mod.def(
"mergeHeavyFootprints", mergeHeavyFootprints<ImagePixelT, MaskPixelT, VariancePixelT>);
87 py::module mod(
"_heavyFootprint",
"Python wrapper for afw _heavyFootprint library");
89 if (_import_array() < 0) {
90 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
94 declareHeavyFootprint<int>(mod,
"I");
95 declareHeavyFootprint<std::uint16_t>(mod,
"U");
96 declareHeavyFootprint<float>(mod,
"F");
97 declareHeavyFootprint<double>(mod,
"D");
PYBIND11_PLUGIN(_cameraPoint)
A class to manipulate images, masks, and variance as a single object.
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
lsst::afw::detection::Footprint Footprint
float VariancePixel
default type for MaskedImage variance images
A class to represent a 2-dimensional array of pixels.