LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
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/daf/base/Citizen.h"
43 #include "lsst/afw/image/Image.h"
44 #include "lsst/afw/image/Mask.h"
45 
46 namespace lsst {
47 namespace afw {
48 namespace image {
49 namespace detail {
51 struct MaskedImage_tag : public basic_tag {};
54 
56 std::string const fitsFile_RE = "\\.fits(\\.[fg]z)?$";
59 } // namespace detail
60 } // namespace image
61 } // namespace afw
62 } // namespace lsst
63 
64 #include "lsst/afw/image/Pixel.h"
66 
67 namespace lsst {
68 namespace afw {
69 namespace image {
70 
72 template <typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel,
73  typename VariancePixelT = lsst::afw::image::VariancePixel>
75 public:
84 
88 
90 
92  template <typename ImagePT = ImagePixelT, typename MaskPT = MaskPixelT, typename VarPT = VariancePixelT>
96  };
97 
99  template <typename, typename, typename>
102  template <typename, typename, typename>
105  template <typename, typename, typename>
108  template <typename, typename, typename>
109  class const_MaskedImageLocator;
110 
115 
117  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator,
118  template <typename> class Ref = Reference>
120  typedef boost::tuple<ImageIterator, MaskIterator, VarianceIterator> IMV_iterator_tuple;
121 
122  public:
126  typedef typename boost::zip_iterator<IMV_iterator_tuple>::reference IMV_tuple;
130  template <typename, typename, typename>
133  typedef Pixel type;
134 
136  MaskedImageIteratorBase(ImageIterator const& img, MaskIterator const& msk,
137  VarianceIterator const& var)
138  : _iter(boost::make_zip_iterator(boost::make_tuple(img, msk, var))) {}
140  typename Ref<ImagePixelT>::type image() { return _iter->template get<0>()[0]; }
141 
143  typename Ref<MaskPixelT>::type mask() { return _iter->template get<1>()[0]; }
144 
146  typename Ref<VariancePixelT>::type variance() { return _iter->template get<2>()[0]; }
147 
151  const IMV_iterator_tuple get_iterator_tuple() const { return _iter.get_iterator_tuple(); }
152 
155  ) {
156  _iter += delta;
157  return *this;
158  }
161  ) {
162  _iter -= delta;
163  return *this;
164  }
167  ++_iter;
168  return *this;
169  }
172  MaskedImageIteratorBase tmp(*this);
173  _iter++;
174  return tmp;
175  }
178  return &this->_iter->template get<0>() - &rhs._iter->template get<0>();
179  }
182  return &this->_iter->template get<0>() == &rhs._iter->template get<0>();
183  }
186  return &this->_iter->template get<0>() != &rhs._iter->template get<0>();
187  }
190  return &this->_iter->template get<0>() < &rhs._iter->template get<0>();
191  }
193  operator Pixel() const {
194  return Pixel(_iter->template get<0>()[0], _iter->template get<1>()[0],
195  _iter->template get<2>()[0]);
196  }
197 
199  Pixel operator*() { return Pixel(image(), mask(), variance()); }
201  const Pixel operator*() const { return Pixel(image(), mask(), variance()); }
202 
203  protected:
204  typename boost::zip_iterator<IMV_iterator_tuple> _iter;
205  };
206 
208  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator>
209  class MaskedImageIterator
210  : public MaskedImageIteratorBase<ImageIterator, MaskIterator, VarianceIterator> {
212  MaskedImageIteratorBase_t;
213 
214  public:
215  MaskedImageIterator(ImageIterator& img, MaskIterator& msk, VarianceIterator& var)
216  : MaskedImageIteratorBase_t(img, msk, var) {}
219  MaskedImageIterator lhs = *this;
220  lhs += delta;
221 
222  return lhs;
223  }
224  };
225 
227  template <typename ImageIterator, typename MaskIterator, typename VarianceIterator>
229  : public MaskedImageIteratorBase<typename detail::const_iterator_type<ImageIterator>::type,
230  typename detail::const_iterator_type<MaskIterator>::type,
231  typename detail::const_iterator_type<VarianceIterator>::type,
232  ConstReference> {
233  typedef typename detail::const_iterator_type<ImageIterator>::type const_ImageIterator;
234  typedef typename detail::const_iterator_type<MaskIterator>::type const_MaskIterator;
235  typedef typename detail::const_iterator_type<VarianceIterator>::type const_VarianceIterator;
236 
237  typedef MaskedImageIteratorBase<const_ImageIterator, const_MaskIterator, const_VarianceIterator,
240 
241  public:
244  : MaskedImageIteratorBase_t(
245  const_ImageIterator(iter.get_iterator_tuple().template get<0>()),
246  const_MaskIterator(iter.get_iterator_tuple().template get<1>()),
247  const_VarianceIterator(iter.get_iterator_tuple().template get<2>())) {
248  ;
249  }
252  const_MaskedImageIterator lhs = *this;
253  lhs += delta;
254 
255  return lhs;
256  }
257  };
258 
260  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator,
261  template <typename> class Ref = Reference>
263  typedef typename boost::tuple<ImageLocator, MaskLocator, VarianceLocator> IMVLocator;
264  //
265  // A class to provide _[xy]_iterator for MaskedImageLocator. We can't just use
266  // a zip_iterator as moving this iterator must be the same as moving the locator
267  // itself, for consistency with {Image,Mask}::xy_locator
268  //
269  template <template <typename> class X_OR_Y>
270  class _x_or_y_iterator {
271  public:
272  _x_or_y_iterator(MaskedImageLocatorBase* mil) : _mil(mil) {}
273 
274  _x_or_y_iterator& operator+=(const int di) {
275  // Equivalent to "_mil->_loc.template get<0>().x() += di;"
276  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() += di;
277  X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())() += di;
278  X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())() += di;
279  return *this;
280  }
281 
282  _x_or_y_iterator& operator++() { // prefix
283  // Equivalent to "++_mil->_loc.template get<0>().x();"
284  ++X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())();
285  ++X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())();
286  ++X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())();
287  return *this;
288  }
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  bool operator<(_x_or_y_iterator const& rhs) {
299  return X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() <
300  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
301  }
302 
303  Pixel operator*() {
304  return Pixel((*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0],
305  (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0],
306  (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0]);
307  }
308 
309  typename Ref<ImagePixelT>::type image() {
310  // Equivalent to "return (*_mil->_loc.template get<0>().x())[0];"
311 
312  return (*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0];
313  }
314  typename Ref<MaskPixelT>::type mask() {
315  return (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0];
316  }
318  return (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0];
319  }
320 
321  protected:
323  };
324 
325  // Two classes to provide .x() and .y() in _x_or_y_iterator
326  template <typename LocT>
327  class apply_x {
328  typedef typename LocT::x_iterator IterT;
329 
330  public:
331  apply_x(LocT& loc) : _loc(loc) {}
332  IterT& operator()() { return _loc.x(); }
333 
334  private:
335  LocT& _loc;
336  };
337 
338  template <typename LocT>
339  class apply_y {
340  typedef typename LocT::y_iterator IterT;
341 
342  public:
343  apply_y(LocT& loc) : _loc(loc) {}
344  IterT& operator()() { return _loc.y(); }
345 
346  private:
347  LocT& _loc;
348  };
349 
350  public:
351  typedef typename boost::tuple<typename ImageLocator::cached_location_t,
352  typename MaskLocator::cached_location_t,
353  typename VarianceLocator::cached_location_t>
356  typedef _x_or_y_iterator<apply_x> x_iterator;
358  typedef _x_or_y_iterator<apply_y> y_iterator;
361  public:
362  // template<typename, typename, typename, template<typename> class> friend class
363  // MaskedImageLocatorBase;
364  template <typename, typename, typename>
366 
368  cached_location_t(IMVLocator const& loc, int x, int y)
369  : _imv(loc.template get<0>().cache_location(x, y),
370  loc.template get<1>().cache_location(x, y),
371  loc.template get<2>().cache_location(x, y)) {
372  ;
373  }
374  // protected:
376  };
378  MaskedImageLocatorBase(ImageLocator const& img, MaskLocator const& msk, VarianceLocator const& var)
379  : _loc(img, msk, var) {
380  ;
381  }
382 
384  Pixel operator*() {
385  return Pixel(_loc.template get<0>().x()[0][0], _loc.template get<1>().x()[0][0],
386  _loc.template get<2>().x()[0][0]);
387  }
388 
390  Pixel operator()(int x, int y) {
391  return Pixel(_loc.template get<0>()(x, y)[0], _loc.template get<1>()(x, y)[0],
392  _loc.template get<2>()(x, y)[0]);
393  }
394 
397  Pixel operator[](cached_location_t const& cached_loc) {
398  return Pixel(_loc.template get<0>()[cached_loc._imv.template get<0>()][0],
399  _loc.template get<1>()[cached_loc._imv.template get<1>()][0],
400  _loc.template get<2>()[cached_loc._imv.template get<2>()][0]);
401  }
406  x_iterator x() { return x_iterator(this); }
407 
412  y_iterator y() { return y_iterator(this); }
413 
415  cached_location_t cache_location(int x, int y) const { return cached_location_t(_loc, x, y); }
416  //
417  // We don't want to duplicate code for image/mask/variance -- but the boost::mpl stuff isn't pretty
418  // as we can't say int_<N> within a template<int N>. So define a set of functions apply_IMV
419  // to do the dirty work
420  //
421  typedef typename boost::mpl::vector<ImagePixelT, MaskPixelT, VariancePixelT> PixelTVec;
422 
423  template <typename N>
425  cached_location_t const& cached_loc) {
426  return _loc.template get<N::value>()[cached_loc._imv.template get<N::value>()][0];
427  }
428 
429  template <typename N>
431  return _loc.template get<N::value>()[0][0];
432  }
433 
434  template <typename N>
436  return _loc.template get<N::value>()(x, y)[0];
437  }
438  //
439  // Use those templated classes to implement image/mask/variance
440  //
442  typename Ref<ImagePixelT>::type image(cached_location_t const& cached_loc) {
443  return apply_IMV<boost::mpl::int_<0>>(cached_loc);
444  }
446  typename Ref<ImagePixelT>::type image() { return apply_IMV<boost::mpl::int_<0>>(); }
448  typename Ref<ImagePixelT>::type image(int x, int y) { return apply_IMV<boost::mpl::int_<0>>(x, y); }
449 
451  typename Ref<MaskPixelT>::type mask(cached_location_t const& cached_loc) {
452  return apply_IMV<boost::mpl::int_<1>>(cached_loc);
453  }
455  typename Ref<MaskPixelT>::type mask() { return apply_IMV<boost::mpl::int_<1>>(); }
457  typename Ref<MaskPixelT>::type mask(int x, int y) { return apply_IMV<boost::mpl::int_<1>>(x, y); }
458 
460  typename Ref<VariancePixelT>::type variance(cached_location_t const& cached_loc) {
461  return apply_IMV<boost::mpl::int_<2>>(cached_loc);
462  }
464  typename Ref<VariancePixelT>::type variance() { return apply_IMV<boost::mpl::int_<2>>(); }
466  typename Ref<VariancePixelT>::type variance(int x, int y) {
467  return apply_IMV<boost::mpl::int_<2>>(x, y);
468  }
469 
472  return _loc.template get<0>() == rhs._loc.template get<0>();
473  }
475  bool operator!=(MaskedImageLocatorBase const& rhs) { return !(*this == rhs); }
478  return _loc.template get<0>() < rhs._loc.template get<0>();
479  }
480 
482  MaskedImageLocatorBase& operator+=(pair2I const& p) {
483  return operator+=(detail::difference_type(p.first, p.second));
484  }
485 
487  MaskedImageLocatorBase& operator+=(detail::difference_type p) {
488  _loc.template get<0>() += p;
489  _loc.template get<1>() += p;
490  _loc.template get<2>() += p;
491 
492  return *this;
493  }
494 
495  // Workaround for DM-5590: clang-3.8 cannot access _loc from
496  // friend class const_MaskedImageLocator.
497  IMVLocator const& getLoc() const { return _loc; }
498 
499  protected:
500  IMVLocator _loc;
501  };
502 
504  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator>
505  class MaskedImageLocator : public MaskedImageLocatorBase<ImageLocator, MaskLocator, VarianceLocator> {
507 
508  public:
509  MaskedImageLocator(ImageLocator& img, MaskLocator& msk, VarianceLocator& var)
510  : MaskedImageLocatorBase_t(img, msk, var) {}
511  };
512 
514  template <typename ImageLocator, typename MaskLocator, typename VarianceLocator>
516  : public MaskedImageLocatorBase<typename detail::const_locator_type<ImageLocator>::type,
517  typename detail::const_locator_type<MaskLocator>::type,
518  typename detail::const_locator_type<VarianceLocator>::type,
519  ConstReference> {
520  typedef typename detail::const_locator_type<ImageLocator>::type const_ImageLocator;
521  typedef typename detail::const_locator_type<MaskLocator>::type const_MaskLocator;
522  typedef typename detail::const_locator_type<VarianceLocator>::type const_VarianceLocator;
523 
524  typedef MaskedImageLocatorBase<const_ImageLocator, const_MaskLocator, const_VarianceLocator,
527 
528  public:
530  : MaskedImageLocatorBase_t(const_ImageLocator(iter.getLoc().template get<0>()),
531  const_MaskLocator(iter.getLoc().template get<1>()),
532  const_VarianceLocator(iter.getLoc().template get<2>())) {
533  ;
534  }
535  };
536 
537  // An iterator to a MaskedImage
538  typedef MaskedImageIterator<typename Image::iterator, typename Mask::iterator,
539  typename Variance::iterator>
541  // A const_iterator to a MaskedImage
542  typedef const_MaskedImageIterator<typename Image::iterator, typename Mask::iterator,
543  typename Variance::iterator>
545  // A reverse_iterator to a MaskedImage
546  typedef MaskedImageIterator<typename Image::reverse_iterator, typename Mask::reverse_iterator,
549 #if 0 // doesn't compile. I should fix this, but it's low priority. RHL
550  typedef const_MaskedImageIterator<typename Image::reverse_iterator,
552  typename Mask::reverse_iterator, typename Variance::reverse_iterator> const_reverse_iterator;
553 #endif
554  typedef MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator,
556  typename Variance::x_iterator>
559  typedef const_MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator,
560  typename Variance::x_iterator>
567  typedef MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator,
568  typename Variance::y_iterator>
571  typedef const_MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator,
572  typename Variance::y_iterator>
574 
576  typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator,
577  typename Variance::xy_locator>
580  typedef const_MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator,
581  typename Variance::xy_locator>
583 
585  typedef typename MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator,
588  typedef typename MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator,
590 
591  // Constructors
599  explicit MaskedImage(unsigned int width, unsigned int height,
600  MaskPlaneDict const& planeDict = MaskPlaneDict());
608  MaskPlaneDict const& planeDict = MaskPlaneDict());
617  explicit MaskedImage(ImagePtr image, MaskPtr mask = MaskPtr(), VariancePtr variance = VariancePtr());
629  explicit MaskedImage(lsst::geom::Box2I const& bbox, MaskPlaneDict const& planeDict = MaskPlaneDict());
630 
648  explicit MaskedImage(
649  std::string const& fileName,
651  lsst::geom::Box2I const& bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
652  bool conformMasks = false, bool needAllHdus = false,
655  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
657  bool allowUnsafe=false);
658 
676  explicit MaskedImage(
677  fits::MemFileManager& manager,
679  lsst::geom::Box2I const& bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
680  bool conformMasks = false, bool needAllHdus = false,
683  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
685  bool allowUnsafe=false);
686 
704  explicit MaskedImage(
705  fits::Fits& fitsfile,
707  lsst::geom::Box2I const& bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
708  bool conformMasks = false, bool needAllHdus = false,
711  std::shared_ptr<daf::base::PropertySet> varianceMetadata =
713  bool allowUnsafe=false);
714 
721  MaskedImage(MaskedImage const& rhs, bool const deep = false);
722  MaskedImage(MaskedImage&& rhs);
723 
733  MaskedImage(MaskedImage const& rhs, lsst::geom::Box2I const& bbox, ImageOrigin const origin = PARENT,
734  bool const deep = false);
740  template <typename OtherPixelT>
742 
743  const bool deep
744  )
745  : lsst::daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
746  if (!deep) {
748  "Only deep copies are permitted for MaskedImages with different pixel types");
749  }
750 
751  _image = ImagePtr(new Image(*rhs.getImage(), deep));
752  _mask = MaskPtr(new Mask(*rhs.getMask(), deep));
753  _variance = VariancePtr(new Variance(*rhs.getVariance(), deep));
754  }
755 
765  MaskedImage& operator=(MaskedImage const& rhs);
766  MaskedImage& operator=(MaskedImage&& rhs);
767 
768  virtual ~MaskedImage() = default;
769 
770  void swap(MaskedImage& rhs);
771 
772  // Operators
774  MaskedImage& operator=(Pixel const& rhs);
776  MaskedImage& operator=(SinglePixel const& rhs);
777 
791  MaskedImage subset(lsst::geom::Box2I const & bbox, ImageOrigin origin=PARENT) const {
792  return MaskedImage(*this, bbox, origin, false);
793  }
794 
797  return subset(bbox);
798  }
799 
807  MaskedImage& operator<<=(MaskedImage const& rhs);
808 
820  void assign(MaskedImage const& rhs, lsst::geom::Box2I const& bbox = lsst::geom::Box2I(),
821  ImageOrigin origin = PARENT);
822 
824  MaskedImage& operator+=(ImagePixelT const rhs);
834  MaskedImage& operator+=(MaskedImage const& rhs);
836  *_image += rhs;
837  return *this;
838  }
840  *_image += function;
841  return *this;
842  }
851  void scaledPlus(double const c, MaskedImage const& rhs);
852 
854  MaskedImage& operator-=(ImagePixelT const rhs);
861  MaskedImage& operator-=(MaskedImage const& rhs);
863  *_image -= rhs;
864  return *this;
865  }
867  *_image -= function;
868  return *this;
869  }
876  void scaledMinus(double const c, MaskedImage const& rhs);
877 
878  MaskedImage& operator*=(ImagePixelT const rhs);
879  MaskedImage& operator*=(MaskedImage const& rhs);
881  *_image *= rhs;
882  *_variance *= rhs; // yes, multiply twice
883  *_variance *= rhs;
884  return *this;
885  }
886  void scaledMultiplies(double const c, MaskedImage const& rhs);
887 
888  MaskedImage& operator/=(ImagePixelT const rhs);
889  MaskedImage& operator/=(MaskedImage const& rhs);
891  *_image /= rhs;
892  *_variance /= rhs; // yes, divide twice
893  *_variance /= rhs;
894  return *this;
895  }
896  void scaledDivides(double const c, MaskedImage const& rhs);
897 
912  void writeFits(std::string const& fileName,
921 
935  void writeFits(fits::MemFileManager& manager,
944 
958  void writeFits(fits::Fits& fitsfile,
967 
984  void writeFits(std::string const& fileName, fits::ImageWriteOptions const& imageOptions,
985  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
987  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
988  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
989  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
990 
1007  void writeFits(fits::MemFileManager& manager, fits::ImageWriteOptions const& imageOptions,
1008  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
1010  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
1011  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
1012  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
1013 
1030  void writeFits(fits::Fits& fitsfile, fits::ImageWriteOptions const& imageOptions,
1031  fits::ImageWriteOptions const& maskOptions, fits::ImageWriteOptions const& varianceOptions,
1033  std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr,
1034  std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr,
1035  std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const;
1036 
1042  static MaskedImage readFits(std::string const& filename) {
1044  }
1045 
1053  }
1054 
1055  // Getters
1056 
1058  ImagePtr getImage() const { return _image; }
1059 
1067  void setImage(Image const& other) { _image->assign(other); }
1068 
1070  MaskPtr getMask() const { return _mask; }
1071 
1079  void setMask(Mask const& other) { _mask->assign(other); }
1080 
1088  void setVariance(Variance const& other) { _variance->assign(other); }
1089 
1091  VariancePtr getVariance() const { return _variance; }
1092 
1094  int getWidth() const { return _image->getWidth(); }
1096  int getHeight() const { return _image->getHeight(); }
1097  lsst::geom::Extent2I getDimensions() const { return _image->getDimensions(); }
1098  lsst::geom::Box2I getBBox(ImageOrigin const origin = PARENT) const { return _image->getBBox(origin); }
1106  int getX0() const { return _image->getX0(); }
1114  int getY0() const { return _image->getY0(); }
1122  lsst::geom::Point2I getXY0() const { return _image->getXY0(); }
1123 
1132  void setXY0(int const x0, int const y0) { setXY0(lsst::geom::Point2I(x0, y0)); }
1133 
1142  void setXY0(lsst::geom::Point2I const origin) {
1143  if (_image) {
1144  _image->setXY0(origin);
1145  }
1146 
1147  if (_mask) {
1148  _mask->setXY0(origin);
1149  }
1150 
1151  if (_variance) {
1152  _variance->setXY0(origin);
1153  }
1154  }
1155 
1161  inline double indexToPosition(double ind,
1162  lsst::afw::image::xOrY const xy
1163  ) const {
1164  return getImage()->indexToPosition(ind, xy);
1165  }
1166 
1173  double const pos,
1174  lsst::afw::image::xOrY const xy
1175  ) const {
1176  return getImage()->positionToIndex(pos, xy);
1177  }
1178 
1179  //
1180  // Iterators and Locators
1181  //
1183  iterator begin() const;
1185  iterator end() const;
1187  iterator at(int const x, int const y) const;
1189  reverse_iterator rbegin() const;
1191  reverse_iterator rend() const;
1192 
1203  fast_iterator begin(bool contiguous) const;
1212  fast_iterator end(bool contiguous) const;
1213 
1215  x_iterator row_begin(int y) const;
1217  x_iterator row_end(int y) const;
1218 
1220  x_iterator x_at(int x, int y) const {
1221 #if 0
1222  typename Image::x_iterator imageEnd = getImage()->x_at(x, y);
1223  typename Mask::x_iterator maskEnd = getMask()->x_at(x, y);
1224  typename Variance::x_iterator varianceEnd = getVariance()->x_at(x, y);
1225 #else // bypass checks for non-NULL pointers
1226  typename Image::x_iterator imageEnd = _image->x_at(x, y);
1227  typename Mask::x_iterator maskEnd = _mask->x_at(x, y);
1228  typename Variance::x_iterator varianceEnd = _variance->x_at(x, y);
1229 #endif
1230 
1231  return x_iterator(imageEnd, maskEnd, varianceEnd);
1232  }
1233 
1235  y_iterator col_begin(int x) const;
1237  y_iterator col_end(int x) const;
1238 
1240  y_iterator y_at(int x, int y) const {
1241 #if 0
1242  typename Image::y_iterator imageEnd = getImage()->y_at(x, y);
1243  typename Mask::y_iterator maskEnd = getMask()->y_at(x, y);
1244  typename Variance::y_iterator varianceEnd = getVariance()->y_at(x, y);
1245 #else // bypass checks for non-NULL pointers
1246  typename Image::y_iterator imageEnd = _image->y_at(x, y);
1247  typename Mask::y_iterator maskEnd = _mask->y_at(x, y);
1248  typename Variance::y_iterator varianceEnd = _variance->y_at(x, y);
1249 #endif
1250  return y_iterator(imageEnd, maskEnd, varianceEnd);
1251  }
1252 
1254  xy_locator xy_at(int x, int y) const {
1255 #if 0
1256  typename Image::xy_locator imageEnd = getImage()->xy_at(x, y);
1257  typename Mask::xy_locator maskEnd = getMask()->xy_at(x, y);
1258  typename Variance::xy_locator varianceEnd = getVariance()->xy_at(x, y);
1259 #else // bypass checks for non-NULL pointers
1260  typename Image::xy_locator imageEnd = _image->xy_at(x, y);
1261  typename Mask::xy_locator maskEnd = _mask->xy_at(x, y);
1262  typename Variance::xy_locator varianceEnd = _variance->xy_at(x, y);
1263 #endif
1264 
1265  return xy_locator(imageEnd, maskEnd, varianceEnd);
1266  }
1267 
1268 private:
1269  void conformSizes();
1270 
1271  ImagePtr _image;
1272  MaskPtr _mask;
1273  VariancePtr _variance;
1274 };
1275 
1279 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
1281  typename std::shared_ptr<Image<ImagePixelT>> image,
1284 ) {
1286 }
1287 
1291 template <typename ImagePixelT1, typename ImagePixelT2>
1294 
1295 /*
1296  * Some metafunctions to extract an Image pointer from a MaskedImage pointer (or return the original Image
1297  * pointer)
1298  *
1299  * GetImage is the public interface (it forwards the tag --- just for the sake of the UI); the real work
1300  * is in GetImage_ which defines a typedef for the Image and a static function, getImage
1301  *
1302  * E.g.
1303  * In the function
1304  *
1305  * template<typename ImageT>
1306  * void func(shared_ptr<ImageT> image) {
1307  * typename shared_ptr<GetImage<ImageT>::type> im = GetImage<ImageT>::getImage(image);
1308  * }
1309  *
1310  * "im" is a shared_ptr<Image> irrespective of whether ImageT is Masked or not.
1311  */
1312 namespace {
1313 template <typename ImageT, typename TagT>
1314 struct GetImage_ {
1315  typedef ImageT type;
1316  static std::shared_ptr<type> getImage(std::shared_ptr<ImageT> image) { return image; }
1317 };
1318 
1319 template <typename ImageT>
1320 struct GetImage_<ImageT, typename image::detail::MaskedImage_tag> {
1321  typedef typename ImageT::Image type;
1322  static std::shared_ptr<type> getImage(std::shared_ptr<ImageT> image) { return image->getImage(); }
1323 };
1324 } // anonymous namespace
1325 
1326 template <typename ImageT>
1327 struct GetImage : public GetImage_<ImageT, typename ImageT::image_category> {};
1328 } // namespace image
1329 } // namespace afw
1330 } // namespace lsst
1331 
1332 #endif // LSST_IMAGE_MASKEDIMAGE_H
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
MaskedImageLocatorBase & operator+=(detail::difference_type p)
Increment the locator&#39;s x and y positions by p
Definition: MaskedImage.h:487
cached_location_t cache_location(int x, int y) const
Create a cached_location_t offset by (x, y) from locator.
Definition: MaskedImage.h:415
MaskedImageIterator operator+(std::ptrdiff_t delta)
Return a MaskedImageIterator that&#39;s delta beyond this.
Definition: MaskedImage.h:218
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:1172
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
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:448
void scaledPlus(OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
Compute the scaled sum of two images.
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:442
Ref< MaskPixelT >::type mask()
Return (a reference to) the mask part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:143
Ref< MaskPixelT >::type mask()
Return a reference to the mask at the current position of the locator.
Definition: MaskedImage.h:455
const_MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator > const_xy_locator
A const_locator for a MaskedImage.
Definition: MaskedImage.h:582
y_iterator y()
Return an iterator that can be used to move (or dereference) a locator.
Definition: MaskedImage.h:412
MaskedImageIteratorBase(ImageIterator const &img, MaskIterator const &msk, VarianceIterator const &var)
Construct a MaskedImageIteratorBase from the image/mask/variance iterators.
Definition: MaskedImage.h:136
The base class for MaskedImageLocators (const and non-const)
Definition: MaskedImage.h:262
MaskedImageLocator(ImageLocator &img, MaskLocator &msk, VarianceLocator &var)
Definition: MaskedImage.h:509
Definition: Polygon.cc:25
MaskedImage & operator-=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:866
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(int x, int y)
Definition: MaskedImage.h:435
boost::mpl::vector< ImagePixelT, MaskPixelT, VariancePixelT > PixelTVec
Definition: MaskedImage.h:421
_view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: ImageBase.h:130
std::shared_ptr< image::Mask< MaskPixelT > > MaskPtr
shared pointer to the Mask
Definition: MaskedImage.h:79
const_MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > const_iterator
Definition: MaskedImage.h:544
boost::zip_iterator< IMV_iterator_tuple > _iter
Definition: MaskedImage.h:204
Image< LhsPixelT > & operator+=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Add lhs to Image rhs (i.e. pixel-by-pixel addition) where types are different.
Definition: Image.cc:686
float Pixel
Typedefs to be used for pixel values.
Definition: common.h:37
Pixel type
Type pointed to by the iterator.
Definition: MaskedImage.h:133
A templated class to return this classes&#39; type (present in Image/Mask/MaskedImage) ...
Definition: MaskedImage.h:93
Pixel operator()(int x, int y)
Dereference a locator, returning a Pixel offset by (x, y) from the locator.
Definition: MaskedImage.h:390
lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
A Pixel in the MaskedImage.
Definition: MaskedImage.h:109
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: MaskedImage.h:565
afw::table::Key< afw::table::Array< VariancePixelT > > variance
const_MaskedImageLocator(MaskedImageLocator< ImageLocator, MaskLocator, VarianceLocator > const &iter)
Definition: MaskedImage.h:529
boost::tuple< typename ImageLocator::cached_location_t, typename MaskLocator::cached_location_t, typename VarianceLocator::cached_location_t > IMVCachedLocation
Definition: MaskedImage.h:354
y_iterator y_at(int x, int y) const
Return an y_iterator at the point (x, y)
Definition: MaskedImage.h:1240
std::map< std::string, int > MaskPlaneDict
Definition: Mask.h:59
std::shared_ptr< Image< PixelT > > operator*(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator*()
Definition: ImageSlice.cc:104
Pixel operator*()
Dereference a locator, returning a Pixel.
Definition: MaskedImage.h:384
Options for writing an image to FITS.
Definition: fits.h:219
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:466
bool operator==(MaskedImageIteratorBase const &rhs)
Return true if the lhs equals the rhs.
Definition: MaskedImage.h:181
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:134
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:397
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(cached_location_t const &cached_loc)
Definition: MaskedImage.h:424
int y
Definition: SpanSet.cc:49
The base class for MaskedImageIterators (const and non-const)
Definition: MaskedImage.h:119
MaskedImage operator[](lsst::geom::Box2I const &bbox) const
Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
Definition: MaskedImage.h:796
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:557
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:451
void setXY0(lsst::geom::Point2I const origin)
Set the MaskedImage&#39;s origin.
Definition: MaskedImage.h:1142
lsst::afw::image::pixel::SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > SinglePixel
A single Pixel of the same type as those in the MaskedImage.
Definition: MaskedImage.h:114
A single pixel of the same type as a MaskedImage.
Definition: Pixel.h:73
std::shared_ptr< image::Image< VariancePixelT > > VariancePtr
shared pointer to the variance Image
Definition: MaskedImage.h:81
MaskedImageIteratorBase operator++(int)
Increment the iterator (postfix)
Definition: MaskedImage.h:171
MaskedImage & operator-=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:862
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:368
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
lsst::geom::Point2I getXY0() const
Return the image&#39;s origin.
Definition: MaskedImage.h:1122
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
MaskedImageIteratorBase & operator+=(std::ptrdiff_t delta)
Increment the iterator by delta
Definition: MaskedImage.h:154
A Function taking two arguments.
Definition: Function.h:261
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:1280
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
Definition: MaskedImage.h:1220
const_MaskedImageIterator & operator+(std::ptrdiff_t delta)
Return a const_MaskedImageIterator that&#39;s delta beyond this.
Definition: MaskedImage.h:251
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:540
Ref< VariancePixelT >::type variance()
Return (a reference to) the variance part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:146
bool operator==(MaskedImageLocatorBase const &rhs)
Return true iff two locators are equal.
Definition: MaskedImage.h:471
Mask< MaskPixelT >::MaskPlaneDict MaskPlaneDict
The Mask&#39;s MaskPlaneDict.
Definition: MaskedImage.h:83
lsst::geom::Extent2I getDimensions() const
Definition: MaskedImage.h:1097
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
STL class.
MaskedImage & operator/=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:890
bool operator!=(MaskedImageIteratorBase const &rhs)
Return true if the lhs doesn&#39;t equal the rhs.
Definition: MaskedImage.h:185
MaskedImage & operator+=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:839
_view_t::iterator iterator
An STL compliant iterator.
Definition: ImageBase.h:126
double indexToPosition(double ind, lsst::afw::image::xOrY const xy) const
Convert image index to image position (see Image::indexToPosition)
Definition: MaskedImage.h:1161
_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:356
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:1096
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:741
A base class for image defects.
table::Key< int > type
Definition: Detector.cc:167
int getX0() const
Return the image&#39;s column-origin.
Definition: MaskedImage.h:1106
static MaskedImage readFits(fits::MemFileManager &manager)
Read a MaskedImage from a FITS RAM file.
Definition: MaskedImage.h:1051
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:78
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:569
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
const_MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator > const_y_iterator
A const_iterator to a column of a MaskedImage.
Definition: MaskedImage.h:573
A traits class for MaskedImage.
Definition: MaskedImage.h:51
_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:358
const IMV_iterator_tuple get_iterator_tuple() const
Return the underlying iterator tuple.
Definition: MaskedImage.h:151
const Pixel operator*() const
Dereference the iterator, returning a const Pixel.
Definition: MaskedImage.h:201
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:74
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: ImageBase.h:144
MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator > reverse_iterator
Definition: MaskedImage.h:548
std::shared_ptr< image::Image< ImagePixelT > > ImagePtr
shared pointer to the Image
Definition: MaskedImage.h:77
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:721
detail::MaskedImage_tag image_category
Definition: MaskedImage.h:89
boost::zip_iterator< IMV_iterator_tuple >::reference IMV_tuple
The underlying iterator tuple.
Definition: MaskedImage.h:126
Ref< ImagePixelT >::type image()
Return (a reference to) the image part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:140
A saved relative position, providing efficient access to neighbouring pixels.
Definition: MaskedImage.h:360
table::Box2IKey bbox
Definition: Detector.cc:169
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
Pixel operator*()
Dereference the iterator, returning a Pixel.
Definition: MaskedImage.h:199
double x
void setMask(Mask const &other)
Set the mask plane&#39;s pixel values to those of another Mask.
Definition: MaskedImage.h:1079
bool operator!=(MaskedImageLocatorBase const &rhs)
Return true iff two locators are not equal.
Definition: MaskedImage.h:475
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070
std::string const compressedFileNoMEF_RE
regexp to identify compressed files that we can&#39;t write MEFs to
Definition: MaskedImage.h:58
void swap(Image< PixelT > &a, Image< PixelT > &b)
Definition: Image.cc:471
int getY0() const
Return the image&#39;s row-origin.
Definition: MaskedImage.h:1114
std::ptrdiff_t operator-(MaskedImageIteratorBase const &rhs)
Return the distance between two iterators.
Definition: MaskedImage.h:177
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Ref< ImagePixelT >::type image()
Return a reference to the image at the current position of the locator.
Definition: MaskedImage.h:446
afw::table::Key< afw::table::Array< MaskPixelT > > mask
x_iterator x()
Return an iterator that can be used to move (or dereference) a locator.
Definition: MaskedImage.h:406
A pixel of a MaskedImage.
Definition: Pixel.h:148
MaskedImageIteratorBase & operator++()
Increment the iterator (prefix)
Definition: MaskedImage.h:166
An const iterator to the MaskedImage.
Definition: MaskedImage.h:103
MaskedImage & operator+=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:835
Image< LhsPixelT > & operator*=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Multiply lhs by Image rhs (i.e. pixel-by-pixel multiplication) where types are different.
Definition: Image.cc:698
std::string const fitsFile_RE
regexp to identify when MaskedImages should be written as MEFs
Definition: MaskedImage.h:56
MaskedImageIterator(ImageIterator &img, MaskIterator &msk, VarianceIterator &var)
Definition: MaskedImage.h:215
MaskedImageIteratorBase & operator-=(std::ptrdiff_t delta)
Decrement the iterator by delta
Definition: MaskedImage.h:160
const_MaskedImageIterator(MaskedImageIterator< ImageIterator, MaskIterator, VarianceIterator > const &iter)
Definition: MaskedImage.h:242
void setXY0(int const x0, int const y0)
Set the MaskedImage&#39;s origin.
Definition: MaskedImage.h:1132
Image< LhsPixelT > & operator-=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Subtract lhs from Image rhs (i.e. pixel-by-pixel subtraction) where types are different.
Definition: Image.cc:692
bool operator<(MaskedImageLocatorBase const &rhs)
Return true iff lhs is less than rhs.
Definition: MaskedImage.h:477
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:457
afw::table::Key< afw::table::Array< ImagePixelT > > image
void setImage(Image const &other)
Set the image plane&#39;s pixel values to those of another Image.
Definition: MaskedImage.h:1067
Ref< VariancePixelT >::type variance()
Return a reference to the variance at the current position of the locator.
Definition: MaskedImage.h:464
MaskedImage subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: MaskedImage.h:791
Reports invalid arguments.
Definition: Runtime.h:66
void setVariance(Variance const &other)
Set the variance plane&#39;s pixel values to those of another Image.
Definition: MaskedImage.h:1088
int getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:1094
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:586
static MaskedImage readFits(std::string const &filename)
Read a MaskedImage from a regular FITS file.
Definition: MaskedImage.h:1042
MaskedImage & operator*=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:880
MaskedImage< ImagePT, MaskPT, VarPT > type
Return the desired type.
Definition: MaskedImage.h:95
ItemVariant const * other
Definition: Schema.cc:56
Image< LhsPixelT > & operator/=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Divide lhs by Image rhs (i.e. pixel-by-pixel division) where types are different. ...
Definition: Image.cc:704
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86
MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator > xy_locator
A locator for a MaskedImage.
Definition: MaskedImage.h:578
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:589
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:55
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
bool operator<(MaskedImageIteratorBase const &rhs)
Return true if the lhs is less than the rhs.
Definition: MaskedImage.h:189
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:460
float VariancePixel
default type for MaskedImage variance images
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: MaskedImage.h:1098
A class used to identify classes that represent MaskedImage pixels.
Definition: MaskedImage.h:53
MaskedImageLocatorBase(ImageLocator const &img, MaskLocator const &msk, VarianceLocator const &var)
Construct a MaskedImageLocator from image/mask/variance locators.
Definition: MaskedImage.h:378
_view_t::xy_locator xy_locator
An xy_locator.
Definition: ImageBase.h:122
An integer coordinate rectangle.
Definition: Box.h:54
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:59
MaskedImageLocatorBase & operator+=(pair2I const &p)
Increment the locator&#39;s x and y positions by p
Definition: MaskedImage.h:482
int end
const_MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator > const_x_iterator
A const_iterator to a row of a MaskedImage.
Definition: MaskedImage.h:561
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y)
Definition: MaskedImage.h:1254
A const locator for the MaskedImage.
Definition: MaskedImage.h:109
metafunction to extract reference type from PixelT
Definition: ImageBase.h:86
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV()
Definition: MaskedImage.h:430
metafunction to extract const reference type from PixelT
Definition: ImageBase.h:91