|
template<typename ImageT > |
| BackgroundMI (ImageT const &img, BackgroundControl const &bgCtrl) |
| Constructor for BackgroundMI. More...
|
|
| BackgroundMI (lsst::geom::Box2I const imageDimensions, image::MaskedImage< InternalPixelT > const &statsImage) |
| Recreate a BackgroundMI from the statsImage and the original Image's BBox. More...
|
|
| BackgroundMI (BackgroundMI const &)=delete |
|
| BackgroundMI (BackgroundMI &&)=delete |
|
BackgroundMI & | operator= (BackgroundMI const &)=delete |
|
BackgroundMI & | operator= (BackgroundMI &&)=delete |
|
| ~BackgroundMI () override=default |
|
BackgroundMI & | operator+= (float const delta) override |
| Add a scalar to the Background (equivalent to adding a constant to the original image) More...
|
|
BackgroundMI & | operator-= (float const delta) override |
| Subtract a scalar from the Background (equivalent to subtracting a constant from the original image) More...
|
|
double | getPixel (Interpolate::Style const style, int const x, int const y) const |
| Method to retrieve the background level at a pixel coord. More...
|
|
double | getPixel (int const x, int const y) const |
| Return the background value at a point. More...
|
|
lsst::afw::image::MaskedImage< InternalPixelT > | getStatsImage () const |
| Return the image of statistical quantities extracted from the image. More...
|
|
template<typename PixelT > |
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. More...
|
|
template<typename PixelT > |
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. More...
|
|
template<typename PixelT > |
std::shared_ptr< lsst::afw::image::Image< PixelT > > | getImage (lsst::geom::Box2I const &bbox, Interpolate::Style const interpStyle, UndersampleStyle const undersampleStyle=THROW_EXCEPTION) const |
|
template<typename PixelT > |
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 |
|
template<typename PixelT > |
std::shared_ptr< lsst::afw::image::Image< PixelT > > | getImage () const |
| Method to interpolate and return the background for entire image. More...
|
|
Interpolate::Style | getAsUsedInterpStyle () const |
| Return the Interpolate::Style that we actually used in the last call to getImage() More...
|
|
UndersampleStyle | getAsUsedUndersampleStyle () const |
| Return the UndersampleStyle that we actually used in the last call to getImage() More...
|
|
std::shared_ptr< math::Approximate< InternalPixelT > > | getApproximate (ApproximateControl const &actrl, UndersampleStyle const undersampleStyle=THROW_EXCEPTION) const |
| Method to return an approximation to the background. More...
|
|
lsst::geom::Box2I | getImageBBox () const |
| Return the input image's (PARENT) bounding box. More...
|
|
std::shared_ptr< BackgroundControl > | getBackgroundControl () |
|
std::shared_ptr< BackgroundControl const > | getBackgroundControl () const |
|
A class to evaluate image background levels.
Break an image up into nx*ny sub-images and use a statistical to estimate the background levels in each square. Then use a user-specified or algorithm to estimate background at a given pixel coordinate.
Methods are available to return the background at a point (inefficiently), or an entire background image. BackgroundControl contains a public StatisticsControl member to allow user control of how the backgrounds are computed.
math::BackgroundControl bctrl(7, 7); // number of sub-image squares in {x,y}-dimensions
bctrl.sctrl.setNumSigmaClip(5.0); // use 5-sigma clipping for the sub-image means
std::shared_ptr<math::Background> backobj = math::makeBackground(img, bctrl);
// get a whole background image
Image<PixelT> back = backobj->getImage<PixelT>(math::Interpolate::NATURAL_SPLINE);
there is also
// get the background at a pixel at i_x,i_y
double someValue = backobj.getPixel(math::Interpolate::LINEAR, i_x, i_y);
Definition at line 434 of file Background.h.
template<typename ImageT >
lsst::afw::math::BackgroundMI::BackgroundMI |
( |
ImageT const & |
img, |
|
|
BackgroundControl const & |
bgCtrl |
|
) |
| |
|
explicit |
Constructor for BackgroundMI.
Estimate the statistical properties of the Image in a grid of cells; we'll later call getImage() to interpolate those values, creating an image the same size as the original
- Parameters
-
img | ImageT (or MaskedImage) whose properties we want |
bgCtrl | Control how the BackgroundMI is estimated |
- Note
- If there are heavily masked or Nan regions in the image we may not be able to estimate all the cells in the "statsImage". Interpolation will still work, but if you want to prevent the code wildly extrapolating, it may be better to set the values directly; e.g.
defaultValue = 10
statsImage = afwMath.cast_BackgroundMI(bkgd).getStatsImage()
sim = statsImage.getImage().getArray()
sim[np.isnan(sim)] = defaultValue # replace NaN by defaultValue
bkgdImage = bkgd.getImageF(afwMath.Interpolate.NATURAL_SPLINE, afwMath.REDUCE_INTERP_ORDER)
There is a ticket (#2825) to allow getImage to specify a default value to use when interpolation fails
Definition at line 81 of file BackgroundMI.cc.