LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lsst::afw::image::DecoratedImage< PixelT > Class Template Reference

A container for an Image and its associated metadata. More...

#include <Image.h>

Inheritance diagram for lsst::afw::image::DecoratedImage< PixelT >:
lsst::daf::base::Persistable lsst::daf::base::Citizen

Public Types

typedef boost::shared_ptr
< DecoratedImage
Ptr
 shared_ptr to a DecoratedImage More...
 
typedef boost::shared_ptr
< const DecoratedImage
ConstPtr
 shared_ptr to a const DecoratedImage More...
 
typedef boost::shared_ptr
< Image< PixelT > > 
ImagePtr
 shared_ptr to the Image More...
 
typedef boost::shared_ptr
< Image< PixelT > const > 
ImageConstPtr
 shared_ptr to the Image as const More...
 
- Public Types inherited from lsst::daf::base::Persistable
typedef boost::shared_ptr
< Persistable
Ptr
 
- Public Types inherited from lsst::daf::base::Citizen
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

 DecoratedImage (const geom::Extent2I &dimensions=geom::Extent2I())
 Create an image of the specified size. More...
 
 DecoratedImage (const geom::Box2I &bbox)
 
 DecoratedImage (boost::shared_ptr< Image< PixelT > > rhs)
 
 DecoratedImage (DecoratedImage const &rhs, const bool deep=false)
 
 DecoratedImage (std::string const &fileName, const int hdu=0, geom::Box2I const &bbox=geom::Box2I(), ImageOrigin const origin=PARENT)
 
DecoratedImageoperator= (const DecoratedImage &image)
 
boost::shared_ptr
< lsst::daf::base::PropertySet
getMetadata () const
 
void setMetadata (boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
 
int getWidth () const
 Return the number of columns in the image. More...
 
int getHeight () const
 Return the number of rows in the image. More...
 
int getX0 () const
 Return the image's column-origin. More...
 
int getY0 () const
 Return the image's row-origin. More...
 
const geom::Extent2I getDimensions () const
 Return the image's size; useful for passing to constructors. More...
 
void swap (DecoratedImage &rhs)
 
void writeFits (std::string const &fileName, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
 
ImagePtr getImage ()
 Return a shared_ptr to the DecoratedImage's Image. More...
 
ImageConstPtr getImage () const
 Return a shared_ptr to the DecoratedImage's Image as const. More...
 
double getGain () const
 
void setGain (double gain)
 Set the DecoratedImage's gain. More...
 
- Public Member Functions inherited from lsst::daf::base::Persistable
 Persistable (void)
 
virtual ~Persistable (void)
 
template<class Archive >
void serialize (Archive &, unsigned int const)
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
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...
 

Private Member Functions

void init ()
 

Private Attributes

boost::shared_ptr< Image
< PixelT > > 
_image
 
boost::shared_ptr
< lsst::daf::base::PropertySet
_metadata
 
double _gain
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst::daf::base::Citizen
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...
 
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...
 
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...
 
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 PixelT>
class lsst::afw::image::DecoratedImage< PixelT >

A container for an Image and its associated metadata.

Definition at line 614 of file Image.h.

Member Typedef Documentation

template<typename PixelT>
typedef boost::shared_ptr<const DecoratedImage> lsst::afw::image::DecoratedImage< PixelT >::ConstPtr

shared_ptr to a const DecoratedImage

Definition at line 620 of file Image.h.

template<typename PixelT>
typedef boost::shared_ptr< Image<PixelT> const> lsst::afw::image::DecoratedImage< PixelT >::ImageConstPtr

shared_ptr to the Image as const

Definition at line 624 of file Image.h.

template<typename PixelT>
typedef boost::shared_ptr< Image<PixelT> > lsst::afw::image::DecoratedImage< PixelT >::ImagePtr

shared_ptr to the Image

Definition at line 622 of file Image.h.

template<typename PixelT>
typedef boost::shared_ptr<DecoratedImage> lsst::afw::image::DecoratedImage< PixelT >::Ptr

shared_ptr to a DecoratedImage

Definition at line 618 of file Image.h.

Constructor & Destructor Documentation

template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( const geom::Extent2I dimensions = geom::Extent2I())
explicit

Create an image of the specified size.

Parameters
dimensionsdesired number of columns. rows

Definition at line 46 of file DecoratedImage.cc.

48  :
49  lsst::daf::base::Citizen(typeid(this)),
50  _image(new Image<PixelT>(dimensions))
51 {
52  init();
53 }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( const geom::Box2I bbox)
explicit

Create an image of the specified size

Note
Many lsst::afw::image and lsst::afw::math objects define a dimensions member which may be conveniently used to make objects of an appropriate size

Definition at line 60 of file DecoratedImage.cc.

62  :
63  lsst::daf::base::Citizen(typeid(this)),
64  _image(new Image<PixelT>(bbox))
65 {
66  init();
67 }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( boost::shared_ptr< Image< PixelT > >  rhs)
explicit

Create a DecoratedImage wrapping rhs

Note that this ctor shares pixels with the rhs; it isn't a deep copy

Parameters
rhsImage to go into DecoratedImage

Definition at line 74 of file DecoratedImage.cc.

76  :
77  lsst::daf::base::Citizen(typeid(this)),
78  _image(rhs)
79 {
80  init();
81 }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( DecoratedImage< PixelT > const &  rhs,
const bool  deep = false 
)

Copy constructor

Note that the lhs will share memory with the rhs unless deep is true

Parameters
rhsright hand side
deepMake deep copy?

Definition at line 88 of file DecoratedImage.cc.

91  :
92  lsst::daf::base::Citizen(typeid(this)),
93  _image(new Image<PixelT>(*src._image, deep)), _gain(src._gain)
94 {
95  setMetadata(src.getMetadata());
96 }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
void setMetadata(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Image.h:640
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( std::string const &  fileName,
const int  hdu = 0,
geom::Box2I const &  bbox = geom::Box2I(),
ImageOrigin const  origin = PARENT 
)
explicit

Create a DecoratedImage from a FITS file

< HDU within the file

Parameters
fileNameFile to read
hduThe HDU to read
bboxOnly read these pixels
originCoordinate system of the bbox

Definition at line 139 of file DecoratedImage.cc.

143  :
144  lsst::daf::base::Citizen(typeid(this))
145 {
146  init();
147  _image = typename Image<PixelT>::Ptr(new Image<PixelT>(fileName, hdu, getMetadata(), bbox, origin));
148 }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
boost::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
Definition: Image.h:639
boost::shared_ptr< Image< PixelT > > Ptr
Definition: Image.h:418
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56

Member Function Documentation

template<typename PixelT>
const geom::Extent2I lsst::afw::image::DecoratedImage< PixelT >::getDimensions ( ) const
inline

Return the image's size; useful for passing to constructors.

Definition at line 653 of file Image.h.

653 { return _image->getDimensions(); }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
double lsst::afw::image::DecoratedImage< PixelT >::getGain ( ) const
inline

Return the DecoratedImage's gain

Note
This is mostly just a place holder for other properties that we might want to associate with a DecoratedImage

Definition at line 673 of file Image.h.

673 { return _gain; }
template<typename PixelT>
int lsst::afw::image::DecoratedImage< PixelT >::getHeight ( ) const
inline

Return the number of rows in the image.

Definition at line 645 of file Image.h.

645 { return _image->getHeight(); }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
ImagePtr lsst::afw::image::DecoratedImage< PixelT >::getImage ( )
inline

Return a shared_ptr to the DecoratedImage's Image.

Definition at line 664 of file Image.h.

664 { return _image; }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
ImageConstPtr lsst::afw::image::DecoratedImage< PixelT >::getImage ( ) const
inline

Return a shared_ptr to the DecoratedImage's Image as const.

Definition at line 666 of file Image.h.

666 { return _image; }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
boost::shared_ptr< lsst::daf::base::PropertySet > lsst::afw::image::DecoratedImage< PixelT >::getMetadata ( ) const
inline

Definition at line 639 of file Image.h.

639 { return _metadata; }
boost::shared_ptr< lsst::daf::base::PropertySet > _metadata
Definition: Image.h:679
template<typename PixelT>
int lsst::afw::image::DecoratedImage< PixelT >::getWidth ( ) const
inline

Return the number of columns in the image.

Definition at line 643 of file Image.h.

643 { return _image->getWidth(); }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
int lsst::afw::image::DecoratedImage< PixelT >::getX0 ( ) const
inline

Return the image's column-origin.

Definition at line 648 of file Image.h.

648 { return _image->getX0(); }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT>
int lsst::afw::image::DecoratedImage< PixelT >::getY0 ( ) const
inline

Return the image's row-origin.

Definition at line 650 of file Image.h.

650 { return _image->getY0(); }
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::init ( )
private

Definition at line 37 of file DecoratedImage.cc.

37  {
38  // safer to initialize a smart pointer as a named variable
39  PTR(daf::base::PropertySet) metadata(new daf::base::PropertyList);
40  setMetadata(metadata);
41  _gain = 0;
42 }
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
#define PTR(...)
Definition: base.h:41
lsst::daf::base::PropertySet PropertySet
Definition: Wcs.cc:58
void setMetadata(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Image.h:640
template<typename PixelT >
image::DecoratedImage< PixelT > & lsst::afw::image::DecoratedImage< PixelT >::operator= ( const DecoratedImage< PixelT > &  src)

Assignment operator

N.b. this is a shallow assignment; use operator<<=() if you want to copy the pixels

Definition at line 103 of file DecoratedImage.cc.

103  {
104  DecoratedImage tmp(src);
105  swap(tmp); // See Meyers, Effective C++, Item 11
106 
107  return *this;
108 }
DecoratedImage(const geom::Extent2I &dimensions=geom::Extent2I())
Create an image of the specified size.
void swap(DecoratedImage &rhs)
template<typename PixelT>
void lsst::afw::image::DecoratedImage< PixelT >::setGain ( double  gain)
inline

Set the DecoratedImage's gain.

Definition at line 675 of file Image.h.

675 { _gain = gain; }
template<typename PixelT>
void lsst::afw::image::DecoratedImage< PixelT >::setMetadata ( boost::shared_ptr< lsst::daf::base::PropertySet metadata)
inline

Definition at line 640 of file Image.h.

640 { _metadata = metadata; }
boost::shared_ptr< lsst::daf::base::PropertySet > _metadata
Definition: Image.h:679
template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::swap ( DecoratedImage< PixelT > &  rhs)

Definition at line 111 of file DecoratedImage.cc.

111  {
112  using std::swap; // See Meyers, Effective C++, Item 25
113 
114  swap(_image, rhs._image); // just swapping the pointers
115  swap(_gain, rhs._gain);
116 }
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
void swap(DecoratedImage &rhs)
template<typename PixelT>
void lsst::afw::image::DecoratedImage< PixelT >::writeFits ( std::string const &  fileName,
boost::shared_ptr< lsst::daf::base::PropertySet const >  metadata = boost::shared_ptr< lsst::daf::base::PropertySet const>(),
std::string const &  mode = "w" 
) const

Write a FITS file

Definition at line 155 of file DecoratedImage.cc.

159  {
161 
162  if (metadata_i) {
163  metadata = getMetadata()->deepCopy();
164  metadata->combine(metadata_i);
165  } else {
166  metadata = getMetadata();
167  }
168 
169  getImage()->writeFits(fileName, metadata, mode);
170 }
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
boost::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
Definition: Image.h:639
ImagePtr getImage()
Return a shared_ptr to the DecoratedImage&#39;s Image.
Definition: Image.h:664

Member Data Documentation

template<typename PixelT>
double lsst::afw::image::DecoratedImage< PixelT >::_gain
private

Definition at line 681 of file Image.h.

template<typename PixelT>
boost::shared_ptr< Image<PixelT> > lsst::afw::image::DecoratedImage< PixelT >::_image
private

Definition at line 678 of file Image.h.

template<typename PixelT>
boost::shared_ptr< lsst::daf::base::PropertySet > lsst::afw::image::DecoratedImage< PixelT >::_metadata
private

Definition at line 679 of file Image.h.


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