lsst.afw  13.0-95-g793934f
 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"
30 #include "lsst/afw/table/AmpInfo.h"
35 
36 namespace lsst {
37 namespace afw {
38 namespace cameraGeom {
39 
48 };
49 
64 class Detector {
65 public:
89  explicit Detector(std::string const &name, int id, DetectorType type, std::string const &serial,
90  geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
91  Orientation const &orientation, geom::Extent2D const &pixelSize,
92  TransformMap::Transforms const &transforms);
93 
94  ~Detector() {}
95 
97  std::string getName() const { return _name; }
98 
100  int getId() const { return _id; }
101 
102  DetectorType getType() const { return _type; }
103 
105  std::string getSerial() const { return _serial; }
106 
108  lsst::afw::geom::Box2I getBBox() const { return _bbox; }
109 
111  std::vector<geom::Point2D> getCorners(CameraSys const &cameraSys) const;
112 
114  std::vector<geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
115 
117  CameraPoint getCenter(CameraSys const &cameraSys) const;
118 
120  CameraPoint getCenter(CameraSysPrefix const &cameraSysPrefix) const;
121 
123  lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const { return _ampInfoCatalog; }
124 
126  Orientation const getOrientation() const { return _orientation; }
127 
129  geom::Extent2D getPixelSize() const { return _pixelSize; }
130 
132  TransformMap const getTransformMap() const { return _transformMap; }
133 
135  lsst::afw::table::AmpInfoCatalog::const_iterator begin() const { return _ampInfoCatalog.begin(); }
136 
138  lsst::afw::table::AmpInfoCatalog::const_iterator end() const { return _ampInfoCatalog.end(); }
139 
145  lsst::afw::table::AmpInfoRecord const &operator[](size_t i) const { return _ampInfoCatalog.at(i); }
146 
152  lsst::afw::table::AmpInfoRecord const &operator[](std::string const &name) const;
153 
166  std::shared_ptr<lsst::afw::table::AmpInfoRecord const> _get(int i) const;
167 
178  std::shared_ptr<lsst::afw::table::AmpInfoRecord const> _get(std::string const &name) const;
179 
183  size_t size() const { return _ampInfoCatalog.size(); }
184 
186  bool hasTransform(CameraSys const &cameraSys) const;
187 
189  bool hasTransform(CameraSysPrefix const &cameraSysPrefix) const;
190 
203  template <typename FromSysT, typename ToSysT>
204  std::shared_ptr<geom::TransformPoint2ToPoint2> getTransform(FromSysT const &fromSys,
205  ToSysT const &toSys) const;
206 
216  CameraSys const &cameraSys
217  ) const {
218  return CameraPoint(point, cameraSys);
219  }
220 
227  CameraPoint makeCameraPoint(geom::Point2D const &point, CameraSysPrefix const &cameraSysPrefix) const {
228  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
229  }
230 
239  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
240 
247  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
248  return CameraSys(cameraSysPrefix, _name);
249  }
250 
260  CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const {
261  return CameraPoint(
262  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
263  toSys);
264  }
265 
275  CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const {
276  return transform(fromCameraPoint, makeCameraSys(toSys));
277  }
278 
280  CameraSys getNativeCoordSys() const { return _nativeSys; }
281 
282 private:
283  typedef std::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> _AmpInfoMap;
294  void _init();
295 
296  std::string _name;
297  int _id;
298  DetectorType _type;
299  std::string _serial;
300  geom::Box2I _bbox;
301  table::AmpInfoCatalog _ampInfoCatalog;
302  _AmpInfoMap _ampNameIterMap;
303  Orientation _orientation;
304  geom::Extent2D _pixelSize;
305  CameraSys _nativeSys;
306  TransformMap _transformMap;
307 };
308 } // namespace cameraGeom
309 } // namespace afw
310 } // namespace lsst
311 
312 #endif
geom::Point2D transform(geom::Point2D const &point, CameraSys const &fromSys, CameraSys const &toSys) const
Convert a point from one camera coordinate system to another.
A registry of 2-dimensional coordinate transforms for a specific camera.
Definition: TransformMap.h:57
Camera coordinate system; used as a key in in TransformMap.
Definition: CameraSys.h:77
Orientation const getOrientation() const
Get detector&#39;s orientation in the focal plane.
Definition: Detector.h:126
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified camera coordinate system.
Definition: Detector.cc:49
lsst::afw::table::AmpInfoCatalog::const_iterator end() const
Get iterator to end of amplifier list.
Definition: Detector.h:138
CameraPoint makeCameraPoint(geom::Point2D const &point, CameraSysPrefix const &cameraSysPrefix) const
Make a CameraPoint from a point and a camera system prefix.
Definition: Detector.h:227
std::string getSerial() const
Get the detector serial &quot;number&quot;.
Definition: Detector.h:105
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:129
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:145
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Convert a CameraPoint from one coordinate system to another.
Definition: Detector.h:260
CameraPoint getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified camera coordinate system.
Definition: Detector.cc:58
size_t size() const
Get the number of amplifiers.
Definition: Detector.h:183
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:428
lsst::afw::geom::Box2I getBBox() const
Get the bounding box.
Definition: Detector.h:108
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:399
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const
Convert a CameraPoint from one coordinate system to a coordinate system prefix.
Definition: Detector.h:275
An integer coordinate rectangle.
Definition: Box.h:55
Describe a detector&#39;s orientation in the focal plane.
Definition: Orientation.h:51
std::shared_ptr< geom::TransformPoint2ToPoint2 > getTransform(FromSysT const &fromSys, ToSysT const &toSys) const
Get a Transform from one camera coordinate system, or camera coordinate system prefix, to another.
Definition: Detector.cc:93
DetectorType getType() const
Definition: Detector.h:102
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:135
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested) ...
Definition: Detector.h:239
Iterator class for CatalogT.
Definition: Catalog.h:37
table::Key< std::string > name
Definition: ApCorrMap.cc:71
lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const
Get the amplifier information catalog.
Definition: Detector.h:123
CameraPoint makeCameraPoint(geom::Point2D const &point, CameraSys const &cameraSys) const
Make a CameraPoint from a point and a camera system.
Definition: Detector.h:215
bool hasTransform(CameraSys const &cameraSys) const
Can this object convert between PIXELS and the specified camera coordinate system?
Definition: Detector.cc:86
std::string getName() const
Get the detector name.
Definition: Detector.h:97
TransformMap const getTransformMap() const
Get the transform registry.
Definition: Detector.h:132
Camera coordinate system prefix.
Definition: CameraSys.h:44
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Get a coordinate system from a detector system prefix (add detector name)
Definition: Detector.h:247
CameraSys getCameraSys() const
Definition: CameraPoint.h:41
Information about a CCD or other imaging detector.
Definition: Detector.h:64
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, TransformMap::Transforms const &transforms)
Make a Detector.
Definition: Detector.cc:31
A Point2D with associated camera coordinate system.
Definition: CameraPoint.h:37
CameraSys getNativeCoordSys() const
The &quot;native&quot; coordinate system of this detector.
Definition: Detector.h:280
std::shared_ptr< lsst::afw::table::AmpInfoRecord const > _get(int i) const
Get the amplifier specified by index, returning a shared pointer to an AmpInfo record.
Definition: Detector.cc:69
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:100
std::unordered_map< CameraSys, std::shared_ptr< geom::TransformPoint2ToPoint2 >> Transforms
Definition: TransformMap.h:65