LSSTApplications  18.1.0
LSSTDataManagementBasePackage
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 
36  py::class_<Threshold, std::shared_ptr<Threshold>> clsThreshold(mod, "Threshold");
37 
38  /* Member types and enums */
39  py::enum_<Threshold::ThresholdType>(clsThreshold, "ThresholdType")
40  .value("VALUE", Threshold::ThresholdType::VALUE)
41  .value("BITMASK", Threshold::ThresholdType::BITMASK)
42  .value("STDEV", Threshold::ThresholdType::STDEV)
43  .value("VARIANCE", Threshold::ThresholdType::VARIANCE)
44  .value("PIXEL_STDEV", Threshold::ThresholdType::PIXEL_STDEV)
45  .export_values();
46 
47  /* Constructors */
48  clsThreshold.def(
49  py::init<double const, typename Threshold::ThresholdType const, bool const, double const>(),
50  "value"_a, "type"_a = Threshold::VALUE, "polarity"_a = true, "includeMultiplier"_a = 1.0);
51 
52  /* Members */
53  clsThreshold.def("getType", &Threshold::getType);
54  clsThreshold.def_static("parseTypeString", Threshold::parseTypeString);
55  clsThreshold.def_static("getTypeString", Threshold::getTypeString);
56  clsThreshold.def("getValue", (double (Threshold::*)(const double) const) & Threshold::getValue,
57  "param"_a = -1);
58  //
59  // template<typename ImageT>
60  // double getValue(ImageT const& image) const;
61  //
62  clsThreshold.def("getPolarity", &Threshold::getPolarity);
63  clsThreshold.def("setPolarity", &Threshold::setPolarity);
64  clsThreshold.def("getIncludeMultiplier", &Threshold::getIncludeMultiplier);
65  clsThreshold.def("setIncludeMultiplier", &Threshold::setIncludeMultiplier);
66 
67  /* Module level */
68  mod.def("createThreshold", createThreshold, "value"_a, "type"_a = "value", "polarity"_a = true);
69 }
70 }
71 }
72 } // lsst::afw::detection
estimate sample standard deviation
Definition: Statistics.h:68
PYBIND11_MODULE(threshold, mod)
Definition: threshold.cc:35
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:43
A base class for image defects.
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