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 Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT > Class Template Reference

Class implementing persistence and retrieval for MaskedImages. More...

#include <MaskedImageFormatter.h>

Inheritance diagram for lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >:
lsst::daf::persistence::Formatter lsst::daf::base::Citizen

Public Member Functions

virtual ~MaskedImageFormatter (void)
 
virtual void write (lsst::daf::base::Persistable const *persistable, lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
virtual
lsst::daf::base::Persistable
read (lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
virtual void update (lsst::daf::base::Persistable *persistable, lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
- Public Member Functions inherited from lsst::daf::persistence::Formatter
virtual ~Formatter (void)
 
- 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...
 

Static Public Member Functions

static
lsst::daf::persistence::Formatter::Ptr 
createInstance (lsst::pex::policy::Policy::Ptr policy)
 
template<class Archive >
static void delegateSerialize (Archive &ar, unsigned int const version, lsst::daf::base::Persistable *persistable)
 
- Static Public Member Functions inherited from lsst::daf::persistence::Formatter
static Formatter::Ptr lookupFormatter (std::string const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 
static Formatter::Ptr lookupFormatter (std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 
- 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...
 

Private Member Functions

 MaskedImageFormatter (lsst::pex::policy::Policy::Ptr policy)
 

Static Private Attributes

static
lsst::daf::persistence::FormatterRegistration 
registration
 

Additional Inherited Members

- Public Types inherited from lsst::daf::persistence::Formatter
typedef boost::shared_ptr
< Formatter
Ptr
 
typedef Ptr(* FactoryPtr )(lsst::pex::policy::Policy::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)
 
- Protected Member Functions inherited from lsst::daf::persistence::Formatter
 Formatter (std::type_info const &type)
 

Detailed Description

template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
class lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >

Class implementing persistence and retrieval for MaskedImages.

Definition at line 54 of file MaskedImageFormatter.h.

Constructor & Destructor Documentation

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::~MaskedImageFormatter ( void  )
virtual

Definition at line 119 of file MaskedImageFormatter.cc.

119  {
120 }
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImageFormatter ( lsst::pex::policy::Policy::Ptr  policy)
explicitprivate

Definition at line 111 of file MaskedImageFormatter.cc.

114  :
115  lsst::daf::persistence::Formatter(typeid(this)) {
116 }
Abstract base class for all formatters.
Definition: Formatter.h:79

Member Function Documentation

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::daf::persistence::Formatter::Ptr lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::createInstance ( lsst::pex::policy::Policy::Ptr  policy)
static

Definition at line 202 of file MaskedImageFormatter.cc.

203  {
205  new MaskedImageFormatter<ImagePixelT, MaskPixelT, VariancePixelT>(policy));
206 }
boost::shared_ptr< Formatter > Ptr
Definition: Formatter.h:81
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
template<class Archive >
void lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::delegateSerialize ( Archive &  ar,
unsigned int const  version,
lsst::daf::base::Persistable persistable 
)
static

Definition at line 187 of file MaskedImageFormatter.cc.

188  {
189  execTrace("MaskedImageFormatter delegateSerialize start");
191  dynamic_cast<MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>*>(persistable);
192  if (ip == 0) {
193  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Serializing non-MaskedImage");
194  }
195  ar & ip->_image & ip->_variance & ip->_mask;
196  execTrace("MaskedImageFormatter delegateSerialize end");
197 }
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
Persistable * lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::read ( lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

Read a Persistable instance from a Storage instance.

Parameters
[in]storagePointer to the Storage instance.
[in]additionalDataAdditional data used to find the proper instance within the Storage.
Returns
Shared pointer to the new Persistable instance.

Implements lsst::daf::persistence::Formatter.

Definition at line 151 of file MaskedImageFormatter.cc.

155 {
156  execTrace("MaskedImageFormatter read start");
157  if (typeid(*storage) == typeid(BoostStorage)) {
158  execTrace("MaskedImageFormatter read BoostStorage");
159  BoostStorage* boost = dynamic_cast<BoostStorage*>(storage.get());
161  boost->getIArchive() & *ip;
162  execTrace("MaskedImageFormatter read end");
163  return ip;
164  }
165  else if (typeid(*storage) == typeid(FitsStorage)) {
166  execTrace("MaskedImageFormatter read FitsStorage");
167  FitsStorage* fits = dynamic_cast<FitsStorage*>(storage.get());
169  execTrace("MaskedImageFormatter read end");
170  return ip;
171  }
172  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for MaskedImage");
173 }
virtual boost::archive::text_iarchive & getIArchive(void)
virtual std::string const & getPath(void)
Definition: FitsStorage.cc:109
Class for FITS file storage.
Definition: FitsStorage.h:52
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
Class for boost::serialization storage.
Definition: BoostStorage.h:58
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
void lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::update ( lsst::daf::base::Persistable persistable,
lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

Update an existing Persistable instance with information from an additional Storage instance.

Parameters
[in,out]persistablePointer to the Persistable instance.
[in]storageShared pointer to the additional Storage instance.
[in]additionalDataAdditional data used to find the proper instance within the Storage.

Implements lsst::daf::persistence::Formatter.

Definition at line 176 of file MaskedImageFormatter.cc.

181 {
182  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
183  "Unexpected call to update for MaskedImage");
184 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
void lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::write ( lsst::daf::base::Persistable const *  persistable,
lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

Write a Persistable instance to a Storage instance.

Parameters
[in]persistablePointer to the Persistable instance.
[in]storageShared pointer to the Storage instance.
[in]additionalDataAdditional data used to find the proper place to put the instance into the Storage.

Implements lsst::daf::persistence::Formatter.

Definition at line 123 of file MaskedImageFormatter.cc.

126  {
127  execTrace("MaskedImageFormatter write start");
129  dynamic_cast<MaskedImage<ImagePixelT, MaskPixelT> const*>(persistable);
130  if (ip == 0) {
131  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Persisting non-MaskedImage");
132  }
133  if (typeid(*storage) == typeid(BoostStorage)) {
134  execTrace("MaskedImageFormatter write BoostStorage");
135  BoostStorage* boost = dynamic_cast<BoostStorage*>(storage.get());
136  boost->getOArchive() & *ip;
137  execTrace("MaskedImageFormatter write end");
138  return;
139  }
140  else if (typeid(*storage) == typeid(FitsStorage)) {
141  execTrace("MaskedImageFormatter write FitsStorage");
142  FitsStorage* fits = dynamic_cast<FitsStorage*>(storage.get());
143  ip->writeFits(fits->getPath());
144  execTrace("MaskedImageFormatter write end");
145  return;
146  }
147  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for MaskedImage");
148 }
virtual std::string const & getPath(void)
Definition: FitsStorage.cc:109
void writeFits(std::string const &fileName, boost::shared_ptr< daf::base::PropertySet const > metadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > imageMetadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > maskMetadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > varianceMetadata=boost::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:562
Class for FITS file storage.
Definition: FitsStorage.h:52
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
virtual boost::archive::text_oarchive & getOArchive(void)
Class for boost::serialization storage.
Definition: BoostStorage.h:58

Member Data Documentation

template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
lsst::daf::persistence::FormatterRegistration lsst::afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >::registration
staticprivate

Definition at line 86 of file MaskedImageFormatter.h.


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