lsst.afw  13.0-39-g3deb52d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Detector.h
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2014 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 
23 #if !defined(LSST_AFW_CAMERAGEOM_DETECTOR_H)
24 #define LSST_AFW_CAMERAGEOM_DETECTOR_H
25 
26 #include <string>
27 #include <vector>
28 #include <unordered_map>
29 #include "lsst/base.h"
31 #include "lsst/afw/table/AmpInfo.h"
35 
36 namespace lsst {
37 namespace afw {
38 namespace cameraGeom {
39 
48 };
49 
64 class Detector {
65 public:
77  explicit Detector(
78  std::string const &name,
79  int id,
80  DetectorType type,
81  std::string const &serial,
82  geom::Box2I const &bbox,
83  lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
84  Orientation const &orientation,
85  geom::Extent2D const &pixelSize,
86  CameraTransformMap::Transforms const &transforms
87  );
90 
91  ~Detector() {}
92 
94  std::string getName() const { return _name; }
95 
97  int getId() const { return _id; }
98 
99  DetectorType getType() const { return _type; }
100 
102  std::string getSerial() const { return _serial; }
103 
105  lsst::afw::geom::Box2I getBBox() const { return _bbox; }
106 
108  std::vector<geom::Point2D> getCorners(CameraSys const &cameraSys) const;
109 
111  std::vector<geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
112 
114  CameraPoint getCenter(CameraSys const &cameraSys) const;
115 
117  CameraPoint getCenter(CameraSysPrefix const &cameraSysPrefix) const;
118 
120  lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const { return _ampInfoCatalog; }
121 
123  Orientation const getOrientation() const { return _orientation; }
124 
126  geom::Extent2D getPixelSize() const { return _pixelSize; }
127 
129  CameraTransformMap const getTransformMap() const { return _transformMap; }
130 
132  lsst::afw::table::AmpInfoCatalog::const_iterator begin() const { return _ampInfoCatalog.begin(); }
133 
135  lsst::afw::table::AmpInfoCatalog::const_iterator end() const { return _ampInfoCatalog.end(); }
136 
142  lsst::afw::table::AmpInfoRecord const &operator[](size_t i) const { return _ampInfoCatalog.at(i); }
143 
149  lsst::afw::table::AmpInfoRecord const &operator[](std::string const &name) const;
150 
163  std::shared_ptr<lsst::afw::table::AmpInfoRecord const> _get(int i) const;
164 
175  std::shared_ptr<lsst::afw::table::AmpInfoRecord const> _get(std::string const &name) const;
176 
180  size_t size() const { return _ampInfoCatalog.size(); }
181 
183  bool hasTransform(CameraSys const &cameraSys) const;
184 
186  bool hasTransform(CameraSysPrefix const &cameraSysPrefix) const;
187 
196  std::shared_ptr<afw::geom::XYTransform const> getTransform(CameraSys const &cameraSys) const;
197 
206  std::shared_ptr<afw::geom::XYTransform const> getTransform(CameraSysPrefix const &cameraSysPrefix) const;
207 
214  CameraSys cameraSys
215  ) const {
216  return CameraPoint(point, cameraSys);
217  }
218 
223  CameraSysPrefix cameraSysPrefix
224  ) const {
225  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
226  }
227 
233  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
234 
238  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
239  return CameraSys(cameraSysPrefix.getSysName(), _name);
240  }
241 
247  CameraPoint transform(CameraPoint const &fromCameraPoint,
248  CameraSys const &toSys
249  ) const {
250  return CameraPoint(
251  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
252  toSys);
253  }
254 
262  CameraPoint transform(CameraPoint const &fromCameraPoint,
263  CameraSysPrefix const &toSys
264  ) const {
265  return transform(fromCameraPoint, makeCameraSys(toSys));
266  }
267 
268 private:
269  typedef std::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> _AmpInfoMap;
280  void _init();
281 
282  std::string _name;
283  int _id;
284  DetectorType _type;
285  std::string _serial;
286  geom::Box2I _bbox;
287  table::AmpInfoCatalog _ampInfoCatalog;
288  _AmpInfoMap _ampNameIterMap;
289  Orientation _orientation;
290  geom::Extent2D _pixelSize;
291  CameraTransformMap _transformMap;
292 };
293 }
294 }
295 }
296 
297 #endif
Camera coordinate system; used as a key in in TransformMap.
Definition: CameraSys.h:74
Orientation const getOrientation() const
Get detector&#39;s orientation in the focal plane.
Definition: Detector.h:123
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified coordinate system.
Definition: Detector.cc:48
lsst::afw::table::AmpInfoCatalog::const_iterator end() const
Get iterator to end of amplifier list.
Definition: Detector.h:135
std::string getSerial() const
Get the detector serial &quot;number&quot;.
Definition: Detector.h:102
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:79
geom::Extent2D getPixelSize() const
Get size of pixel along (mm)
Definition: Detector.h:126
geom::Point2D getPoint() const
Definition: CameraPoint.h:40
A custom container class for records, based on std::vector.
Definition: Catalog.h:96
lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const
Get the amplifier specified by index.
Definition: Detector.h:142
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Convert a CameraPoint from one coordinate system to another.
Definition: Detector.h:247
CameraPoint getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified coordinate system.
Definition: Detector.cc:57
size_t size() const
Get number of amplifiers.
Definition: Detector.h:180
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:426
lsst::afw::geom::Box2I getBBox() const
Get the bounding box.
Definition: Detector.h:105
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:397
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const
Convert a CameraPoint from one coordinate system to a coordinate system prefix.
Definition: Detector.h:262
An integer coordinate rectangle.
Definition: Box.h:55
Describe a detector&#39;s orientation in the focal plane.
Definition: Orientation.h:51
std::map< CameraSys, std::shared_ptr< XYTransform const > > Transforms
Definition: TransformMap.h:67
CameraPoint makeCameraPoint(geom::Point2D point, CameraSys cameraSys) const
Make a CameraPoint from a point and a camera system.
Definition: Detector.h:213
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
Convert a point from one coordinate system to another.
std::shared_ptr< afw::geom::XYTransform const > getTransform(CameraSys const &cameraSys) const
Get an XYTransform that transforms from cameraSys to the native system in the forward direction...
Definition: Detector.cc:91
DetectorType getType() const
Definition: Detector.h:99
CameraTransformMap const getTransformMap() const
Get the transform registry.
Definition: Detector.h:129
iterator end()
Iterator access.
Definition: Catalog.h:388
lsst::afw::table::AmpInfoCatalog::const_iterator begin() const
Get iterator to beginning of amplifier list.
Definition: Detector.h:132
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested) ...
Definition: Detector.h:233
Iterator class for CatalogT.
Definition: Catalog.h:37
table::Key< std::string > name
Definition: ApCorrMap.cc:71
Detector(std::string const &name, int id, DetectorType type, std::string const &serial, geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog, Orientation const &orientation, geom::Extent2D const &pixelSize, CameraTransformMap::Transforms const &transforms)
Make a Detector.
Definition: Detector.cc:31
lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const
Get the amplifier information catalog.
Definition: Detector.h:120
bool hasTransform(CameraSys const &cameraSys) const
Does the specified CameraSys exist in the transform registry.
Definition: Detector.cc:85
std::string getName() const
Get the detector name.
Definition: Detector.h:94
Camera coordinate system prefix.
Definition: CameraSys.h:46
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Get a coordinate system from a detector system prefix (add detector name)
Definition: Detector.h:238
CameraSys getCameraSys() const
Definition: CameraPoint.h:41
Information about a CCD or other imaging detector.
Definition: Detector.h:64
A Point2D with associated camera coordinate system.
Definition: CameraPoint.h:37
CameraPoint makeCameraPoint(geom::Point2D point, CameraSysPrefix cameraSysPrefix) const
Make a CameraPoint from a point and a camera system prefix.
Definition: Detector.h:222
std::shared_ptr< lsst::afw::table::AmpInfoRecord const > _get(int i) const
Get the amplifier specified by index as a shared_ptr.
Definition: Detector.cc:68
iterator begin()
Iterator access.
Definition: Catalog.h:387
DetectorType
Type of imaging detector.
Definition: Detector.h:43
int getId() const
Get the detector ID.
Definition: Detector.h:97
std::string getSysName() const
Get coordinate system name.
Definition: CameraSys.h:55