Class TransformMap

Inheritance Relationships

Base Types

Class Documentation

class TransformMap : public lsst::afw::table::io::PersistableFacade<TransformMap>, public lsst::afw::table::io::Persistable

A registry of 2-dimensional coordinate transforms for a specific camera.

Represents the interrelationships between camera coordinate systems for a particular camera. It can be seen as a mapping between a pair of CameraSys and a Transform between them (though it does not conform to either the C++ map or Python dictionary APIs).

TransformMap supports:

  • Transforming between any two supported CameraSys using the transform methods.

  • Retrieving a transform between any two supported CameraSys using getTransform.

  • Iteration over supported CameraSys using begin and end in C++ and standard Python iteration in Python.

TransformMap is immutable and must always be held by shared_ptr; this is enforced by making all non-deleted constructors private, and instead providing static make member functions for construction (in Python, these are exposed as regular constructors).

Unless otherwise specified, all methods guarantee only basic exception safety.

Unnamed Group

TransformMap(TransformMap const &other)

TransformMap is immutable, so both moving and copying are prohibited. It is also always held by shared_ptr, so there is no good reason to copy it.

TransformMap(TransformMap &&other)
TransformMap &operator=(TransformMap const&)
TransformMap &operator=(TransformMap&&)

Public Types

using Transforms = std::unordered_map<CameraSys, std::shared_ptr<geom::TransformPoint2ToPoint2>>
using CameraSysIterator = boost::transform_iterator<GetKey, CameraSysFrameIdMap::const_iterator>

Public Functions

~TransformMap()
lsst::geom::Point2D transform(lsst::geom::Point2D const &point, CameraSys const &fromSys, CameraSys const &toSys) const

Convert a point from one camera coordinate system to another.

Return

the transformed value. Equivalent to getTransform(fromSys, toSys).applyForward(point).

Parameters
  • point: Point from which to transform

  • fromSystoSys: Camera coordinate systems between which to transform

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: Thrown if either fromSys or toSys is not supported.

std::vector<lsst::geom::Point2D> transform(std::vector<lsst::geom::Point2D> const &pointList, CameraSys const &fromSys, CameraSys const &toSys) const

Convert a list of points from one coordinate system to another.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

CameraSysIterator begin() const
CameraSysIterator end() const
bool contains(CameraSys const &system) const

Can this transform to and from the specified coordinate system?

Shall not throw exceptions.

Return

true if system is supported, false otherwise

Parameters
  • system: The coordinate system to search for

std::shared_ptr<geom::TransformPoint2ToPoint2> getTransform(CameraSys const &fromSys, CameraSys const &toSys) const

Get a Transform from one camera coordinate system to another.

Return

a Transform that converts from fromSys to toSys in the forward direction. The Transform will be invertible.

Parameters
  • fromSystoSys: Camera coordinate systems between which to transform

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: Thrown if either fromSys or toSys is not supported.

size_t size() const

Get the number of supported coordinate systems.

Shall not throw exceptions.

std::vector<Connection> getConnections() const

Return the sequence of connections used to construct this Transform.

The order of the connections may differ from the original order, but is guaranteed to yield the same TransformMap when passed to make with the same reference system.

bool isPersistable() const

TransformMaps should always be Persistable.

Public Static Functions

static std::shared_ptr<TransformMap const> make(CameraSys const &reference, Transforms const &transforms)

Construct a TransformMap with all transforms relative to a single reference CameraSys.

This method is wrapped as a regular constructor in Python.

Parameters
  • reference: Coordinate system from which each Transform in transforms converts.

  • transforms: A map whose keys are camera coordinate systems, and whose values point to Transforms that convert from reference to the corresponding key. All Transforms must be invertible.

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: Thrown if transforms contains the reference camera system as a key, or if any Transform is not invertible.

static std::shared_ptr<TransformMap const> make(CameraSys const &reference, std::vector<Connection> const &connections)

Construct a TransformMap from a sequence of Connections.

This method is wrapped as a regular constructor in Python.

Parameters
  • reference: Initial coordinate system that must be connected to all other coordinate systems in the map.

  • connections: Sequence of Connection structs, each of which relates two CameraSys via the Transform that connects them.

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: Thrown if the graph defined by the given connections does not define a single unique path (which may involve multiple Connections) between any CameraSys and the reference CameraSys.

struct Connection

Representation of a single edge in the graph defined by a TransformMap.

Public Functions

void reverse()

Reverse the connection, by swapping fromSys and toSys and inverting the transform.

Public Members

std::shared_ptr<geom::TransformPoint2ToPoint2 const> transform
CameraSys fromSys
CameraSys toSys