LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 
30 #ifndef LSST_IMAGE_MASKEDIMAGE_H
31 #define LSST_IMAGE_MASKEDIMAGE_H
32 
33 #include <ostream>
34 #include <list>
35 #include <map>
36 #include <string>
37 
38 #include "boost/shared_ptr.hpp"
39 #include "boost/mpl/at.hpp"
40 #include "boost/iterator/zip_iterator.hpp"
41 
42 #include "lsst/daf/base/Citizen.h"
45 #include "lsst/afw/image/Image.h"
46 #include "lsst/afw/image/Mask.h"
47 
48 namespace lsst {
49 namespace afw {
50 namespace image {
51  namespace detail {
53  struct MaskedImage_tag : public basic_tag { };
56 
57  std::string const fitsFile_RE = "\\.fits(\\.[fg]z)?$";
58  std::string const compressedFileNoMEF_RE = "(\\.gz)$";
60  }
61 }}}
62 
63 #include "lsst/afw/image/Pixel.h"
65 
66 namespace lsst {
67 namespace afw {
68  namespace formatters {
69  template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT> class MaskedImageFormatter;
70  }
71 
72 namespace image {
73 
75 template<typename ImagePixelT, typename MaskPixelT=lsst::afw::image::MaskPixel,
76  typename VariancePixelT=lsst::afw::image::VariancePixel>
79 public:
83  typedef typename Mask<MaskPixelT>::Ptr MaskPtr;
87  typedef boost::shared_ptr<MaskedImage> Ptr;
88  typedef boost::shared_ptr<const MaskedImage> ConstPtr;
91 
92  typedef lsst::afw::image::Image<VariancePixelT> Variance; // These need to be here, and in this order, as
93  typedef lsst::afw::image::Image<ImagePixelT> Image; // "typedef Image::Ptr ImagePtr;" confuses swig (it can't
94  typedef lsst::afw::image::Mask<MaskPixelT> Mask; // find ImagePtr) and we can't use Image<> after these typedefs
95 
97 
98 #if !defined(SWIG)
99  template<typename ImagePT=ImagePixelT, typename MaskPT=MaskPixelT, typename VarPT=VariancePixelT>
104  };
105 #endif
106 
107  /************************************************************************************************************/
109  template<typename, typename, typename> class MaskedImageIterator;
111  template<typename, typename, typename> class const_MaskedImageIterator;
113  template<typename, typename, typename> class MaskedImageLocator;
115  template<typename, typename, typename> class const_MaskedImageLocator;
116 
117  /************************************************************************************************************/
118 
119 #if !defined(SWIG)
124 
125  /************************************************************************************************************/
127  template<typename ImageIterator, typename MaskIterator, typename VarianceIterator,
128  template<typename> class Ref=Reference>
130  typedef boost::tuple<ImageIterator, MaskIterator, VarianceIterator> IMV_iterator_tuple;
131 
132  public:
135  typedef typename boost::zip_iterator<IMV_iterator_tuple>::reference IMV_tuple;
138  template<typename, typename, typename> friend class const_MaskedImageIterator;
140  typedef Pixel type;
141 
143  MaskedImageIteratorBase(ImageIterator const& img, MaskIterator const& msk, VarianceIterator const &var) :
144  _iter(boost::make_zip_iterator(boost::make_tuple(img, msk, var))) {
145  }
147  typename Ref<ImagePixelT>::type image() {
148  return _iter->template get<0>()[0];
149  }
150 
152  typename Ref<MaskPixelT>::type mask() {
153  return _iter->template get<1>()[0];
154  }
155 
157  typename Ref<VariancePixelT>::type variance() {
158  return _iter->template get<2>()[0];
159  }
160 
164  return _iter.get_iterator_tuple();
165  }
166 
168  void operator+=(std::ptrdiff_t delta
169  ) {
170  _iter += delta;
171  }
173  void operator-=(std::ptrdiff_t delta
174  ) {
175  _iter -= delta;
176  }
178  void operator++() { // prefix
179  ++_iter;
180  }
182  void operator++(int) { // postfix
183  _iter++;
184  }
186  std::ptrdiff_t operator-(MaskedImageIteratorBase const& rhs) {
187  return &this->_iter->template get<0>() - &rhs._iter->template get<0>();
188  }
191  return &this->_iter->template get<0>() == &rhs._iter->template get<0>();
192  }
195  return &this->_iter->template get<0>() != &rhs._iter->template get<0>();
196  }
199  return &this->_iter->template get<0>() < &rhs._iter->template get<0>();
200  }
202  operator Pixel() const {
203  return Pixel(_iter->template get<0>()[0],
204  _iter->template get<1>()[0],
205  _iter->template get<2>()[0]);
206  }
207 
210  return Pixel(image(), mask(), variance());
211  }
213  const Pixel operator*() const {
214  return Pixel(image(), mask(), variance());
215  }
216 
217  protected:
218  typename boost::zip_iterator<IMV_iterator_tuple> _iter;
219  };
220 
222  template<typename ImageIterator, typename MaskIterator, typename VarianceIterator>
223  class MaskedImageIterator :
224  public MaskedImageIteratorBase<ImageIterator, MaskIterator, VarianceIterator> {
226  public:
227  MaskedImageIterator(ImageIterator& img, MaskIterator& msk, VarianceIterator &var) :
228  MaskedImageIteratorBase_t(img, msk, var) {
229  }
231  MaskedImageIterator operator+(std::ptrdiff_t delta) {
232  MaskedImageIterator lhs = *this;
233  lhs += delta;
234 
235  return lhs;
236  }
237  };
238 
240  template<typename ImageIterator, typename MaskIterator, typename VarianceIterator>
241  class const_MaskedImageIterator :
242  public MaskedImageIteratorBase<typename detail::const_iterator_type<ImageIterator>::type,
243  typename detail::const_iterator_type<MaskIterator>::type,
244  typename detail::const_iterator_type<VarianceIterator>::type,
245  ConstReference> {
246 
247  typedef typename detail::const_iterator_type<ImageIterator>::type const_ImageIterator;
248  typedef typename detail::const_iterator_type<MaskIterator>::type const_MaskIterator;
249  typedef typename detail::const_iterator_type<VarianceIterator>::type const_VarianceIterator;
250 
253  public:
256  const_MaskIterator(iter.get_iterator_tuple().template get<1>()),
257  const_VarianceIterator(iter.get_iterator_tuple().template get<2>())
258  ) {
259  ;
260  }
262  const_MaskedImageIterator& operator+(std::ptrdiff_t delta) {
263  const_MaskedImageIterator lhs = *this;
264  lhs += delta;
265 
266  return lhs;
267  }
268  };
269 
270  /************************************************************************************************************/
272  template<typename ImageLocator, typename MaskLocator, typename VarianceLocator,
273  template<typename> class Ref=Reference>
275  typedef typename boost::tuple<ImageLocator, MaskLocator, VarianceLocator> IMVLocator;
276  //
277  // A class to provide _[xy]_iterator for MaskedImageLocator. We can't just use
278  // a zip_iterator as moving this iterator must be the same as moving the locator
279  // itself, for consistency with {Image,Mask}::xy_locator
280  //
281  template<template<typename> class X_OR_Y >
283  public:
285 
286  void operator+=(const int di) {
287  // Equivalent to "_mil->_loc.template get<0>().x() += di;"
288  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() += di;
289  X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())() += di;
290  X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())() += di;
291  }
292 
293  void operator++() { // prefix
294  // Equivalent to "++_mil->_loc.template get<0>().x();"
295  ++X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())();
296  ++X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())();
297  ++X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())();
298  }
299 
300  bool operator==(_x_or_y_iterator const& rhs) {
301  return
302  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() ==
303  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
304 
305  }
306  bool operator!=(_x_or_y_iterator const& rhs) {
307  return
308  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() !=
309  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
310 
311  }
312  bool operator<(_x_or_y_iterator const& rhs) {
313  return
314  X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())() <
315  X_OR_Y<ImageLocator>(rhs._mil->_loc.template get<0>())();
316 
317  }
318 
320  return Pixel((*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0],
321  (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0],
322  (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0]);
323  }
324 
325  typename Ref<ImagePixelT>::type image() {
326  // Equivalent to "return (*_mil->_loc.template get<0>().x())[0];"
327 
328  return (*(X_OR_Y<ImageLocator>(_mil->_loc.template get<0>())()))[0];
329  }
330  typename Ref<MaskPixelT>::type mask() {
331  return (*(X_OR_Y<MaskLocator>(_mil->_loc.template get<1>())()))[0];
332  }
333  typename Ref<VariancePixelT>::type variance() {
334  return (*(X_OR_Y<VarianceLocator>(_mil->_loc.template get<2>())()))[0];
335  }
336  protected:
338  };
339 
340  // Two classes to provide .x() and .y() in _x_or_y_iterator
341  template<typename LocT>
342  class apply_x {
343  typedef typename LocT::x_iterator IterT;
344  public:
345  apply_x(LocT &loc) : _loc(loc) { }
346  IterT& operator()() { return _loc.x(); }
347  private:
348  LocT& _loc;
349  };
350 
351  template<typename LocT>
352  class apply_y {
353  typedef typename LocT::y_iterator IterT;
354  public:
355  apply_y(LocT &loc) : _loc(loc) { }
356  IterT& operator()() { return _loc.y(); }
357  private:
358  LocT& _loc;
359  };
360 
361  public:
362  template<typename, typename, typename> friend class const_MaskedImageLocator;
363 
364  typedef typename boost::tuple<typename ImageLocator::cached_location_t,
365  typename MaskLocator::cached_location_t,
366  typename VarianceLocator::cached_location_t> IMVCachedLocation;
368  typedef _x_or_y_iterator<apply_x> x_iterator;
370  typedef _x_or_y_iterator<apply_y> y_iterator;
373  public:
374  //template<typename, typename, typename, template<typename> class> friend class MaskedImageLocatorBase;
375  template<typename, typename, typename> friend class const_MaskedImageLocator;
376 
378  cached_location_t(IMVLocator const& loc, int x, int y) :
379  _imv(loc.template get<0>().cache_location(x, y),
380  loc.template get<1>().cache_location(x, y),
381  loc.template get<2>().cache_location(x, y)) {
382  ;
383  }
384  //protected:
386  };
388  MaskedImageLocatorBase(ImageLocator const& img, MaskLocator const& msk, VarianceLocator const& var) :
389  _loc(img, msk, var) {
390  ;
391  }
392 
395  return Pixel(_loc.template get<0>().x()[0][0],
396  _loc.template get<1>().x()[0][0],
397  _loc.template get<2>().x()[0][0]);
398  }
399 
401  Pixel operator()(int x, int y) {
402  return Pixel(_loc.template get<0>()(x, y)[0],
403  _loc.template get<1>()(x, y)[0],
404  _loc.template get<2>()(x, y)[0]);
405  }
406 
408  Pixel operator[](cached_location_t const& cached_loc) {
409  return Pixel(_loc.template get<0>()[cached_loc._imv.template get<0>()][0],
410  _loc.template get<1>()[cached_loc._imv.template get<1>()][0],
411  _loc.template get<2>()[cached_loc._imv.template get<2>()][0]);
412  }
417  return x_iterator(this);
418  }
419 
424  return y_iterator(this);
425  }
426 
428  cached_location_t cache_location(int x, int y) const {
429  return cached_location_t(_loc, x, y);
430  }
431  //
432  // We don't want to duplicate code for image/mask/variance -- but the boost::mpl stuff isn't pretty
433  // as we can't say int_<N> within a template<int N>. So define a set of functions apply_IMV
434  // to do the dirty work
435  //
436  typedef typename boost::mpl::vector<ImagePixelT, MaskPixelT, VariancePixelT> PixelTVec;
437 
438  template<typename N>
439  typename Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV(cached_location_t const& cached_loc) {
440  return _loc.template get<N::value>()[cached_loc._imv.template get<N::value>()][0];
441  }
442 
443  template<typename N>
444  typename Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV() {
445  return _loc.template get<N::value>()[0][0];
446  }
447 
448  template<typename N>
449  typename Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV(int x, int y) {
450  return _loc.template get<N::value>()(x, y)[0];
451  }
452  //
453  // Use those templated classes to implement image/mask/variance
454  //
456  typename Ref<ImagePixelT>::type image(cached_location_t const& cached_loc) {
457  return apply_IMV<boost::mpl::int_<0> >(cached_loc);
458  }
460  typename Ref<ImagePixelT>::type image() {
461  return apply_IMV<boost::mpl::int_<0> >();
462  }
464  typename Ref<ImagePixelT>::type image(int x, int y) {
465  return apply_IMV<boost::mpl::int_<0> >(x, y);
466  }
467 
469  typename Ref<MaskPixelT>::type mask(cached_location_t const& cached_loc) {
470  return apply_IMV<boost::mpl::int_<1> >(cached_loc);
471  }
473  typename Ref<MaskPixelT>::type mask() {
474  return apply_IMV<boost::mpl::int_<1> >();
475  }
477  typename Ref<MaskPixelT>::type mask(int x, int y) {
478  return apply_IMV<boost::mpl::int_<1> >(x, y);
479  }
480 
482  typename Ref<VariancePixelT>::type variance(cached_location_t const& cached_loc) {
483  return apply_IMV<boost::mpl::int_<2> >(cached_loc);
484  }
486  typename Ref<VariancePixelT>::type variance() {
487  return apply_IMV<boost::mpl::int_<2> >();
488  }
490  typename Ref<VariancePixelT>::type variance(int x, int y) {
491  return apply_IMV<boost::mpl::int_<2> >(x, y);
492  }
493 
496  return _loc.template get<0>() == rhs._loc.template get<0>();
497  }
500  return !(*this == rhs);
501  }
504  return _loc.template get<0>() < rhs._loc.template get<0>();
505  }
506 
508  MaskedImageLocatorBase& operator+=(pair2I const& p) {
509  return operator+=(detail::difference_type(p.first, p.second));
510  }
511 
513  MaskedImageLocatorBase& operator+=(detail::difference_type p) {
514  _loc.template get<0>() += p;
515  _loc.template get<1>() += p;
516  _loc.template get<2>() += p;
517 
518  return *this;
519  }
520  protected:
522  };
523 
525  template<typename ImageLocator, typename MaskLocator, typename VarianceLocator>
526  class MaskedImageLocator :
527  public MaskedImageLocatorBase<ImageLocator, MaskLocator, VarianceLocator> {
529  public:
530  MaskedImageLocator(ImageLocator& img, MaskLocator& msk, VarianceLocator &var) :
531  MaskedImageLocatorBase_t(img, msk, var) {
532  }
533  };
534 
536  template<typename ImageLocator, typename MaskLocator, typename VarianceLocator>
537  class const_MaskedImageLocator :
538  public MaskedImageLocatorBase<typename detail::const_locator_type<ImageLocator>::type,
539  typename detail::const_locator_type<MaskLocator>::type,
540  typename detail::const_locator_type<VarianceLocator>::type,
541  ConstReference> {
542 
543  typedef typename detail::const_locator_type<ImageLocator>::type const_ImageLocator;
544  typedef typename detail::const_locator_type<MaskLocator>::type const_MaskLocator;
545  typedef typename detail::const_locator_type<VarianceLocator>::type const_VarianceLocator;
546 
549  public:
551  MaskedImageLocatorBase_t(const_ImageLocator(iter._loc.template get<0>()),
552  const_MaskLocator(iter._loc.template get<1>()),
553  const_VarianceLocator(iter._loc.template get<2>())
554  ) {
555  ;
556  }
557  };
558 
559 #endif // !defined(SWIG)
560 
561 /************************************************************************************************************/
562  // An iterator to a MaskedImage
563  typedef MaskedImageIterator<typename Image::iterator,
565  // A const_iterator to a MaskedImage
566  typedef const_MaskedImageIterator<typename Image::iterator,
568  // A reverse_iterator to a MaskedImage
569  typedef MaskedImageIterator<typename Image::reverse_iterator,
571 #if 0 // doesn't compile. I should fix this, but it's low priority. RHL
572  typedef const_MaskedImageIterator<typename Image::reverse_iterator,
574  typename Mask::reverse_iterator, typename Variance::reverse_iterator> const_reverse_iterator;
575 #endif
576  typedef MaskedImageIterator<typename Image::x_iterator,
580  typedef const_MaskedImageIterator<typename Image::x_iterator,
586  typedef MaskedImageIterator<typename Image::y_iterator,
589  typedef const_MaskedImageIterator<typename Image::y_iterator,
591 
593  typedef MaskedImageLocator<typename Image::xy_locator,
596  typedef const_MaskedImageLocator<typename Image::xy_locator,
598 
600  typedef typename MaskedImageLocator<typename Image::xy_locator,
603  typedef typename MaskedImageLocator<typename Image::xy_locator,
605 
606  /************************************************************************************************************/
607 
608  // Constructors
609  explicit MaskedImage(
610  unsigned int width, unsigned int height,
611  MaskPlaneDict const& planeDict=MaskPlaneDict()
612  );
613  explicit MaskedImage(
615  MaskPlaneDict const& planeDict=MaskPlaneDict()
616  );
617  explicit MaskedImage(
618  ImagePtr image,
619  MaskPtr mask = MaskPtr(),
620  VariancePtr variance = VariancePtr()
621  );
622  explicit MaskedImage(
623  geom::Box2I const & bbox,
624  MaskPlaneDict const& planeDict=MaskPlaneDict()
625  );
626 
642  explicit MaskedImage(
643  std::string const & fileName,
645  geom::Box2I const & bbox=geom::Box2I(), ImageOrigin origin=PARENT,
646  bool conformMasks=false, bool needAllHdus=false,
650  );
651 
667  explicit MaskedImage(
668  fits::MemFileManager & manager,
670  geom::Box2I const & bbox=geom::Box2I(), ImageOrigin origin=PARENT,
671  bool conformMasks=false, bool needAllHdus=false,
675  );
676 
692  explicit MaskedImage(
693  fits::Fits & fitsfile,
695  geom::Box2I const & bbox=geom::Box2I(), ImageOrigin origin=PARENT,
696  bool conformMasks=false, bool needAllHdus=false,
700  );
701 
702  MaskedImage(
703  MaskedImage const& rhs,
704  bool const deep=false
705  );
706  MaskedImage(
707  MaskedImage const & rhs,
708  geom::Box2I const & bbox,
709  ImageOrigin const origin=PARENT,
710  bool const deep=false
711  );
716  template<typename OtherPixelT>
719 
720  const bool deep
721  ) :
722  lsst::daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
723  if (!deep) {
724  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
725  "Only deep copies are permitted for MaskedImages with different pixel types");
726  }
727 
728  _image = typename Image::Ptr(new Image(*rhs.getImage(), deep));
729  _mask = typename Mask::Ptr(new Mask(*rhs.getMask(), deep));
730  _variance = typename Variance::Ptr(new Variance(*rhs.getVariance(), deep));
731  }
732 
733 #if defined(DOXYGEN)
734  MaskedImage& operator=(MaskedImage const& rhs);
735 #endif
736 
737  virtual ~MaskedImage() {}
738 
739  void swap(MaskedImage &rhs);
740 
741  // Operators
742  MaskedImage& operator=(Pixel const& rhs);
743  MaskedImage& operator=(SinglePixel const& rhs);
744 
745  void operator<<=(MaskedImage const& rhs);
746 
747  void operator+=(ImagePixelT const rhs);
748  void operator+=(MaskedImage const& rhs);
750  *_image += rhs;
751  }
753  *_image += function;
754  }
755  void scaledPlus(double const c, MaskedImage const& rhs);
756 
757  void operator-=(ImagePixelT const rhs);
758  void operator-=(MaskedImage const& rhs);
760  *_image -= rhs;
761  }
763  *_image -= function;
764  }
765  void scaledMinus(double const c, MaskedImage const& rhs);
766 
767  void operator*=(ImagePixelT const rhs);
768  void operator*=(MaskedImage const& rhs);
770  *_image *= rhs;
771  *_variance *= rhs; // yes, multiply twice
772  *_variance *= rhs;
773  }
774  void scaledMultiplies(double const c, MaskedImage const& rhs);
775 
776  void operator/=(ImagePixelT const rhs);
777  void operator/=(MaskedImage const& rhs);
779  *_image /= rhs;
780  *_variance /= rhs; // yes, divide twice
781  *_variance /= rhs;
782  }
783  void scaledDivides(double const c, MaskedImage const& rhs);
784 
799  void writeFits(
800  std::string const & fileName,
805  ) const;
806 
820  void writeFits(
821  fits::MemFileManager & manager,
826  ) const;
827 
841  void writeFits(
842  fits::Fits & fitsfile,
847  ) const;
848 
854  static MaskedImage readFits(std::string const & filename) {
856  }
857 
865  }
866 
867  // Getters
869  ImagePtr getImage(bool const noThrow=false) const {
870  if (!_image && !noThrow) {
871  throw LSST_EXCEPT(
872  lsst::pex::exceptions::RuntimeError,
873  "MaskedImage's Image is NULL"
874  );
875  }
876  return _image;
877  }
879  MaskPtr getMask(bool const noThrow=false) const {
880  if (!_mask && !noThrow) {
881  throw LSST_EXCEPT(
882  lsst::pex::exceptions::RuntimeError,
883  "MaskedImage's Mask is NULL"
884  );
885  }
886 
887  return _mask;
888  }
890  VariancePtr getVariance(bool const noThrow=false) const {
891  if (!_variance && !noThrow) {
892  throw LSST_EXCEPT(
893  lsst::pex::exceptions::RuntimeError,
894  "MaskedImage's Variance is NULL"
895  );
896  }
897 
898  return _variance;
899  }
901  int getWidth() const { return _image->getWidth(); }
903  int getHeight() const { return _image->getHeight(); }
904  geom::Extent2I getDimensions() const {return _image->getDimensions();}
905  geom::Box2I getBBox(ImageOrigin const origin=PARENT) const {return _image->getBBox(origin);}
913  int getX0() const { return _image->getX0(); }
921  int getY0() const { return _image->getY0(); }
929  geom::Point2I getXY0() const { return _image->getXY0(); }
930 
939  void setXY0(int const x0, int const y0) {
940  setXY0(geom::Point2I(x0,y0));
941  }
942 
951  void setXY0(geom::Point2I const origin) {
952  if (_image) {
953  _image->setXY0(origin);
954  }
955 
956  if (_mask) {
957  _mask->setXY0(origin);
958  }
959 
960  if (_variance) {
961  _variance->setXY0(origin);
962  }
963  }
964 
965 
971  inline double indexToPosition(
972  double ind,
973  lsst::afw::image::xOrY const xy
974  ) const {
975  return getImage()->indexToPosition(ind, xy);
976  }
977 
983  std::pair<int, double> positionToIndex(
984  double const pos,
985  lsst::afw::image::xOrY const xy
986  ) const {
987  return getImage()->positionToIndex(pos, xy);
988  }
989 
990  //
991  // Iterators and Locators
992  //
993  iterator begin() const;
994  iterator end() const;
995  iterator at(int const x, int const y) const;
996  reverse_iterator rbegin() const;
997  reverse_iterator rend() const;
998 
999  fast_iterator begin(bool) const;
1000  fast_iterator end(bool) const;
1001 
1002  x_iterator row_begin(int y) const;
1003  x_iterator row_end(int y) const;
1004 
1006  x_iterator x_at(int x, int y) const {
1007 #if 0
1008  typename Image::x_iterator imageEnd = getImage()->x_at(x, y);
1009  typename Mask::x_iterator maskEnd = getMask()->x_at(x, y);
1010  typename Variance::x_iterator varianceEnd = getVariance()->x_at(x, y);
1011 #else // bypass checks for non-NULL pointers
1012  typename Image::x_iterator imageEnd = _image->x_at(x, y);
1013  typename Mask::x_iterator maskEnd = _mask->x_at(x, y);
1014  typename Variance::x_iterator varianceEnd = _variance->x_at(x, y);
1015 #endif
1016 
1017  return x_iterator(imageEnd, maskEnd, varianceEnd);
1018  }
1019 
1020  y_iterator col_begin(int x) const;
1021  y_iterator col_end(int x) const;
1022 
1024  y_iterator y_at(int x, int y) const {
1025 #if 0
1026  typename Image::y_iterator imageEnd = getImage()->y_at(x, y);
1027  typename Mask::y_iterator maskEnd = getMask()->y_at(x, y);
1028  typename Variance::y_iterator varianceEnd = getVariance()->y_at(x, y);
1029 #else // bypass checks for non-NULL pointers
1030  typename Image::y_iterator imageEnd = _image->y_at(x, y);
1031  typename Mask::y_iterator maskEnd = _mask->y_at(x, y);
1032  typename Variance::y_iterator varianceEnd = _variance->y_at(x, y);
1033 #endif
1034  return y_iterator(imageEnd, maskEnd, varianceEnd);
1035  }
1036 
1037 
1039  xy_locator xy_at(int x, int y) const {
1040 #if 0
1041  typename Image::xy_locator imageEnd = getImage()->xy_at(x, y);
1042  typename Mask::xy_locator maskEnd = getMask()->xy_at(x, y);
1043  typename Variance::xy_locator varianceEnd = getVariance()->xy_at(x, y);
1044 #else // bypass checks for non-NULL pointers
1045  typename Image::xy_locator imageEnd = _image->xy_at(x, y);
1046  typename Mask::xy_locator maskEnd = _mask->xy_at(x, y);
1047  typename Variance::xy_locator varianceEnd = _variance->xy_at(x, y);
1048 #endif
1049 
1050  return xy_locator(imageEnd, maskEnd, varianceEnd);
1051  }
1052 
1053 private:
1054 
1056  void conformSizes();
1057 
1061 };
1062 
1066 template<typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
1067 MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>* makeMaskedImage(
1068  typename Image<ImagePixelT>::Ptr image,
1069  typename Mask<MaskPixelT>::Ptr mask = typename Mask<MaskPixelT>::Ptr(),
1070  typename Image<VariancePixelT>::Ptr variance = typename Image<VariancePixelT>::Ptr()
1071  ) {
1072  return new MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(image, mask, variance);
1073 }
1074 
1075 /*
1076  * Some metafunctions to extract an Image::Ptr from a MaskedImage::Ptr (or return the original Image::Ptr)
1077  *
1078  * GetImage is the public interface (it forwards the tag --- just for the sake of the UI); the real work
1079  * is in GetImage_ which defines a typedef for the Image and a static function, getImage
1080  *
1081  * E.g.
1082  * In the function
1083  *
1084  * template<typename ImageT>
1085  * void func(typename ImageT::Ptr image) {
1086  * typename GetImage<ImageT>::type::Ptr im = GetImage<ImageT>::getImage(image);
1087  * }
1088  *
1089  * "im" is an Image::Ptr irrespective of whether ImageT is Masked or not.
1090  */
1091 namespace {
1092 template<typename ImageT, typename TagT>
1093 struct GetImage_ {
1094  typedef ImageT type;
1095  static typename type::Ptr getImage(typename ImageT::Ptr image) {
1096  return image;
1097  }
1098 };
1099 
1100 template<typename ImageT>
1101 struct GetImage_<ImageT, typename image::detail::MaskedImage_tag> {
1102  typedef typename ImageT::Image type;
1103  static typename type::Ptr getImage(typename ImageT::Ptr image) {
1104  return image->getImage();
1105  }
1106 };
1107 } // anonymous namespace
1108 
1109 template<typename ImageT>
1110 struct GetImage : public GetImage_<ImageT, typename ImageT::image_category> {
1111 };
1112 
1113 }}} // lsst::afw::image
1114 
1115 #endif // LSST_IMAGE_MASKEDIMAGE_H
int y
int iter
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Definition: MaskedImage.cc:742
MaskedImageLocatorBase & operator+=(detail::difference_type p)
Increment the locator&#39;s x and y positions by p.
Definition: MaskedImage.h:513
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:464
Image< VariancePixelT >::Ptr VariancePtr
shared pointer to the variance Image
Definition: MaskedImage.h:85
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:456
void scaledDivides(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:541
Ref< MaskPixelT >::type mask()
Return (a reference to) the mask part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:152
MaskedImageIterator(ImageIterator &img, MaskIterator &msk, VarianceIterator &var)
Definition: MaskedImage.h:227
Ref< MaskPixelT >::type mask()
Return a reference to the mask at the current position of the locator.
Definition: MaskedImage.h:473
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:597
detail::const_iterator_type< ImageIterator >::type const_ImageIterator
Definition: MaskedImage.h:247
MaskedImageIteratorBase(ImageIterator const &img, MaskIterator const &msk, VarianceIterator const &var)
Construct a MaskedImageIteratorBase from the image/mask/variance iterators.
Definition: MaskedImage.h:143
The base class for MaskedImageLocators (const and non-const)
Definition: MaskedImage.h:274
void operator-=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:762
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename Image< ImagePixelT >::Ptr image, typename Mask< MaskPixelT >::Ptr mask=typename Mask< MaskPixelT >::Ptr(), typename Image< VariancePixelT >::Ptr variance=typename Image< VariancePixelT >::Ptr())
Definition: MaskedImage.h:1067
boost::tuple< ImageLocator, MaskLocator, VarianceLocator > IMVLocator
Definition: MaskedImage.h:275
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(int x, int y)
Definition: MaskedImage.h:449
boost::mpl::vector< ImagePixelT, MaskPixelT, VariancePixelT > PixelTVec
Definition: MaskedImage.h:436
_view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: Image.h:147
const_MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > const_iterator
Definition: MaskedImage.h:567
boost::zip_iterator< IMV_iterator_tuple > _iter
Definition: MaskedImage.h:218
Pixel type
Type pointed to by the iterator.
Definition: MaskedImage.h:140
A templated class to return this classes&#39; type (present in Image/Mask/MaskedImage) ...
Definition: MaskedImage.h:101
Pixel operator()(int x, int y)
Dereference a locator, returning a Pixel offset by (x, y) from the locator.
Definition: MaskedImage.h:401
iterator begin() const
Return an iterator to the start of the image.
Definition: MaskedImage.cc:688
lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
A Pixel in the MaskedImage.
Definition: MaskedImage.h:115
void operator<<=(MaskedImage const &rhs)
Definition: MaskedImage.cc:377
detail::const_locator_type< MaskLocator >::type const_MaskLocator
Definition: MaskedImage.h:544
void operator/=(ImagePixelT const rhs)
Definition: MaskedImage.cc:556
boost::tuple< typename ImageLocator::cached_location_t, typename MaskLocator::cached_location_t, typename VarianceLocator::cached_location_t > IMVCachedLocation
Definition: MaskedImage.h:366
boost::uint16_t MaskPixel
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:903
void scaledPlus(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:405
Pixel operator*()
Dereference a locator, returning a Pixel.
Definition: MaskedImage.h:394
void writeFits(std::string const &fileName, boost::shared_ptr< daf::base::PropertySet const > metadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > imageMetadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > maskMetadata=boost::shared_ptr< daf::base::PropertySet const >(), boost::shared_ptr< daf::base::PropertySet const > varianceMetadata=boost::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:562
iterator at(int const x, int const y) const
Return an iterator at the point (x, y)
Definition: MaskedImage.cc:712
detail::const_iterator_type< VarianceIterator >::type const_VarianceIterator
Definition: MaskedImage.h:249
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:490
bool operator==(MaskedImageIteratorBase const &rhs)
Return true if the lhs equals the rhs.
Definition: MaskedImage.h:190
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: Image.h:151
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:408
x_iterator row_end(int y) const
Return an x_iterator to the end of the image.
Definition: MaskedImage.cc:752
MaskedImageLocatorBase< ImageLocator, MaskLocator, VarianceLocator > MaskedImageLocatorBase_t
Definition: MaskedImage.h:528
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV(cached_location_t const &cached_loc)
Definition: MaskedImage.h:439
The base class for MaskedImageIterators (const and non-const)
Definition: MaskedImage.h:129
detail::const_iterator_type< MaskIterator >::type const_MaskIterator
Definition: MaskedImage.h:248
geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition: MaskedImage.h:905
#define PTR(...)
Definition: base.h:41
detail::MaskPlaneDict MaskPlaneDict
Definition: Mask.h:97
void operator+=(lsst::afw::math::Function2< double > const &function)
Definition: MaskedImage.h:752
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:578
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:469
detail::const_locator_type< ImageLocator >::type const_ImageLocator
Definition: MaskedImage.h:543
boost::shared_ptr< const MaskedImage > ConstPtr
Definition: MaskedImage.h:88
lsst::afw::image::pixel::SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > SinglePixel
A single Pixel of the same type as those in the MaskedImage.
Definition: MaskedImage.h:123
ImagePtr getImage(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:869
A single pixel of the same type as a MaskedImage.
Definition: Pixel.h:63
void setXY0(geom::Point2I const origin)
Definition: MaskedImage.h:951
void operator+=(std::ptrdiff_t delta)
Increment the iterator by delta.
Definition: MaskedImage.h:168
void operator++(int)
Increment the iterator (postfix)
Definition: MaskedImage.h:182
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:378
void swap(MaskedImage &rhs)
Definition: MaskedImage.cc:333
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:194
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:94
void operator+=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:749
Interface for MaskedImageFormatter class.
geom::Extent2I getDimensions() const
Definition: MaskedImage.h:904
MaskedImage(unsigned int width, unsigned int height, MaskPlaneDict const &planeDict=MaskPlaneDict())
Construct from a supplied dimensions. The Image, Mask, and Variance will be set to zero...
Definition: MaskedImage.cc:53
boost::tuple< ImageIterator, MaskIterator, VarianceIterator > IMV_iterator_tuple
Definition: MaskedImage.h:130
int const x0
Definition: saturated.cc:45
void operator-=(ImagePixelT const rhs)
Subtract a scalar rhs from a MaskedImage.
Definition: MaskedImage.cc:445
void operator+=(ImagePixelT const rhs)
Add a scalar rhs to a MaskedImage.
Definition: MaskedImage.cc:414
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:564
An integer coordinate rectangle.
Definition: Box.h:53
Ref< VariancePixelT >::type variance()
Return (a reference to) the variance part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:157
bool operator==(MaskedImageLocatorBase const &rhs)
Return true iff two locators are equal.
Definition: MaskedImage.h:495
Mask< MaskPixelT >::MaskPlaneDict MaskPlaneDict
The Mask&#39;s MaskPlaneDict.
Definition: MaskedImage.h:90
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y)
Definition: MaskedImage.h:1039
VariancePtr getVariance(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:890
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
bool operator!=(MaskedImageIteratorBase const &rhs)
Return true if the lhs doesn&#39;t equal the rhs.
Definition: MaskedImage.h:194
_view_t::iterator iterator
An STL compliant iterator.
Definition: Image.h:143
const_MaskedImageIterator & operator+(std::ptrdiff_t delta)
Return a const_MaskedImageIterator that&#39;s delta beyond this.
Definition: MaskedImage.h:262
_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:368
double indexToPosition(double ind, lsst::afw::image::xOrY const xy) const
Convert image index to image position (see Image::indexToPosition)
Definition: MaskedImage.h:971
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
Definition: MaskedImage.h:1006
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:42
MaskedImageIteratorBase< ImageIterator, MaskIterator, VarianceIterator > MaskedImageIteratorBase_t
Definition: MaskedImage.h:225
MaskedImageLocator(ImageLocator &img, MaskLocator &msk, VarianceLocator &var)
Definition: MaskedImage.h:530
reverse_iterator rbegin() const
Return a reverse_iterator to the start of the image.
Definition: MaskedImage.cc:722
MaskedImage(MaskedImage< OtherPixelT, MaskPixelT, VariancePixelT > const &rhs, const bool deep)
Definition: MaskedImage.h:717
void ImageT ImageT int float saturatedPixelValue int const width
Definition: saturated.cc:44
static MaskedImage readFits(fits::MemFileManager &manager)
Read a MaskedImage from a FITS RAM file.
Definition: MaskedImage.h:863
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
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:587
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:106
iterator end() const
Return an iterator to the end of the image.
Definition: MaskedImage.cc:702
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:590
A traits class for MaskedImage.
Definition: MaskedImage.h:53
_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:370
void operator-=(std::ptrdiff_t delta)
Decrement the iterator by delta.
Definition: MaskedImage.h:173
MaskPtr getMask(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:879
void operator*=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:769
void operator/=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:778
const_MaskedImageIterator(MaskedImageIterator< ImageIterator, MaskIterator, VarianceIterator > const &iter)
Definition: MaskedImage.h:254
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: Image.h:160
boost::shared_ptr< MaskedImage > Ptr
shared pointer to a MaskedImage
Definition: MaskedImage.h:87
MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator > reverse_iterator
Definition: MaskedImage.h:570
Classes to provide utility functions for a &quot;Pixel&quot; to get at image/mask/variance operators.
Support for 2-D images.
detail::MaskedImage_tag image_category
Definition: MaskedImage.h:96
MaskedImageLocatorBase< const_ImageLocator, const_MaskLocator, const_VarianceLocator, ConstReference > MaskedImageLocatorBase_t
Definition: MaskedImage.h:548
boost::shared_ptr< Image< ImagePixelT > > Ptr
Definition: Image.h:418
void operator++()
Increment the iterator (prefix)
Definition: MaskedImage.h:178
boost::zip_iterator< IMV_iterator_tuple >::reference IMV_tuple
Definition: MaskedImage.h:135
double x
reverse_iterator rend() const
Return a reverse_iterator to the end of the image.
Definition: MaskedImage.cc:732
Ref< ImagePixelT >::type image()
Return (a reference to) the image part of the Pixel pointed at by the iterator.
Definition: MaskedImage.h:147
A saved relative position, providing efficient access to neighbouring pixels.
Definition: MaskedImage.h:372
#define LSST_PERSIST_FORMATTER(formatter...)
Definition: Persistable.h:98
detail::const_locator_type< VarianceLocator >::type const_VarianceLocator
Definition: MaskedImage.h:545
y_iterator col_end(int x) const
Return an y_iterator to the end of the image.
Definition: MaskedImage.cc:774
Pixel operator*()
Dereference the iterator, returning a Pixel.
Definition: MaskedImage.h:209
void scaledMultiplies(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:484
void ImageT ImageT int float saturatedPixelValue int const height
Definition: saturated.cc:44
const Pixel operator*() const
Dereference the iterator, returning a const Pixel.
Definition: MaskedImage.h:213
LSST bitmasks.
Interface for Persistable base class.
Image< ImagePixelT >::Ptr ImagePtr
shared pointer to the Image
Definition: MaskedImage.h:81
bool operator!=(MaskedImageLocatorBase const &rhs)
Return true iff two locators are not equal.
Definition: MaskedImage.h:499
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:92
std::string const compressedFileNoMEF_RE
be written as MEFs
Definition: MaskedImage.h:59
MaskedImageIterator operator+(std::ptrdiff_t delta)
Return a MaskedImageIterator that&#39;s delta beyond this.
Definition: MaskedImage.h:231
std::ptrdiff_t operator-(MaskedImageIteratorBase const &rhs)
Return the distance between two iterators.
Definition: MaskedImage.h:186
boost::shared_ptr< Mask > Ptr
Definition: Mask.h:95
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
Ref< ImagePixelT >::type image()
Return a reference to the image at the current position of the locator.
Definition: MaskedImage.h:460
A pixel of a MaskedImage.
Definition: Pixel.h:137
Mask< MaskPixelT >::Ptr MaskPtr
shared pointer to the Mask
Definition: MaskedImage.h:83
An const iterator to the MaskedImage.
Definition: MaskedImage.h:111
std::string const fitsFile_RE
Definition: MaskedImage.h:57
Citizen(const std::type_info &)
Definition: Citizen.cc:173
cached_location_t cache_location(int x, int y) const
Create a cached_location_t offset by (x, y) from locator.
Definition: MaskedImage.h:428
Class implementing persistence and retrieval for MaskedImages.
void setXY0(int const x0, int const y0)
Definition: MaskedImage.h:939
geom::Point2I getXY0() const
Definition: MaskedImage.h:929
bool operator<(MaskedImageLocatorBase const &rhs)
Return true iff lhs is less than rhs.
Definition: MaskedImage.h:503
Class for storing generic metadata.
Definition: PropertySet.h:82
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:477
Ref< VariancePixelT >::type variance()
Return a reference to the variance at the current position of the locator.
Definition: MaskedImage.h:486
int getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:901
const IMV_iterator_tuple get_iterator_tuple() const
Definition: MaskedImage.h:163
#define CONST_PTR(...)
Definition: base.h:47
void operator*=(ImagePixelT const rhs)
Definition: MaskedImage.cc:499
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:601
static MaskedImage readFits(std::string const &filename)
Read a MaskedImage from a regular FITS file.
Definition: MaskedImage.h:854
MaskedImage< ImagePT, MaskPT, VarPT > type
Return the desired type.
Definition: MaskedImage.h:103
y_iterator col_begin(int x) const
Return an y_iterator to the start of the image.
Definition: MaskedImage.cc:764
Base class for all persistable classes.
Definition: Persistable.h:74
MaskedImageIteratorBase< const_ImageIterator, const_MaskIterator, const_VarianceIterator, ConstReference > MaskedImageIteratorBase_t
Definition: MaskedImage.h:252
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:93
MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator > xy_locator
A locator for a MaskedImage.
Definition: MaskedImage.h:594
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:604
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
void operator-=(lsst::afw::image::Image< ImagePixelT > const &rhs)
Definition: MaskedImage.h:759
bool operator<(MaskedImageIteratorBase const &rhs)
Return true if the lhs is less than the rhs.
Definition: MaskedImage.h:198
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:482
int const y0
Definition: saturated.cc:45
float VariancePixel
! default type for Masks and MaskedImage Masks
A class used to identify classes that represent MaskedImage pixels.
Definition: MaskedImage.h:55
MaskedImageLocatorBase(ImageLocator const &img, MaskLocator const &msk, VarianceLocator const &var)
Construct a MaskedImageLocator from image/mask/variance locators.
Definition: MaskedImage.h:388
_view_t::xy_locator xy_locator
An xy_locator.
Definition: Image.h:139
y_iterator y_at(int x, int y) const
Return an y_iterator at the point (x, y)
Definition: MaskedImage.h:1024
MaskedImage & operator=(MaskedImage const &rhs)
Make the lhs use the rhs&#39;s pixels.
Definition: MaskedImage.cc:328
Definition of default types for Masks and Variance Images.
MaskedImageLocatorBase & operator+=(pair2I const &p)
Increment the locator&#39;s x and y positions by p.
Definition: MaskedImage.h:508
const_MaskedImageLocator(MaskedImageLocator< ImageLocator, MaskLocator, VarianceLocator > const &iter)
Definition: MaskedImage.h:550
void scaledMinus(double const c, MaskedImage const &rhs)
Definition: MaskedImage.cc:436
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:581
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:983
A const locator for the MaskedImage.
Definition: MaskedImage.h:115
metafunction to extract reference type from PixelT
Definition: Image.h:98
Ref< typename boost::mpl::at< PixelTVec, N >::type >::type apply_IMV()
Definition: MaskedImage.h:444
metafunction to extract const reference type from PixelT
Definition: Image.h:103