LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
coadd_utils
11.0+1
src
setCoaddEdgeBits.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
30
#include "boost/format.hpp"
31
32
#include "
lsst/pex/exceptions.h
"
33
#include "
lsst/coadd/utils/setCoaddEdgeBits.h
"
34
35
namespace
pexExcept = lsst::pex::exceptions;
36
namespace
afwImage =
lsst::afw::image
;
37
namespace
coaddUtils = lsst::coadd::utils;
38
39
template
<
typename
WeightPixelT>
40
void
coaddUtils::setCoaddEdgeBits
(
41
// spell out lsst:afw::image to make Doxygen happy
42
lsst::afw::image::Mask<lsst::afw::image::MaskPixel>
&coaddMask,
43
lsst::afw::image::Image<WeightPixelT>
const
&weightMap
44
) {
45
typedef
afwImage::Mask<afwImage::MaskPixel>::x_iterator
MaskXIter;
46
typedef
typename
afwImage::Image<WeightPixelT>::const_x_iterator
WeightMapConstXIter;
47
48
if
(coaddMask.
getDimensions
() != weightMap.
getDimensions
()) {
49
throw
LSST_EXCEPT
(pexExcept::InvalidParameterError,
50
(
boost::format
(
"coaddMask and weightMap dimensions differ: %dx%d != %dx%d"
) %
51
coaddMask.
getWidth
() % coaddMask.
getHeight
() % weightMap.
getWidth
() % weightMap.
getHeight
()
52
).str());
53
}
54
55
afwImage::MaskPixel
const
edgeMask =
afwImage::Mask<afwImage::MaskPixel>::getPlaneBitMask
(
"NO_DATA"
);
56
57
// Set the pixels row by row, to avoid repeated checks for end-of-row
58
for
(
int
y
= 0, endY = weightMap.
getHeight
();
y
!= endY; ++
y
) {
59
WeightMapConstXIter weightMapPtr = weightMap.
row_begin
(
y
);
60
WeightMapConstXIter
const
weightMapEndPtr = weightMap.
row_end
(
y
);
61
MaskXIter coaddMaskPtr = coaddMask.
row_begin
(
y
);
62
for
(; weightMapPtr != weightMapEndPtr; ++weightMapPtr, ++coaddMaskPtr) {
63
if
(*weightMapPtr == 0) {
64
(*coaddMaskPtr) = (*coaddMaskPtr) | edgeMask;
65
}
66
}
67
}
68
}
69
70
//
71
// Explicit instantiations
72
//
74
#define INSTANTIATE(WEIGHTPIXEL) \
75
template void coaddUtils::setCoaddEdgeBits<WEIGHTPIXEL>( \
76
afwImage::Mask<afwImage::MaskPixel> &coaddMask, \
77
afwImage::Image<WEIGHTPIXEL> const &weightMap \
78
);
79
80
INSTANTIATE
(
double
);
81
INSTANTIATE
(
float
);
82
INSTANTIATE
(
int
);
83
INSTANTIATE
(boost::uint16_t);
y
int y
Definition:
GaussianCentroid.cc:36
lsst::pex.config.history.format
def format
Definition:
history.py:127
exceptions.h
Include files required for standard LSST Exception handling.
lsst::afw::image::MaskPixel
boost::uint16_t MaskPixel
Definition:
LsstImageTypes.h:33
lsst.coadd.utils::setCoaddEdgeBits
void setCoaddEdgeBits(lsst::afw::image::Mask< lsst::afw::image::MaskPixel > &coaddMask, lsst::afw::image::Image< WeightPixelT > const &weightMap)
set edge bits of coadd mask based on weight map
Definition:
setCoaddEdgeBits.cc:40
INSTANTIATE
#define INSTANTIATE(MATCH)
Definition:
makeMatchStatistics.cc:100
image
table::Key< table::Array< Kernel::Pixel > > image
Definition:
FixedKernel.cc:117
setCoaddEdgeBits.h
lsst::afw::image::ImageBase::getDimensions
geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Definition:
Image.h:298
lsst::afw::image::Mask< lsst::afw::image::MaskPixel >
lsst::afw::image::ImageBase::row_end
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition:
Image.h:324
lsst::afw::image::ImageBase::getHeight
int getHeight() const
Return the number of rows in the image.
Definition:
Image.h:239
lsst::afw::image::Mask::getPlaneBitMask
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
Definition:
Mask.cc:860
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Definition:
Exception.h:46
lsst::afw::image::ImageBase::row_begin
x_iterator row_begin(int y) const
Definition:
Image.h:319
lsst::afw::image::ImageBase::getWidth
int getWidth() const
Return the number of columns in the image.
Definition:
Image.h:237
lsst::afw::image::Image
A class to represent a 2-dimensional array of pixels.
Definition:
Image.h:415
Generated on Thu Sep 24 2015 02:29:18 for LSSTApplications by
1.8.5