LSSTApplications  18.1.0
LSSTDataManagementBasePackage
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>

Inheritance diagram for lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >:
lsst::daf::base::Citizen

Public Types

typedef MaskedImage< ImageT, MaskT, VarianceT > MaskedImageT
 
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback) (const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback) (const Citizen *ptr)
 

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< 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 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 setCalib (std::shared_ptr< PhotoCalib > photoCalib)
 Set the Exposure's Calib object. More...
 
std::shared_ptr< PhotoCalib const > getCalib () const
 Return the Exposure's Calib 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::PsfgetPsf ()
 Return the Exposure's Psf object. 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...
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. 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...
 
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
Census

Provide a list of current Citizens

static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector< const Citizen * > * census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
callbackIDs

Set callback Ids.

The old Id is returned

static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
callbacks

Set the New/Delete callback functions; in each case the previously installed callback is returned.

These callback functions return a value which is Added to the previously registered id.

The default callback functions are called default{New,Delete}Callback; you may want to set a break point in these callbacks from your favourite debugger

static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. 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>
typedef MaskedImage<ImageT, MaskT, VarianceT> lsst::afw::image::Exposure< ImageT, MaskT, VarianceT >::MaskedImageT

Definition at line 74 of file Exposure.h.

◆ memCallback

typedef memId(* lsst::daf::base::Citizen::memCallback) (const Citizen *ptr)
inherited

Definition at line 61 of file Citizen.h.

◆ memId

typedef unsigned long lsst::daf::base::Citizen::memId
inherited

Type of the block's ID.

Definition at line 58 of file Citizen.h.

◆ memNewCallback

typedef memId(* lsst::daf::base::Citizen::memNewCallback) (const memId cid)
inherited

A function used to register a callback.

Definition at line 60 of file Citizen.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 88 of file Citizen.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 52 of file Exposure.cc.

54  : daf::base::Citizen(typeid(this)), _maskedImage(width, height), _info(new ExposureInfo(wcs)) {}

◆ 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 57 of file Exposure.cc.

59  : daf::base::Citizen(typeid(this)), _maskedImage(dimensions), _info(new ExposureInfo(wcs)) {}
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49

◆ 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 62 of file Exposure.cc.

64  : daf::base::Citizen(typeid(this)), _maskedImage(bbox), _info(new ExposureInfo(wcs)) {}
table::Box2IKey bbox
Definition: Detector.cc:169

◆ 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 67 of file Exposure.cc.

69  : daf::base::Citizen(typeid(this)), _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 72 of file Exposure.cc.

73  : daf::base::Citizen(typeid(this)),
74  _maskedImage(maskedImage),
75  _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 94 of file Exposure.cc.

96  : daf::base::Citizen(typeid(this)), _maskedImage(), _info(new ExposureInfo()) {
97  ExposureFitsReader reader(fileName);
98  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
99 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ 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 102 of file Exposure.cc.

104  : daf::base::Citizen(typeid(this)), _maskedImage(), _info(new ExposureInfo()) {
105  ExposureFitsReader reader(manager);
106  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
107 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ 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 110 of file Exposure.cc.

112  : daf::base::Citizen(typeid(this)) {
113  ExposureFitsReader reader(&fitsFile);
114  *this = reader.read<ImageT, MaskT, VarianceT>(bbox, origin, conformMasks, allowUnsafe);
115 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ 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 78 of file Exposure.cc.

79  : daf::base::Citizen(typeid(this)),
80  _maskedImage(src.getMaskedImage(), deep),
81  _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 84 of file Exposure.cc.

84 : Exposure(src) {}
std::shared_ptr< RecordT > src
Definition: Match.cc:48
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:52

◆ 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 87 of file Exposure.cc.

89  : daf::base::Citizen(typeid(this)),
90  _maskedImage(src.getMaskedImage(), bbox, origin, deep),
91  _info(new ExposureInfo(*src.getInfo(), deep)) {}
table::Box2IKey bbox
Definition: Detector.cc:169
std::shared_ptr< RecordT > src
Definition: Match.cc:48

◆ 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  : lsst::daf::base::Citizen(typeid(this)),
193  _maskedImage(rhs.getMaskedImage(), deep),
194  _info(new ExposureInfo(*rhs.getInfo(), deep)) {
195  if (not deep) {
197  "Exposure's converting copy constructor must make a deep copy");
198  }
199  }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:55

◆ ~Exposure()

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

Destructor.

Member Function Documentation

◆ census() [1/3]

int lsst::daf::base::Citizen::census ( int  ,
memId  startingMemId = 0 
)
staticinherited

How many active Citizens are there?

Parameters
startingMemIdDon't print Citizens with lower IDs

Definition at line 238 of file Citizen.cc.

240  {
241  if (startingMemId == 0) { // easy
242  ReadGuard guard(citizenLock);
243  return _activeCitizens.size();
244  }
245 
246  int n = 0;
247  ReadGuard guard(citizenLock);
248  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
249  if (cur->first->_CitizenId >= startingMemId) {
250  n++;
251  }
252  }
253 
254  return n;
255 }
T end(T... args)
T size(T... args)
T begin(T... args)

◆ census() [2/3]

void lsst::daf::base::Citizen::census ( std::ostream stream,
memId  startingMemId = 0 
)
staticinherited

Print a list of all active Citizens to stream, sorted by ID.

Parameters
streamstream to print to
startingMemIdDon't print Citizens with lower IDs

Definition at line 259 of file Citizen.cc.

261  {
262  ReadGuard guard(citizenLock);
263 
265 
266  for (std::vector<Citizen const*>::const_iterator citizen = leaks->begin(), end = leaks->end();
267  citizen != end; ++citizen) {
268  if ((*citizen)->getId() >= startingMemId) {
269  stream << (*citizen)->repr() << "\n";
270  }
271  }
272 }
STL class.
STL class.
T begin(T... args)
int end
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.
Definition: Citizen.cc:287

◆ census() [3/3]

std::vector< dafBase::Citizen const * > const * lsst::daf::base::Citizen::census ( )
staticinherited

Return a (newly allocated) std::vector of active Citizens sorted by ID.

You are responsible for deleting it; or you can say std::unique_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)

Definition at line 287 of file Citizen.cc.

287  {
289  ReadGuard guard(citizenLock);
290  vec->reserve(_activeCitizens.size());
291 
292  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
293  vec->push_back(dynamic_cast<Citizen const*>(cur->first));
294  }
295 
296  std::sort(vec->begin(), vec->end(), cmpId);
297 
298  return vec;
299 }
T end(T... args)
T push_back(T... args)
T size(T... args)
STL class.
T begin(T... args)
T sort(T... args)
T reserve(T... args)

◆ 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 275 of file Exposure.h.

275  {
276  return _maskedImage.getBBox(origin);
277  }
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: MaskedImage.h:1098

◆ getCalib()

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 >::getCalib ( ) const
inline

Return the Exposure's Calib object.

Definition at line 312 of file Exposure.h.

312  {
313  return _info->getPhotoCalib();
314  }

◆ 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 216 of file Exposure.cc.

217  {
218  if (!hasWcs()) {
219  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot look up source position without WCS.");
220  }
221  lsst::geom::Point2D pixelCenter = getWcs()->skyToPixel(center);
222 
223  if (!lsst::geom::Box2D(getBBox()).contains(pixelCenter)) {
224  std::stringstream buffer;
225  buffer << "Point " << center << " lies at pixel " << pixelCenter << ", which lies outside Exposure "
226  << getBBox();
227  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, buffer.str());
228  }
229  if (size[0] <= 0 || size[1] <= 0) {
230  std::stringstream buffer;
231  buffer << "Cannot create bounding box with dimensions " << size;
232  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, buffer.str());
233  }
235 
236  // cutout must have independent ExposureInfo
237  auto copyInfo = std::make_shared<ExposureInfo>(*getInfo());
238  MaskedImageT blank(bbox); // Can't initialize Exposure with a temporary
239  blank = math::edgePixel<MaskedImageT>(
241  Exposure cutout(blank, copyInfo);
242 
243  _copyCommonPixels(cutout, *this);
244  return cutout;
245 }
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
A floating-point coordinate rectangle geometry.
Definition: Box.h:305
std::shared_ptr< ExposureInfo > getInfo()
Get the ExposureInfo that aggregates all the non-image components. Never null.
Definition: Exposure.h:331
MaskedImage< ImageT, MaskT, VarianceT > MaskedImageT
Definition: Exposure.h:74
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: Exposure.h:275
bool hasWcs() const
Does this Exposure have a Wcs?
Definition: Exposure.h:328
T str(T... args)
table::Box2IKey bbox
Definition: Detector.cc:169
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
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:52
std::shared_ptr< geom::SkyWcs const > getWcs() const
Definition: Exposure.h:234
ImageT::image_category image_category
Definition: ImageBase.h:68
static Box2I makeCenteredBox(Point2D const &center, Extent const &size)
Create a box centered as closely as possible on a particular point.
Definition: Box.cc:100
An integer coordinate rectangle.
Definition: Box.h:54

◆ 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 237 of file Exposure.h.

237  {
238  return _info->getDetector();
239  }

◆ 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 251 of file Exposure.h.

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

◆ 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 241 of file Exposure.h.

241 { return _info->getFilter(); }

◆ 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 249 of file Exposure.h.

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

◆ getId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getId ( ) const
inherited

Return the Citizen's ID.

Definition at line 206 of file Citizen.cc.

206 { return _CitizenId; }

◆ 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 331 of file Exposure.h.

331 { 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 334 of file Exposure.h.

334 { 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 230 of file Exposure.h.

230 { 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 232 of file Exposure.h.

232 { 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 243 of file Exposure.h.

243 { return _info->getMetadata(); }

◆ getNextMemId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getNextMemId ( )
staticinherited

Return the memId of the next object to be allocated.

Definition at line 209 of file Citizen.cc.

209 { return _nextMemId(); }

◆ 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 303 of file Exposure.h.

303 { return _info->getPhotoCalib(); }

◆ getPsf() [1/2]

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

Return the Exposure's Psf object.

Definition at line 320 of file Exposure.h.

320 { return _info->getPsf(); }

◆ getPsf() [2/2]

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 322 of file Exposure.h.

322 { 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 234 of file Exposure.h.

234 { 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 247 of file Exposure.h.

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

◆ 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 258 of file Exposure.h.

258 { return _maskedImage.getX0(); }
int getX0() const
Return the image&#39;s column-origin.
Definition: MaskedImage.h:1106

◆ 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 273 of file Exposure.h.

273 { return _maskedImage.getXY0(); }
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: MaskedImage.h:1122

◆ 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 264 of file Exposure.h.

264 { return _maskedImage.getY0(); }
int getY0() const
Return the image&#39;s row-origin.
Definition: MaskedImage.h:1114

◆ hasBeenCorrupted()

bool lsst::daf::base::Citizen::hasBeenCorrupted ( )
staticinherited

Check all allocated blocks for corruption.

Definition at line 316 of file Citizen.cc.

316  {
317  ReadGuard guard(citizenLock);
318  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
319  if (cur->first->_hasBeenCorrupted()) {
320  return true;
321  }
322  }
323  for (table::iterator cur = _persistentCitizens.begin(); cur != _persistentCitizens.end(); cur++) {
324  if (cur->first->_hasBeenCorrupted()) {
325  return true;
326  }
327  }
328 
329  return false;
330 }
T end(T... args)
T begin(T... args)

◆ 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 325 of file Exposure.h.

325 { 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 328 of file Exposure.h.

328 { return _info->hasWcs(); }

◆ init()

int lsst::daf::base::Citizen::init ( )
staticinherited

Called once when the memory system is being initialised.

Definition at line 196 of file Citizen.cc.

196  {
197  volatile int dummy = 1;
198  return dummy;
199 }

◆ markPersistent()

void lsst::daf::base::Citizen::markPersistent ( void  )
inherited

Mark a Citizen as persistent and not destroyed until process end.

Definition at line 225 of file Citizen.cc.

225  {
226  WriteGuard guard(citizenLock);
227  _persistentCitizens[this] = _activeCitizens[this];
228  _activeCitizens.erase(this);
229 }
T erase(T... args)

◆ 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 > const &  )
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 > &&  )
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 222 of file Exposure.h.

222 { 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:217
table::Box2IKey bbox
Definition: Detector.cc:169

◆ 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 ( std::string const &  filename)
inlinestatic

Read an Exposure from a regular FITS file.

Parameters
[in]filenameName of the file to read.

Definition at line 414 of file Exposure.h.

414  {
415  return Exposure<ImageT, MaskT, VarianceT>(filename);
416  }

◆ 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 ( 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 423 of file Exposure.h.

423  {
424  return Exposure<ImageT, MaskT, VarianceT>(manager);
425  }

◆ repr()

std::string lsst::daf::base::Citizen::repr ( ) const
inherited

Return a string representation of a Citizen.

Definition at line 219 of file Citizen.cc.

219  {
220  return boost::str(boost::format("%d: %08x %s") % _CitizenId % this %
221  lsst::utils::demangleType(_typeName));
222 }
std::string demangleType(std::string const _typeName)
Definition: Demangle.cc:113
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168

◆ setCalib()

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

Set the Exposure's Calib object.

Definition at line 306 of file Exposure.h.

307  {
308  _info->setPhotoCalib(photoCalib);
309  }

◆ setCorruptionCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setCorruptionCallback ( Citizen::memCallback  func)
staticinherited

Set the CorruptionCallback function.

Parameters
funcfunction be called when block is found to be corrupted

Definition at line 391 of file Citizen.cc.

393  {
394  Citizen::memCallback old = _corruptionCallback;
395  _corruptionCallback = func;
396 
397  return old;
398 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setDeleteCallback ( Citizen::memCallback  func)
staticinherited

Set the DeleteCallback function.

Parameters
funcfunction be called when desired block is deleted

Definition at line 381 of file Citizen.cc.

383  {
384  Citizen::memCallback old = _deleteCallback;
385  _deleteCallback = func;
386 
387  return old;
388 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setDeleteCallbackId ( Citizen::memId  id)
staticinherited

Call the current DeleteCallback when block is deleted.

Parameters
idDesired ID

Definition at line 347 of file Citizen.cc.

348  {
349  WriteGuard guard(citizenLock);
350  Citizen::memId oldId = _deleteId;
351  _deleteId = id;
352 
353  return oldId;
354 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

◆ 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 294 of file Exposure.h.

294  {
295  _info->setDetector(detector);
296  }

◆ 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.

Definition at line 298 of file Exposure.h.

298 { _info->setFilter(filter); }

◆ 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 337 of file Exposure.h.

337 { _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 123 of file Exposure.cc.

123  {
124  _maskedImage = maskedImage;
125 }

◆ 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 244 of file Exposure.h.

244 { _info->setMetadata(metadata); }

◆ setNewCallback()

dafBase::Citizen::memNewCallback lsst::daf::base::Citizen::setNewCallback ( Citizen::memNewCallback  func)
staticinherited

Set the NewCallback function.

Parameters
funcThe new function to be called when a designated block is allocated

Definition at line 371 of file Citizen.cc.

373  {
374  Citizen::memNewCallback old = _newCallback;
375  _newCallback = func;
376 
377  return old;
378 }
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Definition: Citizen.h:60

◆ setNewCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setNewCallbackId ( Citizen::memId  id)
staticinherited

Call the NewCallback when block is allocated.

Parameters
idDesired ID

Definition at line 337 of file Citizen.cc.

338  {
339  WriteGuard guard(citizenLock);
340  Citizen::memId oldId = _newId;
341  _newId = id;
342 
343  return oldId;
344 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

◆ 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 301 of file Exposure.h.

301 { _info->setPhotoCalib(photoCalib); }

◆ 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 317 of file Exposure.h.

317 { _info->setPsf(psf); }

◆ 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 292 of file Exposure.h.

292 { _info->setWcs(wcs); }

◆ 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 128 of file Exposure.cc.

128  {
129  lsst::geom::Point2I old(_maskedImage.getXY0());
130  if (_info->hasWcs()) {
131  auto shift = lsst::geom::Extent2D(origin - old);
132  auto newWcs = _info->getWcs()->copyAtShiftedPixelOrigin(shift);
133  _info->setWcs(newWcs);
134  }
135  _maskedImage.setXY0(origin);
136 }
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: MaskedImage.h:1122
void setXY0(int const x0, int const y0)
Set the MaskedImage&#39;s origin.
Definition: MaskedImage.h:1132
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 217 of file Exposure.h.

217  {
218  return Exposure(*this, bbox, origin, false);
219  }
table::Box2IKey bbox
Definition: Detector.cc:169
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:52

◆ writeFits() [1/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 146 of file Exposure.cc.

146  {
147  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
148  writeFits(fitsfile);
149 }
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:146

◆ writeFits() [2/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 152 of file Exposure.cc.

152  {
153  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
154  writeFits(fitsfile);
155 }
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:146

◆ writeFits() [3/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 158 of file Exposure.cc.

158  {
159  writeFits(fitsfile, fits::ImageWriteOptions(*_maskedImage.getImage()),
160  fits::ImageWriteOptions(*_maskedImage.getMask()),
161  fits::ImageWriteOptions(*_maskedImage.getVariance()));
162 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:146

◆ writeFits() [4/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 165 of file Exposure.cc.

168  {
169  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
170  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
171 }
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:146

◆ writeFits() [5/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 174 of file Exposure.cc.

177  {
178  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
179  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
180 }
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition: Exposure.cc:146

◆ writeFits() [6/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 183 of file Exposure.cc.

186  {
187  ExposureInfo::FitsWriteData data = _info->_startWriteFits(getXY0());
188  _maskedImage.writeFits(fitsfile, imageOptions, maskOptions, varianceOptions, data.metadata,
189  data.imageMetadata, data.maskMetadata, data.varianceMetadata);
190  _info->_finishWriteFits(fitsfile, data);
191 }
lsst::geom::Point2I getXY0() const
Return the Exposure&#39;s origin.
Definition: Exposure.h:273
char * data
Definition: BaseRecord.cc:62
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

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