LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Measure.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #if !defined(LSST_MEAS_ALGORITHMS_MEASURE_H)
26 #define LSST_MEAS_ALGORITHMS_MEASURE_H
27 
29 // Measure properties of an image selected by a Footprint
30 //
31 #include <list>
32 #include <cmath>
33 
34 #include "boost/cstdint.hpp"
35 #include "boost/type_traits.hpp"
36 #include "boost/array.hpp"
37 
38 #include "lsst/base.h"
39 #include "lsst/pex/logging/Log.h"
40 #include "lsst/pex/config.h"
43 #include "lsst/afw/detection.h"
46 
47 namespace lsst { namespace meas { namespace algorithms {
48 
49 class MeasureSourcesBuilder;
50 
52 public:
54  typedef std::list<CONST_PTR(Algorithm)> AlgorithmList;
55 
62  AlgorithmList const & getAlgorithms() const { return _algorithms; }
63 
73  template <typename PixelT>
74  void apply(
75  afw::table::SourceRecord & source,
76  afw::image::Exposure<PixelT> const & exposure,
77  afw::geom::Point2D const & center,
78  bool refineCenter=true
79  ) const;
80 
90  template <typename PixelT>
91  void apply(
92  afw::table::SourceRecord & source,
93  afw::image::Exposure<PixelT> const & exposure
94  ) const;
95 
102  template <typename PixelT>
104  afw::table::SourceRecord & source,
105  afw::image::Exposure<PixelT> const & exposure
106  ) const {
107  apply(source, exposure, exposure.getWcs()->skyToPixel(source.getCoord()), false);
108  }
109 
116  template <typename PixelT>
118  afw::table::SourceRecord & source,
119  afw::image::Exposure<PixelT> const & exposure
120  ) const {
121  apply(source, exposure, afw::geom::Point2D(source.getX(), source.getY()), false);
122  }
123 
131  template <typename PixelT>
132  void apply(
133  afw::table::SourceRecord & source,
134  afw::image::Exposure<PixelT> const & exposure,
135  afw::table::SourceRecord const& reference,
137  ) const;
138 
139 private:
140 
142 
143  friend class MeasureSourcesBuilder;
144 
149 };
150 
152 public:
153 
160  MeasureSourcesBuilder & addAlgorithm(AlgorithmControl const & algorithmControl);
161 
172  MeasureSourcesBuilder & setCentroider(CentroidControl const & centroidControl);
173 
181  MeasureSources build(
184  ) const;
185 
186  explicit MeasureSourcesBuilder(std::string const & prefix = "") : _prefix(prefix) {}
187 
188 private:
189 
192  return (a->priority < b->priority) ||
193  (a->priority == b->priority && a->name < b->name);
194  }
195  };
196 
197  typedef std::set<CONST_PTR(AlgorithmControl),ComparePriority> ControlSet;
198 
199  std::string _prefix;
201  ControlSet _ctrls;
202 };
203 
204 }}}
205 #endif // LSST_MEAS_ALGORITHMS_MEASURE_H
void applyWithPixel(afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure) const
Apply the registered algorithms to the given source.
Definition: Measure.h:117
Defines the fields and offsets for a table.
Definition: Schema.h:46
bool operator()(boost::shared_ptr< AlgorithmControl const > const &a, boost::shared_ptr< AlgorithmControl const > const &b) const
Definition: Measure.h:191
#define PTR(...)
Definition: base.h:41
void applyWithCoord(afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure) const
Apply the registered algorithms to the given source.
Definition: Measure.h:103
std::string name
Name of the algorithm.
Definition: Algorithm.h:178
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
double priority
&quot;Parameter that sets the sort order for algorithms; lower numbers go first. &quot; &quot;Typically, priority=0 for centroids, 1 for shapes, and 2 for fluxes.&quot; ;
Definition: Algorithm.h:184
double getY() const
Return the centroid slot y coordinate.
Definition: Source.h:839
Image utility functions.
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
AlgorithmList const & getAlgorithms() const
Return the list of algorithms.
Definition: Measure.h:62
MeasureSourcesBuilder(std::string const &prefix="")
Definition: Measure.h:186
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154
double getX() const
Return the centroid slot x coordinate.
Definition: Source.h:836
definition of the DualLog class
Base class for measurement algorithm control objects.
Definition: Algorithm.h:168
std::set< boost::shared_ptr< AlgorithmControl const >, ComparePriority > ControlSet
Definition: Measure.h:197
tbl::Schema schema
Definition: CoaddPsf.cc:324
afw::table::Key< afw::table::Flag > _badCentroidKey
Definition: Measure.h:145
An include file to include the header files for lsst::afw::detection.
IcrsCoord getCoord() const
Convenience accessors for the keys in the minimal reference schema.
Definition: Simple.h:206
void apply(afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure, afw::geom::Point2D const &center, bool refineCenter=true) const
Apply the registered algorithms to the given source.
#define CONST_PTR(...)
Definition: base.h:47
Intermediate base class for algorithms that compute a centroid.
boost::shared_ptr< Wcs const > getWcs() const
Definition: Exposure.h:154
MeasureSourcesBuilder Builder
Definition: Measure.h:53
boost::shared_ptr< pex::logging::Log > _log
Definition: Measure.h:146
afw::table::Key< double > b
Record class that contains measurements made on a single exposure.
Definition: Source.h:81
Implementation of the Class MaskedImage.
std::list< boost::shared_ptr< Algorithm const > > AlgorithmList
Definition: Measure.h:54
boost::shared_ptr< CentroidAlgorithm > _centroider
Definition: Measure.h:148