LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Image.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 
31 #ifndef LSST_AFW_IMAGE_IMAGE_H
32 #define LSST_AFW_IMAGE_IMAGE_H
33 
34 #include <list>
35 #include <map>
36 #include <string>
37 #include <utility>
38 #include <functional>
39 
40 #include "boost/mpl/bool.hpp"
41 #include "boost/shared_ptr.hpp"
42 
43 #include "lsst/afw/geom/Extent.h"
44 #include "lsst/afw/geom/Box.h"
45 #include "lsst/afw/geom/Point.h"
46 #include "lsst/afw/image/lsstGil.h"
47 #include "lsst/afw/image/Utils.h"
49 #include "lsst/afw/math/Function.h"
50 #include "lsst/daf/base.h"
51 #include "lsst/daf/base/Citizen.h"
52 #include "lsst/pex/exceptions.h"
53 #include "ndarray.h"
54 
55 namespace lsst { namespace afw {
56 
57 namespace formatters {
58  template <typename PixelT> class ImageFormatter;
59  template <typename PixelT> class DecoratedImageFormatter;
60 }
61 
62 namespace fits {
63 class Fits;
64 class MemFileManager;
65 }
66 
67 namespace image {
68  namespace detail {
69  //
70  // Traits for image types
71  //
73  struct basic_tag { };
75  struct Image_tag : public basic_tag { };
77  template<typename ImageT>
78  struct image_traits {
79  typedef typename ImageT::image_category image_category;
80  };
81  //
82  std::string const wcsNameForXY0 = "A"; // the name of the WCS to use to save (X0, Y0) to FITS files; e.g. "A"
83  }
84 
85  /*********************************************************************************************************/
87  class CheckIndices {
88  public:
89  explicit CheckIndices(bool check=true) : _check(check) {}
90  operator bool() const { return _check; }
91  private:
92  bool _check;
93  };
94 
95  /*********************************************************************************************************/
97  template<typename PixelT>
98  struct Reference {
99  typedef typename boost::gil::channel_traits<PixelT>::reference type;
100  };
102  template<typename PixelT>
103  struct ConstReference {
104  typedef typename boost::gil::channel_traits<PixelT>::const_reference type;
105  };
106 
108 
110  //
111  // You are not expected to use this class directly in your own code; use one of the
112  // specialised subclasses
113  //
114  template<typename PixelT>
116  public lsst::daf::base::Citizen {
117  private:
118  typedef typename lsst::afw::image::detail::types_traits<PixelT>::view_t _view_t;
119  typedef typename lsst::afw::image::detail::types_traits<PixelT>::const_view_t _const_view_t;
120 
121 
123  public:
124 
125  typedef boost::shared_ptr<ImageBase<PixelT> > Ptr;
126  typedef boost::shared_ptr<const ImageBase<PixelT> > ConstPtr;
127 
129 
133  typedef PixelT Pixel;
139  typedef typename _view_t::xy_locator xy_locator;
141  typedef typename _view_t::xy_locator::const_t const_xy_locator;
143  typedef typename _view_t::iterator iterator;
145  typedef typename _const_view_t::iterator const_iterator;
147  typedef typename _view_t::reverse_iterator reverse_iterator;
149  typedef typename _const_view_t::reverse_iterator const_reverse_iterator;
151  typedef typename _view_t::x_iterator x_iterator;
156  typedef typename _view_t::x_iterator xy_x_iterator;
158  typedef typename _const_view_t::x_iterator const_x_iterator;
160  typedef typename _view_t::y_iterator y_iterator;
162  typedef typename _view_t::y_iterator xy_y_iterator;
164  typedef typename _const_view_t::y_iterator const_y_iterator;
169 
170  template<typename OtherPixelT> friend class ImageBase; // needed by generalised copy constructors
171  //
173  //
174  template<typename SinglePixelT>
175  static SinglePixel PixelCast(SinglePixelT rhs) {
176  return SinglePixel(rhs);
177  }
178  //
179  // DecoratedImage needs enough access to ImageBase to read data from disk; we might be able to design around this
180  //
181  template<typename> friend class DecoratedImage;
182  template<typename, typename, typename> friend class MaskedImage;
184  explicit ImageBase(const geom::Box2I &bbox);
185  ImageBase(const ImageBase& src, const bool deep=false);
186  explicit ImageBase(const ImageBase& src, const geom::Box2I& bbox,
187  const ImageOrigin origin=PARENT, const bool deep=false);
192  template<typename OtherPixelT>
193  ImageBase(const ImageBase<OtherPixelT>& rhs, const bool deep) :
194  lsst::daf::base::Citizen(typeid(this)) {
195  if (!deep) {
196  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
197  "Only deep copies are permitted for ImageBases with different pixel types");
198  }
199 
200  ImageBase<PixelT> tmp(rhs.getBBox());
201  copy_and_convert_pixels(rhs._gilView, tmp._gilView); // from boost::gil
202 
203  using std::swap; // See Meyers, Effective C++, Item 25
204  ImageBase<PixelT>::swap(tmp); // See Meyers, Effective C++, Items 11 and 43
205  }
206 
207  explicit ImageBase(
208  Array const & array, bool deep = false, geom::Point2I const & xy0 = geom::Point2I()
209  );
210 
211  virtual ~ImageBase() { }
212  ImageBase& operator=(const ImageBase& rhs);
213  ImageBase& operator=(const PixelT rhs);
214  void operator<<=(const ImageBase& rhs);
215  //
216  // Operators etc.
217  //
218  PixelReference operator()(int x, int y);
219  PixelReference operator()(int x, int y, CheckIndices const&);
220  PixelConstReference operator()(int x, int y) const;
221  PixelConstReference operator()(int x, int y, CheckIndices const&) const;
222 
223  PixelConstReference get0(int x, int y) const {
224  return operator()(x-getX0(), y-getY0());
225  }
226  PixelConstReference get0(int x, int y, CheckIndices const& check) const {
227  return operator()(x-getX0(), y-getY0(), check);
228  }
229  void set0(int x, int y, const PixelT v) {
230  operator()(x-getX0(), y-getY0()) = v;
231  }
232  void set0(int x, int y, const PixelT v, CheckIndices const& check) {
233  operator()(x-getX0(), y-getY0(), check) = v;
234  }
235 
237  int getWidth() const { return _gilView.width(); }
239  int getHeight() const { return _gilView.height(); }
247  int getX0() const { return _origin.getX(); }
255  int getY0() const { return _origin.getY(); }
256 
264  geom::Point2I getXY0() const { return _origin; }
265 
271  std::pair<int, double> positionToIndex(
272  double const pos,
273  lsst::afw::image::xOrY const xy
274  ) const {
275  double const fullIndex = pos - PixelZeroPos - (xy == X ? getX0() : getY0());
276  int const roundedIndex = static_cast<int>(fullIndex + 0.5);
277  double const residual = fullIndex - roundedIndex;
278  return std::pair<int, double>(roundedIndex, residual);
279  }
280 
290  inline double indexToPosition(
291  double ind,
292  lsst::afw::image::xOrY const xy
293  ) const {
294  return ind + PixelZeroPos + (xy == X ? getX0() : getY0());
295  }
296 
299 
300  void swap(ImageBase &rhs);
301 
302  Array getArray();
303  ConstArray getArray() const;
304  //
305  // Iterators and Locators
306  //
307  iterator begin() const;
308  iterator end() const;
309  reverse_iterator rbegin() const;
310  reverse_iterator rend() const;
311  iterator at(int x, int y) const;
312 
313  fast_iterator begin(bool) const;
314  fast_iterator end(bool) const;
315 
319  x_iterator row_begin(int y) const {
320  return _gilView.row_begin(y);
321  }
322 
324  x_iterator row_end(int y) const {
325  return _gilView.row_end(y);
326  }
327 
329  x_iterator x_at(int x, int y) const { return _gilView.x_at(x, y); }
330 
334  y_iterator col_begin(int x) const {
335  return _gilView.col_begin(x);
336  }
337 
339  y_iterator col_end(int x) const {
340  return _gilView.col_end(x);
341  }
342 
344  y_iterator y_at(int x, int y) const {
345  return _gilView.y_at(x, y);
346  }
347 
351  xy_locator xy_at(int x, int y) const {
352  return xy_locator(_gilView.xy_at(x, y));
353  }
362  void setXY0(geom::Point2I const origin) {
363  _origin=origin;
364  }
373  void setXY0(int const x0, int const y0) {
374  setXY0(geom::Point2I(x0,y0));
375  }
376 
378  if (origin == PARENT) {
379  return geom::Box2I(_origin, getDimensions());
380  }
381  else return geom::Box2I(geom::Point2I(0,0), getDimensions());
382  }
383  private:
387 
388  //oring of ImageBase in some larger image as returned to and manipulated
389  //by the user
390 
391 
392  protected:
393 #if !defined(SWIG)
394  static _view_t _allocateView(geom::Extent2I const & dimensions, Manager::Ptr & manager);
395  static _view_t _makeSubView(
396  geom::Extent2I const & dimensions,
397  geom::Extent2I const & offset,
398  const _view_t & view
399  );
400 
401  _view_t _getRawView() const { return _gilView; }
402 
403 #endif
404  inline bool isContiguous() const {
405  return begin()+getWidth()*getHeight() == end();
406  }
407  };
408 
409  template<typename PixelT>
410  void swap(ImageBase<PixelT>& a, ImageBase<PixelT>& b);
411 
412  /************************************************************************************************************/
414  template<typename PixelT>
415  class Image : public ImageBase<PixelT> {
416  public:
417  template<typename, typename, typename> friend class MaskedImage;
418  typedef boost::shared_ptr<Image<PixelT> > Ptr;
419  typedef boost::shared_ptr<const Image<PixelT> > ConstPtr;
420 
422 
423 #if !defined(SWIG)
424  template<typename ImagePT=PixelT>
429  };
430 #endif
431  template<typename OtherPixelT> friend class Image; // needed by generalised copy constructors
432 
433  explicit Image(unsigned int width, unsigned int height, PixelT initialValue=0);
434  explicit Image(geom::Extent2I const & dimensions=geom::Extent2I(), PixelT initialValue=0);
435  explicit Image(geom::Box2I const & bbox, PixelT initialValue=0);
436 
437  explicit Image(Image const & rhs, geom::Box2I const & bbox, ImageOrigin const origin=PARENT,
438  const bool deep=false);
439  Image(const Image& rhs, const bool deep=false);
440 
453  explicit Image(
454  std::string const & fileName, int hdu=0,
456  geom::Box2I const & bbox=geom::Box2I(),
457  ImageOrigin origin=PARENT
458  );
459 
472  explicit Image(
473  fits::MemFileManager & manager, int hdu=0,
475  geom::Box2I const & bbox=geom::Box2I(),
476  ImageOrigin origin=PARENT
477  );
478 
488  explicit Image(
489  fits::Fits & fitsfile,
491  geom::Box2I const & bbox=geom::Box2I(),
492  ImageOrigin origin=PARENT
493  );
494 
495  // generalised copy constructor
496  template<typename OtherPixelT>
497  Image(Image<OtherPixelT> const& rhs, const bool deep) :
498  image::ImageBase<PixelT>(rhs, deep) {}
499 
500  explicit Image(ndarray::Array<PixelT,2,1> const & array, bool deep = false,
501  geom::Point2I const & xy0 = geom::Point2I()) :
502  image::ImageBase<PixelT>(array, deep, xy0) {}
503 
504  virtual ~Image() { }
505  //
506  // Assignment operators are not inherited
507  //
508  Image& operator=(const PixelT rhs);
509  Image& operator=(const Image& rhs);
510 
518  void writeFits(
519  std::string const& fileName,
521  std::string const& mode="w"
522  ) const;
523 
531  void writeFits(
532  fits::MemFileManager & manager,
534  std::string const& mode="w"
535  ) const;
536 
543  void writeFits(
544  fits::Fits & fitsfile,
546  ) const;
547 
555  static Image readFits(std::string const & filename, int hdu=0) {
556  return Image<PixelT>(filename, hdu);
557  }
558 
566  static Image readFits(fits::MemFileManager & manager, int hdu=0) {
567  return Image<PixelT>(manager, hdu);
568  }
569 
570  void swap(Image &rhs);
571  //
572  // Operators etc.
573  //
574  void operator+=(PixelT const rhs);
575  virtual void operator+=(Image<PixelT>const & rhs);
576  void operator+=(lsst::afw::math::Function2<double> const& function);
577  void scaledPlus(double const c, Image<PixelT>const & rhs);
578  void operator-=(PixelT const rhs);
579  void operator-=(Image<PixelT> const& rhs);
580  void operator-=(lsst::afw::math::Function2<double> const& function);
581  void scaledMinus(double const c, Image<PixelT>const & rhs);
582  void operator*=(PixelT const rhs);
583  void operator*=(Image<PixelT> const& rhs);
584  void scaledMultiplies(double const c, Image<PixelT>const & rhs);
585  void operator/=(PixelT const rhs);
586  void operator/=(Image<PixelT> const& rhs);
587  void scaledDivides(double const c, Image<PixelT>const & rhs);
588 
589  // In-place per-pixel sqrt(). Useful when handling variance planes.
590  void sqrt();
591  protected:
593  private:
595  };
596 
597  template<typename LhsPixelT, typename RhsPixelT>
598  void operator+=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const& rhs);
599  template<typename LhsPixelT, typename RhsPixelT>
600  void operator-=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const& rhs);
601  template<typename LhsPixelT, typename RhsPixelT>
602  void operator*=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const& rhs);
603  template<typename LhsPixelT, typename RhsPixelT>
604  void operator/=(Image<LhsPixelT> &lhs, Image<RhsPixelT> const& rhs);
605 
606  template<typename PixelT>
607  void swap(Image<PixelT>& a, Image<PixelT>& b);
608 
609 /************************************************************************************************************/
613  template<typename PixelT>
615  public lsst::daf::base::Citizen {
616  public:
618  typedef boost::shared_ptr<DecoratedImage> Ptr;
620  typedef boost::shared_ptr<const DecoratedImage> ConstPtr;
625 
626  explicit DecoratedImage(const geom::Extent2I & dimensions=geom::Extent2I());
627  explicit DecoratedImage(const geom::Box2I & bbox);
628  explicit DecoratedImage(PTR(Image<PixelT>) rhs);
629  DecoratedImage(DecoratedImage const& rhs, const bool deep=false);
630  explicit DecoratedImage(
631  std::string const& fileName,
632  const int hdu=0,
633  geom::Box2I const& bbox=geom::Box2I(),
634  ImageOrigin const origin = PARENT
635  );
636 
637  DecoratedImage& operator=(const DecoratedImage& image);
638 
639  PTR(lsst::daf::base::PropertySet) getMetadata() const { return _metadata; }
640  void setMetadata(PTR(lsst::daf::base::PropertySet) metadata) { _metadata = metadata; }
641 
643  int getWidth() const { return _image->getWidth(); }
645  int getHeight() const { return _image->getHeight(); }
646 
648  int getX0() const { return _image->getX0(); }
650  int getY0() const { return _image->getY0(); }
651 
653  const geom::Extent2I getDimensions() const { return _image->getDimensions(); }
654 
655  void swap(DecoratedImage &rhs);
656 
657  void writeFits(
658  std::string const& fileName,
660  std::string const& mode="w"
661  ) const;
662 
664  ImagePtr getImage() { return _image; }
666  ImageConstPtr getImage() const { return _image; }
667 
673  double getGain() const { return _gain; }
675  void setGain(double gain) { _gain = gain; }
676  private:
679  PTR(lsst::daf::base::PropertySet) _metadata;
680 
681  double _gain;
682 
683  void init();
684  };
685 
686  template<typename PixelT>
688 
689 }}} // lsst::afw::image
690 
691 #endif
int y
boost::shared_ptr< ImageBase< PixelT > > Ptr
A shared_ptr to an ImageBase.
Definition: Image.h:125
Manager::Ptr _manager
Definition: Image.h:385
A templated class to return this classes&#39; type (present in Image/Mask/MaskedImage) ...
Definition: Image.h:426
View< boost::fusion::vector1< index::Full > > view()
Start a view definition that includes the entire first dimension.
Definition: views.h:131
void operator<<=(const ImageBase &rhs)
Set the lhs&#39;s pixel values to equal the rhs&#39;s.
Definition: Image.cc:225
A coordinate class intended to represent absolute positions.
void scaledMinus(double const c, Image< PixelT >const &rhs)
Subtract Image c*rhs from lhs.
Definition: Image.cc:706
x_iterator fast_iterator
Definition: Image.h:154
#define PTR(...)
Definition: base.h:41
ndarray::Manager Manager
Definition: Image.h:122
x_iterator row_begin(int y) const
Definition: Image.h:319
boost::shared_ptr< lsst::daf::base::PropertySet > _metadata
Definition: Image.h:679
const geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: Image.h:653
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
virtual ~Image()
Definition: Image.h:504
x_iterator row_end(int y) const
Return an x_iterator to the end of the y&#39;th row.
Definition: Image.h:324
double indexToPosition(double ind, lsst::afw::image::xOrY const xy) const
Convert image index to image position.
Definition: Image.h:290
reverse_iterator rend() const
Return an STL compliant reverse iterator to the end of the image.
Definition: Image.cc:343
void scaledMultiplies(double const c, Image< PixelT >const &rhs)
Multiply lhs by Image c*rhs (i.e. pixel-by-pixel multiplication)
Definition: Image.cc:752
boost::shared_ptr< const ImageBase< PixelT > > ConstPtr
A shared_ptr to a const ImageBase.
Definition: Image.h:126
ndarray::Array< PixelT const, 2, 1 > ConstArray
An immutable ndarray representation of the image.
Definition: Image.h:168
void setXY0(int const x0, int const y0)
Definition: Image.h:373
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: Image.h:160
PixelReference operator()(int x, int y)
Return a reference to the pixel (x, y)
Definition: Image.cc:236
static Image readFits(std::string const &filename, int hdu=0)
Read an Image from a regular FITS file.
Definition: Image.h:555
ImageConstPtr getImage() const
Return a shared_ptr to the DecoratedImage&#39;s Image as const.
Definition: Image.h:666
#define CONST_PTR(...)
Definition: base.h:47
virtual ~ImageBase()
Definition: Image.h:211
y_iterator y_at(int x, int y) const
Return an y_iterator to the point (x, y) in the image.
Definition: Image.h:344
static SinglePixel PixelCast(SinglePixelT rhs)
Convert a type to our SinglePixel type.
Definition: Image.h:175
static Image readFits(fits::MemFileManager &manager, int hdu=0)
Read an Image from a FITS RAM file.
Definition: Image.h:566
int getX0() const
Return the image&#39;s column-origin.
Definition: Image.h:648
void operator+=(PixelT const rhs)
Add scalar rhs to lhs.
Definition: Image.cc:643
void operator/=(PixelT const rhs)
Definition: Image.cc:766
ImageBase & operator=(const ImageBase &rhs)
Definition: Image.cc:216
geom::Point2I _origin
Definition: Image.h:384
iterator begin() const
Definition: Image.cc:325
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:194
The base class for all image classed (Image, Mask, MaskedImage, ...)
Definition: Image.h:115
static _view_t _allocateView(geom::Extent2I const &dimensions, Manager::Ptr &manager)
Definition: Image.cc:53
void operator*=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Definition: Image.cc:861
boost::shared_ptr< Image< PixelT > > Ptr
Definition: Image.h:418
void writeFits(std::string const &fileName, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
Write an image to a regular FITS file.
iterator end() const
Return an STL compliant iterator to the end of the image.
Definition: Image.cc:331
CheckIndices(bool check=true)
Definition: Image.h:89
int const x0
Definition: saturated.cc:45
void set0(int x, int y, const PixelT v)
Definition: Image.h:229
Image utility functions.
PixelConstReference get0(int x, int y) const
Definition: Image.h:223
PixelT Pixel
A pixel in this ImageBase.
Definition: Image.h:133
An integer coordinate rectangle.
Definition: Box.h:53
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
y_iterator col_begin(int x) const
Definition: Image.h:334
_view_t::iterator iterator
An STL compliant iterator.
Definition: Image.h:143
bool isContiguous() const
Definition: Image.h:404
int getY0() const
Return the image&#39;s row-origin.
Definition: Image.h:650
PixelT SinglePixel
A single Pixel of the same type as those in the ImageBase.
Definition: Image.h:131
ndarray::Array< PixelT, 2, 1 > Array
A mutable ndarray representation of the image.
Definition: Image.h:166
_view_t::x_iterator xy_x_iterator
An iterator for traversing the pixels in a row, created from an xy_locator.
Definition: Image.h:156
afw::table::PointKey< int > dimensions
int getWidth() const
Return the number of columns in the image.
Definition: Image.h:237
boost::intrusive_ptr< Manager > Ptr
Definition: Manager.h:42
void swap(ImageBase &rhs)
Definition: Image.cc:282
A set of classes of general utility in connection with images.
ImageT::image_category image_category
Definition: Image.h:79
_const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
Definition: Image.h:158
_view_t::xy_locator xy_locator
An xy_locator.
Definition: Image.h:139
static _view_t _makeSubView(geom::Extent2I const &dimensions, geom::Extent2I const &offset, const _view_t &view)
Definition: Image.cc:78
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:106
Types and classes to interface lsst::afw::image to boost::gil.
boost::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
Definition: Image.h:639
x_iterator x_at(int x, int y) const
Return an x_iterator to the point (x, y) in the image.
Definition: Image.h:329
detail::Image_tag image_category
Definition: Image.h:421
detail::basic_tag image_category
trait class to identify type of image
Definition: Image.h:128
Image(ndarray::Array< PixelT, 2, 1 > const &array, bool deep=false, geom::Point2I const &xy0=geom::Point2I())
Definition: Image.h:500
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
tag for an Image
Definition: Image.h:75
reverse_iterator rbegin() const
Return an STL compliant reverse iterator to the start of the image.
Definition: Image.cc:337
_view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: Image.h:147
void operator-=(PixelT const rhs)
Subtract scalar rhs from lhs.
Definition: Image.cc:689
friend class ImageBase
Definition: Image.h:170
traits class for image categories
Definition: Image.h:78
A class used to request that array accesses be checked.
Definition: Image.h:87
y_iterator col_end(int x) const
Return an y_iterator to the end of the y&#39;th row.
Definition: Image.h:339
int getWidth() const
Return the number of columns in the image.
Definition: Image.h:643
Class implementing persistence and retrieval for Images.
void writeFits(std::string const &fileName, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
ImagePtr getImage()
Return a shared_ptr to the DecoratedImage&#39;s Image.
Definition: Image.h:664
Reference< PixelT >::type PixelReference
A Reference to a PixelT.
Definition: Image.h:135
Image(Image< OtherPixelT > const &rhs, const bool deep)
Definition: Image.h:497
int getY0() const
Definition: Image.h:255
boost::shared_ptr< Image< PixelT > const > ImageConstPtr
shared_ptr to the Image as const
Definition: Image.h:624
_view_t::y_iterator xy_y_iterator
An iterator for traversing the pixels in a row, created from an xy_locator.
Definition: Image.h:162
boost::shared_ptr< const Image< PixelT > > ConstPtr
Definition: Image.h:419
void operator*=(PixelT const rhs)
Multiply lhs by scalar rhs.
Definition: Image.cc:735
int x
std::pair< int, double > positionToIndex(double const pos, lsst::afw::image::xOrY const xy) const
Convert image position to index (nearest integer and fractional parts)
Definition: Image.h:271
void setMetadata(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Image.h:640
#define LSST_PERSIST_FORMATTER(formatter...)
Definition: Persistable.h:98
void setXY0(geom::Point2I const origin)
Definition: Image.h:362
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
boost::shared_ptr< Image< PixelT > > ImagePtr
shared_ptr to the Image
Definition: Image.h:622
A multidimensional strided array.
Definition: Array.h:47
Citizen(const std::type_info &)
Definition: Citizen.cc:173
ConstReference< PixelT >::type PixelConstReference
A ConstReference to a PixelT.
Definition: Image.h:137
geom::Box2I getBBox(ImageOrigin origin=PARENT) const
Definition: Image.h:377
boost::gil::channel_traits< PixelT >::reference type
reference type
Definition: Image.h:99
lsst::afw::image::detail::types_traits< PixelT >::const_view_t _const_view_t
Definition: Image.h:119
ImageBase(const ImageBase< OtherPixelT > &rhs, const bool deep)
Definition: Image.h:193
const double PixelZeroPos
FITS uses 1.0, SDSS uses 0.5, LSST uses 0.0 (http://dev.lsstcorp.org/trac/wiki/BottomLeftPixelProposa...
Definition: ImageUtils.h:42
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: Image.h:151
Class for storing generic metadata.
Definition: PropertySet.h:82
void swap(DecoratedImage &rhs)
boost::shared_ptr< Image< PixelT > > _image
Definition: Image.h:678
void operator/=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Definition: Image.cc:868
Image & operator=(const PixelT rhs)
Set the image&#39;s pixels to rhs.
Definition: Image.cc:480
Define the basic Function classes.
afw::table::Key< double > b
iterator at(int x, int y) const
Return an STL compliant iterator at the point (x, y)
Definition: Image.cc:349
xy_locator xy_at(int x, int y) const
Definition: Image.h:351
void operator-=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Definition: Image.cc:854
boost::shared_ptr< const DecoratedImage > ConstPtr
shared_ptr to a const DecoratedImage
Definition: Image.h:620
geom::Point2I getXY0() const
Definition: Image.h:264
Base class for all persistable classes.
Definition: Persistable.h:74
int getHeight() const
Return the number of rows in the image.
Definition: Image.h:239
Class implementing persistence and retrieval for DecoratedImages.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< DecoratedImage > Ptr
shared_ptr to a DecoratedImage
Definition: Image.h:618
void swap(Image &rhs)
Definition: Image.cc:606
int const y0
Definition: saturated.cc:45
void scaledDivides(double const c, Image< PixelT >const &rhs)
Divide lhs by Image c*rhs (i.e. pixel-by-pixel division)
Definition: Image.cc:799
friend class Image
Definition: Image.h:431
void set0(int x, int y, const PixelT v, CheckIndices const &check)
Definition: Image.h:232
lsst::afw::image::detail::types_traits< PixelT >::view_t _view_t
Definition: Image.h:118
boost::gil::channel_traits< PixelT >::const_reference type
const reference type
Definition: Image.h:104
A coordinate class intended to represent offsets and dimensions.
_const_view_t::iterator const_iterator
An STL compliant const iterator.
Definition: Image.h:145
_view_t::xy_locator::const_t const_xy_locator
A const_xy_locator.
Definition: Image.h:141
double getGain() const
Definition: Image.h:673
geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: Image.h:298
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43
_const_view_t::y_iterator const_y_iterator
A const iterator for traversing the pixels in a column.
Definition: Image.h:164
Extent< int, 2 > Extent2I
Definition: Extent.h:355
void setGain(double gain)
Set the DecoratedImage&#39;s gain.
Definition: Image.h:675
std::string const wcsNameForXY0
Definition: Image.h:82
_view_t _getRawView() const
Definition: Image.h:401
PixelConstReference get0(int x, int y, CheckIndices const &check) const
Definition: Image.h:226
Image< ImagePT > type
Return the desired type.
Definition: Image.h:428
int getHeight() const
Return the number of rows in the image.
Definition: Image.h:645
Include files required for standard LSST Exception handling.
_const_view_t::reverse_iterator const_reverse_iterator
An STL compliant const reverse iterator.
Definition: Image.h:149
A container for an Image and its associated metadata.
Definition: Image.h:614
int getX0() const
Definition: Image.h:247
void operator+=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Definition: Image.cc:847
metafunction to extract reference type from PixelT
Definition: Image.h:98
void scaledPlus(double const c, Image< PixelT >const &rhs)
Add Image c*rhs to lhs.
Definition: Image.cc:677
metafunction to extract const reference type from PixelT
Definition: Image.h:103