43 namespace ex = pex::exceptions;
58 template<
typename ImageT>
62 lsst::daf::base::Citizen(typeid(this)),
63 _imgBBox(img.getBBox()),
67 _xcen(0), _ycen(0), _xorig(0), _yorig(0), _xsize(0), _ysize(0)
70 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
75 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
76 str(
boost::format(
"Image %dx%d has more pixels than fit in an int (%d)")
94 lsst::daf::base::Citizen(typeid(this)),
99 _xcen(0), _ycen(0), _xorig(0), _yorig(0), _xsize(0), _ysize(0)
102 throw LSST_EXCEPT(ex::InvalidParameterError,
"Image contains no pixels");
107 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
108 str(
boost::format(
"Image %dx%d has more pixels than fit in an int (%d)")
122 int const nxSample,
int const nySample)
124 _xcen.resize( nxSample);
_ycen.resize(nySample);
129 for (
int iX = 0; iX < nxSample; ++iX) {
130 const int endx = std::min(((iX+1)*width + nxSample/2)/nxSample, width);
133 _xcen [iX] = _xorig[iX] + (0.5 *
_xsize[iX]) - 0.5;
136 for (
int iY = 0; iY < nySample; ++iY) {
137 const int endy = std::min(((iY+1)*height + nySample/2)/nySample, height);
140 _ycen [iY] = _yorig[iY] + (0.5 *
_ysize[iY]) - 0.5;
149 static std::map<std::string, UndersampleStyle> undersampleStrings;
150 if (undersampleStrings.size() == 0) {
156 if (undersampleStrings.find(style) == undersampleStrings.end()) {
157 throw LSST_EXCEPT(ex::InvalidParameterError,
"Understample style not defined: "+style);
159 return undersampleStrings[style];
166 #define INSTANTIATE_BACKGROUND(TYPE) \
167 template Background::Background(image::Image<TYPE> const& img, \
168 BackgroundControl const& bgCtrl); \
169 template Background::Background(image::MaskedImage<TYPE> const& img, \
170 BackgroundControl const& bgCtrl); \
171 template PTR(image::Image<TYPE>) Background::getImage<TYPE>(Interpolate::Style const, \
172 UndersampleStyle const) const;
175 INSTANTIATE_BACKGROUND(
float)
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
std::vector< int > _ysize
y size ...
Interpolate values for a set of x,y vector<>s.
std::vector< int > _xorig
x origin pix coords of sub images
Background(ImageT const &img, BackgroundControl const &bgCtrl)
Constructor for Background.
std::vector< double > _ycen
y center ...
Pass parameters to a Background object.
An integer coordinate rectangle.
std::vector< int > _xsize
x size of sub images
geom::Box2I _imgBBox
size and origin of input image
#define LSST_EXCEPT(type,...)
std::vector< double > _xcen
x center pix coords of sub images
bool isEmpty() const
Return true if the box contains no points.
void _setCenOrigSize(int const width, int const height, int const nxSample, int const nySample)
Compute Image Statistics.
Implementation of the Class MaskedImage.
std::vector< int > _yorig
y origin ...