LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
25 #if !defined(LSST_AFW_MATH_BACKGROUND_H)
26 #define LSST_AFW_MATH_BACKGROUND_H
30 #include <boost/preprocessor/seq.hpp>
75 if (nxSample <= 0 || nySample <= 0) {
77 str(
boost::format(
"You must specify at least one point, not %dx%d") % nxSample %
101 if (nxSample <= 0 || nySample <= 0) {
103 str(
boost::format(
"You must specify at least one point, not %dx%d") % nxSample %
127 _undersampleStyle(undersampleStyle),
131 if (nxSample <= 0 || nySample <= 0) {
133 str(
boost::format(
"You must specify at least one point, not %dx%d") % nxSample %
150 std::string const& undersampleStyle =
"THROW_EXCEPTION",
161 if (nxSample <= 0 || nySample <= 0) {
163 str(
boost::format(
"You must specify at least one point, not %dx%d") % nxSample %
177 str(
boost::format(
"nxSample must be position, not %d") % nxSample));
179 _nxSample = nxSample;
184 str(
boost::format(
"nySample must be position, not %d") % nySample));
186 _nySample = nySample;
194 _undersampleStyle = undersampleStyle;
246 template <
typename ImageT>
282 template <
typename PixelT>
286 return getImage<PixelT>(
_imgBBox, interpStyle, undersampleStyle);
295 template <
typename PixelT>
306 template <
typename PixelT>
310 return _getImage(
bbox, interpStyle, undersampleStyle,
static_cast<PixelT>(0));
317 template <
typename PixelT>
320 std::string const& undersampleStyle =
"THROW_EXCEPTION")
const {
328 template <
typename PixelT>
330 return getImage<PixelT>(
_bctrl->getInterpStyle(),
_bctrl->getUndersampleStyle());
352 return _getApproximate(actrl, undersampleStyle, disambiguate);
384 #define LSST_makeBackground_getImage_types (Background::InternalPixelT)
385 #define LSST_makeBackground_getApproximate_types (Background::InternalPixelT)
386 #define LSST_makeBackground_getImage(m, v, T) \
387 virtual std::shared_ptr<lsst::afw::image::Image<T>> _getImage( \
388 lsst::geom::Box2I const& bbox, \
389 Interpolate::Style const interpStyle, \
390 UndersampleStyle const undersampleStyle = \
395 #define LSST_makeBackground_getApproximate(m, v, T) \
396 virtual std::shared_ptr<Approximate<T>> _getApproximate( \
397 ApproximateControl const& actrl, \
398 UndersampleStyle const undersampleStyle = \
410 void _setCenOrigSize(
int const width,
int const height,
int const nxSample,
int const nySample);
436 template <
typename ImageT>
500 #if defined(LSST_makeBackground_getImage)
504 #undef LSST_makeBackground_getImage
505 #undef LSST_makeBackground_getApproximate
511 template <
typename PixelT>
516 template <
typename PixelT>
525 template <
typename ImageT>
533 #endif // LSST_AFW_MATH_BACKGROUND_H
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
void setInterpStyle(std::string const &style)
Background & operator=(Background &&)=delete
BackgroundMI(ImageT const &img, BackgroundControl const &bgCtrl)
Constructor for BackgroundMI.
BackgroundControl(int const nxSample, int const nySample, StatisticsControl const &sctrl, std::string const &prop, ApproximateControl const actrl=ApproximateControl(ApproximateControl::UNKNOWN, 1))
Overload constructor to handle string for statistical operator.
std::shared_ptr< math::Approximate< InternalPixelT > > getApproximate(ApproximateControl const &actrl, UndersampleStyle const undersampleStyle=THROW_EXCEPTION) const
Method to return an approximation to the background.
BackgroundMI & operator=(BackgroundMI &&)=delete
std::vector< int > _ysize
y size ...
void setStatisticsProperty(Property prop)
std::shared_ptr< lsst::afw::image::Image< PixelT > > getImage(lsst::geom::Box2I const &bbox, Interpolate::Style const interpStyle, UndersampleStyle const undersampleStyle=THROW_EXCEPTION) const
std::shared_ptr< ApproximateControl > getApproximateControl()
void setNySample(int nySample)
lsst::geom::Box2I getImageBBox() const
Return the input image's (PARENT) bounding box.
Background(Background &&)=delete
std::shared_ptr< Background > makeBackground(ImageT const &img, BackgroundControl const &bgCtrl)
A convenience function that uses function overloading to make the correct type of Background.
std::shared_ptr< BackgroundControl > getBackgroundControl()
std::shared_ptr< lsst::afw::image::Image< PixelT > > getImage() const
Method to interpolate and return the background for entire image.
Background(ImageT const &img, BackgroundControl const &bgCtrl)
Constructor for Background.
std::shared_ptr< lsst::afw::image::Image< PixelT > > getImage(lsst::geom::Box2I const &bbox, std::string const &interpStyle, std::string const &undersampleStyle="THROW_EXCEPTION") const
BackgroundControl(int const nxSample, int const nySample, StatisticsControl const sctrl=StatisticsControl(), Property const prop=MEANCLIP, ApproximateControl const actrl=ApproximateControl(ApproximateControl::UNKNOWN, 1))
float InternalPixelT
type used for any internal images, and returned by getApproximate
void setUndersampleStyle(std::string const &undersampleStyle)
BackgroundMI(BackgroundMI &&)=delete
Property stringToStatisticsProperty(std::string const property)
Conversion function to switch a string to a Property (see Statistics.h)
A class to evaluate image background levels.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
#define LSST_makeBackground_getApproximate(m, v, T)
std::shared_ptr< StatisticsControl > getStatisticsControl()
#define LSST_makeBackground_getImage_types
~BackgroundMI() override=default
std::vector< int > _yorig
y origin ...
#define LSST_makeBackground_getImage(m, v, T)
void setUndersampleStyle(UndersampleStyle const undersampleStyle)
@ MEANCLIP
estimate sample N-sigma clipped mean (N set in StatisticsControl, default=3)
BackgroundControl(std::string const &style, int const nxSample=10, int const nySample=10, std::string const &undersampleStyle="THROW_EXCEPTION", StatisticsControl const sctrl=StatisticsControl(), std::string const &prop="MEANCLIP", ApproximateControl const actrl=ApproximateControl(ApproximateControl::UNKNOWN, 1))
Overload constructor to handle strings for both interp and undersample styles.
UndersampleStyle getAsUsedUndersampleStyle() const
Return the UndersampleStyle that we actually used in the last call to getImage()
A virtual base class to evaluate image background levels.
std::vector< double > _xcen
x center pix coords of sub images
std::shared_ptr< BackgroundControl > _bctrl
control info set by user.
lsst::afw::image::MaskedImage< InternalPixelT > getStatsImage() const
Return the image of statistical quantities extracted from the image.
Background & operator=(Background const &)=delete
UndersampleStyle _asUsedUndersampleStyle
the undersampleStyle we actually used
Reports attempts to exceed implementation-defined length limits for some classes.
BackgroundControl & operator=(BackgroundControl const &)=default
std::shared_ptr< lsst::afw::image::Image< PixelT > > getImage(std::string const &interpStyle, std::string const &undersampleStyle="THROW_EXCEPTION") const
Method to interpolate and return the background for entire image.
std::shared_ptr< ApproximateControl const > getApproximateControl() const
Pass parameters to a Background object.
BackgroundMI(BackgroundMI const &)=delete
void setNxSample(int nxSample)
std::vector< int > _xsize
x size of sub images
BackgroundControl(BackgroundControl const &)=default
BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_COLUMNVIEW_SCALAR, _, BOOST_PP_TUPLE_TO_SEQ(AFW_TABLE_SCALAR_FIELD_TYPE_N, AFW_TABLE_SCALAR_FIELD_TYPE_TUPLE)) BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_COLUMNVIEW_ARRAY
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
BackgroundMI & operator+=(float const delta) override
Add a scalar to the Background (equivalent to adding a constant to the original image)
std::vector< int > _xorig
x origin pix coords of sub images
Interpolate::Style getInterpStyle() const
UndersampleStyle getUndersampleStyle() const
Pass parameters to a Statistics object.
virtual ~BackgroundControl()=default
std::shared_ptr< lsst::afw::image::Image< PixelT > > getImage(Interpolate::Style const interpStyle, UndersampleStyle const undersampleStyle=THROW_EXCEPTION) const
Method to interpolate and return the background for entire image.
#define LSST_makeBackground_getApproximate_types
Reports invalid arguments.
Control how to make an approximation.
Interpolate::Style _asUsedInterpStyle
the style we actually used
BackgroundControl(Interpolate::Style const style, int const nxSample=10, int const nySample=10, UndersampleStyle const undersampleStyle=THROW_EXCEPTION, StatisticsControl const sctrl=StatisticsControl(), Property const prop=MEANCLIP, ApproximateControl const actrl=ApproximateControl(ApproximateControl::UNKNOWN, 1))
Overload constructor to provide interp style.
An integer coordinate rectangle.
lsst::geom::Box2I _imgBBox
size and origin of input image
void setInterpStyle(Interpolate::Style const style)
BackgroundControl(BackgroundControl &&)=default
std::shared_ptr< StatisticsControl const > getStatisticsControl() const
virtual Background & operator+=(float const delta)=0
Add a constant level to a background.
virtual Background & operator-=(float const delta)=0
Subtract a constant level from a background.
void setStatisticsProperty(std::string prop)
Interpolate::Style getAsUsedInterpStyle() const
Return the Interpolate::Style that we actually used in the last call to getImage()
Property
control what is calculated
std::shared_ptr< BackgroundControl const > getBackgroundControl() const
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
virtual ~Background()=default
dtor
BackgroundMI & operator-=(float const delta) override
Subtract a scalar from the Background (equivalent to subtracting a constant from the original image)
std::vector< double > _ycen
y center ...
void setApproximateControl(std::shared_ptr< ApproximateControl > actrl)
BackgroundMI & operator=(BackgroundMI const &)=delete
BackgroundControl & operator=(BackgroundControl &&)=default
Background(Background const &)=delete
Property getStatisticsProperty() const