LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
FootprintCtrl.h
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008, 2009, 2010 LSST Corporation.
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 <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 #if !defined(LSST_DETECTION_FOOTPRINTCTRL_H)
23 #define LSST_DETECTION_FOOTPRINTCTRL_H
24 
29 namespace lsst {
30 namespace afw {
31 namespace detection {
37  enum TBool { FALSE_=false, TRUE_=true, NONE_ }; // ternary boolean value. N.b. _XXX is reserved
38 
39  static std::pair<bool, bool> makePairFromTBool(TBool const val)
40  {
41  return (val == NONE_) ? std::make_pair(false, false) : std::make_pair(true, val == TRUE_);
42  }
43 public:
46  explicit FootprintControl(bool circular, bool isotropic=false) :
47  _circular(circular ? TRUE_ : FALSE_), _isotropic(isotropic ? TRUE_ : FALSE_),
49  explicit FootprintControl(bool left, bool right, bool up, bool down) :
51  _left(left ? TRUE_ : FALSE_), _right(right ? TRUE_ : FALSE_),
52  _up(up ? TRUE_ : FALSE_), _down(down ? TRUE_ : FALSE_) {}
53 
54 #define DEFINE_ACCESSORS(NAME, UNAME) \
55  \
56  void grow ## UNAME(bool val \
57  ) { _ ## NAME = val ? TRUE_ : FALSE_; } \
58  \
59  std::pair<bool, bool> is ## UNAME() const { \
60  return makePairFromTBool(_ ## NAME); \
61  }
62 
63  DEFINE_ACCESSORS(circular, Circular)
64  //DEFINE_ACCESSORS(isotropic, Isotropic) // special, as isotropic => circular
65  DEFINE_ACCESSORS(left, Left)
66  DEFINE_ACCESSORS(right, Right)
68  DEFINE_ACCESSORS(down, Down)
69 
71  void growIsotropic(bool val
72  ) {
73  _circular = TRUE_;
74  _isotropic = val ? TRUE_ : FALSE_;
75  }
77  std::pair<bool, bool> isIsotropic() const {
79  }
80 
81 #undef DEFINE_ACCESSORS
82 private:
83  TBool _circular; // grow in all directions ( == left & right & up & down)
84  TBool _isotropic; // go to the expense of as isotropic a grow as possible
85  TBool _left, _right, _up, _down; // grow in selected directions?
86 };
87 
92  public:
93  enum ModifySource {NONE, SET,};
94 
95  explicit HeavyFootprintCtrl(ModifySource modifySource=NONE) :
96  _modifySource(modifySource),
97  _imageVal(0.0), _maskVal(0), _varianceVal(0.0)
98  {}
99 
101  void setModifySource(ModifySource modifySource) { _modifySource = modifySource; }
102 
103  double getImageVal() const { return _imageVal; }
104  void setImageVal(double imageVal) { _imageVal = imageVal; }
105  long getMaskVal() const { return _maskVal; }
106  void setMaskVal(long maskVal) { _maskVal = maskVal; }
107  double getVarianceVal() const { return _varianceVal; }
108  void setVarianceVal(double varianceVal) { _varianceVal = varianceVal; }
109 
110 private:
112  double _imageVal;
113  long _maskVal;
114  double _varianceVal;
115 };
116 
117 }}}
118 
119 #endif
A Control Object for Footprints, controlling e.g. how they are grown.
Definition: FootprintCtrl.h:36
A control object for HeavyFootprints.
Definition: FootprintCtrl.h:91
std::pair< bool, bool > isIsotropic() const
Return &lt;isSet, Value&gt; for isotropic grows.
Definition: FootprintCtrl.h:77
static std::pair< bool, bool > makePairFromTBool(TBool const val)
Definition: FootprintCtrl.h:39
FootprintControl(bool left, bool right, bool up, bool down)
Definition: FootprintCtrl.h:49
FootprintControl(bool circular, bool isotropic=false)
Definition: FootprintCtrl.h:46
void setModifySource(ModifySource modifySource)
void setVarianceVal(double varianceVal)
void growIsotropic(bool val)
Set whether Footprint should be grown isotropically.
Definition: FootprintCtrl.h:71
#define DEFINE_ACCESSORS(NAME, UNAME)
Definition: FootprintCtrl.h:54
HeavyFootprintCtrl(ModifySource modifySource=NONE)
Definition: FootprintCtrl.h:95
ImageT val
Definition: CR.cc:154