42 namespace ex = pex::exceptions;
57 template<
typename ImageT>
61 lsst::daf::base::Citizen(typeid(this)),
62 _imgBBox(img.getBBox()),
66 _xcen(0), _ycen(0), _xorig(0), _yorig(0), _xsize(0), _ysize(0)
69 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
74 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
75 str(
boost::format(
"Image %dx%d has more pixels than fit in an int (%d)")
93 lsst::daf::base::Citizen(typeid(this)),
98 _xcen(0), _ycen(0), _xorig(0), _yorig(0), _xsize(0), _ysize(0)
101 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
106 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
107 str(
boost::format(
"Image %dx%d has more pixels than fit in an int (%d)")
121 int const nxSample,
int const nySample)
123 _xcen.resize( nxSample);
_ycen.resize(nySample);
128 for (
int iX = 0; iX < nxSample; ++iX) {
129 const int endx = std::min(((iX+1)*width + nxSample/2)/nxSample, width);
132 _xcen [iX] = _xorig[iX] + (0.5 *
_xsize[iX]) - 0.5;
135 for (
int iY = 0; iY < nySample; ++iY) {
136 const int endy = std::min(((iY+1)*height + nySample/2)/nySample, height);
139 _ycen [iY] = _yorig[iY] + (0.5 *
_ysize[iY]) - 0.5;
148 static std::map<std::string, UndersampleStyle> undersampleStrings;
149 if (undersampleStrings.size() == 0) {
155 if (undersampleStrings.find(style) == undersampleStrings.end()) {
156 throw LSST_EXCEPT(ex::InvalidParameterError,
"Understample style not defined: "+style);
158 return undersampleStrings[style];
165 #define INSTANTIATE_BACKGROUND(TYPE) \
166 template Background::Background(image::Image<TYPE> const& img, \
167 BackgroundControl const& bgCtrl); \
168 template Background::Background(image::MaskedImage<TYPE> const& img, \
169 BackgroundControl const& bgCtrl); \
170 template PTR(image::Image<TYPE>) Background::getImage<TYPE>(Interpolate::Style const, \
171 UndersampleStyle const) const;
174 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
Interpolate values for a set of x,y vector<>s.
std::vector< int > _yorig
y origin ...
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.
bool isEmpty() const
Return true if the box contains no points.
#define LSST_EXCEPT(type,...)
std::vector< int > _xorig
x origin pix coords of sub images
std::vector< int > _ysize
y size ...
Compute Image Statistics.
Implementation of the Class MaskedImage.
void _setCenOrigSize(int const width, int const height, int const nxSample, int const nySample)