Skip to content

Commit

Permalink
Use geom instead of afwGeom in C++ where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 16, 2019
1 parent 3895388 commit e687e9d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions include/lsst/coadd/utils/addToCoadd.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @author Russell Owen
*/
#include "lsst/afw/geom.h"
#include "lsst/geom.h"
#include "lsst/afw/image.h"

namespace lsst {
Expand All @@ -50,7 +50,7 @@ namespace utils {
* @throw pexExcept::InvalidParameterError if coadd and weightMap dimensions or xy0 do not match.
*/
template <typename CoaddPixelT, typename WeightPixelT>
lsst::afw::geom::Box2I addToCoadd(
lsst::geom::Box2I addToCoadd(
lsst::afw::image::Image<CoaddPixelT> &coadd, ///< [in,out] coadd to be modified
lsst::afw::image::Image<WeightPixelT> &
weightMap, ///< [in,out] weight map to be modified;
Expand All @@ -73,7 +73,7 @@ lsst::afw::geom::Box2I addToCoadd(
* @throw pexExcept::InvalidParameterError if coadd and weightMap dimensions or xy0 do not match.
*/
template <typename CoaddPixelT, typename WeightPixelT>
lsst::afw::geom::Box2I addToCoadd(
lsst::geom::Box2I addToCoadd(
lsst::afw::image::MaskedImage<CoaddPixelT, lsst::afw::image::MaskPixel,
lsst::afw::image::VariancePixel>
&coadd, ///< [in,out] coadd to be modified
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/coadd/utils/copyGoodPixels.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @author Russell Owen
*/
#include "lsst/afw/geom.h"
#include "lsst/geom.h"
#include "lsst/afw/image.h"

namespace lsst {
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/coadd/utils/addToCoadd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ namespace {

template <typename CoaddPixelT, typename WeightPixelT>
void declareAddToCoadd(py::module &mod) {
namespace afwGeom = lsst::afw::geom;
namespace geom = lsst::geom;
namespace afwImage = lsst::afw::image;

mod.def("addToCoadd",
(afwGeom::Box2I(*)(afwImage::Image<CoaddPixelT> &, afwImage::Image<WeightPixelT> &,
(geom::Box2I(*)(afwImage::Image<CoaddPixelT> &, afwImage::Image<WeightPixelT> &,
afwImage::Image<CoaddPixelT> const &, WeightPixelT)) &
addToCoadd,
"coadd"_a, "weightMap"_a, "image"_a, "weight"_a);
mod.def("addToCoadd",
(afwGeom::Box2I(*)(afwImage::MaskedImage<CoaddPixelT> &, afwImage::Image<WeightPixelT> &,
(geom::Box2I(*)(afwImage::MaskedImage<CoaddPixelT> &, afwImage::Image<WeightPixelT> &,
afwImage::MaskedImage<CoaddPixelT> const &, afwImage::MaskPixel const,
WeightPixelT)) &
addToCoadd,
Expand Down
18 changes: 9 additions & 9 deletions src/addToCoadd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "boost/format.hpp"

#include "lsst/pex/exceptions.h"
#include "lsst/afw/geom.h"
#include "lsst/geom.h"
#include "lsst/coadd/utils/addToCoadd.h"

namespace pexExcept = lsst::pex::exceptions;
namespace afwGeom = lsst::afw::geom;
namespace geom = lsst::geom;
namespace afwImage = lsst::afw::image;
namespace coaddUtils = lsst::coadd::utils;

Expand Down Expand Up @@ -79,7 +79,7 @@ namespace {
* @return overlapping bounding box, relative to parent image
*/
template <typename CoaddT, typename WeightPixelT, typename isValidPixel>
static lsst::afw::geom::Box2I addToCoaddImpl(
static lsst::geom::Box2I addToCoaddImpl(
CoaddT &coadd, ///< [in,out] coadd to be modified
lsst::afw::image::Image<WeightPixelT> &weightMap, ///< [in,out] weight map to be modified
CoaddT const &image, ///< image to add to coadd
Expand All @@ -93,8 +93,8 @@ namespace {
(boost::format("coadd and weightMap parent bboxes differ: %s != %s") %
coadd.getBBox() % weightMap.getBBox()).str());
}
afwGeom::Box2I overlapBBox = coadd.getBBox();

geom::Box2I overlapBBox = coadd.getBBox();
overlapBBox.clip(image.getBBox());
if (overlapBBox.isEmpty()) {
return overlapBBox;
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace {
} // anonymous namespace

template <typename CoaddPixelT, typename WeightPixelT>
lsst::afw::geom::Box2I coaddUtils::addToCoadd(
lsst::geom::Box2I coaddUtils::addToCoadd(
// spell out lsst:afw::image to make Doxygen happy
lsst::afw::image::Image<CoaddPixelT> &coadd,
lsst::afw::image::Image<WeightPixelT> &weightMap,
Expand All @@ -136,7 +136,7 @@ lsst::afw::geom::Box2I coaddUtils::addToCoadd(
}

template <typename CoaddPixelT, typename WeightPixelT>
lsst::afw::geom::Box2I coaddUtils::addToCoadd(
lsst::geom::Box2I coaddUtils::addToCoadd(
// spell out lsst:afw::image to make Doxygen happy
lsst::afw::image::MaskedImage<CoaddPixelT, lsst::afw::image::MaskPixel,
lsst::afw::image::VariancePixel> &coadd,
Expand All @@ -156,14 +156,14 @@ lsst::afw::geom::Box2I coaddUtils::addToCoadd(
#define MASKEDIMAGE(IMAGEPIXEL) afwImage::MaskedImage<IMAGEPIXEL, \
afwImage::MaskPixel, afwImage::VariancePixel>
#define INSTANTIATE(COADDPIXEL, WEIGHTPIXEL) \
template lsst::afw::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \
template lsst::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \
afwImage::Image<COADDPIXEL> &coadd, \
afwImage::Image<WEIGHTPIXEL> &weightMap, \
afwImage::Image<COADDPIXEL> const &image, \
WEIGHTPIXEL weight \
); \
\
template lsst::afw::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \
template lsst::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \
MASKEDIMAGE(COADDPIXEL) &coadd, \
afwImage::Image<WEIGHTPIXEL> &weightMap, \
MASKEDIMAGE(COADDPIXEL) const &image, \
Expand Down
6 changes: 3 additions & 3 deletions src/copyGoodPixels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "boost/format.hpp"

#include "lsst/pex/exceptions.h"
#include "lsst/afw/geom.h"
#include "lsst/geom.h"
#include "lsst/coadd/utils/copyGoodPixels.h"

namespace pexExcept = lsst::pex::exceptions;
namespace afwGeom = lsst::afw::geom;
namespace geom = lsst::geom;
namespace afwImage = lsst::afw::image;
namespace coaddUtils = lsst::coadd::utils;

Expand Down Expand Up @@ -84,7 +84,7 @@ namespace {
ImageT const &srcImage, ///< image to copy
lsst::afw::image::MaskPixel const badPixelMask ///< bad pixel mask; may be ignored
) {
afwGeom::Box2I overlapBBox = destImage.getBBox();
geom::Box2I overlapBBox = destImage.getBBox();
overlapBBox.clip(srcImage.getBBox());
if (overlapBBox.isEmpty()) {
return 0;
Expand Down

0 comments on commit e687e9d

Please sign in to comment.