39 # define __attribute__(x)
44 #include "boost/serialization/shared_ptr.hpp"
45 #include <boost/archive/binary_iarchive.hpp>
46 #include <boost/archive/binary_oarchive.hpp>
47 #include <boost/archive/text_iarchive.hpp>
48 #include <boost/archive/text_oarchive.hpp>
59 static void execTrace(std::string s,
int level =
EXEC_TRACE) {
73 namespace formatters {
75 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
78 static std::string
name();
82 static std::string
name =
"MaskedImageU";
86 static std::string
name =
"MaskedImageI";
90 static std::string
name =
"MaskedImageF";
94 static std::string
name =
"MaskedImageD";
98 static std::string
name =
"MaskedImageL";
102 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
105 VariancePixelT>::registration(
110 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
115 lsst::daf::persistence::Formatter(typeid(this)) {
118 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
122 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
125 Storage::Ptr storage,
127 execTrace(
"MaskedImageFormatter write start");
131 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Persisting non-MaskedImage");
134 execTrace(
"MaskedImageFormatter write BoostStorage");
137 execTrace(
"MaskedImageFormatter write end");
140 else if (
typeid(*storage) ==
typeid(
FitsStorage)) {
141 execTrace(
"MaskedImageFormatter write FitsStorage");
144 execTrace(
"MaskedImageFormatter write end");
147 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Unrecognized Storage for MaskedImage");
150 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
152 Storage::Ptr storage,
156 execTrace(
"MaskedImageFormatter read start");
158 execTrace(
"MaskedImageFormatter read BoostStorage");
162 execTrace(
"MaskedImageFormatter read end");
165 else if (
typeid(*storage) ==
typeid(
FitsStorage)) {
166 execTrace(
"MaskedImageFormatter read FitsStorage");
169 execTrace(
"MaskedImageFormatter read end");
172 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Unrecognized Storage for MaskedImage");
175 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
182 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
183 "Unexpected call to update for MaskedImage");
186 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
template <
class Archive>
188 Archive& ar,
unsigned int const,
Persistable* persistable) {
189 execTrace(
"MaskedImageFormatter delegateSerialize start");
193 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Serializing non-MaskedImage");
196 execTrace(
"MaskedImageFormatter delegateSerialize end");
199 template <
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
202 VariancePixelT>::createInstance(
209 #define INSTANTIATE(I, M, V) \
210 template class MaskedImageFormatter<I, M, V>; \
211 template void MaskedImageFormatter<I, M, V>::delegateSerialize<boost::archive::text_oarchive>( \
212 boost::archive::text_oarchive &, unsigned int const, Persistable *); \
213 template void MaskedImageFormatter<I, M, V>::delegateSerialize<boost::archive::text_iarchive>( \
214 boost::archive::text_iarchive &, unsigned int const, Persistable *); \
215 template void MaskedImageFormatter<I, M, V>::delegateSerialize<boost::archive::binary_oarchive>( \
216 boost::archive::binary_oarchive &, unsigned int const, Persistable *); \
217 template void MaskedImageFormatter<I, M, V>::delegateSerialize<boost::archive::binary_iarchive>( \
218 boost::archive::binary_iarchive &, unsigned int const, Persistable *);
boost::uint16_t MaskPixel
table::Key< std::string > name
daf_persistence package header file
virtual boost::archive::text_iarchive & getIArchive(void)
boost::shared_ptr< PropertySet > Ptr
virtual std::string const & getPath(void)
definition of the Trace messaging facilities
boost::shared_ptr< Policy > Ptr
limited backward compatibility to the DC2 run-time trace facilities
Class for FITS file storage.
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.
A class to manipulate images, masks, and variance as a single object.
float VariancePixel
! default type for Masks and MaskedImage Masks
#define LSST_EXCEPT(type,...)
virtual boost::archive::text_oarchive & getOArchive(void)
Class for boost::serialization storage.
Base class for all persistable classes.
Implementation of the Class MaskedImage.
Abstract base class for storage implementations.