lsst.afw  13.0-92-g8ecf155+1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
threshold.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/stl.h>
25 
27 
28 namespace py = pybind11;
29 using namespace py::literals;
30 
31 namespace lsst {
32 namespace afw {
33 namespace detection {
34 
35 PYBIND11_PLUGIN(_threshold) {
36  py::module mod("_threshold", "Python wrapper for afw _threshold library");
37 
38  py::class_<Threshold, std::shared_ptr<Threshold>> clsThreshold(mod, "Threshold");
39 
40  /* Member types and enums */
41  py::enum_<Threshold::ThresholdType>(clsThreshold, "ThresholdType")
42  .value("VALUE", Threshold::ThresholdType::VALUE)
43  .value("BITMASK", Threshold::ThresholdType::BITMASK)
44  .value("STDEV", Threshold::ThresholdType::STDEV)
45  .value("VARIANCE", Threshold::ThresholdType::VARIANCE)
46  .value("PIXEL_STDEV", Threshold::ThresholdType::PIXEL_STDEV)
47  .export_values();
48 
49  /* Constructors */
50  clsThreshold.def(
51  py::init<double const, typename Threshold::ThresholdType const, bool const, double const>(),
52  "value"_a, "type"_a = Threshold::VALUE, "polarity"_a = true, "includeMultiplier"_a = 1.0);
53 
54  /* Members */
55  clsThreshold.def("getType", &Threshold::getType);
56  clsThreshold.def_static("parseTypeString", Threshold::parseTypeString);
57  clsThreshold.def_static("getTypeString", Threshold::getTypeString);
58  clsThreshold.def("getValue", (double (Threshold::*)(const double) const) & Threshold::getValue,
59  "param"_a = -1);
60  //
61  // template<typename ImageT>
62  // double getValue(ImageT const& image) const;
63  //
64  clsThreshold.def("getPolarity", &Threshold::getPolarity);
65  clsThreshold.def("setPolarity", &Threshold::setPolarity);
66  clsThreshold.def("getIncludeMultiplier", &Threshold::getIncludeMultiplier);
67  clsThreshold.def("setIncludeMultiplier", &Threshold::setIncludeMultiplier);
68 
69  /* Module level */
70  mod.def("createThreshold", createThreshold, "value"_a, "type"_a = "value", "polarity"_a = true);
71 
72  return mod.ptr();
73 }
74 }
75 }
76 } // lsst::afw::detection
estimate sample standard deviation
Definition: Statistics.h:68
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:43
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
double const _a
Definition: RandomImage.cc:77
Threshold createThreshold(const double value, const std::string type="value", const bool polarity=true)
Factory method for creating Threshold objects.
Definition: Threshold.cc:109
estimate sample variance
Definition: Statistics.h:69