46 if (transform.getToEndpoint().getNAxes() != 1) {
48 "To EndPoint of transform must have 1 axis but has " +
58 ndarray::Array<double const, 1>
const&
y)
const {
59 if (
x.getSize<0>() !=
y.getSize<0>()) {
66 int const nPoints =
x.getSize<0>();
67 ndarray::Array<double, 2, 2> xy = ndarray::allocate(ndarray::makeVector(2, nPoints));
76 auto resShape = ndarray::makeVector(nPoints);
77 auto resStrides = ndarray::makeVector(1);
78 return ndarray::external(res2D.getData(), resShape, resStrides, res2D);
85struct PersistenceHelper {
89 table::Key<table::Array<std::uint8_t>>
frameSet;
93 bbox(table::Box2IKey::addFields(schema,
"bbox",
"bounding box",
"pixel")),
94 frameSet(schema.addField<table::Array<
std::uint8_t>>(
95 "frameSet",
"FrameSet contained in the Transform",
"", 0)) {}
97 PersistenceHelper(table::Schema
const& s) : schema(s),
bbox(s[
"bbox"]),
frameSet(s[
"frameSet"]) {}
100class TransformBoundedFieldFactory :
public table::io::PersistableFactory {
102 explicit TransformBoundedFieldFactory(
std::string const& name)
103 :
afw::table::io::PersistableFactory(name) {}
106 CatalogVector
const& catalogs)
const override {
109 table::BaseRecord
const& record = catalogs.front().front();
110 PersistenceHelper
const keys(record.getSchema());
116 return std::make_shared<TransformBoundedField>(
bbox, *transform);
120std::string getTransformBoundedFieldPersistenceName() {
return "TransformBoundedField"; }
122TransformBoundedFieldFactory registration(getTransformBoundedFieldPersistenceName());
127 return getTransformBoundedFieldPersistenceName();
133 PersistenceHelper
const keys;
136 record->set(keys.bbox,
getBBox());
144 auto newTransform =
Transform(newMapping);
145 return std::make_shared<TransformBoundedField>(
getBBox(), newTransform);
150 if (!rhsCasted)
return false;
152 return getBBox() == rhsCasted->getBBox() &&
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
SeriesMap then(Mapping const &next) const
Return a series compound mapping this(first(input)) containing shallow copies of the original.
void applyForward(ConstArray2D const &from, Array2D const &to) const
Perform a forward transformation on 2-D array, putting the results into a pre-allocated 2-D array.
A Mapping which "zooms" a set of points about the origin by multiplying all coordinate values by the ...
An abstract base class for 2-d functions defined on an integer bounding boxes.
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
An integer coordinate rectangle.
Reports invalid arguments.
BoxKey< lsst::geom::Box2I > Box2IKey
std::shared_ptr< table::io::Persistable > read(table::io::InputArchive const &archive, table::io::CatalogVector const &catalogs) const override