30#ifndef LSST_AFW_IMAGE_IMAGE_H
31#define LSST_AFW_IMAGE_IMAGE_H
50template <
typename PixelT>
53 template <
typename,
typename,
typename>
59 template <
typename ImagePT = PixelT>
64 template <
typename OtherPixelT>
77 explicit Image(
unsigned int width,
unsigned int height, PixelT initialValue = 0);
110 const bool deep =
false);
120 Image(
const Image& rhs,
const bool deep =
false);
141 bool allowUnsafe =
false);
161 bool allowUnsafe =
false);
178 bool allowUnsafe =
false);
181 template <
typename OtherPixelT>
184 explicit Image(ndarray::Array<PixelT, 2, 1>
const& array,
bool deep =
false,
220 return Image(*
this,
bbox, origin,
false);
239 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
256 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
270 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
288 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
309 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
328 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
358 void swap(
Image& rhs);
411template <
typename LhsPixelT,
typename RhsPixelT>
412Image<LhsPixelT>&
operator+=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
414template <
typename LhsPixelT,
typename RhsPixelT>
415Image<LhsPixelT>&
operator-=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
417template <
typename LhsPixelT,
typename RhsPixelT>
418Image<LhsPixelT>&
operator*=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
420template <
typename LhsPixelT,
typename RhsPixelT>
421Image<LhsPixelT>&
operator/=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
423template <
typename PixelT>
424void swap(Image<PixelT>&
a, Image<PixelT>&
b);
429template <
typename PixelT>
489 int getWidth()
const {
return _image->getWidth(); }
494 int getX0()
const {
return _image->getX0(); }
496 int getY0()
const {
return _image->getY0(); }
514 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
532 [[deprecated(
"Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
561template <
typename PixelT>
562void swap(DecoratedImage<PixelT>&
a, DecoratedImage<PixelT>&
b);
573template <
typename T1,
typename T2>
574bool imagesOverlap(ImageBase<T1>
const& image1, ImageBase<T2>
const& image2);
table::Key< double > gain
afw::table::PointKey< int > dimensions
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Lifetime-management for memory that goes into FITS memory files.
A container for an Image and its associated metadata.
const lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
DecoratedImage & operator=(const DecoratedImage &image)
Assignment operator.
double getGain() const
Return the DecoratedImage's gain.
int getY0() const
Return the image's row-origin.
int getHeight() const
Return the number of rows in the image.
void setMetadata(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
int getX0() const
Return the image's column-origin.
void writeFits(std::string const &fileName, daf::base::PropertySet const *metadata=nullptr, std::string const &mode="w") const
Write a FITS file.
std::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
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.
void setGain(double gain)
Set the DecoratedImage's gain.
int getWidth() const
Return the number of columns in the image.
The base class for all image classed (Image, Mask, MaskedImage, ...)
_view_t _getRawView() const
A class to represent a 2-dimensional array of pixels.
void writeFits(std::string const &filename, fits::ImageWriteOptions const &options, std::string const &mode="w", daf::base::PropertySet const *header=nullptr, Mask< MaskPixel > const *mask=nullptr) const
Write an image to a regular FITS file.
Image & operator*=(PixelT const rhs)
Multiply lhs by scalar rhs.
void writeFits(fits::Fits &fitsfile, fits::ImageWriteOptions const &options, std::shared_ptr< daf::base::PropertySet const > header, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
Image & operator-=(PixelT const rhs)
Subtract scalar rhs from lhs.
void scaledPlus(PixelT const c, Image< PixelT > const &rhs)
Add Image c*rhs to lhs.
Image(fits::Fits &fitsfile, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Construct an Image from an already-open FITS object.
Image & operator=(const PixelT rhs)
Set the image's pixels to rhs.
Image subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
void writeFits(fits::MemFileManager &manager, fits::ImageWriteOptions const &options, std::string const &mode="w", daf::base::PropertySet const *header=nullptr, Mask< MaskPixel > const *mask=nullptr) const
Write an image to a FITS RAM file.
Image(fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Construct an Image by reading a FITS image in memory.
Image operator[](lsst::geom::Box2I const &bbox) const
Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
Image & operator+=(PixelT const rhs)
Add scalar rhs to lhs.
static Image readFits(fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
Read an Image from a FITS RAM file.
void writeFits(fits::MemFileManager &manager, fits::ImageWriteOptions const &options, std::string const &mode, std::shared_ptr< daf::base::PropertySet const > header, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
~Image() override=default
void scaledMinus(PixelT const c, Image< PixelT > const &rhs)
Subtract Image c*rhs from lhs.
void writeFits(fits::MemFileManager &manager, daf::base::PropertySet const *metadata=nullptr, std::string const &mode="w") const
Write an image to a FITS RAM file.
Image & operator/=(PixelT const rhs)
Divide lhs by scalar rhs.
Image(ndarray::Array< PixelT, 2, 1 > const &array, bool deep=false, lsst::geom::Point2I const &xy0=lsst::geom::Point2I())
void writeFits(std::string const &filename, fits::ImageWriteOptions const &options, std::string const &mode, std::shared_ptr< daf::base::PropertySet const > header, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
Image(Image< OtherPixelT > const &rhs, const bool deep)
void writeFits(std::string const &fileName, daf::base::PropertySet const *metadata=nullptr, std::string const &mode="w") const
Write an image to a regular FITS file.
void scaledDivides(PixelT const c, Image< PixelT > const &rhs)
Divide lhs by Image c*rhs (i.e. pixel-by-pixel division)
static Image readFits(std::string const &filename, int hdu=fits::DEFAULT_HDU)
Read an Image from a regular FITS file.
void scaledMultiplies(PixelT const c, Image< PixelT > const &rhs)
Multiply lhs by Image c*rhs (i.e. pixel-by-pixel multiplication)
Image(std::string const &fileName, int hdu=fits::DEFAULT_HDU, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Construct an Image by reading a regular FITS file.
void writeFits(fits::MemFileManager &manager, std::shared_ptr< daf::base::PropertySet const > metadata, std::string const &mode="w") const
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata, std::string const &mode="w") const
void writeFits(fits::Fits &fitsfile, daf::base::PropertySet const *metadata=nullptr) const
Write an image to an open FITS file object.
void writeFits(fits::Fits &fitsfile, fits::ImageWriteOptions const &options, daf::base::PropertySet const *header=nullptr, Mask< MaskPixel > const *mask=nullptr) const
Write an image to an open FITS file object.
void writeFits(fits::Fits &fitsfile, std::shared_ptr< daf::base::PropertySet const > metadata) const
Represent a 2-dimensional array of bitmask pixels.
A class to manipulate images, masks, and variance as a single object.
A Function taking two arguments.
Class for storing generic metadata.
An integer coordinate rectangle.
const int DEFAULT_HDU
Specify that the default HDU should be read.
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.
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.
lsst::geom::Box2I bboxFromMetadata(daf::base::PropertySet &metadata)
Determine the image bounding box from its metadata (FITS header)
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.
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.
bool imagesOverlap(ImageBase< T1 > const &image1, ImageBase< T2 > const &image2)
Return true if the pixels for two images or masks overlap in memory.
Options for writing an image to FITS.
A templated class to return this classes' type (present in Image/Mask/MaskedImage)