23 #include <pybind11/pybind11.h>
31 using namespace py::literals;
39 template <
typename OutImageT,
typename InImageT>
41 mod.def(
"basicConvolve",
44 mod.def(
"basicConvolve",
47 mod.def(
"basicConvolve",
50 mod.def(
"basicConvolve",
53 mod.def(
"convolveWithBruteForce",
58 template <
typename PixelType1,
typename PixelType2>
64 declareByType<M1, M2>(mod);
69 declareAll<double, double>(mod);
70 declareAll<double, float>(mod);
71 declareAll<double, int>(mod);
72 declareAll<double, std::uint16_t>(mod);
73 declareAll<float, float>(mod);
74 declareAll<float, int>(mod);
75 declareAll<float, std::uint16_t>(mod);
76 declareAll<int, int>(mod);
77 declareAll<std::uint16_t, std::uint16_t>(mod);
79 py::class_<KernelImagesForRegion, std::shared_ptr<KernelImagesForRegion>> clsKernelImagesForRegion(
80 mod,
"KernelImagesForRegion");
82 py::enum_<KernelImagesForRegion::Location>(clsKernelImagesForRegion,
"Location")
83 .value(
"BOTTOM_LEFT", KernelImagesForRegion::Location::BOTTOM_LEFT)
84 .value(
"BOTTOM_RIGHT", KernelImagesForRegion::Location::BOTTOM_RIGHT)
85 .value(
"TOP_LEFT", KernelImagesForRegion::Location::TOP_LEFT)
86 .value(
"TOP_RIGHT", KernelImagesForRegion::Location::TOP_RIGHT)
89 clsKernelImagesForRegion.def(
92 "kernelPtr"_a,
"bbox"_a,
"xy0"_a,
"doNormalize"_a);
93 clsKernelImagesForRegion.def(
98 "kernelPtr"_a,
"bbox"_a,
"xy0"_a,
"doNormalize"_a,
"bottomLeftImagePtr"_a,
99 "bottomRightImagePtr"_a,
"topLeftImagePtr"_a,
"topRightImagePtr"_a);
101 clsKernelImagesForRegion.def(
"getBBox", &KernelImagesForRegion::getBBox);
102 clsKernelImagesForRegion.def(
"getXY0", &KernelImagesForRegion::getXY0);
103 clsKernelImagesForRegion.def(
"getDoNormalize", &KernelImagesForRegion::getDoNormalize);
104 clsKernelImagesForRegion.def(
"getImage", &KernelImagesForRegion::getImage);
105 clsKernelImagesForRegion.def(
"getKernel", &KernelImagesForRegion::getKernel);
106 clsKernelImagesForRegion.def(
"getPixelIndex", &KernelImagesForRegion::getPixelIndex);
107 clsKernelImagesForRegion.def(
"computeNextRow", &KernelImagesForRegion::computeNextRow);
108 clsKernelImagesForRegion.def_static(
"getMinInterpolationSize",
109 KernelImagesForRegion::getMinInterpolationSize);
111 py::class_<RowOfKernelImagesForRegion, std::shared_ptr<RowOfKernelImagesForRegion>>
112 clsRowOfKernelImagesForRegion(mod,
"RowOfKernelImagesForRegion");
114 clsRowOfKernelImagesForRegion.def(py::init<int, int>(),
"nx"_a,
"ny"_a);
116 clsRowOfKernelImagesForRegion.def(
"front", &RowOfKernelImagesForRegion::front);
117 clsRowOfKernelImagesForRegion.def(
"back", &RowOfKernelImagesForRegion::back);
118 clsRowOfKernelImagesForRegion.def(
"getNX", &RowOfKernelImagesForRegion::getNX);
119 clsRowOfKernelImagesForRegion.def(
"getNY", &RowOfKernelImagesForRegion::getNY);
120 clsRowOfKernelImagesForRegion.def(
"getYInd", &RowOfKernelImagesForRegion::getYInd);
121 clsRowOfKernelImagesForRegion.def(
"getRegion", &RowOfKernelImagesForRegion::getRegion);
122 clsRowOfKernelImagesForRegion.def(
"hasData", &RowOfKernelImagesForRegion::hasData);
123 clsRowOfKernelImagesForRegion.def(
"isLastRow", &RowOfKernelImagesForRegion::isLastRow);
124 clsRowOfKernelImagesForRegion.def(
"incrYInd", &RowOfKernelImagesForRegion::incrYInd);
A class to represent a 2-dimensional array of pixels.
A class to manipulate images, masks, and variance as a single object.
Parameters to control convolution.
A kernel that has only one non-zero pixel (of value 1)
Kernels are used for convolution with MaskedImages and (eventually) Images.
A kernel that is a linear combination of fixed basis kernels.
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
An integer coordinate rectangle.
PYBIND11_MODULE(convolve, mod)
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image.
A base class for image defects.