LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
MaskedImage.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 /*
26  * Implementation of the Class MaskedImage
27  */
28 
29 #ifndef LSST_IMAGE_MASKEDIMAGE_H
30 #define LSST_IMAGE_MASKEDIMAGE_H
31 
32 #include <list>
33 #include <map>
34 #include <memory>
35 #include <ostream>
36 #include <string>
37 
38 #include "boost/mpl/at.hpp"
39 #include "boost/iterator/zip_iterator.hpp"
40 #include "boost/tuple/tuple.hpp" // cannot convert to std::tuple (yet) because of use with boost::gil
41 
42 #include "lsst/afw/image/Image.h"
43 #include "lsst/afw/image/Mask.h"
44 
45 namespace lsst {
46 namespace afw {
47 namespace image {
48 namespace detail {
50 struct MaskedImage_tag : public basic_tag {};
53 
55 std::string const fitsFile_RE = "\\.fits(\\.[fg]z)?$";
58 } // namespace detail
59 } // namespace image
60 } // namespace afw
61 } // namespace lsst
62 
63 #include "lsst/afw/image/Pixel.h"
65 
66 namespace lsst {
67 namespace afw {
68 namespace image {
69 
71 template <typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel,
72  typename VariancePixelT = lsst::afw::image::VariancePixel>
73 class MaskedImage {
74 public:
83 
87 
89 
91  template <typename ImagePT = ImagePixelT, typename MaskPT = MaskPixelT, typename VarPT = VariancePixelT>
95  };
96 
98  template <typename, typename, typename>
99  class MaskedImageIterator;
101  template <typename, typename, typename>
104  template <typename, typename, typename>
105  class MaskedImageLocator;
107  template <typename, typename, typename>
109 
114 
116  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator,
117  template <typename> class Ref = Reference>
119  using IMV_iterator_tuple = boost::tuple<ImageIterator, MaskIterator, VarianceIterator>;
120 
121  public:
125  using IMV_tuple = typename boost::zip_iterator<IMV_iterator_tuple>::reference;
129  template <typename, typename, typename>
132  using type = Pixel;
133 
135  MaskedImageIteratorBase(ImageIterator const& img, MaskIterator const& msk,
136  VarianceIterator const& var)
137  : _iter(boost::make_zip_iterator(boost::make_tuple(img, msk, var))) {}
139  typename Ref<ImagePixelT>::type image() { return _iter->template get<0>()[0]; }
140 
142  typename Ref<MaskPixelT>::type mask() { return _iter->template get<1>()[0]; }
143 
145  typename Ref<VariancePixelT>::type variance() { return _iter->template get<2>()[0]; }
146 
150  const IMV_iterator_tuple get_iterator_tuple() const { return _iter.get_iterator_tuple(); }
151 
154  ) {
155  _iter += delta;
156  return *this;
157  }
160  ) {
161  _iter -= delta;
162  return *this;
163  }
166  ++_iter;
167  return *this;
168  }
171  MaskedImageIteratorBase tmp(*this);
172  _iter++;
173  return tmp;
174  }
177  return &this->_iter->template get<0>() - &rhs._iter->template get<0>();
178  }
181  return &this->_iter->template get<0>() == &rhs._iter->template get<0>();
182  }
185  return &this->_iter->template get<0>() != &rhs._iter->template get<0>();
186  }
189  return &this->_iter->template get<0>() < &rhs._iter->template get<0>();
190  }
192  operator Pixel() const {
193  return Pixel(_iter->template get<0>()[0], _iter->template get<1>()[0],
194  _iter->template get<2>()[0]);
195  }
196 
198  Pixel operator*() { return Pixel(image(), mask(), variance()); }
200  const Pixel operator*() const { return Pixel(image(), mask(), variance()); }
201 
202  protected:
203  typename boost::zip_iterator<IMV_iterator_tuple> _iter;
204  };
205 
207  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator>
209  : public MaskedImageIteratorBase<ImageIterator, MaskIterator, VarianceIterator> {
211 
212  public:
213  MaskedImageIterator(ImageIterator& img, MaskIterator& msk, VarianceIterator& var)
214  : MaskedImageIteratorBase_t(img, msk, var) {}
217  MaskedImageIterator lhs = *this;
218  lhs += delta;
219 
220  return lhs;
221  }
222  };
223 
225  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator>
227  : public MaskedImageIteratorBase<typename detail::const_iterator_type<ImageIterator>::type,
228  typename detail::const_iterator_type<MaskIterator>::type,
229  typename detail::const_iterator_type<VarianceIterator>::type,
230  ConstReference> {
231  using const_ImageIterator = typename detail::const_iterator_type<ImageIterator>::type;
232  using const_MaskIterator = typename detail::const_iterator_type<MaskIterator>::type;
233  using const_VarianceIterator = typename detail::const_iterator_type<VarianceIterator>::type;
234 
236 
237  public:
241  const_ImageIterator(iter.get_iterator_tuple().template get<0>()),
242  const_MaskIterator(iter.get_iterator_tuple().template get<1>()),
243  const_VarianceIterator(iter.get_iterator_tuple().template get<2>())) {
244  ;
245  }
248  const_MaskedImageIterator lhs = *this;
249  lhs += delta;
250 
251  return lhs;
252  }
253  };
254 
256  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator,
257  template <typename> class Ref = Reference>
259  using IMVLocator = typename boost::tuple<ImageLocator, MaskLocator, VarianceLocator>;
260  //
261  // A class to provide _[xy]_iterator for MaskedImageLocator. We can't just use
262  // a zip_iterator as moving this iterator must be the same as moving the locator
263  // itself, for consistency with {Image,Mask}::xy_locator
264  //
265  template <template <typename> class X_OR_Y>
266  class _x_or_y_iterator {
267  public:
268  _x_or_y_iterator(MaskedImageLocatorBase* mil) : _mil(mil) {}
269 
270  _x_or_y_iterator& operator+=(const int di) {
271  // Equivalent to "_mil->_loc.template get<0>().x() += di;"
272  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() += di;
273  X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())() += di;
274  X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())() += di;
275  return *this;
276  }
277 
278  _x_or_y_iterator& operator++() { // prefix
279  // Equivalent to "++_mil->_loc.template get<0>().x();"
280  ++X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())();
281  ++X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())();
282  ++X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())();
283  return *this;
284  }
285 
286  bool operator==(_x_or_y_iterator const& rhs) {
287  return X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() ==
288  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
289  }
290  bool operator!=(_x_or_y_iterator const& rhs) {
291  return X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() !=
292  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
293  }
294  bool operator<(_x_or_y_iterator const& rhs) {
295  return X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() <
296  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
297  }
298 
299  Pixel operator*() {
300  return Pixel((*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0],
301  (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0],
302  (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0]);
303  }
304 
305  typename Ref<ImagePixelT>::type image() {
306  // Equivalent to "return (*_mil->_loc.template get<0>().x())[0];"
307 
308  return (*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0];
309  }
310  typename Ref<MaskPixelT>::type mask() {
311  return (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0];
312  }
314  return (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0];
315  }
316 
317  protected:
319  };
320 
321  // Two classes to provide .x() and .y() in _x_or_y_iterator
322  template <typename LocT>
323  class apply_x {
324  using IterT = typename LocT::x_iterator;
325 
326  public:
327  apply_x(LocT& loc) : _loc(loc) {}
328  IterT& operator()() { return _loc.x(); }
329 
330  private:
331  LocT& _loc;
332  };
333 
334  template <typename LocT>
335  class apply_y {
336  using IterT = typename LocT::y_iterator;
337 
338  public:
339  apply_y(LocT& loc) : _loc(loc) {}
340  IterT& operator()() { return _loc.y(); }
341 
342  private:
343  LocT& _loc;
344  };
345 
346  public:
347  using IMVCachedLocation = typename boost::tuple<typename ImageLocator::cached_location_t, typename MaskLocator::cached_location_t, typename VarianceLocator::cached_location_t>;
349  using x_iterator = _x_or_y_iterator<apply_x>;
351  using y_iterator = _x_or_y_iterator<apply_y>;
354  public:
355  // template<typename, typename, typename, template<typename> class> friend class
356  // MaskedImageLocatorBase;
357  template <typename, typename, typename>
359 
361  cached_location_t(IMVLocator const& loc, int x, int y)
362  : _imv(loc.template get<0>().cache_location(x, y),
363  loc.template get<1>().cache_location(x, y),
364  loc.template get<2>().cache_location(x, y)) {
365  ;
366  }
367  // protected:
369  };
371  MaskedImageLocatorBase(ImageLocator const& img, MaskLocator const& msk, VarianceLocator const& var)
372  : _loc(img, msk, var) {
373  ;
374  }
375 
378  return Pixel(_loc.template get<0>().x()[0][0], _loc.template get<1>().x()[0][0],
379  _loc.template get<2>().x()[0][0]);
380  }
381 
383  Pixel operator()(int x, int y) {
384  return Pixel(_loc.template get<0>()(x, y)[0], _loc.template get<1>()(x, y)[0],
385  _loc.template get<2>()(x, y)[0]);
386  }
387 
390  Pixel operator[](cached_location_t const& cached_loc) {
391  return Pixel(_loc.template get<0>()[cached_loc._imv.template get<0>()][0],
392  _loc.template get<1>()[cached_loc._imv.template get<1>()][0],
393  _loc.template get<2>()[cached_loc._imv.template get<2>()][0]);
394  }
399  x_iterator x() { return x_iterator(this); }
400 
405  y_iterator y() { return y_iterator(this); }
406 
408  cached_location_t cache_location(int x, int y) const { return cached_location_t(_loc, x, y); }
409  //
410  // We don't want to duplicate code for image/mask/variance -- but the boost::mpl stuff isn't pretty
411  // as we can't say int_<N> within a template<int N>. So define a set of functions apply_IMV
412  // to do the dirty work
413  //
414  using PixelTVec = typename boost::mpl::vector<ImagePixelT, MaskPixelT, VariancePixelT>;
415 
416  template <typename N>
418  cached_location_t const& cached_loc) {
419  return _loc.template get<N::value>()[cached_loc._imv.template get<N::value>()][0];
420  }
421 
422  template <typename N>
424  return _loc.template get<N::value>()[0][0];
425  }
426 
427  template <typename N>
429  return _loc.template get<N::value>()(x, y)[0];
430  }
431  //
432  // Use those templated classes to implement image/mask/variance
433  //
435  typename Ref<ImagePixelT>::type image(cached_location_t const& cached_loc) {
436  return apply_IMV<boost::mpl::int_<0>>(cached_loc);
437  }
439  typename Ref<ImagePixelT>::type image() { return apply_IMV<boost::mpl::int_<0>>(); }
441  typename Ref<ImagePixelT>::type image(int x, int y) { return apply_IMV<boost::mpl::int_<0>>(x, y); }
442 
444  typename Ref<MaskPixelT>::type mask(cached_location_t const& cached_loc) {
445  return apply_IMV<boost::mpl::int_<1>>(cached_loc);
446  }
448  typename Ref<MaskPixelT>::type mask() { return apply_IMV<boost::mpl::int_<1>>(); }
450  typename Ref<MaskPixelT>::type mask(int x, int y) { return apply_IMV<boost::mpl::int_<1>>(x, y); }
451 
454  return apply_IMV<boost::mpl::int_<2>>(cached_loc);
455  }
457  typename Ref<VariancePixelT>::type variance() { return apply_IMV<boost::mpl::int_<2>>(); }
459  typename Ref<VariancePixelT>::type variance(int x, int y) {
460  return apply_IMV<boost::mpl::int_<2>>(x, y);
461  }
462 
465  return _loc.template get<0>() == rhs._loc.template get<0>();
466  }
468  bool operator!=(MaskedImageLocatorBase const& rhs) { return !(*this == rhs); }
471  return _loc.template get<0>() < rhs._loc.template get<0>();
472  }
473 
475  MaskedImageLocatorBase& operator+=(pair2I const& p) {
476  return operator+=(detail::difference_type(p.first, p.second));
477  }
478 
480  MaskedImageLocatorBase& operator+=(detail::difference_type p) {
481  _loc.template get<0>() += p;
482  _loc.template get<1>() += p;
483  _loc.template get<2>() += p;
484 
485  return *this;
486  }
487 
488  // Workaround for DM-5590: clang-3.8 cannot access _loc from
489  // friend class const_MaskedImageLocator.
490  IMVLocator const& getLoc() const { return _loc; }
491 
492  protected:
493  IMVLocator _loc;
494  };
495 
497  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator>
498  class MaskedImageLocator : public MaskedImageLocatorBase<ImageLocator, MaskLocator, VarianceLocator> {
500 
501  public:
502  MaskedImageLocator(ImageLocator& img, MaskLocator& msk, VarianceLocator& var)
503  : MaskedImageLocatorBase_t(img, msk, var) {}
504  };
505 
507  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator>
509  : public MaskedImageLocatorBase<typename detail::const_locator_type<ImageLocator>::type,
510  typename detail::const_locator_type<MaskLocator>::type,
511  typename detail::const_locator_type<VarianceLocator>::type,
512  ConstReference> {
513  using const_ImageLocator = typename detail::const_locator_type<ImageLocator>::type;
514  using const_MaskLocator = typename detail::const_locator_type<MaskLocator>::type;
515  using const_VarianceLocator = typename detail::const_locator_type<VarianceLocator>::type;
516 
518 
519  public:
521  : MaskedImageLocatorBase_t(const_ImageLocator(iter.getLoc().template get<0>()),
522  const_MaskLocator(iter.getLoc().template get<1>()),
523  const_VarianceLocator(iter.getLoc().template get<2>())) {
524  ;
525  }
526  };
527 
528  // An iterator to a MaskedImage
530  // A const_iterator to a MaskedImage
532  // A reverse_iterator to a MaskedImage
534 #if 0 // doesn't compile. I should fix this, but it's low priority. RHL
536  typedef const_MaskedImageIterator<typename Image::reverse_iterator,
537  typename Mask::reverse_iterator, typename Variance::reverse_iterator> const_reverse_iterator;
538 #endif
551 
556 
561 
562  // Constructors
570  explicit MaskedImage(unsigned int width, unsigned int height,
571  MaskPlaneDict const& planeDict = MaskPlaneDict());
579  MaskPlaneDict const& planeDict = MaskPlaneDict());
600  explicit MaskedImage(lsst::geom::Box2I const& bbox, MaskPlaneDict const& planeDict = MaskPlaneDict());
601 
619  explicit MaskedImage(
620  std::string const& fileName,
623  bool conformMasks = false, bool needAllHdus = false,
626  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
628  bool allowUnsafe = false);
629 
647  explicit MaskedImage(
648  fits::MemFileManager& manager,
651  bool conformMasks = false, bool needAllHdus = false,
654  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
656  bool allowUnsafe = false);
657 
675  explicit MaskedImage(
676  fits::Fits& fitsfile,
679  bool conformMasks = false, bool needAllHdus = false,
682  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
684  bool allowUnsafe = false);
685 
692  MaskedImage(MaskedImage const& rhs, bool const deep = false);
693  MaskedImage(MaskedImage&& rhs);
694 
704  MaskedImage(MaskedImage const& rhs, lsst::geom::Box2I const& bbox, ImageOrigin const origin = PARENT,
705  bool const deep = false);
711  template <typename OtherPixelT>
713 
714  const bool deep
715  )
716  : _image(), _mask(), _variance() {
717  if (!deep) {
719  "Only deep copies are permitted for MaskedImages with different pixel types");
720  }
721 
722  _image = ImagePtr(new Image(*rhs.getImage(), deep));
723  _mask = MaskPtr(new Mask(*rhs.getMask(), deep));
724  _variance = VariancePtr(new Variance(*rhs.getVariance(), deep));
725  }
726 
738 
739  virtual ~MaskedImage() = default;
740 
741  void swap(MaskedImage& rhs);
742 
743  // Operators
745  MaskedImage& operator=(Pixel const& rhs);
747  MaskedImage& operator=(SinglePixel const& rhs);
748 
763  return MaskedImage(*this, bbox, origin, false);
764  }
765 
768 
780  void assign(MaskedImage const& rhs, lsst::geom::Box2I const& bbox = lsst::geom::Box2I(),
781  ImageOrigin origin = PARENT);
782 
784  MaskedImage& operator+=(ImagePixelT const rhs);
794  MaskedImage& operator+=(MaskedImage const& rhs);
796  *_image += rhs;
797  return *this;
798  }
800  *_image += function;
801  return *this;
802  }
811  void scaledPlus(double const c, MaskedImage const& rhs);
812 
814  MaskedImage& operator-=(ImagePixelT const rhs);
821  MaskedImage& operator-=(MaskedImage const& rhs);
823  *_image -= rhs;
824  return *this;
825  }
827  *_image -= function;
828  return *this;
829  }
836  void scaledMinus(double const c, MaskedImage const& rhs);
837 
838  MaskedImage& operator*=(ImagePixelT const rhs);
839  MaskedImage& operator*=(MaskedImage const& rhs);
841  *_image *= rhs;
842  *_variance *= rhs; // yes, multiply twice
843  *_variance *= rhs;
844  return *this;
845  }
846  void scaledMultiplies(double const c, MaskedImage const& rhs);
847 
848  MaskedImage& operator/=(ImagePixelT const rhs);
849  MaskedImage& operator/=(MaskedImage const& rhs);
851  *_image /= rhs;
852  *_variance /= rhs; // yes, divide twice
853  *_variance /= rhs;
854  return *this;
855  }
856  void scaledDivides(double const c, MaskedImage const& rhs);
857 
872  void writeFits(std::string const& fileName,
881 
895  void writeFits(fits::MemFileManager& manager,
904 
918  void writeFits(fits::Fits& fitsfile,
927 
944  void writeFits(std::string const& fileName, fits::ImageWriteOptions const& imageOptions,
945  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
947  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
948  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
949  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
950 
967  void writeFits(fits::MemFileManager& manager, fits::ImageWriteOptions const& imageOptions,
968  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
970  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
971  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
972  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
973 
990  void writeFits(fits::Fits& fitsfile, fits::ImageWriteOptions const& imageOptions,
991  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
993  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
994  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
995  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
996 
1002  static MaskedImage readFits(std::string const& filename) {
1004  }
1005 
1013  }
1014 
1015  // Getters
1016 
1018  ImagePtr getImage() const { return _image; }
1019 
1027  void setImage(Image const& other) { _image->assign(other); }
1028 
1030  MaskPtr getMask() const { return _mask; }
1031 
1039  void setMask(Mask const& other) { _mask->assign(other); }
1040 
1048  void setVariance(Variance const& other) { _variance->assign(other); }
1049 
1051  VariancePtr getVariance() const { return _variance; }
1052 
1054  int getWidth() const { return _image->getWidth(); }
1056  int getHeight() const { return _image->getHeight(); }
1057  lsst::geom::Extent2I getDimensions() const { return _image->getDimensions(); }
1058  lsst::geom::Box2I getBBox(ImageOrigin const origin = PARENT) const { return _image->getBBox(origin); }
1066  int getX0() const { return _image->getX0(); }
1074  int getY0() const { return _image->getY0(); }
1082  lsst::geom::Point2I getXY0() const { return _image->getXY0(); }
1083 
1092  void setXY0(int const x0, int const y0) { setXY0(lsst::geom::Point2I(x0, y0)); }
1093 
1102  void setXY0(lsst::geom::Point2I const origin) {
1103  if (_image) {
1104  _image->setXY0(origin);
1105  }
1106 
1107  if (_mask) {
1108  _mask->setXY0(origin);
1109  }
1110 
1111  if (_variance) {
1112  _variance->setXY0(origin);
1113  }
1114  }
1115 
1121  inline double indexToPosition(double ind,
1122  lsst::afw::image::xOrY const xy
1123  ) const {
1124  return getImage()->indexToPosition(ind, xy);
1125  }
1126 
1133  double const pos,
1134  lsst::afw::image::xOrY const xy
1135  ) const {
1136  return getImage()->positionToIndex(pos, xy);
1137  }
1138 
1139  //
1140  // Iterators and Locators
1141  //
1143  iterator begin() const;
1145  iterator end() const;
1147  iterator at(int const x, int const y) const;
1149  reverse_iterator rbegin() const;
1151  reverse_iterator rend() const;
1152 
1163  fast_iterator begin(bool contiguous) const;
1172  fast_iterator end(bool contiguous) const;
1173 
1175  x_iterator row_begin(int y) const;
1177  x_iterator row_end(int y) const;
1178 
1180  x_iterator x_at(int x, int y) const {
1181 #if 0
1182  typename Image::x_iterator imageEnd = getImage()->x_at(x, y);
1183  typename Mask::x_iterator maskEnd = getMask()->x_at(x, y);
1184  typename Variance::x_iterator varianceEnd = getVariance()->x_at(x, y);
1185 #else // bypass checks for non-NULL pointers
1186  typename Image::x_iterator imageEnd = _image->x_at(x, y);
1187  typename Mask::x_iterator maskEnd = _mask->x_at(x, y);
1188  typename Variance::x_iterator varianceEnd = _variance->x_at(x, y);
1189 #endif
1190 
1191  return x_iterator(imageEnd, maskEnd, varianceEnd);
1192  }
1193 
1195  y_iterator col_begin(int x) const;
1197  y_iterator col_end(int x) const;
1198 
1200  y_iterator y_at(int x, int y) const {
1201 #if 0
1202  typename Image::y_iterator imageEnd = getImage()->y_at(x, y);
1203  typename Mask::y_iterator maskEnd = getMask()->y_at(x, y);
1204  typename Variance::y_iterator varianceEnd = getVariance()->y_at(x, y);
1205 #else // bypass checks for non-NULL pointers
1206  typename Image::y_iterator imageEnd = _image->y_at(x, y);
1207  typename Mask::y_iterator maskEnd = _mask->y_at(x, y);
1208  typename Variance::y_iterator varianceEnd = _variance->y_at(x, y);
1209 #endif
1210  return y_iterator(imageEnd, maskEnd, varianceEnd);
1211  }
1212 
1214  xy_locator xy_at(int x, int y) const {
1215 #if 0
1216  typename Image::xy_locator imageEnd = getImage()->xy_at(x, y);
1217  typename Mask::xy_locator maskEnd = getMask()->xy_at(x, y);
1218  typename Variance::xy_locator varianceEnd = getVariance()->xy_at(x, y);
1219 #else // bypass checks for non-NULL pointers
1220  typename Image::xy_locator imageEnd = _image->xy_at(x, y);
1221  typename Mask::xy_locator maskEnd = _mask->xy_at(x, y);
1222  typename Variance::xy_locator varianceEnd = _variance->xy_at(x, y);
1223 #endif
1224 
1225  return xy_locator(imageEnd, maskEnd, varianceEnd);
1226  }
1227 
1228 private:
1229  void conformSizes();
1230 
1231  ImagePtr _image;
1232  MaskPtr _mask;
1233  VariancePtr _variance;
1234 };
1235 
1239 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
1244 ) {
1246 }
1247 
1251 template <typename ImagePixelT1, typename ImagePixelT2>
1252 bool imagesOverlap(MaskedImage<ImagePixelT1, MaskPixel, VariancePixel> const& image1,
1253  MaskedImage<ImagePixelT2, MaskPixel, VariancePixel> const& image2);
1254 
1255 /*
1256  * Some metafunctions to extract an Image pointer from a MaskedImage pointer (or return the original Image
1257  * pointer)
1258  *
1259  * GetImage is the public interface (it forwards the tag --- just for the sake of the UI); the real work
1260  * is in GetImage_ which defines a typedef for the Image and a static function, getImage
1261  *
1262  * E.g.
1263  * In the function
1264  *
1265  * template<typename ImageT>
1266  * void func(shared_ptr<ImageT> image) {
1267  * typename shared_ptr<GetImage<ImageT>::type> im = GetImage<ImageT>::getImage(image);
1268  * }
1269  *
1270  * "im" is a shared_ptr<Image> irrespective of whether ImageT is Masked or not.
1271  */
1272 namespace {
1273 template <typename ImageT, typename TagT>
1274 struct GetImage_ {
1275  using type = ImageT;
1276  static std::shared_ptr<type> getImage(std::shared_ptr<ImageT> image) { return image; }
1277 };
1278 
1279 template <typename ImageT>
1280 struct GetImage_<ImageT, typename image::detail::MaskedImage_tag> {
1281  using type = typename ImageT::Image;
1282  static std::shared_ptr<type> getImage(std::shared_ptr<ImageT> image) { return image->getImage(); }
1283 };
1284 } // anonymous namespace
1285 
1286 template <typename ImageT>
1287 struct GetImage : public GetImage_<ImageT, typename ImageT::image_category> {};
1288 } // namespace image
1289 } // namespace afw
1290 } // namespace lsst
1291 
1292 #endif // LSST_IMAGE_MASKEDIMAGE_H
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
double x
table::Key< int > type
Definition: Detector.cc:163
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:48
afw::table::Key< afw::table::Array< ImagePixelT > > image
afw::table::Key< afw::table::Array< MaskPixelT > > mask
afw::table::Key< afw::table::Array< VariancePixelT > > variance
int y
Definition: SpanSet.cc:48
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
typename _view_t::xy_locator xy_locator
An xy_locator.
Definition: ImageBase.h:121
typename _view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: ImageBase.h:129
typename _view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:133
typename _view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: ImageBase.h:143
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
The base class for MaskedImageIterators (const and non-const)
Definition: MaskedImage.h:118
bool operator==(MaskedImageIteratorBase const &rhs)
Return true if the lhs equals the rhs.
Definition: MaskedImage.h:180
MaskedImageIteratorBase operator++(int)
Increment the iterator (postfix)
Definition: MaskedImage.h:170
const Pixel operator*() const
Dereference the iterator, returning a const Pixel.
Definition: MaskedImage.h:200
std::ptrdiff_t operator-(MaskedImageIteratorBase const &rhs)
Return the distance between two iterators.
Definition: MaskedImage.h:176
bool operator!=(MaskedImageIteratorBase const &rhs)
Return true if the lhs doesn't equal the rhs.
Definition: MaskedImage.h:184
boost::zip_iterator< IMV_iterator_tuple > _iter
Definition: MaskedImage.h:203
MaskedImageIteratorBase & operator++()
Increment the iterator (prefix)
Definition: MaskedImage.h:165
Pixel operator*()
Dereference the iterator, returning a Pixel.
Definition: MaskedImage.h:198
Ref< MaskPixelT >::type mask()
Return (a reference to) the mask part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:142
Ref< ImagePixelT >::type image()
Return (a reference to) the image part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:139
MaskedImageIteratorBase & operator+=(std::ptrdiff_t delta)
Increment the iterator by delta
Definition: MaskedImage.h:153
MaskedImageIteratorBase & operator-=(std::ptrdiff_t delta)
Decrement the iterator by delta
Definition: MaskedImage.h:159
typename boost::zip_iterator< IMV_iterator_tuple >::reference IMV_tuple
The underlying iterator tuple.
Definition: MaskedImage.h:125
MaskedImageIteratorBase(ImageIterator const &img, MaskIterator const &msk, VarianceIterator const &var)
Construct a MaskedImageIteratorBase from the image/mask/variance iterators.
Definition: MaskedImage.h:135
Ref< VariancePixelT >::type variance()
Return (a reference to) the variance part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:145
bool operator<(MaskedImageIteratorBase const &rhs)
Return true if the lhs is less than the rhs.
Definition: MaskedImage.h:188
const IMV_iterator_tuple get_iterator_tuple() const
Return the underlying iterator tuple.
Definition: MaskedImage.h:150
MaskedImageIterator(ImageIterator &img, MaskIterator &msk, VarianceIterator &var)
Definition: MaskedImage.h:213
MaskedImageIterator operator+(std::ptrdiff_t delta)
Return a MaskedImageIterator that's delta beyond this.
Definition: MaskedImage.h:216
A saved relative position, providing efficient access to neighbouring pixels.
Definition: MaskedImage.h:353
cached_location_t(IMVLocator const &loc, int x, int y)
Create a cached_location_t that can be used to access pixels (x, y) away from loc
Definition: MaskedImage.h:361
The base class for MaskedImageLocators (const and non-const)
Definition: MaskedImage.h:258
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(int x, int y)
Definition: MaskedImage.h:428
typename boost::tuple< typename ImageLocator::cached_location_t, typename MaskLocator::cached_location_t, typename VarianceLocator::cached_location_t > IMVCachedLocation
Definition: MaskedImage.h:347
MaskedImageLocatorBase & operator+=(pair2I const &p)
Increment the locator's x and y positions by p
Definition: MaskedImage.h:475
Pixel operator*()
Dereference a locator, returning a Pixel.
Definition: MaskedImage.h:377
Ref< VariancePixelT >::type variance(cached_location_t const &cached_loc)
Return a reference to the variance at the offset set when we created the cached_location_t
Definition: MaskedImage.h:453
_x_or_y_iterator< apply_y > y_iterator
A y_iterator that provides a view of the xy_locator (i.e. advancing one advances the other)
Definition: MaskedImage.h:351
Pixel operator[](cached_location_t const &cached_loc)
Dereference a locator, returning a Pixel offset by the amount set when we created the cached_location...
Definition: MaskedImage.h:390
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(cached_location_t const &cached_loc)
Definition: MaskedImage.h:417
MaskedImageLocatorBase & operator+=(detail::difference_type p)
Increment the locator's x and y positions by p
Definition: MaskedImage.h:480
cached_location_t cache_location(int x, int y) const
Create a cached_location_t offset by (x, y) from locator.
Definition: MaskedImage.h:408
Ref< MaskPixelT >::type mask(cached_location_t const &cached_loc)
Return a reference to the mask at the offset set when we created the cached_location_t
Definition: MaskedImage.h:444
_x_or_y_iterator< apply_x > x_iterator
An x_iterator that provides a view of the xy_locator (i.e. advancing one advances the other)
Definition: MaskedImage.h:349
Ref< ImagePixelT >::type image()
Return a reference to the image at the current position of the locator.
Definition: MaskedImage.h:439
Ref< VariancePixelT >::type variance(int x, int y)
Return a reference to the variance offset by (x, y) from the current position of the locator.
Definition: MaskedImage.h:459
Ref< MaskPixelT >::type mask(int x, int y)
Return a reference to the mask offset by (x, y) from the current position of the locator.
Definition: MaskedImage.h:450
Pixel operator()(int x, int y)
Dereference a locator, returning a Pixel offset by (x, y) from the locator.
Definition: MaskedImage.h:383
y_iterator y()
Return an iterator that can be used to move (or dereference) a locator.
Definition: MaskedImage.h:405
bool operator==(MaskedImageLocatorBase const &rhs)
Return true iff two locators are equal.
Definition: MaskedImage.h:464
Ref< MaskPixelT >::type mask()
Return a reference to the mask at the current position of the locator.
Definition: MaskedImage.h:448
Ref< ImagePixelT >::type image(int x, int y)
Return a reference to the image offset by (x, y) from the current position of the locator.
Definition: MaskedImage.h:441
Ref< VariancePixelT >::type variance()
Return a reference to the variance at the current position of the locator.
Definition: MaskedImage.h:457
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV()
Definition: MaskedImage.h:423
bool operator!=(MaskedImageLocatorBase const &rhs)
Return true iff two locators are not equal.
Definition: MaskedImage.h:468
typename boost::mpl::vector< ImagePixelT, MaskPixelT, VariancePixelT > PixelTVec
Definition: MaskedImage.h:414
Ref< ImagePixelT >::type image(cached_location_t const &cached_loc)
Return a reference to the image at the offset set when we created the cached_location_t
Definition: MaskedImage.h:435
bool operator<(MaskedImageLocatorBase const &rhs)
Return true iff lhs is less than rhs.
Definition: MaskedImage.h:470
MaskedImageLocatorBase(ImageLocator const &img, MaskLocator const &msk, VarianceLocator const &var)
Construct a MaskedImageLocator from image/mask/variance locators.
Definition: MaskedImage.h:371
x_iterator x()
Return an iterator that can be used to move (or dereference) a locator.
Definition: MaskedImage.h:399
MaskedImageLocator(ImageLocator &img, MaskLocator &msk, VarianceLocator &var)
Definition: MaskedImage.h:502
An const iterator to the MaskedImage.
Definition: MaskedImage.h:230
const_MaskedImageIterator & operator+(std::ptrdiff_t delta)
Return a const_MaskedImageIterator that's delta beyond this.
Definition: MaskedImage.h:247
const_MaskedImageIterator(MaskedImageIterator< ImageIterator, MaskIterator, VarianceIterator > const &iter)
Definition: MaskedImage.h:238
A const locator for the MaskedImage.
Definition: MaskedImage.h:512
const_MaskedImageLocator(MaskedImageLocator< ImageLocator, MaskLocator, VarianceLocator > const &iter)
Definition: MaskedImage.h:520
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
void scaledPlus(double const c, MaskedImage const &rhs)
Add a scaled MaskedImage c*rhs to a MaskedImage.
Definition: MaskedImage.cc:241
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:84
MaskedImage operator[](lsst::geom::Box2I const &bbox) const
Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
Definition: MaskedImage.h:767
std::shared_ptr< image::Mask< MaskPixelT > > MaskPtr
shared pointer to the Mask
Definition: MaskedImage.h:78
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421
int getX0() const
Return the image's column-origin.
Definition: MaskedImage.h:1066
MaskedImage(unsigned int width, unsigned int height, MaskPlaneDict const &planeDict=MaskPlaneDict())
Construct from a supplied dimensions.
Definition: MaskedImage.cc:43
void setXY0(lsst::geom::Point2I const origin)
Set the MaskedImage's origin.
Definition: MaskedImage.h:1102
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: MaskedImage.h:1058
MaskedImage & operator*=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:840
void setVariance(Variance const &other)
Set the variance plane's pixel values to those of another Image.
Definition: MaskedImage.h:1048
void setXY0(int const x0, int const y0)
Set the MaskedImage's origin.
Definition: MaskedImage.h:1092
MaskedImage & operator/=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:850
static MaskedImage readFits(fits::MemFileManager &manager)
Read a MaskedImage from a FITS RAM file.
Definition: MaskedImage.h:1011
std::shared_ptr< image::Image< ImagePixelT > > ImagePtr
shared pointer to the Image
Definition: MaskedImage.h:76
void scaledDivides(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:393
typename MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator >::y_iterator xy_y_iterator
an y_iterator associated with an xy_locator
Definition: MaskedImage.h:560
MaskedImage(MaskedImage< OtherPixelT, MaskPixelT, VariancePixelT > const &rhs, const bool deep)
generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/...
Definition: MaskedImage.h:712
MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator > y_iterator
An iterator to a column of a MaskedImage.
Definition: MaskedImage.h:548
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:1056
typename Mask< MaskPixelT >::MaskPlaneDict MaskPlaneDict
The Mask's MaskPlaneDict.
Definition: MaskedImage.h:82
MaskedImage & operator-=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:822
int getY0() const
Return the image's row-origin.
Definition: MaskedImage.h:1074
virtual ~MaskedImage()=default
MaskedImage & operator=(MaskedImage &&rhs)
lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
A Pixel in the MaskedImage.
Definition: MaskedImage.h:111
iterator begin() const
Return an iterator to the start of the image.
Definition: MaskedImage.cc:567
MaskedImage & operator+=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:799
reverse_iterator rbegin() const
Return a reverse_iterator to the start of the image.
Definition: MaskedImage.cc:601
MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator > x_iterator
An iterator to a row of a MaskedImage.
Definition: MaskedImage.h:540
void setMask(Mask const &other)
Set the mask plane's pixel values to those of another Mask.
Definition: MaskedImage.h:1039
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:86
y_iterator col_end(int x) const
Return an y_iterator to the end of the image.
Definition: MaskedImage.cc:651
void scaledMinus(double const c, MaskedImage const &rhs)
Subtract a scaled MaskedImage c*rhs from a MaskedImage.
Definition: MaskedImage.cc:265
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: MaskedImage.h:546
MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator > xy_locator
A locator for a MaskedImage.
Definition: MaskedImage.h:553
lsst::geom::Extent2I getDimensions() const
Definition: MaskedImage.h:1057
std::pair< int, double > positionToIndex(double const pos, lsst::afw::image::xOrY const xy) const
Convert image position to index (see Image::positionToIndex)
Definition: MaskedImage.h:1132
lsst::geom::Point2I getXY0() const
Return the image's origin.
Definition: MaskedImage.h:1082
MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator > reverse_iterator
Definition: MaskedImage.h:533
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:529
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y)
Definition: MaskedImage.h:1214
MaskedImage & operator-=(ImagePixelT const rhs)
Subtract a scalar rhs from a MaskedImage.
Definition: MaskedImage.cc:274
int getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:1054
x_iterator row_end(int y) const
Return an x_iterator to the end of the image.
Definition: MaskedImage.cc:631
MaskedImage subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: MaskedImage.h:762
void scaledMultiplies(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:322
std::shared_ptr< image::Image< VariancePixelT > > VariancePtr
shared pointer to the variance Image
Definition: MaskedImage.h:80
iterator end() const
Return an iterator to the end of the image.
Definition: MaskedImage.cc:581
typename MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator >::x_iterator xy_x_iterator
an x_iterator associated with an xy_locator
Definition: MaskedImage.h:558
void assign(MaskedImage const &rhs, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Copy pixels from another masked image to a specified subregion of this masked image.
Definition: MaskedImage.cc:223
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
Definition: MaskedImage.h:1051
MaskedImage & operator=(MaskedImage const &rhs)
Make the lhs use the rhs's pixels.
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:85
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Definition: MaskedImage.cc:621
void swap(MaskedImage &rhs)
Definition: MaskedImage.cc:193
double indexToPosition(double ind, lsst::afw::image::xOrY const xy) const
Convert image index to image position (see Image::indexToPosition)
Definition: MaskedImage.h:1121
MaskedImage & operator+=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:795
void setImage(Image const &other)
Set the image plane's pixel values to those of another Image.
Definition: MaskedImage.h:1027
y_iterator col_begin(int x) const
Return an y_iterator to the start of the image.
Definition: MaskedImage.cc:641
reverse_iterator rend() const
Return a reverse_iterator to the end of the image.
Definition: MaskedImage.cc:611
static MaskedImage readFits(std::string const &filename)
Read a MaskedImage from a regular FITS file.
Definition: MaskedImage.h:1002
MaskedImage & operator+=(ImagePixelT const rhs)
Add a scalar rhs to a MaskedImage.
Definition: MaskedImage.cc:250
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
Definition: MaskedImage.h:1180
MaskedImage & operator*=(ImagePixelT const rhs)
Definition: MaskedImage.cc:343
MaskedImage & operator-=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:826
iterator at(int const x, int const y) const
Return an iterator at the point (x, y)
Definition: MaskedImage.cc:591
MaskedImage & operator/=(ImagePixelT const rhs)
Definition: MaskedImage.cc:414
y_iterator y_at(int x, int y) const
Return an y_iterator at the point (x, y)
Definition: MaskedImage.h:1200
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage's mask.
Definition: MaskedImage.h:1030
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.
Definition: MaskedImage.h:1018
A pixel of a MaskedImage.
Definition: Pixel.h:148
A single pixel of the same type as a MaskedImage.
Definition: Pixel.h:73
A Function taking two arguments.
Definition: Function.h:259
An integer coordinate rectangle.
Definition: Box.h:55
Reports invalid arguments.
Definition: Runtime.h:66
Definition: Polygon.cc:24
std::string const fitsFile_RE
regexp to identify when MaskedImages should be written as MEFs
Definition: MaskedImage.h:55
std::string const compressedFileNoMEF_RE
regexp to identify compressed files that we can't write MEFs to
Definition: MaskedImage.h:57
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
float VariancePixel
default type for MaskedImage variance images
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT >> image, typename std::shared_ptr< Mask< MaskPixelT >> mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT >> variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
Definition: MaskedImage.h:1240
bool imagesOverlap(ImageBase< T1 > const &image1, ImageBase< T2 > const &image2)
Return true if the pixels for two images or masks overlap in memory.
Definition: Image.cc:692
A base class for image defects.
Options for writing an image to FITS.
Definition: fits.h:219
A templated class to return this classes' type (present in Image/Mask/MaskedImage)
Definition: MaskedImage.h:92
metafunction to extract reference type from PixelT
Definition: ImageBase.h:85
A traits class for MaskedImage.
Definition: MaskedImage.h:50
A class used to identify classes that represent MaskedImage pixels.
Definition: MaskedImage.h:52