27 #include <pybind11/pybind11.h>
38 using namespace py::literals;
53 template <
typename KernelT>
55 using PyClass = py::class_<KernelT, std::shared_ptr<KernelT>, SeparableKernel>;
57 cls.def(py::init<int>(),
"order"_a);
58 cls.def(
"getOrder", &KernelT::getOrder);
59 cls.def(
"clone", &KernelT::clone);
71 template <
typename KernelT>
73 using PyClass = py::class_<KernelT, std::shared_ptr<KernelT>, SeparableKernel>;
75 cls.def(py::init<>());
76 cls.def(
"clone", &KernelT::clone);
88 template <
typename DestImageT,
typename SrcImageT>
90 wrappers.
wrap([](
auto &mod) {
91 typename DestImageT::SinglePixel
const EdgePixel =
92 edgePixel<DestImageT>(
typename image::detail::image_traits<DestImageT>::image_category());
94 (
int (*)(DestImageT &, geom::SkyWcs
const &, SrcImageT
const &, geom::SkyWcs
const &,
95 WarpingControl
const &,
typename DestImageT::SinglePixel)) &
96 warpImage<DestImageT, SrcImageT>,
97 "destImage"_a,
"destWcs"_a,
"srcImage"_a,
"srcWcs"_a,
"control"_a,
"padValue"_a = EdgePixel);
101 WarpingControl
const &,
typename DestImageT::SinglePixel)) &
102 warpImage<DestImageT, SrcImageT>,
103 "destImage"_a,
"srcImage"_a,
"srcToDest"_a,
"control"_a,
"padValue"_a = EdgePixel);
105 mod.def(
"warpCenteredImage", &warpCenteredImage<DestImageT, SrcImageT>,
"destImage"_a,
"srcImage"_a,
106 "linearTransform"_a,
"centerPoint"_a,
"control"_a,
"padValue"_a = EdgePixel);
120 template <
typename DestPixelT,
typename SrcPixelT>
128 wrappers.
wrap([](
auto &mod) {
129 mod.def(
"warpExposure", &warpExposure<DestExposureT, SrcExposureT>,
"destExposure"_a,
"srcExposure"_a,
131 "padValue"_a = edgePixel<DestMaskedImageT>(
132 typename image::detail::image_traits<DestMaskedImageT>::image_category()));
134 declareImageWarpingFunctions<DestImageT, SrcImageT>(wrappers);
135 declareImageWarpingFunctions<DestMaskedImageT, SrcMaskedImageT>(wrappers);
139 using PyClass = py::class_<WarpingControl, std::shared_ptr<WarpingControl>>;
141 cls.def(py::init<std::string, std::string, int, int, image::MaskPixel>(),
"warpingKernelName"_a,
142 "maskWarpingKernelName"_a =
"",
"cacheSize"_a = 0,
"interpLength"_a = 0,
143 "growFullMask"_a = 0);
145 cls.def(
"getCacheSize", &WarpingControl::getCacheSize);
146 cls.def(
"setCacheSize", &WarpingControl::setCacheSize,
"cacheSize"_a);
147 cls.def(
"getInterpLength", &WarpingControl::getInterpLength);
148 cls.def(
"setInterpLength", &WarpingControl::setInterpLength,
"interpLength"_a);
149 cls.def(
"setWarpingKernelName", &WarpingControl::setWarpingKernelName,
"warpingKernelName"_a);
150 cls.def(
"getWarpingKernel", &WarpingControl::getWarpingKernel);
151 cls.def(
"setWarpingKernel", &WarpingControl::setWarpingKernel,
"warpingKernel"_a);
152 cls.def(
"setMaskWarpingKernelName", &WarpingControl::setMaskWarpingKernelName,
153 "maskWarpingKernelName"_a);
154 cls.def(
"getMaskWarpingKernel", &WarpingControl::getMaskWarpingKernel);
155 cls.def(
"hasMaskWarpingKernel", &WarpingControl::hasMaskWarpingKernel);
156 cls.def(
"setMaskWarpingKernelName", &WarpingControl::setMaskWarpingKernelName,
157 "maskWarpingKernelName"_a);
158 cls.def(
"setMaskWarpingKernel", &WarpingControl::setMaskWarpingKernel,
"maskWarpingKernel"_a);
159 cls.def(
"getGrowFullMask", &WarpingControl::getGrowFullMask);
160 cls.def(
"setGrowFullMask", &WarpingControl::setGrowFullMask,
"growFullMask"_a);
168 declareWarpExposure(wrappers);
169 declareWarpingKernel<LanczosWarpingKernel>(wrappers,
"LanczosWarpingKernel");
170 declareSimpleWarpingKernel<BilinearWarpingKernel>(wrappers,
"BilinearWarpingKernel");
171 declareSimpleWarpingKernel<NearestWarpingKernel>(wrappers,
"NearestWarpingKernel");
172 declareWarpingFunctions<double, double>(wrappers);
173 declareWarpingFunctions<double, float>(wrappers);
174 declareWarpingFunctions<double, int>(wrappers);
175 declareWarpingFunctions<double, std::uint16_t>(wrappers);
176 declareWarpingFunctions<float, float>(wrappers);
177 declareWarpingFunctions<float, int>(wrappers);
178 declareWarpingFunctions<float, std::uint16_t>(wrappers);
179 declareWarpingFunctions<int, int>(wrappers);
180 declareWarpingFunctions<std::uint16_t, std::uint16_t>(wrappers);
table::Key< std::string > name
A class to contain the data, WCS, and other information needed to describe an image of the sky.
A class to represent a 2-dimensional array of pixels.
A class to manipulate images, masks, and variance as a single object.
A helper class for subdividing pybind11 module across multiple translation units (i....
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
void wrap(WrapperCallback function)
Add a set of wrappers without defining a class.
void addSignatureDependency(std::string const &name)
Indicate an external module that provides a type used in function/method signatures.
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
void wrapWarpExposure(lsst::utils::python::WrapperCollection &)
py::class_< PixelAreaBoundedField, std::shared_ptr< PixelAreaBoundedField >, BoundedField > PyClass
A base class for image defects.