File Image.h¶
-
namespace
lsst Class for a simple mapping implementing a generic AstrometryTransform.
Remove all non-astronomical counts from the Chunk Exposure’s pixels.
Forward declarations for lsst::utils::Cache
For details on the Cache class, see the Cache.h file.
It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.
A base class for image defects
Numeric constants used by the Integrate.h integrator routines.
Compute Image Statistics
- Note
Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.
- Note
The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.
-
namespace
afw -
namespace
image Functions
-
template<typename
LhsPixelT, typenameRhsPixelT>
Image<LhsPixelT> &operator+=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const &rhs)¶ Add lhs to Image rhs (i.e. pixel-by-pixel addition) where types are different.
-
template<typename
LhsPixelT, typenameRhsPixelT>
Image<LhsPixelT> &operator-=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const &rhs)¶ Subtract lhs from Image rhs (i.e. pixel-by-pixel subtraction) where types are different.
-
template<typename
LhsPixelT, typenameRhsPixelT>
Image<LhsPixelT> &operator*=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const &rhs)¶ Multiply lhs by Image rhs (i.e. pixel-by-pixel multiplication) where types are different.
-
template<typename
LhsPixelT, typenameRhsPixelT>
Image<LhsPixelT> &operator/=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const &rhs)¶ Divide lhs by Image rhs (i.e. pixel-by-pixel division) where types are different.
-
template<typename
PixelT>
voidswap(DecoratedImage<PixelT> &a, DecoratedImage<PixelT> &b)¶
-
template<typename
PixelT>
classDecoratedImage - #include <Image.h>
A container for an Image and its associated metadata
Public Functions
-
DecoratedImage(const lsst::geom::Extent2I &dimensions = lsst::geom::Extent2I()) Create an image of the specified size
- Parameters
dimensions: desired number of columns. rows
-
DecoratedImage(const lsst::geom::Box2I &bbox) Create an image of the specified size
- Note
Many lsst::afw::image and lsst::afw::math objects define a
dimensionsmember which may be conveniently used to make objects of an appropriate size- Parameters
bbox: (width, height) and origin of the desired Image
Create a DecoratedImage wrapping
rhsNote that this ctor shares pixels with the rhs; it isn’t a deep copy
- Parameters
rhs: Image to go into DecoratedImage
-
DecoratedImage(DecoratedImage const &rhs, const bool deep = false) Copy constructor
Note that the lhs will share memory with the rhs unless
deepis true- Parameters
rhs: right hand sidedeep: Make deep copy?
-
DecoratedImage(std::string const &fileName, const int hdu = fits::DEFAULT_HDU, lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin const origin = PARENT, bool allowUnsafe = false) Create a DecoratedImage from a FITS file
- Parameters
fileName: File to readhdu: The HDU to readbbox: Only read these pixelsorigin: Coordinate system of the bboxallowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.
-
DecoratedImage &
operator=(const DecoratedImage &image) Assignment operator
N.b. this is a shallow assignment; use set(src) if you want to copy the pixels
-
int
getWidth() const Return the number of columns in the image.
-
int
getHeight() const Return the number of rows in the image.
-
int
getX0() const Return the image’s column-origin.
-
int
getY0() const Return the image’s row-origin.
-
const lsst::geom::Extent2I
getDimensions() const Return the image’s size; useful for passing to constructors.
-
void
swap(DecoratedImage &rhs)
Write a FITS file
- Parameters
fileName: the file to writemetadata: metadata to write to header; or NULLmode: “w” to write a new file; “a” to append
Write a FITS file
- Parameters
[in] fileName: the file to write[in] options: Options controlling writing of FITS image.[in] metadata: metadata to write to header; or NULL[in] mode: “w” to write a new file; “a” to append
-
std::shared_ptr<Image<PixelT>>
getImage() Return a shared_ptr to the DecoratedImage’s Image.
-
std::shared_ptr<Image<PixelT> const>
getImage() const Return a shared_ptr to the DecoratedImage’s Image as const.
-
double
getGain() const Return the DecoratedImage’s gain
- Note
This is mostly just a place holder for other properties that we might want to associate with a DecoratedImage
-
void
setGain(double gain) Set the DecoratedImage’s gain.
Private Functions
-
void
init()¶
-
-
template<typename
PixelT>
classImage: public lsst::afw::image::ImageBase<PixelT> - #include <Image.h>
A class to represent a 2-dimensional array of pixels.
Subclassed by lsst::afw::image::ImageSlice< PixelT >
Public Functions
-
Image(unsigned int width, unsigned int height, PixelT initialValue = 0) Create an initialised Image of the specified size
- Note
Many lsst::afw::image and lsst::afw::math objects define a
dimensionsmember which may be conveniently used to make objects of an appropriate size- Parameters
width: number of columnsheight: number of rowsinitialValue: Initial value
-
Image(lsst::geom::Extent2I const &dimensions = lsst::geom::Extent2I(), PixelT initialValue = 0) Create an initialised Image of the specified size
- Note
Many lsst::afw::image and lsst::afw::math objects define a
dimensionsmember which may be conveniently used to make objects of an appropriate size- Parameters
dimensions: Number of columns, rowsinitialValue: Initial value
-
Image(lsst::geom::Box2I const &bbox, PixelT initialValue = 0) Create an initialized Image of the specified size
- Parameters
bbox: dimensions and origin of desired ImageinitialValue: Initial value
-
Image(Image const &rhs, lsst::geom::Box2I const &bbox, ImageOrigin const origin = PARENT, const bool deep = false) Copy constructor to make a copy of part of an Image.
The bbox ignores X0/Y0 if origin == LOCAL, and uses it if origin == PARENT.
- Note
Unless
deepistrue, the new image will share the old image’s pixels; this is probably what you want- Parameters
-
Image(const Image &rhs, const bool deep = false) Copy constructor.
-
Image(Image &&rhs)
Construct an Image by reading a regular FITS file.
- Parameters
[in] fileName: File to read.[in] hdu: HDU to read, 0-indexed (i.e. 0=Primary HDU). The special value of afw::fits::DEFAULT_HDU reads the Primary HDU unless it is empty, in which case it reads the first extension HDU.[inout] metadata: Metadata read from the header (may be null).[in] bbox: If non-empty, read only the pixels within the bounding box.[in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.[in] allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.
Construct an Image by reading a FITS image in memory.
- Parameters
[in] manager: An object that manages the memory buffer to read.[in] hdu: HDU to read, 0-indexed (i.e. 0=Primary HDU). The special value of afw::fits::DEFAULT_HDU reads the Primary HDU unless it is empty, in which case it reads the first extension HDU.[inout] metadata: Metadata read from the header (may be null).[in] bbox: If non-empty, read only the pixels within the bounding box.[in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.[in] allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.
Construct an Image from an already-open FITS object.
- Parameters
[in] fitsfile: A FITS object to read from, already at the desired HDU.[inout] metadata: Metadata read from the header (may be null).[in] bbox: If non-empty, read only the pixels within the bounding box.[in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.[in] allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.
-
template<typename
OtherPixelT>Image(Image<OtherPixelT> const &rhs, const bool deep)
-
Image(ndarray::Array<PixelT, 2, 1> const &array, bool deep = false, lsst::geom::Point2I const &xy0 = lsst::geom::Point2I())
-
~Image()
-
Image &
operator=(const PixelT rhs) Set the image’s pixels to rhs.
-
Image &
operator=(const Image &rhs) Assignment operator.
- Note
that this has the effect of making the lhs share pixels with the rhs which may not be what you intended; to copy the pixels, use assign(rhs)
- Note
this behaviour is required to make the swig interface work, otherwise I’d declare this function private
-
Image &
operator=(Image &&rhs)
-
Image
subset(lsst::geom::Box2I const &bbox, ImageOrigin origin = PARENT) const Return a subimage corresponding to the given box.
This method is wrapped as
getitem in Python.- Return
A subimage view into this.
- Parameters
bbox: Bounding box of the subimage returned.origin: Origin bbox is rleative to; PARENT accounts for xy0, LOCAL does not.
- Note
This method permits mutable views to be obtained from const references to images (just as the copy constructor does). This is an intrinsic flaw in Image’s design.
-
Image
operator[](lsst::geom::Box2I const &bbox) const Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
Write an image to a regular FITS file.
- Parameters
[in] fileName: Name of the file to write.[in] metadata: Additional values to write to the header (may be null).[in] mode: “w”=Create a new file; “a”=Append a new HDU.
Write an image to a FITS RAM file.
- Parameters
[in] manager: Manager object for the memory block to write to.[in] metadata: Additional values to write to the header (may be null).[in] mode: “w”=Create a new file; “a”=Append a new HDU.
Write an image to an open FITS file object.
- Parameters
[in] fitsfile: A FITS file already open to the desired HDU.[in] metadata: Additional values to write to the header (may be null).
Write an image to a regular FITS file.
- Parameters
[in] filename: Name of the file to write.[in] options: Options controlling writing of FITS image.[in] mode: “w”=Create a new file; “a”=Append a new HDU.[in] header: Additional values to write to the header (may be null).[in] mask: Mask, for calculation of statistics.
Write an image to a FITS RAM file.
- Parameters
[in] manager: Manager object for the memory block to write to.[in] options: Options controlling writing of FITS image.[in] header: Additional values to write to the header (may be null).[in] mode: “w”=Create a new file; “a”=Append a new HDU.[in] mask: Mask, for calculation of statistics.
Write an image to an open FITS file object.
- Parameters
[in] fitsfile: A FITS file already open to the desired HDU.[in] options: Options controlling writing of FITS image.[in] header: Additional values to write to the header (may be null).[in] mask: Mask, for calculation of statistics.
-
void
swap(Image &rhs)
-
Image &
operator+=(PixelT const rhs) Add scalar rhs to lhs.
-
virtual Image &
operator+=(Image<PixelT> const &rhs) Add Image rhs to lhs.
-
Image &
operator+=(lsst::afw::math::Function2<double> const &function) Add a Function2(x, y) to an Image
- Parameters
function: function to add
-
void
scaledPlus(double const c, Image<PixelT> const &rhs) Add Image c*rhs to lhs.
-
Image &
operator-=(PixelT const rhs) Subtract scalar rhs from lhs.
-
Image &
operator-=(Image<PixelT> const &rhs) Subtract Image rhs from lhs.
-
Image &
operator-=(lsst::afw::math::Function2<double> const &function) Subtract a Function2(x, y) from an Image
- Parameters
function: function to add
-
void
scaledMinus(double const c, Image<PixelT> const &rhs) Subtract Image c*rhs from lhs.
-
Image &
operator*=(PixelT const rhs) Multiply lhs by scalar rhs.
-
Image &
operator*=(Image<PixelT> const &rhs) Multiply lhs by Image rhs (i.e. pixel-by-pixel multiplication)
-
void
scaledMultiplies(double const c, Image<PixelT> const &rhs) Multiply lhs by Image c*rhs (i.e. pixel-by-pixel multiplication)
-
Image &
operator/=(PixelT const rhs) Divide lhs by scalar rhs
- Note
Floating point types implement this by multiplying by the 1/rhs
-
Image &
operator/=(Image<PixelT> const &rhs) Divide lhs by Image rhs (i.e. pixel-by-pixel division)
-
void
scaledDivides(double const c, Image<PixelT> const &rhs) Divide lhs by Image c*rhs (i.e. pixel-by-pixel division)
-
void
sqrt()
Public Static Functions
-
static Image
readFits(std::string const &filename, int hdu = fits::DEFAULT_HDU) Read an Image from a regular FITS file.
- Parameters
[in] filename: Name of the file to read.[in] hdu: Number of the “header-data unit” to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as “the first HDU with NAXIS != 0”.
-
static Image
readFits(fits::MemFileManager &manager, int hdu = fits::DEFAULT_HDU) Read an Image from a FITS RAM file.
- Parameters
[in] manager: Object that manages the memory to be read.[in] hdu: Number of the “header-data unit” to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as “the first HDU with NAXIS != 0”.
Friends
-
friend
lsst::afw::image::MaskedImage
-
friend
lsst::afw::image::Image
-
template<typename
ImagePT= PixelT>
structImageTypeFactory - #include <Image.h>
A templated class to return this classes’ type (present in Image/Mask/MaskedImage)
Public Types
-
template<>
typedef Image<ImagePT>type Return the desired type.
-
template<>
-
-
template<typename
-
namespace