LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
25 #include "boost/functional/hash.hpp"
28 namespace lsst {
namespace afw {
namespace image {
namespace detail {
43 _allMaskDicts.insert(dict);
46 return _defaultMaskDict;
52 _allMaskDicts.insert(
result);
57 return _defaultMaskDict;
66 _defaultMaskDict =
copy(*_defaultMaskDict);
67 return _defaultMaskDict;
70 template <
typename Functor>
74 for (
auto const &
ptr : _allMaskDicts) {
82 _allMaskDicts.insert(_defaultMaskDict);
83 _defaultMaskDict->_addInitialMaskPlanes();
86 GlobalState(GlobalState
const &) =
delete;
87 GlobalState(GlobalState &&) =
delete;
89 GlobalState & operator=(GlobalState
const &) =
delete;
90 GlobalState & operator=(GlobalState &&) =
delete;
92 ~GlobalState() =
default;
97 for (
auto iter = _allMaskDicts.begin();
iter != _allMaskDicts.end(); ) {
98 if (
iter->expired()) {
132 [bitId](
auto const & item) { return item.second == bitId; }
134 if (found == dict.
end()) {
147 return GlobalState::get().copy(*
this);
157 [](
auto const &
a,
auto const &
b) {
return a.second <
b.second; }
159 assert(maxIter !=
end());
160 int id = maxIter->second + 1;
162 for (
int i = 0; i <
id; ++i) {
166 [i](
auto const & item) {
return item.second == i; }
168 if (sameIter ==
end()) {
182 for (
auto const & item : *
this) {
188 return this == &rhs || (_hash == rhs._hash && _dict == rhs._dict);
193 _hash = boost::hash<MaskPlaneDict>()(_dict);
198 _hash = boost::hash<MaskPlaneDict>()(_dict);
206 void MaskDict::_addInitialMaskPlanes() {
210 _dict[
"INTRP"] = ++i;
213 _dict[
"DETECTED"] = ++i;
214 _dict[
"DETECTED_NEGATIVE"] = ++i;
215 _dict[
"SUSPECT"] = ++i;
216 _dict[
"NO_DATA"] = ++i;
217 _hash = boost::hash<MaskPlaneDict>()(_dict);
220 MaskDict::MaskDict() : _dict(), _hash(0x0) {}
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
std::shared_ptr< MaskDict > copy(MaskDict const &dict)
std::map< std::string, int > MaskPlaneDict
bool empty() const noexcept
std::shared_ptr< MaskDict > getDefault() const noexcept
void forEachMaskDict(Functor functor)
bool operator==(MaskDict const &rhs) const
const_iterator end() const noexcept
int getMaskPlane(std::string const &name) const
static GlobalState & get()
static void addAllMasksPlane(std::string const &name, int bitId)
int getUnusedPlane() const
static void setDefault(std::shared_ptr< MaskDict > dict)
const_iterator find(std::string const &name) const
static std::shared_ptr< MaskDict > detachDefault()
void erase(std::string const &name)
void add(std::string const &name, int bitId)
A base class for image defects.
static std::shared_ptr< MaskDict > getDefault()
void setDefault(std::shared_ptr< MaskDict > dict)
const_iterator begin() const noexcept
static std::shared_ptr< MaskDict > copyOrGetDefault(MaskPlaneDict const &dict)
std::shared_ptr< MaskDict > detachDefault()
std::shared_ptr< MaskDict > copyOrGetDefault(MaskPlaneDict const &mpd)