lsst.afw  13.0-92-g8ecf155+1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
stack.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2016 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #include <pybind11/pybind11.h>
24 //#include <pybind11/operators.h>
25 #include <pybind11/stl.h>
26 
27 #include "lsst/afw/math/Stack.h"
28 
29 namespace py = pybind11;
30 
31 using namespace py::literals;
32 
33 using namespace lsst::afw::math;
34 
35 template <typename PixelT>
36 void declareStatisticsStack(py::module &mod) {
37  mod.def("statisticsStack", (std::shared_ptr<lsst::afw::image::MaskedImage<PixelT>>(*)(
39  StatisticsControl const &))statisticsStack<PixelT>,
40  "image"_a, "flags"_a, "dimensions"_a, "sctrl"_a = StatisticsControl());
41  mod.def("statisticsStack", (std::shared_ptr<lsst::afw::image::MaskedImage<PixelT>>(*)(
43  StatisticsControl const &))statisticsStack<PixelT>,
44  "image"_a, "flags"_a, "dimensions"_a, "sctrl"_a = StatisticsControl());
45 }
46 
47 template <typename PixelT>
49  mod.def("statisticsStack",
51  std::vector<std::shared_ptr<lsst::afw::image::Image<PixelT>>> &, Property,
52  StatisticsControl const &,
53  std::vector<lsst::afw::image::VariancePixel> const &))statisticsStack<PixelT>,
54  "out"_a, "images"_a, "flags"_a, "sctrl"_a = StatisticsControl(),
55  "wvector"_a = std::vector<lsst::afw::image::VariancePixel>(0));
56  mod.def("statisticsStack",
58  std::vector<std::shared_ptr<lsst::afw::image::MaskedImage<PixelT>>> &, Property,
59  StatisticsControl const &,
60  std::vector<lsst::afw::image::VariancePixel> const &))statisticsStack<PixelT>,
61  "out"_a, "images"_a, "flags"_a, "sctrl"_a = StatisticsControl(),
62  "wvector"_a = std::vector<lsst::afw::image::VariancePixel>(0));
63 }
64 
65 template <typename PixelT>
67  mod.def("statisticsStack",
68  (std::shared_ptr<lsst::afw::image::Image<PixelT>>(*)(
69  std::vector<std::shared_ptr<lsst::afw::image::Image<PixelT>>> &, Property,
70  StatisticsControl const &,
71  std::vector<lsst::afw::image::VariancePixel> const &))statisticsStack<PixelT>,
72  "images"_a, "flags"_a, "sctrl"_a = StatisticsControl(),
73  "wvector"_a = std::vector<lsst::afw::image::VariancePixel>(0));
74  mod.def("statisticsStack",
75  (std::shared_ptr<lsst::afw::image::MaskedImage<PixelT>>(*)(
76  std::vector<std::shared_ptr<lsst::afw::image::MaskedImage<PixelT>>> &, Property,
77  StatisticsControl const &,
78  std::vector<lsst::afw::image::VariancePixel> const &))statisticsStack<PixelT>,
79  "images"_a, "flags"_a, "sctrl"_a = StatisticsControl(),
80  "wvector"_a = std::vector<lsst::afw::image::VariancePixel>(0));
81  mod.def("statisticsStack",
82  (std::shared_ptr<std::vector<PixelT>>(*)(
83  std::vector<std::shared_ptr<std::vector<PixelT>>> &, Property, StatisticsControl const &,
84  std::vector<lsst::afw::image::VariancePixel> const &))statisticsStack<PixelT>,
85  "vectors"_a, "flags"_a, "sctrl"_a = StatisticsControl(),
86  "wvector"_a = std::vector<lsst::afw::image::VariancePixel>(0));
87 }
88 
89 PYBIND11_PLUGIN(_stack) {
90  py::module mod("_stack", "Python wrapper for afw _stack library");
91 
92  /* Module level */
93  declareStatisticsStack<float>(mod);
94  declareStatisticsStack<double>(mod);
95  declareStatisticsStackVectorOverloads<float>(mod);
96  declareStatisticsStackVectorOverloads<double>(mod);
97  declareStatisticsStackVectorOverloads2<float>(mod);
98  declareStatisticsStackVectorOverloads2<double>(mod);
99 
100  return mod.ptr();
101 }
void declareStatisticsStackVectorOverloads(py::module &mod)
Definition: stack.cc:48
void declareStatisticsStackVectorOverloads2(py::module &mod)
Definition: stack.cc:66
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
Pass parameters to a Statistics object.
Definition: Statistics.h:91
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:81
double const _a
Definition: RandomImage.cc:77
void declareStatisticsStack(py::module &mod)
Definition: stack.cc:36
Property
control what is calculated
Definition: Statistics.h:63
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:486