24 #ifndef LSST_AFW_IMAGE_fits_io_mpl_h_INCLUDED
25 #define LSST_AFW_IMAGE_fits_io_mpl_h_INCLUDED
27 #include "boost/mpl/for_each.hpp"
28 #include "boost/mpl/vector.hpp"
35 namespace lsst {
namespace afw {
namespace image {
38 struct found_type :
public std::exception { };
40 template<
typename ImageT,
typename ExceptionT>
41 class try_fits_read_array {
43 try_fits_read_array(fits::Fits & fitsfile,
53 void operator()(
typename ImageT::Pixel) {
57 }
catch(fits::FitsTypeError
const&) {
62 template <
typename OtherPixel>
63 void operator()(OtherPixel) {
71 }
catch(fits::FitsTypeError
const&) {
86 template<
typename supported_fits_types,
typename ImageT>
96 boost::mpl::for_each<supported_fits_types>(
97 try_fits_read_array<ImageT, found_type>(
98 fitsfile, array, xy0, metadata, bbox, origin
101 }
catch (found_type &) {
102 img = ImageT(array,
false, xy0);
108 "FITS file does not have one of the expected types"
112 template<
typename supported_fits_types,
typename ImageT>
120 fits_read_image<supported_fits_types, ImageT>(fitsfile, img, (metadata ? *metadata : metadata_s),
125 #endif // !LSST_AFW_IMAGE_fits_io_mpl_h_INCLUDED
An include file to include the header files for lsst::afw::geom.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
lsst::daf::base::PropertySet PropertySet
Index getShape() const
Return a Vector of the sizes of all dimensions.
geom::Box2I const & _bbox
void fits_read_array(fits::Fits &fitsfile, ndarray::Array< PixelT, 2, 2 > &array, geom::Point2I &xy0, lsst::daf::base::PropertySet &metadata, geom::Box2I bbox=geom::Box2I(), ImageOrigin origin=PARENT)
detail::SimpleInitializer< N > allocate(Vector< int, N > const &shape)
Create an expression that allocates uninitialized memory for an array.
A multidimensional strided array.
void fits_read_image(fits::Fits &fitsfile, ImageT &img, lsst::daf::base::PropertySet &metadata, geom::Box2I const &bbox=geom::Box2I(), ImageOrigin const origin=PARENT)
Class for storing generic metadata.
ndarray::Array< typename ImageT::Pixel, 2, 2 > & _array
daf::base::PropertySet & _metadata
#define LSST_FITS_EXCEPT(type, fitsObj,...)