LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
43 :
Kernel(width, height, 0), _pixel(point) {
44 if (point.getX() < 0 || point.getX() >= width || point.getY() < 0 || point.getY() >= height) {
46 os <<
"point (" << point.getX() <<
", " << point.getY() <<
") lies outside " << width <<
"x" << height
55 retPtr->setCtr(this->
getCtr());
62 if ((padX % 2) || (padY % 2)) {
64 os <<
"Cannot resize DeltaFunctionKernel from (" <<
getWidth() <<
", " <<
getHeight() <<
") to ("
65 << width <<
", " << height <<
"), because at least one dimension would change by an odd value.";
68 int newPixelX =
getPixel().getX() + padX / 2;
69 int newPixelY =
getPixel().getY() + padY / 2;
71 std::make_shared<DeltaFunctionKernel>(width, height,
lsst::geom::Point2I(newPixelX, newPixelY));
76 const int pixelX =
getPixel().getX();
77 const int pixelY =
getPixel().getY();
87 const int pixelX =
getPixel().getX();
88 const int pixelY =
getPixel().getY();
91 *
image.xy_at(pixelX, pixelY) = 1;
103 static DeltaFunctionKernelPersistenceHelper
const& get() {
104 static DeltaFunctionKernelPersistenceHelper
const instance;
109 DeltaFunctionKernelPersistenceHelper(
const DeltaFunctionKernelPersistenceHelper&) =
delete;
110 DeltaFunctionKernelPersistenceHelper& operator=(
const DeltaFunctionKernelPersistenceHelper&) =
delete;
113 DeltaFunctionKernelPersistenceHelper(DeltaFunctionKernelPersistenceHelper&&) =
delete;
114 DeltaFunctionKernelPersistenceHelper& operator=(DeltaFunctionKernelPersistenceHelper&&) =
delete;
117 explicit DeltaFunctionKernelPersistenceHelper()
118 : Kernel::PersistenceHelper(0),
119 pixel(table::PointKey<int>::addFields(
schema,
"pixel",
"position of nonzero pixel",
"pixel")) {}
130 DeltaFunctionKernelPersistenceHelper
const&
keys = DeltaFunctionKernelPersistenceHelper::get();
145 std::string getDeltaFunctionKernelPersistenceName() {
return "DeltaFunctionKernel"; }
152 return getDeltaFunctionKernelPersistenceName();
156 DeltaFunctionKernelPersistenceHelper
const&
keys = DeltaFunctionKernelPersistenceHelper::get();
158 record->set(
keys.pixel, _pixel);
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Factory(std::string const &name)
int getHeight() const
Return the Kernel's height.
An object passed to Persistable::write to allow it to persist itself.
std::string toString(std::string const &prefix="") const override
Return a string representation of the kernel.
double doComputeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize) const override
Low-level version of computeImage.
lsst::geom::Point2I getPixel() const
std::shared_ptr< Kernel > clone() const override
Return a pointer to a deep copy of this kernel.
lsst::geom::Point2I getCtr() const
Return index of kernel's center.
PersistableFactory(std::string const &name)
Constructor for the factory.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
virtual std::string toString(std::string const &prefix="") const
Return a string representation of the kernel.
std::shared_ptr< Kernel > resized(int width, int height) const override
Return a pointer to a clone with specified kernel dimensions.
Base class for all records.
std::shared_ptr< afw::table::io::Persistable > read(InputArchive const &archive, CatalogVector const &catalogs) const override
Construct a new object from the given InputArchive and vector of catalogs.
A vector of catalogs used by Persistable.
A base class for factory classes used to reconstruct objects from records.
DeltaFunctionKernel(int width, int height, lsst::geom::Point2I const &point)
Construct a spatially invariant DeltaFunctionKernel.
table::PointKey< int > pixel
int getWidth() const
Return the Kernel's width.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Reports invalid arguments.
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Kernels are used for convolution with MaskedImages and (eventually) Images.