LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Public Member Functions | 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>

Public Member Functions

 DecoratedImage (const lsst::geom::Extent2I &dimensions=lsst::geom::Extent2I())
 Create an image of the specified size. More...
 
 DecoratedImage (const lsst::geom::Box2I &bbox)
 Create an image of the specified size. More...
 
 DecoratedImage (std::shared_ptr< Image< PixelT >> rhs)
 Create a DecoratedImage wrapping rhs More...
 
 DecoratedImage (DecoratedImage const &rhs, const bool deep=false)
 Copy constructor. More...
 
 DecoratedImage (std::string const &fileName, const int hdu=fits::DEFAULT_HDU, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin const origin=PARENT, bool allowUnsafe=false)
 Create a DecoratedImage from a FITS file. More...
 
DecoratedImageoperator= (const DecoratedImage &image)
 Assignment operator. More...
 
std::shared_ptr< lsst::daf::base::PropertySetgetMetadata () const
 
void setMetadata (std::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 lsst::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, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
 Write a FITS file. More...
 
void writeFits (std::string const &fileName, fits::ImageWriteOptions const &options, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
 Write a FITS file. More...
 
std::shared_ptr< Image< PixelT > > getImage ()
 Return a shared_ptr to the DecoratedImage's Image. More...
 
std::shared_ptr< Image< PixelT > const > getImage () const
 Return a shared_ptr to the DecoratedImage's Image as const. More...
 
double getGain () const
 Return the DecoratedImage's gain. More...
 
void setGain (double gain)
 Set the DecoratedImage's gain. More...
 

Detailed Description

template<typename PixelT>
class lsst::afw::image::DecoratedImage< PixelT >

A container for an Image and its associated metadata.

Definition at line 404 of file Image.h.

Constructor & Destructor Documentation

◆ DecoratedImage() [1/5]

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

Create an image of the specified size.

Parameters
dimensionsdesired number of columns. rows

Definition at line 56 of file DecoratedImage.cc.

57  : _image(new Image<PixelT>(dimensions)) {
58  init();
59 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49

◆ DecoratedImage() [2/5]

template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( const lsst::geom::Box2I bbox)
explicit

Create an image of the specified size.

Parameters
bbox(width, height) and origin of the desired Image
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 61 of file DecoratedImage.cc.

61  : _image(new Image<PixelT>(bbox)) {
62  init();
63 }
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117

◆ DecoratedImage() [3/5]

template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( std::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 65 of file DecoratedImage.cc.

65  : _image(rhs) {
66  init();
67 }

◆ DecoratedImage() [4/5]

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 69 of file DecoratedImage.cc.

70  : _image(new Image<PixelT>(*src._image, deep)), _gain(src._gain) {
71  setMetadata(src.getMetadata());
72 }
std::shared_ptr< RecordT > src
Definition: Match.cc:48
void setMetadata(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Image.h:460

◆ DecoratedImage() [5/5]

template<typename PixelT >
lsst::afw::image::DecoratedImage< PixelT >::DecoratedImage ( std::string const &  fileName,
const int  hdu = fits::DEFAULT_HDU,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin const  origin = PARENT,
bool  allowUnsafe = false 
)
explicit

Create a DecoratedImage from a FITS file.

Parameters
fileNameFile to read
hduThe HDU to read
bboxOnly read these pixels
originCoordinate system of the bbox
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 98 of file DecoratedImage.cc.

100  {
101  init();
103  new Image<PixelT>(fileName, hdu, getMetadata(), bbox, origin, allowUnsafe));
104 }
std::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
Definition: Image.h:459

Member Function Documentation

◆ getDimensions()

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

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

Definition at line 473 of file Image.h.

473 { return _image->getDimensions(); }

◆ getGain()

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 512 of file Image.h.

512 { return _gain; }

◆ getHeight()

template<typename PixelT >
int lsst::afw::image::DecoratedImage< PixelT >::getHeight ( ) const
inline

Return the number of rows in the image.

Definition at line 465 of file Image.h.

465 { return _image->getHeight(); }

◆ getImage() [1/2]

template<typename PixelT >
std::shared_ptr<Image<PixelT> > lsst::afw::image::DecoratedImage< PixelT >::getImage ( )
inline

Return a shared_ptr to the DecoratedImage's Image.

Definition at line 503 of file Image.h.

503 { return _image; }

◆ getImage() [2/2]

template<typename PixelT >
std::shared_ptr<Image<PixelT> const> lsst::afw::image::DecoratedImage< PixelT >::getImage ( ) const
inline

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

Definition at line 505 of file Image.h.

505 { return _image; }

◆ getMetadata()

template<typename PixelT >
std::shared_ptr<lsst::daf::base::PropertySet> lsst::afw::image::DecoratedImage< PixelT >::getMetadata ( ) const
inline

Definition at line 459 of file Image.h.

459 { return _metadata; }

◆ getWidth()

template<typename PixelT >
int lsst::afw::image::DecoratedImage< PixelT >::getWidth ( ) const
inline

Return the number of columns in the image.

Definition at line 463 of file Image.h.

463 { return _image->getWidth(); }

◆ getX0()

template<typename PixelT >
int lsst::afw::image::DecoratedImage< PixelT >::getX0 ( ) const
inline

Return the image's column-origin.

Definition at line 468 of file Image.h.

468 { return _image->getX0(); }

◆ getY0()

template<typename PixelT >
int lsst::afw::image::DecoratedImage< PixelT >::getY0 ( ) const
inline

Return the image's row-origin.

Definition at line 470 of file Image.h.

470 { return _image->getY0(); }

◆ operator=()

template<typename PixelT >
DecoratedImage< PixelT > & lsst::afw::image::DecoratedImage< PixelT >::operator= ( const DecoratedImage< PixelT > &  image)

Assignment operator.

N.b. this is a shallow assignment; use set(src) if you want to copy the pixels

Definition at line 74 of file DecoratedImage.cc.

74  {
75  DecoratedImage tmp(src);
76  swap(tmp); // See Meyers, Effective C++, Item 11
77 
78  return *this;
79 }
DecoratedImage(const lsst::geom::Extent2I &dimensions=lsst::geom::Extent2I())
Create an image of the specified size.
void swap(DecoratedImage &rhs)

◆ setGain()

template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::setGain ( double  gain)
inline

Set the DecoratedImage's gain.

Definition at line 514 of file Image.h.

514 { _gain = gain; }
table::Key< double > gain
Definition: Amplifier.cc:118

◆ setMetadata()

template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::setMetadata ( std::shared_ptr< lsst::daf::base::PropertySet metadata)
inline

Definition at line 460 of file Image.h.

460 { _metadata = metadata; }

◆ swap()

template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::swap ( DecoratedImage< PixelT > &  rhs)

Definition at line 82 of file DecoratedImage.cc.

82  {
83  using std::swap; // See Meyers, Effective C++, Item 25
84 
85  swap(_image, rhs._image); // just swapping the pointers
86  swap(_gain, rhs._gain);
87 }
T swap(T... args)

◆ writeFits() [1/2]

template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::writeFits ( std::string const &  fileName,
fits::ImageWriteOptions const &  options,
std::shared_ptr< lsst::daf::base::PropertySet const >  metadata = std::shared_ptr<lsst::daf::base::PropertySet const>(),
std::string const &  mode = "w" 
) const

Write a FITS file.

Parameters
[in]fileNamethe file to write
[in]optionsOptions controlling writing of FITS image.
[in]metadatametadata to write to header; or NULL
[in]mode"w" to write a new file; "a" to append

Definition at line 115 of file DecoratedImage.cc.

117  {
119 
120  if (metadata_i) {
121  metadata = getMetadata()->deepCopy();
122  metadata->combine(metadata_i);
123  } else {
124  metadata = getMetadata();
125  }
126 
127  getImage()->writeFits(fileName, options, mode, metadata);
128 }
std::shared_ptr< Image< PixelT > > getImage()
Return a shared_ptr to the DecoratedImage's Image.
Definition: Image.h:503
virtual Ptr deepCopy() const
Make a deep copy of the PropertySet and all of its contents.

◆ writeFits() [2/2]

template<typename PixelT >
void lsst::afw::image::DecoratedImage< PixelT >::writeFits ( std::string const &  fileName,
std::shared_ptr< lsst::daf::base::PropertySet const >  metadata = std::shared_ptr<lsst::daf::base::PropertySet const>(),
std::string const &  mode = "w" 
) const

Write a FITS file.

Parameters
fileNamethe file to write
metadatametadata to write to header; or NULL
mode"w" to write a new file; "a" to append

Definition at line 107 of file DecoratedImage.cc.

109  {
110  fits::ImageWriteOptions const options;
111  writeFits(fileName, options, metadata, mode);
112 }
void writeFits(std::string const &fileName, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
Write a FITS file.

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