23 #include <pybind11/pybind11.h>
29 using namespace py::literals;
36 template <
typename OutImageT,
typename InImageT,
typename KernelT>
37 void declareConvolve(lsst::utils::python::WrapperCollection &wrappers) {
38 wrappers.wrap([](
auto &mod) {
40 (
void (*)(OutImageT &, InImageT
const &, KernelT
const &,
41 ConvolutionControl
const &))convolve<OutImageT, InImageT, KernelT>,
42 "convolvedImage"_a,
"inImage"_a,
"kernel"_a,
"convolutionControl"_a = ConvolutionControl());
44 (
void (*)(OutImageT &, InImageT
const &, KernelT
const &,
bool,
45 bool))convolve<OutImageT, InImageT, KernelT>,
46 "convolvedImage"_a,
"inImage"_a,
"kernel"_a,
"doNormalize"_a,
"doCopyEdge"_a =
false);
50 template <
typename ImageType1,
typename ImageType2>
51 void declareScaledPlus(lsst::utils::python::WrapperCollection &wrappers) {
52 wrappers.wrap([](
auto &mod) {
54 (
void (*)(ImageType1 &,
double, ImageType2
const &,
double, ImageType2
const &))
scaledPlus);
58 template <
typename ImageType1,
typename ImageType2>
59 void declareByType(lsst::utils::python::WrapperCollection &wrappers) {
60 declareConvolve<ImageType1, ImageType2, AnalyticKernel>(wrappers);
61 declareConvolve<ImageType1, ImageType2, DeltaFunctionKernel>(wrappers);
62 declareConvolve<ImageType1, ImageType2, FixedKernel>(wrappers);
63 declareConvolve<ImageType1, ImageType2, LinearCombinationKernel>(wrappers);
64 declareConvolve<ImageType1, ImageType2, SeparableKernel>(wrappers);
65 declareConvolve<ImageType1, ImageType2, Kernel>(wrappers);
66 declareScaledPlus<ImageType1, ImageType2>(wrappers);
69 template <
typename PixelType1,
typename PixelType2>
70 void declareAll(lsst::utils::python::WrapperCollection &wrappers) {
75 declareByType<M1, M2>(wrappers);
78 void declareConvolveImage(lsst::utils::python::WrapperCollection &wrappers) {
79 using PyClass = py::class_<ConvolutionControl, std::shared_ptr<ConvolutionControl>>;
80 wrappers.wrapType(
PyClass(wrappers.module,
"ConvolutionControl"), [](
auto &mod,
auto &clsl) {
81 clsl.def(py::init<bool, bool, int>(),
"doNormalize"_a = true,
"doCopyEdge"_a = false,
82 "maxInterpolationDistance"_a = 10);
84 clsl.def(
"getDoNormalize", &ConvolutionControl::getDoNormalize);
85 clsl.def(
"getDoCopyEdge", &ConvolutionControl::getDoCopyEdge);
86 clsl.def(
"getMaxInterpolationDistance", &ConvolutionControl::getMaxInterpolationDistance);
87 clsl.def(
"setDoNormalize", &ConvolutionControl::setDoNormalize);
88 clsl.def(
"setDoCopyEdge", &ConvolutionControl::setDoCopyEdge);
89 clsl.def(
"setMaxInterpolationDistance", &ConvolutionControl::setMaxInterpolationDistance);
95 wrappers.addSignatureDependency(
"lsst.afw.image");
96 declareConvolveImage(wrappers);
97 declareAll<double, double>(wrappers);
98 declareAll<double, float>(wrappers);
99 declareAll<double, int>(wrappers);
100 declareAll<double, std::uint16_t>(wrappers);
101 declareAll<float, float>(wrappers);
102 declareAll<float, int>(wrappers);
103 declareAll<float, std::uint16_t>(wrappers);
104 declareAll<int, int>(wrappers);
105 declareAll<std::uint16_t, std::uint16_t>(wrappers);
A class to represent a 2-dimensional array of pixels.
A class to manipulate images, masks, and variance as a single object.
void declareConvolve(lsst::utils::python::WrapperCollection &wrappers)
void scaledPlus(OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
Compute the scaled sum of two images.
void wrapConvolveImage(lsst::utils::python::WrapperCollection &wrappers)
py::class_< PixelAreaBoundedField, std::shared_ptr< PixelAreaBoundedField >, BoundedField > PyClass
A base class for image defects.