LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
30 #ifndef LSST_AFW_IMAGE_IMAGE_H
31 #define LSST_AFW_IMAGE_IMAGE_H
37 #include "boost/mpl/bool.hpp"
57 template <
typename PixelT>
60 template <
typename,
typename,
typename>
66 template <
typename ImagePT = PixelT>
71 template <
typename OtherPixelT>
84 explicit Image(
unsigned int width,
unsigned int height,
PixelT initialValue = 0);
117 const bool deep =
false);
127 Image(
const Image& rhs,
const bool deep =
false);
148 bool allowUnsafe =
false);
168 bool allowUnsafe =
false);
185 bool allowUnsafe =
false);
188 template <
typename OtherPixelT>
191 explicit Image(ndarray::Array<PixelT, 2, 1>
const& array,
bool deep =
false,
227 return Image(*
this,
bbox, origin,
false);
385 template <
typename LhsPixelT,
typename RhsPixelT>
386 Image<LhsPixelT>&
operator+=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
388 template <
typename LhsPixelT,
typename RhsPixelT>
389 Image<LhsPixelT>&
operator-=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
391 template <
typename LhsPixelT,
typename RhsPixelT>
392 Image<LhsPixelT>&
operator*=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
394 template <
typename LhsPixelT,
typename RhsPixelT>
395 Image<LhsPixelT>&
operator/=(Image<LhsPixelT>& lhs, Image<RhsPixelT>
const& rhs);
397 template <
typename PixelT>
398 void swap(Image<PixelT>&
a, Image<PixelT>&
b);
403 template <
typename PixelT>
463 int getWidth()
const {
return _image->getWidth(); }
468 int getX0()
const {
return _image->getX0(); }
470 int getY0()
const {
return _image->getY0(); }
525 template <
typename PixelT>
526 void swap(DecoratedImage<PixelT>&
a, DecoratedImage<PixelT>&
b);
537 template <
typename T1,
typename T2>
538 bool imagesOverlap(ImageBase<T1>
const& image1, ImageBase<T2>
const& image2);
void writeFits(std::string const &fileName, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
Write an image to a regular FITS file.
Image(Image< OtherPixelT > const &rhs, const bool deep)
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
A container for an Image and its associated metadata.
int getY0() const
Return the image's row-origin.
Image & operator*=(PixelT const rhs)
Multiply lhs by scalar rhs.
Represent a 2-dimensional array of bitmask pixels.
const int DEFAULT_HDU
Specify that the default HDU should be read.
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.
void scaledMultiplies(double const c, Image< PixelT > const &rhs)
Multiply lhs by Image c*rhs (i.e. pixel-by-pixel multiplication)
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
static Image readFits(fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
Read an Image from a FITS RAM file.
void setMetadata(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
DecoratedImage & operator=(const DecoratedImage &image)
Assignment operator.
Image & operator/=(PixelT const rhs)
Divide lhs by scalar rhs.
Image & operator+=(PixelT const rhs)
Add scalar rhs to lhs.
Lifetime-management for memory that goes into FITS memory files.
Options for writing an image to FITS.
void scaledPlus(double const c, Image< PixelT > const &rhs)
Add Image c*rhs to lhs.
void writeFits(std::string const &filename, fits::ImageWriteOptions const &options, std::string const &mode="w", std::shared_ptr< daf::base::PropertySet const > header=nullptr, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
Write an image to a regular FITS file.
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.
void swap(DecoratedImage &rhs)
void scaledMinus(double const c, Image< PixelT > const &rhs)
Subtract Image c*rhs from lhs.
Image operator[](lsst::geom::Box2I const &bbox) const
Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
static Image readFits(std::string const &filename, int hdu=fits::DEFAULT_HDU)
Read an Image from a regular FITS file.
A class to manipulate images, masks, and variance as a single object.
void setGain(double gain)
Set the DecoratedImage's gain.
void writeFits(fits::MemFileManager &manager, fits::ImageWriteOptions const &options, std::string const &mode="w", std::shared_ptr< daf::base::PropertySet const > header=nullptr, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
Write an image to a FITS RAM file.
int getX0() const
Return the image's column-origin.
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.
int getHeight() const
Return the number of rows in the image.
double getGain() const
Return the DecoratedImage's gain.
Image(ndarray::Array< PixelT, 2, 1 > const &array, bool deep=false, lsst::geom::Point2I const &xy0=lsst::geom::Point2I())
afw::table::PointKey< int > dimensions
A templated class to return this classes' type (present in Image/Mask/MaskedImage)
Image & operator=(const PixelT rhs)
Set the image's pixels to rhs.
void writeFits(fits::MemFileManager &manager, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
Write an image to a FITS RAM file.
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.
int getWidth() const
Return the number of columns in the image.
std::shared_ptr< Image< PixelT > const > getImage() const
Return a shared_ptr to the DecoratedImage's Image as const.
detail::Image_tag image_category
A base class for image defects.
DecoratedImage(const lsst::geom::Extent2I &dimensions=lsst::geom::Extent2I())
Create an image of the specified size.
void writeFits(fits::Fits &fitsfile, fits::ImageWriteOptions const &options, std::shared_ptr< daf::base::PropertySet const > header=nullptr, std::shared_ptr< Mask< MaskPixel > const > mask=nullptr) const
Write an image to an open FITS file object.
lsst::geom::Box2I bboxFromMetadata(daf::base::PropertySet &metadata)
Determine the image bounding box from its metadata (FITS header)
table::Key< double > gain
std::shared_ptr< Image< PixelT > > getImage()
Return a shared_ptr to the DecoratedImage's Image.
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.
const lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Class for storing generic metadata.
Image subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
An integer coordinate rectangle.
void swap(Image< PixelT > &a, Image< PixelT > &b)
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.
bool imagesOverlap(ImageBase< T1 > const &image1, ImageBase< T2 > const &image2)
Return true if the pixels for two images or masks overlap in memory.
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.
std::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
A class to represent a 2-dimensional array of pixels.
~Image() override=default
Image & operator-=(PixelT const rhs)
Subtract scalar rhs from lhs.
The base class for all image classed (Image, Mask, MaskedImage, ...)
void writeFits(fits::Fits &fitsfile, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >()) const
Write an image to an open FITS file object.
Image< ImagePT > type
Return the desired type.
void scaledDivides(double const c, Image< PixelT > const &rhs)
Divide lhs by Image c*rhs (i.e. pixel-by-pixel division)
void writeFits(std::string const &fileName, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
Write a FITS file.