LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT > Class Template Reference

A class to contain the data, WCS, and other information needed to describe an image of the sky. More...

#include <Exposure.h>

Public Types

using MaskedImageT = MaskedImage< ImageT, MaskT, VarianceT >
 

Public Member Functions

 Exposure (unsigned int width, unsigned int height, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
 Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which may be default constructed) More...
 
 Exposure (lsst::geom::Extent2I const &dimensions=lsst::geom::Extent2I(), std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
 Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which may be default constructed) More...
 
 Exposure (lsst::geom::Box2I const &bbox, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
 Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs. More...
 
 Exposure (MaskedImageT &maskedImage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
 Construct an Exposure from a MaskedImage and an optional SkyWcs. More...
 
 Exposure (MaskedImageT &maskedImage, std::shared_ptr< ExposureInfo > info)
 Construct an Exposure from a MaskedImage and an ExposureInfo. More...
 
 Exposure (std::string const &fileName, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct an Exposure by reading a regular FITS file. More...
 
 Exposure (fits::MemFileManager &manager, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct an Exposure by reading a FITS image in memory. More...
 
 Exposure (fits::Fits &fitsfile, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct an Exposure from an already-open FITS object. More...
 
 Exposure (Exposure const &src, bool const deep=false)
 Copy an Exposure. More...
 
 Exposure (Exposure &&src)
 
 Exposure (Exposure const &src, lsst::geom::Box2I const &bbox, ImageOrigin const origin=PARENT, bool const deep=false)
 Construct a subExposure given an Exposure and a bounding box. More...
 
template<typename OtherPixelT >
 Exposure (Exposure< OtherPixelT, MaskT, VarianceT > const &rhs, const bool deep)
 generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/2 conversions between N ImageBase types. More...
 
Exposureoperator= (Exposure const &)
 
Exposureoperator= (Exposure &&)
 
Exposure subset (lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
 Return a subimage corresponding to the given box. More...
 
Exposure operator[] (lsst::geom::Box2I const &bbox) const
 Return a subimage corresponding to the given box (interpreted as PARENT coordinates). More...
 
virtual ~Exposure ()
 Destructor. More...
 
MaskedImageT getMaskedImage ()
 Return the MaskedImage. More...
 
MaskedImageT getMaskedImage () const
 Return the MaskedImage. More...
 
std::shared_ptr< geom::SkyWcs const > getWcs () const
 
std::shared_ptr< lsst::afw::cameraGeom::Detector const > getDetector () const
 Return the Exposure's Detector information. More...
 
Filter getFilter () const
 Return the Exposure's filter. More...
 
std::shared_ptr< FilterLabel const > getFilterLabel () const
 Return the Exposure's filter information. More...
 
std::shared_ptr< lsst::daf::base::PropertySetgetMetadata () const
 Return flexible metadata. More...
 
void setMetadata (std::shared_ptr< lsst::daf::base::PropertySet > metadata)
 
int getWidth () const
 Return the Exposure's width. More...
 
int getHeight () const
 Return the Exposure's height. More...
 
lsst::geom::Extent2I getDimensions () const
 Return the Exposure's size. More...
 
int getX0 () const
 Return the Exposure's column-origin. More...
 
int getY0 () const
 Return the Exposure's row-origin. More...
 
lsst::geom::Point2I getXY0 () const
 Return the Exposure's origin. More...
 
lsst::geom::Box2I getBBox (ImageOrigin const origin=PARENT) const
 
void setXY0 (lsst::geom::Point2I const &origin)
 Set the Exposure's origin (including correcting the Wcs) More...
 
void setMaskedImage (MaskedImageT &maskedImage)
 Set the MaskedImage of the Exposure. More...
 
void setWcs (std::shared_ptr< geom::SkyWcs > wcs)
 
void setDetector (std::shared_ptr< lsst::afw::cameraGeom::Detector const > detector)
 Set the Exposure's Detector information. More...
 
void setFilter (Filter const &filter)
 Set the Exposure's filter. More...
 
void setFilterLabel (std::shared_ptr< FilterLabel const > filterLabel)
 Set the Exposure's filter information. More...
 
void setPhotoCalib (std::shared_ptr< PhotoCalib const > photoCalib)
 Set the Exposure's PhotoCalib object. More...
 
std::shared_ptr< PhotoCalib const > getPhotoCalib () const
 Return the Exposure's PhotoCalib object. More...
 
void setPsf (std::shared_ptr< lsst::afw::detection::Psf const > psf)
 Set the Exposure's Psf. More...
 
std::shared_ptr< lsst::afw::detection::Psf const > getPsf () const
 Return the Exposure's Psf object. More...
 
bool hasPsf () const
 Does this Exposure have a Psf? More...
 
bool hasWcs () const
 Does this Exposure have a Wcs? More...
 
std::shared_ptr< ExposureInfogetInfo ()
 Get the ExposureInfo that aggregates all the non-image components. Never null. More...
 
std::shared_ptr< ExposureInfo const > getInfo () const
 Get the ExposureInfo that aggregates all the non-image components. Never null. More...
 
void setInfo (std::shared_ptr< ExposureInfo > exposureInfo)
 Set the ExposureInfo that aggregates all the non-image components. More...
 
void writeFits (std::string const &fileName) const
 Write an Exposure to a regular multi-extension FITS file. More...
 
void writeFits (fits::MemFileManager &manager) const
 Write an Exposure to a multi-extension FITS file in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write an Exposure to an already-open FITS file object. More...
 
void writeFits (std::string const &fileName, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions) const
 Write an Exposure to a regular multi-extension FITS file. More...
 
void writeFits (fits::MemFileManager &manager, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions) const
 Write an Exposure to a regular multi-extension FITS file. More...
 
void writeFits (fits::Fits &fitsfile, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions) const
 Write an Exposure to a regular multi-extension FITS file. More...
 
Exposure getCutout (lsst::geom::SpherePoint const &center, lsst::geom::Extent2I const &size) const
 Return an Exposure that is a small cutout of the original. More...
 

Static Public Member Functions

static Exposure readFits (std::string const &filename)
 Read an Exposure from a regular FITS file. More...
 
static Exposure readFits (fits::MemFileManager &manager)
 Read an Exposure from a FITS RAM file. More...
 

Detailed Description

template<typename ImageT, typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
class lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >

A class to contain the data, WCS, and other information needed to describe an image of the sky.

Exposure Class Implementation for LSST: a templated framework class for creating an Exposure from a MaskedImage and a Wcs.

An Exposure is required to take one afwImage::MaskedImage or a region (col, row) defining the size of a MaskedImage (this can be of size 0,0). An Exposure can (but is not required to) contain an afwImage::SkyWcs.

The template types should optimally be a float, double, unsigned int 16 bit, or unsigned int 32 bit for the image (pixel) type and an unsigned int 32 bit for the mask type. These types have been explicitly instantiated for the Exposure class. All MaskedImage and Wcs constructors are 'const' to allow for views and copying.

An Exposure can get and return its MaskedImage, SkyWcs, and a subExposure. The getSubExposure member takes a BBox region defining the subRegion of the original Exposure to be returned. The member retrieves the MaskedImage corresponding to the subRegion. The MaskedImage class throws an exception for any subRegion extending beyond the original MaskedImage bounding box. This member is not yet fully implemented because it requires the SkyWcs class to return the SkyWcs metadata to the member so the CRPIX values of the SkyWcs can be adjusted to reflect the new subMaskedImage origin. The getSubExposure member will eventually return a subExposure consisting of the subMAskedImage and the SkyWcs object with its corresponding adjusted metadata.

The hasWcs member is used to determine if the Exposure has a SkyWcs. It is not required to have one.

Definition at line 72 of file Exposure.h.

Member Typedef Documentation

◆ MaskedImageT

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
using lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::MaskedImageT = MaskedImage<ImageT, MaskT, VarianceT>

Definition at line 74 of file Exposure.h.

Constructor & Destructor Documentation

◆ Exposure() [1/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( unsigned int  width,
unsigned int  height,
std::shared_ptr< geom::SkyWcs const >  wcs = std::shared_ptr<geom::SkyWcs const>() 
)
explicit

Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which may be default constructed)

Parameters
widthnumber of columns
heightnumber of rows
wcsthe SkyWcs

Definition at line 46 of file Exposure.cc.

48  : _maskedImage(width, height), _info(new ExposureInfo(wcs)) {}
Key< int > wcs
Definition: Exposure.cc:64

◆ Exposure() [2/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( lsst::geom::Extent2I const &  dimensions = lsst::geom::Extent2I(),
std::shared_ptr< geom::SkyWcs const >  wcs = std::shared_ptr<geom::SkyWcs const>() 
)
explicit

Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which may be default constructed)

Parameters
dimensionsdesired image width/height
wcsthe SkyWcs

Definition at line 51 of file Exposure.cc.

53  : _maskedImage(dimensions), _info(new ExposureInfo(wcs)) {}
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:48

◆ Exposure() [3/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( lsst::geom::Box2I const &  bbox,
std::shared_ptr< geom::SkyWcs const >  wcs = std::shared_ptr<geom::SkyWcs const>() 
)
explicit

Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs.

Parameters
bboxdesired image width/height, and origin
wcsthe SkyWcs

Definition at line 56 of file Exposure.cc.

58  : _maskedImage(bbox), _info(new ExposureInfo(wcs)) {}
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117

◆ Exposure() [4/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( MaskedImageT maskedImage,
std::shared_ptr< geom::SkyWcs const >  wcs = std::shared_ptr<geom::SkyWcs const>() 
)
explicit

Construct an Exposure from a MaskedImage and an optional SkyWcs.

Parameters
maskedImagethe MaskedImage
wcsthe SkyWcs

Definition at line 61 of file Exposure.cc.

63  : _maskedImage(maskedImage), _info(new ExposureInfo(wcs)) {}

◆ Exposure() [5/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( MaskedImageT maskedImage,
std::shared_ptr< ExposureInfo info 
)
explicit

Construct an Exposure from a MaskedImage and an ExposureInfo.

If the ExposureInfo is an empty pointer then a new empty ExposureInfo is used

Parameters
maskedImagethe MaskedImage
infothe ExposureInfo

Definition at line 66 of file Exposure.cc.

67  : _maskedImage(maskedImage), _info(info ? info : std::make_shared<ExposureInfo>()) {}

◆ Exposure() [6/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( std::string const &  fileName,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct an Exposure by reading a regular FITS file.

Parameters
[in]fileNameFile to read.
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 83 of file Exposure.cc.

85  : _maskedImage(), _info(new ExposureInfo()) {
86  ExposureFitsReader reader(fileName);
87  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
88 }

◆ Exposure() [7/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( fits::MemFileManager manager,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct an Exposure by reading a FITS image in memory.

Parameters
[in]managerAn object that manages the memory buffer to read.
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 91 of file Exposure.cc.

93  : _maskedImage(), _info(new ExposureInfo()) {
94  ExposureFitsReader reader(manager);
95  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
96 }

◆ Exposure() [8/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( fits::Fits fitsfile,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct an Exposure from an already-open FITS object.

Parameters
[in]fitsfileA FITS object to read from. Current HDU is ignored.
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 99 of file Exposure.cc.

100  {
101  ExposureFitsReader reader(&fitsFile);
102  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
103 }

◆ Exposure() [9/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( Exposure< ImageT, MaskT, VarianceT > const &  src,
bool const  deep = false 
)

Copy an Exposure.

Parameters
srcParent Exposure
deepShould we copy the pixels?

Definition at line 70 of file Exposure.cc.

71  : _maskedImage(src.getMaskedImage(), deep), _info(new ExposureInfo(*src.getInfo(), deep)) {}
std::shared_ptr< RecordT > src
Definition: Match.cc:48

◆ Exposure() [10/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( Exposure< ImageT, MaskT, VarianceT > &&  src)

Definition at line 74 of file Exposure.cc.

74 : Exposure(src) {}
Exposure(unsigned int width, unsigned int height, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which ma...
Definition: Exposure.cc:46

◆ Exposure() [11/12]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( Exposure< ImageT, MaskT, VarianceT > const &  src,
lsst::geom::Box2I const &  bbox,
ImageOrigin const  origin = PARENT,
bool const  deep = false 
)

Construct a subExposure given an Exposure and a bounding box.

Parameters
srcParent Exposure
bboxDesired region in Exposure
originCoordinate system for bbox
deepShould we copy the pixels?
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif the requested subRegion is not fully contained by the original MaskedImage BBox.

Definition at line 77 of file Exposure.cc.

79  : _maskedImage(src.getMaskedImage(), bbox, origin, deep),
80  _info(new ExposureInfo(*src.getInfo(), deep)) {}

◆ Exposure() [12/12]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
template<typename OtherPixelT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::Exposure ( Exposure< OtherPixelT, MaskT, VarianceT > const &  rhs,
const bool  deep 
)
inline

generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/2 conversions between N ImageBase types.

We only support converting the Image part

Parameters
rhsInput Exposure
deepMust be true; needed to disambiguate

Definition at line 189 of file Exposure.h.

192  : _maskedImage(rhs.getMaskedImage(), deep), _info(new ExposureInfo(*rhs.getInfo(), deep)) {
193  if (not deep) {
195  "Exposure's converting copy constructor must make a deep copy");
196  }
197  }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66

◆ ~Exposure()

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::~Exposure ( )
virtualdefault

Destructor.

Member Function Documentation

◆ getBBox()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
lsst::geom::Box2I lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getBBox ( ImageOrigin const  origin = PARENT) const
inline

Definition at line 279 of file Exposure.h.

279  {
280  return _maskedImage.getBBox(origin);
281  }
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: MaskedImage.h:1058

◆ getCutout()

template<typename ImageT , typename MaskT , typename VarianceT >
Exposure< ImageT, MaskT, VarianceT > lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getCutout ( lsst::geom::SpherePoint const &  center,
lsst::geom::Extent2I const &  size 
) const

Return an Exposure that is a small cutout of the original.

Parameters
centerdesired center of cutout (in RA and Dec)
sizewidth and height (in that order) of cutout in pixels
Returns
An Exposure of the requested size centered on center to within half a pixel in either dimension. Pixels past the edge of the original exposure will equal math::edgePixel<MaskedImageT>.
Exceptions
lsst::pex::exceptions::LogicErrorThrown if this Exposure does not have a WCS.
lsst::pex::exceptions::InvalidParameterErrorThrown if center falls outside this Exposure or if size is not a valid size.

Definition at line 204 of file Exposure.cc.

205  {
206  if (!hasWcs()) {
207  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot look up source position without WCS.");
208  }
209  lsst::geom::Point2D pixelCenter = getWcs()->skyToPixel(center);
210 
211  if (!lsst::geom::Box2D(getBBox()).contains(pixelCenter)) {
212  std::stringstream buffer;
213  buffer << "Point " << center << " lies at pixel " << pixelCenter << ", which lies outside Exposure "
214  << getBBox();
215  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, buffer.str());
216  }
217  if (size[0] <= 0 || size[1] <= 0) {
218  std::stringstream buffer;
219  buffer << "Cannot create bounding box with dimensions " << size;
220  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, buffer.str());
221  }
223 
224  // cutout must have independent ExposureInfo
225  auto copyInfo = std::make_shared<ExposureInfo>(*getInfo());
226  MaskedImageT blank(bbox); // Can't initialize Exposure with a temporary
227  blank = math::edgePixel<MaskedImageT>(
229  Exposure cutout(blank, copyInfo);
230 
231  _copyCommonPixels(cutout, *this);
232  return cutout;
233 }
bool hasWcs() const
Does this Exposure have a Wcs?
Definition: Exposure.h:333
std::shared_ptr< geom::SkyWcs const > getWcs() const
Definition: Exposure.h:232
std::shared_ptr< ExposureInfo > getInfo()
Get the ExposureInfo that aggregates all the non-image components. Never null.
Definition: Exposure.h:336
MaskedImage< ImageT, MaskT, VarianceT > MaskedImageT
Definition: Exposure.h:74
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: Exposure.h:279
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
An integer coordinate rectangle.
Definition: Box.h:55
static Box2I makeCenteredBox(Point2D const &center, Extent const &size)
Create a box centered as closely as possible on a particular point.
Definition: Box.cc:97
T str(T... args)
typename ImageT::image_category image_category
Definition: ImageBase.h:67

◆ getDetector()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<lsst::afw::cameraGeom::Detector const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getDetector ( ) const
inline

Return the Exposure's Detector information.

Definition at line 235 of file Exposure.h.

235  {
236  return _info->getDetector();
237  }

◆ getDimensions()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
lsst::geom::Extent2I lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getDimensions ( ) const
inline

Return the Exposure's size.

Definition at line 255 of file Exposure.h.

255 { return _maskedImage.getDimensions(); }
lsst::geom::Extent2I getDimensions() const
Definition: MaskedImage.h:1057

◆ getFilter()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
Filter lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getFilter ( ) const
inline

Return the Exposure's filter.

Definition at line 240 of file Exposure.h.

240  {
241  return _info->getFilter();
242  }

◆ getFilterLabel()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<FilterLabel const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getFilterLabel ( ) const
inline

Return the Exposure's filter information.

Definition at line 245 of file Exposure.h.

245 { return _info->getFilterLabel(); }

◆ getHeight()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
int lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getHeight ( ) const
inline

Return the Exposure's height.

Definition at line 253 of file Exposure.h.

253 { return _maskedImage.getHeight(); }
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:1056

◆ getInfo() [1/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<ExposureInfo> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getInfo ( )
inline

Get the ExposureInfo that aggregates all the non-image components. Never null.

Definition at line 336 of file Exposure.h.

336 { return _info; }

◆ getInfo() [2/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<ExposureInfo const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getInfo ( ) const
inline

Get the ExposureInfo that aggregates all the non-image components. Never null.

Definition at line 339 of file Exposure.h.

339 { return _info; }

◆ getMaskedImage() [1/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
MaskedImageT lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getMaskedImage ( )
inline

Return the MaskedImage.

Definition at line 228 of file Exposure.h.

228 { return _maskedImage; }

◆ getMaskedImage() [2/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
MaskedImageT lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getMaskedImage ( ) const
inline

Return the MaskedImage.

Definition at line 230 of file Exposure.h.

230 { return _maskedImage; }

◆ getMetadata()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<lsst::daf::base::PropertySet> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getMetadata ( ) const
inline

Return flexible metadata.

Definition at line 247 of file Exposure.h.

247 { return _info->getMetadata(); }

◆ getPhotoCalib()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<PhotoCalib const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getPhotoCalib ( ) const
inline

Return the Exposure's PhotoCalib object.

Definition at line 321 of file Exposure.h.

321 { return _info->getPhotoCalib(); }

◆ getPsf()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<lsst::afw::detection::Psf const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getPsf ( ) const
inline

Return the Exposure's Psf object.

Definition at line 327 of file Exposure.h.

327 { return _info->getPsf(); }

◆ getWcs()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
std::shared_ptr<geom::SkyWcs const> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getWcs ( ) const
inline

Definition at line 232 of file Exposure.h.

232 { return _info->getWcs(); }

◆ getWidth()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
int lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getWidth ( ) const
inline

Return the Exposure's width.

Definition at line 251 of file Exposure.h.

251 { return _maskedImage.getWidth(); }
int getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:1054

◆ getX0()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
int lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getX0 ( ) const
inline

Return the Exposure's column-origin.

See also
getXY0()

Definition at line 262 of file Exposure.h.

262 { return _maskedImage.getX0(); }
int getX0() const
Return the image's column-origin.
Definition: MaskedImage.h:1066

◆ getXY0()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
lsst::geom::Point2I lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getXY0 ( ) const
inline

Return the Exposure's origin.

This will usually be (0, 0) except for images created using the Exposure(fileName, hdu, BBox, mode) ctor or Exposure(Exposure, BBox) cctor The origin can be reset with setXY0

Definition at line 277 of file Exposure.h.

277 { return _maskedImage.getXY0(); }
lsst::geom::Point2I getXY0() const
Return the image's origin.
Definition: MaskedImage.h:1082

◆ getY0()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
int lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::getY0 ( ) const
inline

Return the Exposure's row-origin.

See also
getXY0()

Definition at line 268 of file Exposure.h.

268 { return _maskedImage.getY0(); }
int getY0() const
Return the image's row-origin.
Definition: MaskedImage.h:1074

◆ hasPsf()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
bool lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::hasPsf ( ) const
inline

Does this Exposure have a Psf?

Definition at line 330 of file Exposure.h.

330 { return _info->hasPsf(); }

◆ hasWcs()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
bool lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::hasWcs ( ) const
inline

Does this Exposure have a Wcs?

Definition at line 333 of file Exposure.h.

333 { return _info->hasWcs(); }

◆ operator=() [1/2]

template<typename ImageT , typename MaskT , typename VarianceT >
Exposure< ImageT, MaskT, VarianceT > & lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::operator= ( Exposure< ImageT, MaskT, VarianceT > &&  )
default

◆ operator=() [2/2]

template<typename ImageT , typename MaskT , typename VarianceT >
Exposure< ImageT, MaskT, VarianceT > & lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::operator= ( Exposure< ImageT, MaskT, VarianceT > const &  )
default

◆ operator[]()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
Exposure lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::operator[] ( lsst::geom::Box2I const &  bbox) const
inline

Return a subimage corresponding to the given box (interpreted as PARENT coordinates).

Definition at line 220 of file Exposure.h.

220 { return subset(bbox); }
Exposure subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: Exposure.h:215

◆ readFits() [1/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
static Exposure lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::readFits ( fits::MemFileManager manager)
inlinestatic

Read an Exposure from a FITS RAM file.

Parameters
[in]managerObject that manages the memory to be read.

Definition at line 428 of file Exposure.h.

428  {
429  return Exposure<ImageT, MaskT, VarianceT>(manager);
430  }

◆ readFits() [2/2]

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
static Exposure lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::readFits ( std::string const &  filename)
inlinestatic

Read an Exposure from a regular FITS file.

Parameters
[in]filenameName of the file to read.

Definition at line 419 of file Exposure.h.

419  {
420  return Exposure<ImageT, MaskT, VarianceT>(filename);
421  }

◆ setDetector()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setDetector ( std::shared_ptr< lsst::afw::cameraGeom::Detector const >  detector)
inline

Set the Exposure's Detector information.

Definition at line 298 of file Exposure.h.

298  {
299  _info->setDetector(detector);
300  }
table::Key< int > detector

◆ setFilter()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setFilter ( Filter const &  filter)
inline

Set the Exposure's filter.

Parameters
filterThe filter to set. If this is the default filter ("_unknown_"), it is interpreted as "no filter".

Definition at line 308 of file Exposure.h.

309  {
310  _info->setFilter(filter);
311  }

◆ setFilterLabel()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setFilterLabel ( std::shared_ptr< FilterLabel const >  filterLabel)
inline

Set the Exposure's filter information.

Definition at line 314 of file Exposure.h.

314  {
315  _info->setFilterLabel(filterLabel);
316  }

◆ setInfo()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setInfo ( std::shared_ptr< ExposureInfo exposureInfo)
inline

Set the ExposureInfo that aggregates all the non-image components.

Definition at line 342 of file Exposure.h.

342 { _info = exposureInfo; }

◆ setMaskedImage()

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setMaskedImage ( MaskedImageT maskedImage)

Set the MaskedImage of the Exposure.

Definition at line 111 of file Exposure.cc.

111  {
112  _maskedImage = maskedImage;
113 }

◆ setMetadata()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setMetadata ( std::shared_ptr< lsst::daf::base::PropertySet metadata)
inline

Definition at line 248 of file Exposure.h.

248 { _info->setMetadata(metadata); }

◆ setPhotoCalib()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setPhotoCalib ( std::shared_ptr< PhotoCalib const >  photoCalib)
inline

Set the Exposure's PhotoCalib object.

Definition at line 319 of file Exposure.h.

319 { _info->setPhotoCalib(photoCalib); }
Key< int > photoCalib
Definition: Exposure.cc:67

◆ setPsf()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setPsf ( std::shared_ptr< lsst::afw::detection::Psf const >  psf)
inline

Set the Exposure's Psf.

Definition at line 324 of file Exposure.h.

324 { _info->setPsf(psf); }
Key< int > psf
Definition: Exposure.cc:65

◆ setWcs()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setWcs ( std::shared_ptr< geom::SkyWcs >  wcs)
inline

Definition at line 296 of file Exposure.h.

296 { _info->setWcs(wcs); }
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:66

◆ setXY0()

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::setXY0 ( lsst::geom::Point2I const &  origin)

Set the Exposure's origin (including correcting the Wcs)

The origin is usually set by the constructor, so you shouldn't need this function

Note
There are use cases (e.g. memory overlays) that may want to set these values, but don't do so unless you are an Expert.

Definition at line 116 of file Exposure.cc.

116  {
117  lsst::geom::Point2I old(_maskedImage.getXY0());
118  if (_info->hasWcs()) {
119  auto shift = lsst::geom::Extent2D(origin - old);
120  auto newWcs = _info->getWcs()->copyAtShiftedPixelOrigin(shift);
121  _info->setWcs(newWcs);
122  }
123  _maskedImage.setXY0(origin);
124 }
void setXY0(int const x0, int const y0)
Set the MaskedImage's origin.
Definition: MaskedImage.h:1092
Extent< double, 2 > Extent2D
Definition: Extent.h:400

◆ subset()

template<typename ImageT , typename MaskT = lsst::afw::image::MaskPixel, typename VarianceT = lsst::afw::image::VariancePixel>
Exposure lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::subset ( lsst::geom::Box2I const &  bbox,
ImageOrigin  origin = PARENT 
) const
inline

Return a subimage corresponding to the given box.

Parameters
bboxBounding box of the subimage returned.
originOrigin bbox is rleative to; PARENT accounts for xy0, LOCAL does not.
Returns
A subimage view into this.

This method is wrapped as getitem in Python.

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.

Definition at line 215 of file Exposure.h.

215  {
216  return Exposure(*this, bbox, origin, false);
217  }

◆ writeFits() [1/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( fits::Fits fitsfile) const

Write an Exposure to an already-open FITS file object.

Parameters
[in]fitsfileFITS object to write.
See also
writeFits

Definition at line 146 of file Exposure.cc.

146  {
147  writeFits(fitsfile, fits::ImageWriteOptions(*_maskedImage.getImage()),
148  fits::ImageWriteOptions(*_maskedImage.getMask()),
149  fits::ImageWriteOptions(*_maskedImage.getVariance()));
150 }
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:134
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
Definition: MaskedImage.h:1051
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage's mask.
Definition: MaskedImage.h:1030
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.
Definition: MaskedImage.h:1018

◆ writeFits() [2/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( fits::Fits fitsfile,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions 
) const

Write an Exposure to a regular multi-extension FITS file.

Parameters
[in]fitsfileFITS object to which to write.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.

Definition at line 171 of file Exposure.cc.

174  {
175  ExposureInfo::FitsWriteData data = _info->_startWriteFits(getXY0());
176  _maskedImage.writeFits(fitsfile, imageOptions, maskOptions, varianceOptions, data.metadata,
177  data.imageMetadata, data.maskMetadata, data.varianceMetadata);
178  _info->_finishWriteFits(fitsfile, data);
179 }
char * data
Definition: BaseRecord.cc:61
lsst::geom::Point2I getXY0() const
Return the Exposure's origin.
Definition: Exposure.h:277
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [3/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( fits::MemFileManager manager) const

Write an Exposure to a multi-extension FITS file in memory.

Parameters
[in]managerManager for the memory to write to.
See also
writeFits

Definition at line 140 of file Exposure.cc.

140  {
141  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
142  writeFits(fitsfile);
143 }

◆ writeFits() [4/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( fits::MemFileManager manager,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions 
) const

Write an Exposure to a regular multi-extension FITS file.

Parameters
[in]managerManager for the memory to write to.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.

Definition at line 162 of file Exposure.cc.

165  {
166  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
167  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
168 }

◆ writeFits() [5/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( std::string const &  fileName) const

Write an Exposure to a regular multi-extension FITS file.

Parameters
[in]fileNameName of the file to write.

As with MaskedImage persistence, an empty primary HDU will be created and all images planes will be saved to extension HDUs. Most metadata will be saved only to the header of the main image HDU, but the WCS will be saved to the header of the mask and variance as well. If present, the Psf will be written to one or more additional HDUs.

Note that the LSST pixel origin differs from the FITS convention by one, so the values of CRPIX and LTV saved in the file are not the same as those in the C++ objects in memory, but are rather modified so they are interpreted by external tools (like ds9).

Definition at line 134 of file Exposure.cc.

134  {
135  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
136  writeFits(fitsfile);
137 }

◆ writeFits() [6/6]

template<typename ImageT , typename MaskT , typename VarianceT >
void lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::writeFits ( std::string const &  fileName,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions 
) const

Write an Exposure to a regular multi-extension FITS file.

Parameters
[in]fileNameName of the file to write.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.

Definition at line 153 of file Exposure.cc.

156  {
157  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
158  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
159 }

The documentation for this class was generated from the following files: