38 namespace ex = pex::exceptions;
43 template <
typename ImageT>
45 :
lsst::daf::base::Citizen(typeid(this)),
46 _imgBBox(img.getBBox()),
57 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
62 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
63 str(boost::format(
"Image %dx%d has more pixels than fit in an int (%d)") %
71 :
lsst::daf::base::Citizen(typeid(this)),
83 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
88 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
89 str(boost::format(
"Image %dx%d has more pixels than fit in an int (%d)") %
96 void Background::_setCenOrigSize(
int const width,
int const height,
int const nxSample,
int const nySample) {
97 _xcen.resize(nxSample);
98 _ycen.resize(nySample);
104 for (
int iX = 0; iX < nxSample; ++iX) {
105 const int endx =
std::min(((iX + 1) * width + nxSample / 2) / nxSample, width);
111 for (
int iY = 0; iY < nySample; ++iY) {
112 const int endy =
std::min(((iY + 1) * height + nySample / 2) / nySample, height);
120 static std::map<std::string, UndersampleStyle> undersampleStrings;
121 if (undersampleStrings.size() == 0) {
127 if (undersampleStrings.find(style) == undersampleStrings.end()) {
128 throw LSST_EXCEPT(ex::InvalidParameterError,
"Understample style not defined: " + style);
130 return undersampleStrings[style];
137 #define INSTANTIATE_BACKGROUND(TYPE) \ 138 template Background::Background(image::Image<TYPE> const& img, BackgroundControl const& bgCtrl); \ 139 template Background::Background(image::MaskedImage<TYPE> const& img, BackgroundControl const& bgCtrl); \ 140 template std::shared_ptr<image::Image<TYPE>> Background::getImage<TYPE>(Interpolate::Style const, \ 141 UndersampleStyle const) const; 143 INSTANTIATE_BACKGROUND(
float)
std::vector< int > _xsize
x size of sub images
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
std::vector< double > _xcen
x center pix coords of sub images
std::vector< int > _yorig
y origin ...
bool isEmpty() const
Return true if the box contains no points.
Background(ImageT const &img, BackgroundControl const &bgCtrl)
Constructor for Background.
geom::Box2I _imgBBox
size and origin of input image
std::vector< double > _ycen
y center ...
Pass parameters to a Background object.
An integer coordinate rectangle.
Interpolate::Style _asUsedInterpStyle
the style we actually used
A base class for image defects.
std::vector< int > _xorig
x origin pix coords of sub images
std::shared_ptr< BackgroundControl > _bctrl
control info set by user.
std::vector< int > _ysize
y size ...
UndersampleStyle _asUsedUndersampleStyle
the undersampleStyle we actually used