Template Class Image¶
Defined in File Image.h
Inheritance Relationships¶
Base Type¶
public lsst::afw::image::ImageBase< PixelT >(Template Class ImageBase)
Derived Type¶
public lsst::afw::image::ImageSlice< PixelT >(Template Class ImageSlice)
Class Documentation¶
-
template<typename
PixelT>
classImage: public lsst::afw::image::ImageBase<PixelT> 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
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.
-
Image &
operator+=(lsst::afw::math::Function2<double> const &function)¶ Add a Function2(x, y) to an Image
- Parameters
function: function to add
-
Image &
operator-=(PixelT const rhs)¶ Subtract scalar 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
-
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
-
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::Image::MaskedImage
-
friend
lsst::afw::image::Image::Image
Related
-