31 namespace pexExcept = lsst::pex::exceptions;
32 namespace afwGeom = lsst::afw::geom;
33 namespace afwMath = lsst::afw::math;
46 Kernel(image.getWidth(), image.getHeight(), 0),
53 for (XIter imPtr = image.
row_begin(
y), imEnd = image.
row_end(
y); imPtr != imEnd; ++imPtr) {
64 Kernel(kernel.getWidth(), kernel.getHeight(), 0),
65 _image(kernel.getDimensions()),
72 retPtr->setCtr(this->getCtr());
80 double multFactor = 1.0;
81 double imSum = this->
_sum;
84 throw LSST_EXCEPT(pexExcept::OverflowError,
"Cannot normalize; kernel sum is 0");
86 multFactor = 1.0/
static_cast<double>(this->
_sum);
92 for (
int y = 0;
y != this->getHeight(); ++
y) {
93 for (XIter imPtr = image.
row_begin(
y), imEnd = image.
row_end(
y), kPtr = this->_image.row_begin(
y);
94 imPtr != imEnd; ++imPtr, ++kPtr) {
95 imPtr[0] = multFactor*kPtr[0];
103 std::ostringstream os;
104 os << prefix <<
"FixedKernel:" << std::endl;
105 os << prefix <<
"..sum: " <<
_sum << std::endl;
112 namespace lsst {
namespace afw {
namespace math {
117 table::Key< table::Array<Kernel::Pixel> >
image;
120 Kernel::PersistenceHelper(0),
122 schema.addField< table::Array<Kernel::Pixel> >(
123 "image",
"pixel values (row-major)", dimensions.getX() * dimensions.getY()
128 explicit FixedKernelPersistenceHelper(table::Schema
const & schema_) :
129 Kernel::PersistenceHelper(schema_),
143 FixedKernelPersistenceHelper
const keys(catalogs.front().getSchema());
148 ) = record[keys.image];
150 result->setCtr(record.get(keys.center));
159 std::string getFixedKernelPersistenceName() {
return "FixedKernel"; }
161 FixedKernel::Factory registration(getFixedKernelPersistenceName());
168 FixedKernelPersistenceHelper
const keys(getDimensions());
170 (*record)[keys.image] = ndarray::flatten<1>(
ndarray::copy(_image.getArray()));
Declare the Kernel class and subclasses.
table::Key< std::string > name
An object passed to Persistable::write to allow it to persist itself.
afw::table::Schema schema
Include files required for standard LSST Exception handling.
A base class for factory classes used to reconstruct objects from records.
virtual std::string toString(std::string const &prefix="") const
Return a string representation of the kernel.
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
virtual std::string toString(std::string const &prefix="") const
Return a string representation of the kernel.
Array< T, N, C_ > static_dimension_cast(Array< T, N, C > const &array)
std::map< Citizen const *, CitizenInfo > table
table::Key< table::Array< Kernel::Pixel > > image
A base class for objects that can be persisted via afw::table::io Archive classes.
afw::table::PointKey< int > dimensions
FixedKernel()
Construct an empty FixedKernel of size 0x0.
x_iterator row_end(int y) const
Return an x_iterator to the end 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.
int getHeight() const
Return the number of rows in the image.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
#define LSST_EXCEPT(type,...)
A vector of catalogs used by Persistable.
Base class for all records.
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
double doComputeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize) const
Low-level version of computeImage.
x_iterator row_begin(int y) const
lsst::afw::image::Image< Pixel > _image
Kernels are used for convolution with MaskedImages and (eventually) Images.
A kernel created from an Image.
Factory(std::string const &name)