LSST Applications g042eb84c57+730a74494b,g04e9c324dd+8c5ae1fdc5,g134cb467dc+1f1e3e7524,g199a45376c+0ba108daf9,g1fd858c14a+fa7d31856b,g210f2d0738+f66ac109ec,g262e1987ae+83a3acc0e5,g29ae962dfc+d856a2cb1f,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+a1e0c9f713,g47891489e3+0d594cb711,g4d44eb3520+c57ec8f3ed,g4d7b6aa1c5+f66ac109ec,g53246c7159+8c5ae1fdc5,g56a1a4eaf3+fd7ad03fde,g64539dfbff+f66ac109ec,g67b6fd64d1+0d594cb711,g67fd3c3899+f66ac109ec,g6985122a63+0d594cb711,g74acd417e5+3098891321,g786e29fd12+668abc6043,g81db2e9a8d+98e2ab9f28,g87389fa792+8856018cbb,g89139ef638+0d594cb711,g8d7436a09f+80fda9ce03,g8ea07a8fe4+760ca7c3fc,g90f42f885a+033b1d468d,g97be763408+a8a29bda4b,g99822b682c+e3ec3c61f9,g9d5c6a246b+0d5dac0c3d,ga41d0fce20+9243b26dd2,gbf99507273+8c5ae1fdc5,gd7ef33dd92+0d594cb711,gdab6d2f7ff+3098891321,ge410e46f29+0d594cb711,geaed405ab2+c4bbc419c6,gf9a733ac38+8c5ae1fdc5,w.2025.38
LSST Data Management Base Package
Loading...
Searching...
No Matches
Camera.h
Go to the documentation of this file.
1/*
2 * Developed for the LSST Data Management System.
3 * This product includes software developed by the LSST Project
4 * (https://www.lsst.org).
5 * See the COPYRIGHT file at the top-level directory of this distribution
6 * for details of code ownership.
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 GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef LSST_AFW_CAMERAGEOM_CAMERA_H
23#define LSST_AFW_CAMERAGEOM_CAMERA_H
24
25#include <string>
26#include <memory>
27
31
32namespace lsst {
33namespace afw {
34namespace cameraGeom {
35
43public:
44 class Builder;
45
47
48 // Camera is immutable, so it cannot be moveable. It is also always held
49 // by shared_ptr, so there is no good reason to copy it.
50 Camera(Camera const &) = delete;
51 Camera(Camera &&) = delete;
52
53 // Camera is immutable, so it cannot be assignable.
54 Camera &operator=(Camera const &) = delete;
55 Camera &operator=(Camera &&) = delete;
56
57 virtual ~Camera() noexcept;
58
64 Camera::Builder rebuild() const;
65
69 std::string getName() const { return _name; }
70
74 std::string getPupilFactoryName() const { return _pupilFactoryName; }
75
83 bool getFocalPlaneParity() const noexcept { return _transformMap->getFocalPlaneParity(); }
84
92 DetectorList findDetectors(lsst::geom::Point2D const &point, CameraSys const &cameraSys) const;
93
103 CameraSys const &cameraSys) const;
104
118 CameraSys const &toSys) const;
119
127 std::shared_ptr<TransformMap const> getTransformMap() const noexcept { return _transformMap; }
128
137 lsst::geom::Point2D transform(lsst::geom::Point2D const &point, CameraSys const &fromSys,
138 CameraSys const &toSys) const;
139
149 CameraSys const &fromSys, CameraSys const &toSys) const;
150
154 bool isPersistable() const noexcept override { return true; }
155
156protected:
157 void write(OutputArchiveHandle &handle) const override;
158
159private:
160 // static methods below provide access to private methods of
161 // Detector::InCameraBuilder for use by Camera::Builder, because
162 // Detector::InCameraBuilder can only friend Camera.
163
164 /*
165 * Create a new Detector::InCameraBuilder for a completely new Detector.
166 */
167 static std::shared_ptr<Detector::InCameraBuilder> makeDetectorBuilder(std::string const &name, int id);
168
169 /*
170 * Create a new Detector::InCameraBuilder with the state of the given
171 * Detector.
172 */
173 static std::shared_ptr<Detector::InCameraBuilder> makeDetectorBuilder(Detector const &detector);
174
175 /*
176 * Extract the sequence of TransformMap::Connections from a
177 * Detector::InCameraBuilder.
178 */
179 static std::vector<TransformMap::Connection> const &getDetectorBuilderConnections(
180 Detector::InCameraBuilder const &detector);
181
182 // Deserialization factory.
183 class Factory;
184
185 // Constructor used by Camera::Builder.
186 // Some arguments passed by value to make moves possible.
187 Camera(std::string const &name, DetectorList detectors, std::shared_ptr<TransformMap const> transformMap,
188 std::string const &pupilFactoryName);
189
190 // Constructor used by persistence.
191 Camera(table::io::InputArchive const &archive, table::io::CatalogVector const &catalogs);
192
193 std::string getPersistenceName() const override;
194
195 // getPythonModule implementation inherited from DetectorCollection.
196
197 std::string _name;
198 std::string _pupilFactoryName;
200};
201
210class Camera::Builder : public DetectorCollectionBase<Detector::InCameraBuilder> {
212
213public:
214 virtual ~Builder() noexcept;
215
219 explicit Builder(std::string const &name);
220
224 explicit Builder(Camera const &camera);
225
229 std::shared_ptr<Camera const> finish() const;
230
232 std::string getName() const { return _name; }
233
235 void setName(std::string const &name) { _name = name; }
236
238 std::string getPupilFactoryName() const { return _pupilFactoryName; }
239
241 void setPupilFactoryName(std::string const &pupilFactoryName) { _pupilFactoryName = pupilFactoryName; }
242
244 bool getFocalPlaneParity() const noexcept { return _focalPlaneParity; }
245
260 void setFocalPlaneParity(bool flipX);
261
271 void setTransformFromFocalPlaneTo(CameraSys const &toSys,
273
281
295
297
304 void remove(std::string const &name) { return BaseCollection::remove(name); }
305 void remove(int id) { return BaseCollection::remove(id); }
307
308private:
309 std::string _name;
310 std::string _pupilFactoryName;
311 bool _focalPlaneParity;
313};
314
315} // namespace cameraGeom
316} // namespace afw
317} // namespace lsst
318
319#endif // LSST_AFW_CAMERAGEOM_CAMERA_H
A helper class for creating and modifying cameras.
Definition Camera.h:210
void setPupilFactoryName(std::string const &pupilFactoryName)
Set the fully-qualified name of the Python class that provides this Camera's PupilFactory.
Definition Camera.h:241
void setTransformFromFocalPlaneTo(CameraSys const &toSys, std::shared_ptr< afw::geom::TransformPoint2ToPoint2 const > transform)
Set the transformation from FOCAL_PLANE to the given coordinate system.
Definition Camera.cc:306
Builder(std::string const &name)
Construct a Builder for a completely new Camera with the given name.
Definition Camera.cc:194
std::string getName() const
Return the name of the camera.
Definition Camera.h:232
void setFocalPlaneParity(bool flipX)
Set whether an x-axis flip should be included in the FOCAL_PLANE to FIELD_ANGLE transform.
Definition Camera.cc:234
std::string getPupilFactoryName() const
Return the fully-qualified name of the Python class that provides this Camera's PupilFactory.
Definition Camera.h:238
std::shared_ptr< Detector::InCameraBuilder > add(std::string const &name, int id)
Add a new Detector with the given name and ID.
Definition Camera.cc:331
void remove(std::string const &name)
Remove the detector with the given name or ID.
Definition Camera.h:304
bool discardTransformFromFocalPlaneTo(CameraSys const &toSys)
Remove any transformation from FOCAL_PLANE to the given coordinate system.
Definition Camera.cc:322
bool getFocalPlaneParity() const noexcept
Return True if there is an x-axis flip from FOCAL_PLANE to FIELD_ANGLE, False otherwise.
Definition Camera.h:244
void setName(std::string const &name)
Set the name of the camera.
Definition Camera.h:235
std::shared_ptr< Camera const > finish() const
Construct a new Camera from the state of the Builder.
Definition Camera.cc:236
Camera(Camera const &)=delete
DetectorCollection::List DetectorList
Definition Camera.h:46
Camera::Builder rebuild() const
Create a Camera::Builder object initialized with this camera's state.
Definition Camera.cc:47
std::shared_ptr< TransformMap const > getTransformMap() const noexcept
Obtain the transform registry.
Definition Camera.h:127
std::string getPupilFactoryName() const
Return the fully-qualified name of the Python class that provides this Camera's PupilFactory.
Definition Camera.h:74
std::string getName() const
Return the name of the camera.
Definition Camera.h:69
DetectorList findDetectors(lsst::geom::Point2D const &point, CameraSys const &cameraSys) const
Find the detectors that cover a point in any camera system.
Definition Camera.cc:49
virtual ~Camera() noexcept
std::vector< DetectorList > findDetectorsList(std::vector< lsst::geom::Point2D > const &pointList, CameraSys const &cameraSys) const
Find the detectors that cover a list of points in any camera system.
Definition Camera.cc:64
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Definition Camera.cc:192
lsst::geom::Point2D transform(lsst::geom::Point2D const &point, CameraSys const &fromSys, CameraSys const &toSys) const
Transform a point from one camera coordinate system to another.
Definition Camera.cc:87
Camera & operator=(Camera &&)=delete
Camera & operator=(Camera const &)=delete
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition Camera.cc:143
bool getFocalPlaneParity() const noexcept
Return True if there is an x-axis flip from FOCAL_PLANE to FIELD_ANGLE, False otherwise.
Definition Camera.h:83
bool isPersistable() const noexcept override
Cameras are always persistable.
Definition Camera.h:154
std::shared_ptr< afw::geom::TransformPoint2ToPoint2 > getTransform(CameraSys const &fromSys, CameraSys const &toSys) const
Get a transform from one CameraSys to another.
Definition Camera.cc:82
Camera coordinate system; used as a key in in TransformMap.
Definition CameraSys.h:83
A helper class that allows the properties of a detector to be modified in the course of modifying a f...
Definition Detector.h:554
std::vector< std::shared_ptr< T > > List
A representation of a detector in a mosaic camera.
Definition Detector.h:184
A vector of catalogs used by Persistable.
A multi-catalog archive object used to load table::io::Persistable objects.
A CRTP facade class for subclasses of Persistable.
io::OutputArchiveHandle OutputArchiveHandle
Point< double, 2 > Point2D
Definition Point.h:324
STL namespace.