LSST Applications g07dc498a13+8a3ff5e555,g1409bbee79+8a3ff5e555,g1a7e361dbc+8a3ff5e555,g1fd858c14a+cdfc45a1e6,g28da252d5a+05df2523c9,g33399d78f5+b7ce9b29cb,g35bb328faa+e55fef2c71,g3bd4b5ce2c+801aef9193,g43bc871e57+32b9ddb877,g53246c7159+e55fef2c71,g60b5630c4e+f284161bd5,g6992a3b7c1+89734069dd,g6e5c4a0e23+7c1dc9d5af,g78460c75b0+8427c4cc8f,g786e29fd12+307f82e6af,g8534526c7b+af2545e932,g85d8d04dbe+6bd817bf56,g89139ef638+8a3ff5e555,g8b49a6ea8e+f284161bd5,g9125e01d80+e55fef2c71,g989de1cb63+8a3ff5e555,g9a9baf55bd+a4ec829099,g9f33ca652e+eafd8913dc,gaaedd4e678+8a3ff5e555,gabe3b4be73+9c0c3c7524,gb092a606b0+b01f69f56e,gb58c049af0+28045f66fd,gc2fcbed0ba+f284161bd5,gca43fec769+e55fef2c71,gcf25f946ba+b7ce9b29cb,gd6cbbdb0b4+784e334a77,gde0f65d7ad+3bc0905521,ge278dab8ac+25667260f6,geab183fbe5+f284161bd5,gecb8035dfe+0fa5abcb94,gf1e97e5484+b700727375,gf58bf46354+e55fef2c71,gfe7187db8c+f9d6462591,w.2025.01
LSST Data Management Base Package
Loading...
Searching...
No Matches
KernelFunctions.cc
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2
3/*
4 * LSST Data Management System
5 * Copyright 2008, 2009, 2010 LSST Corporation.
6 *
7 * This product includes software developed by the
8 * LSST Project (http://www.lsst.org/).
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the LSST License Statement and
21 * the GNU General Public License along with this program. If not,
22 * see <http://www.lsstcorp.org/LegalNotices/>.
23 */
24
25/*
26 * Definitions of members of lsst::afw::math
27 */
28#include <iostream>
29
30#include "boost/format.hpp"
31
33
34namespace lsst {
35namespace afw {
36namespace math {
37
38void printKernel(Kernel const &kernel, bool doNormalize, double xPos, double yPos, std::string pixelFmt) {
39 using Pixel = Kernel::Pixel;
40
41 image::Image<Pixel> kImage(kernel.getDimensions());
42 double kSum = kernel.computeImage(kImage, doNormalize, xPos, yPos);
43
44 for (int y = kImage.getHeight() - 1; y >= 0; --y) {
46 ++ptr) {
47 std::cout << boost::format(pixelFmt) % *ptr << " ";
48 }
50 }
51
52 if (doNormalize && std::abs(static_cast<double>(kSum) - 1.0) > 1.0e-5) {
53 std::cout << boost::format("Warning! Sum of all pixels = %9.5f != 1.0\n") % kSum;
54 }
56}
57} // namespace math
58} // namespace afw
59} // namespace lsst
std::uint64_t * ptr
Definition RangeSet.cc:95
int y
Definition SpanSet.cc:48
int getHeight() const
Return the number of rows in the image.
Definition ImageBase.h:296
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
Definition ImageBase.h:401
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition ImageBase.h:404
A class to represent a 2-dimensional array of pixels.
Definition Image.h:51
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition Kernel.h:110
lsst::geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)
Definition Kernel.h:212
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.
Definition Kernel.cc:76
T endl(T... args)
void printKernel(lsst::afw::math::Kernel const &kernel, bool doNormalize, double x=0, double y=0, std::string pixelFmt="%7.3f")
Print the pixel values of a Kernel to std::cout.