LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
42 FixedKernel::FixedKernel() :
Kernel(), _image(), _sum(0) {}
48 for (
int y = 0;
y !=
image.getHeight(); ++
y) {
49 for (XIter imPtr =
image.row_begin(
y), imEnd =
image.row_end(
y); imPtr != imEnd; ++imPtr) {
57 :
Kernel(kernel.getWidth(), kernel.getHeight(), 0), _image(kernel.getDimensions()), _sum(0) {
58 _sum = kernel.
computeImage(_image,
false, pos[0], pos[1]);
63 retPtr->setCtr(this->
getCtr());
68 if ((width <= 0) || (height <= 0)) {
70 os <<
"Cannot create FixedKernel with dimensions (" << width <<
", " << height <<
"). ";
75 os <<
"Cannot resize FixedKernel from (" <<
getWidth() <<
", " <<
getHeight() <<
") to (" << width
76 <<
", " << height <<
"), because at least one dimension would change by an odd value.";
87 bboxIntersect.clip(bboxNew);
96 bboxIntersect.getDimensions());
99 imNew->assign(imIntersect, bboxIntersect);
105 double multFactor = 1.0;
106 double imSum = this->_sum;
111 multFactor = 1.0 /
static_cast<double>(this->_sum);
119 imPtr != imEnd; ++imPtr, ++kPtr) {
120 imPtr[0] = multFactor * kPtr[0];
140 table::Key<table::Array<Kernel::Pixel>>
image;
143 : Kernel::PersistenceHelper(0),
144 image(
schema.addField<table::Array<Kernel::
Pixel>>(
"image",
"pixel values (row-major)",
147 explicit FixedKernelPersistenceHelper(table::Schema
const& schema_)
148 : Kernel::PersistenceHelper(schema_),
image(
schema[
"image"]) {}
159 FixedKernelPersistenceHelper
const keys(catalogs.
front().getSchema());
162 ndarray::flatten<1>(ndarray::static_dimension_cast<2>(
image.getArray())) = record[
keys.image];
173 std::string getFixedKernelPersistenceName() {
return "FixedKernel"; }
184 (*record)[
keys.image] = ndarray::flatten<1>(ndarray::copy(_image.
getArray()));
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
lsst::geom::Box2I getBBox() const
return parent bounding box, with XY0 = -center
Factory(std::string const &name)
lsst::geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
std::shared_ptr< Kernel > clone() const override
Return a pointer to a deep copy of this kernel.
float Pixel
Typedefs to be used for pixel values.
int getHeight() const
Return the Kernel's height.
An object passed to Persistable::write to allow it to persist itself.
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
double computeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize, double x=0.0, double y=0.0) const
Compute an image (pixellized representation of the kernel) in place.
lsst::geom::Point2I getCtr() const
Return index of kernel's center.
std::shared_ptr< Kernel > resized(int width, int height) const override
Return a pointer to a clone with specified kernel dimensions.
#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.
FixedKernel()
Construct an empty FixedKernel of size 0x0.
Reports when the result of an arithmetic operation is too large for the destination type.
Base class for all records.
A vector of catalogs used by Persistable.
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 base class for factory classes used to reconstruct objects from records.
double doComputeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize) const override
Low-level version of computeImage.
afw::table::PointKey< int > dimensions
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
std::string toString(std::string const &prefix="") const override
Return a string representation of the kernel.
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.
int getX0() const
Return the image's column-origin.
Reports invalid arguments.
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
table::Key< table::Array< Kernel::Pixel > > image
An integer coordinate rectangle.
int getMinX() const noexcept
Kernels are used for convolution with MaskedImages and (eventually) Images.
int getY0() const
Return the image's row-origin.
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
int getMinY() const noexcept