LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
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.