30 #define __attribute__(x) 36 #include "boost/serialization/shared_ptr.hpp" 37 #include "boost/serialization/binary_object.hpp" 38 #include <boost/archive/binary_oarchive.hpp> 39 #include <boost/archive/binary_iarchive.hpp> 52 LOG_LOGGER _log =
LOG_GET(
"afw.MaskFormatter");
64 namespace formatters {
66 template <
typename imagePixelT>
78 template <
typename MaskPixelT>
82 template <
typename MaskPixelT>
86 template <
typename MaskPixelT>
89 template <
typename MaskPixelT>
101 LOGL_DEBUG(_log,
"MaskFormatter write BoostStorage");
102 boost->getOArchive() & *ip;
108 LOGL_DEBUG(_log,
"MaskFormatter write FitsStorage");
112 if (additionalData) {
116 LOGLS_WARN(_log,
"Unable to construct mask write options (" 117 << exc.
what() <<
"); writing with default options");
129 template <
typename MaskPixelT>
136 LOGL_DEBUG(_log,
"MaskFormatter read BoostStorage");
138 boost->getIArchive() & *ip;
144 LOGL_DEBUG(_log,
"MaskFormatter read FitsStorage");
152 template <
typename MaskPixelT>
158 template <
typename MaskPixelT>
159 template <
class Archive>
161 LOGL_DEBUG(_log,
"MaskFormatter delegateSerialize start");
166 ar & ip->_offsetRows & ip->_offsetCols;
167 ar & ip->_maskPlaneDict;
171 if (Archive::is_saving::value) {
172 cols = ip->_vwImagePtr->cols();
173 rows = ip->_vwImagePtr->rows();
174 planes = ip->_vwImagePtr->planes();
176 ar& cols& rows& planes;
177 if (Archive::is_loading::value) {
178 ip->_vwImagePtr->set_size(cols, rows, planes);
180 unsigned int pixels = cols * rows * planes;
181 MaskPixelT*
data = ip->_vwImagePtr->data();
182 ar& boost::serialization::make_array(data, pixels);
183 LOGL_DEBUG(_log,
"MaskFormatter delegateSerialize end");
186 template <
typename MaskPixelT>
#define LOGLS_WARN(logger, message)
Options for writing an image to FITS.
#define LOGL_DEBUG(logger, message...)
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
T dynamic_pointer_cast(T... args)
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
#define LSST_EXCEPT(type,...)
void writeFits(std::string const &fileName, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), std::string const &mode="w") const
Write a mask to a regular FITS file.