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
Public Types | Public Member Functions | Private Attributes | List of all members
lsst.afw.image::ImageSlice< PixelT > Class Template Reference

A class to specify a slice of an image. More...

#include <ImageSlice.h>

Inheritance diagram for lsst.afw.image::ImageSlice< PixelT >:
lsst.afw.image::Image< PixelT > lsst.afw.image::ImageBase< PixelT > lsst::daf::base::Persistable lsst::daf::base::Citizen

Public Types

enum  ImageSliceType { ROW, COLUMN }
 
- Public Types inherited from lsst.afw.image::Image< PixelT >
typedef boost::shared_ptr
< Image< PixelT > > 
Ptr
 
typedef boost::shared_ptr
< const Image< PixelT > > 
ConstPtr
 
typedef detail::Image_tag image_category
 
- Public Types inherited from lsst.afw.image::ImageBase< PixelT >
typedef boost::shared_ptr
< ImageBase< PixelT > > 
Ptr
 A shared_ptr to an ImageBase. More...
 
typedef boost::shared_ptr
< const ImageBase< PixelT > > 
ConstPtr
 A shared_ptr to a const ImageBase. More...
 
typedef detail::basic_tag image_category
 trait class to identify type of image More...
 
typedef PixelT SinglePixel
 A single Pixel of the same type as those in the ImageBase. More...
 
typedef PixelT Pixel
 A pixel in this ImageBase. More...
 
typedef Reference< PixelT >::type PixelReference
 A Reference to a PixelT. More...
 
typedef ConstReference< PixelT >
::type 
PixelConstReference
 A ConstReference to a PixelT. More...
 
typedef _view_t::xy_locator xy_locator
 An xy_locator. More...
 
typedef
_view_t::xy_locator::const_t 
const_xy_locator
 A const_xy_locator. More...
 
typedef _view_t::iterator iterator
 An STL compliant iterator. More...
 
typedef _const_view_t::iterator const_iterator
 An STL compliant const iterator. More...
 
typedef _view_t::reverse_iterator reverse_iterator
 An STL compliant reverse iterator. More...
 
typedef
_const_view_t::reverse_iterator 
const_reverse_iterator
 An STL compliant const reverse iterator. More...
 
typedef _view_t::x_iterator x_iterator
 An iterator for traversing the pixels in a row. More...
 
typedef x_iterator fast_iterator
 
typedef _view_t::x_iterator xy_x_iterator
 An iterator for traversing the pixels in a row, created from an xy_locator. More...
 
typedef _const_view_t::x_iterator const_x_iterator
 A const iterator for traversing the pixels in a row. More...
 
typedef _view_t::y_iterator y_iterator
 An iterator for traversing the pixels in a column. More...
 
typedef _view_t::y_iterator xy_y_iterator
 An iterator for traversing the pixels in a row, created from an xy_locator. More...
 
typedef _const_view_t::y_iterator const_y_iterator
 A const iterator for traversing the pixels in a column. More...
 
typedef ndarray::Array< PixelT, 2, 1 > Array
 A mutable ndarray representation of the image. More...
 
typedef ndarray::Array< PixelT
const, 2, 1 > 
ConstArray
 An immutable ndarray representation of the image. More...
 
- Public Types inherited from lsst::daf::base::Persistable
typedef boost::shared_ptr
< Persistable
Ptr
 
- Public Types inherited from lsst::daf::base::Citizen
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback )(const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback )(const Citizen *ptr)
 

Public Member Functions

 ImageSlice (Image< PixelT > const &img)
 Constructor for ImageSlice. More...
 
 ~ImageSlice ()
 
ImageSliceType getImageSliceType () const
 
- Public Member Functions inherited from lsst.afw.image::Image< PixelT >
 Image (unsigned int width, unsigned int height, PixelT initialValue=0)
 
 Image (geom::Extent2I const &dimensions=geom::Extent2I(), PixelT initialValue=0)
 
 Image (geom::Box2I const &bbox, PixelT initialValue=0)
 
 Image (Image const &rhs, geom::Box2I const &bbox, ImageOrigin const origin=PARENT, const bool deep=false)
 
 Image (const Image &rhs, const bool deep=false)
 
 Image (std::string const &fileName, int hdu=0, boost::shared_ptr< lsst::daf::base::PropertySet > metadata=boost::shared_ptr< lsst::daf::base::PropertySet >(), geom::Box2I const &bbox=geom::Box2I(), ImageOrigin origin=PARENT)
 Construct an Image by reading a regular FITS file. More...
 
 Image (fits::MemFileManager &manager, int hdu=0, boost::shared_ptr< lsst::daf::base::PropertySet > metadata=boost::shared_ptr< lsst::daf::base::PropertySet >(), geom::Box2I const &bbox=geom::Box2I(), ImageOrigin origin=PARENT)
 Construct an Image by reading a FITS image in memory. More...
 
 Image (fits::Fits &fitsfile, boost::shared_ptr< lsst::daf::base::PropertySet > metadata=boost::shared_ptr< lsst::daf::base::PropertySet >(), geom::Box2I const &bbox=geom::Box2I(), ImageOrigin origin=PARENT)
 Construct an Image from an already-open FITS object. More...
 
 Image (Image< OtherPixelT > const &rhs, const bool deep)
 
 Image (ndarray::Array< PixelT, 2, 1 > const &array, bool deep=false, geom::Point2I const &xy0=geom::Point2I())
 
virtual ~Image ()
 
Imageoperator= (const PixelT rhs)
 
Imageoperator= (const Image &rhs)
 
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. More...
 
void writeFits (fits::MemFileManager &manager, 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 FITS RAM file. More...
 
void writeFits (fits::Fits &fitsfile, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet const >()) const
 Write an image to an open FITS file object. More...
 
void swap (Image &rhs)
 
void operator+= (PixelT const rhs)
 
virtual void operator+= (Image< PixelT >const &rhs)
 
void operator+= (lsst::afw::math::Function2< double > const &function)
 
void scaledPlus (double const c, Image< PixelT >const &rhs)
 
void operator-= (PixelT const rhs)
 
void operator-= (Image< PixelT > const &rhs)
 
void operator-= (lsst::afw::math::Function2< double > const &function)
 
void scaledMinus (double const c, Image< PixelT >const &rhs)
 
void operator*= (PixelT const rhs)
 
void operator*= (Image< PixelT > const &rhs)
 
void scaledMultiplies (double const c, Image< PixelT >const &rhs)
 
void operator/= (PixelT const rhs)
 
void operator/= (Image< PixelT > const &rhs)
 
void scaledDivides (double const c, Image< PixelT >const &rhs)
 
void sqrt ()
 
- Public Member Functions inherited from lsst.afw.image::ImageBase< PixelT >
 ImageBase (const geom::Extent2I &dimensions=geom::Extent2I())
 
 ImageBase (const geom::Box2I &bbox)
 
 ImageBase (const ImageBase &src, const bool deep=false)
 
 ImageBase (const ImageBase &src, const geom::Box2I &bbox, const ImageOrigin origin=PARENT, const bool deep=false)
 
template<typename OtherPixelT >
 ImageBase (const ImageBase< OtherPixelT > &rhs, const bool deep)
 
 ImageBase (Array const &array, bool deep=false, geom::Point2I const &xy0=geom::Point2I())
 
virtual ~ImageBase ()
 
ImageBaseoperator= (const ImageBase &rhs)
 
ImageBaseoperator= (const PixelT rhs)
 Set the image's pixels to rhs. More...
 
void operator<<= (const ImageBase &rhs)
 Set the lhs's pixel values to equal the rhs's. More...
 
PixelReference operator() (int x, int y)
 Return a reference to the pixel (x, y) More...
 
PixelReference operator() (int x, int y, CheckIndices const &)
 Return a reference to the pixel (x, y) with bounds checking. More...
 
PixelConstReference operator() (int x, int y) const
 Return a const reference to the pixel (x, y) More...
 
PixelConstReference operator() (int x, int y, CheckIndices const &) const
 Return a const reference to the pixel (x, y) with bounds checking. More...
 
PixelConstReference get0 (int x, int y) const
 
PixelConstReference get0 (int x, int y, CheckIndices const &check) const
 
void set0 (int x, int y, const PixelT v)
 
void set0 (int x, int y, const PixelT v, CheckIndices const &check)
 
int getWidth () const
 Return the number of columns in the image. More...
 
int getHeight () const
 Return the number of rows in the image. More...
 
int getX0 () const
 
int getY0 () const
 
geom::Point2I getXY0 () const
 
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) More...
 
double indexToPosition (double ind, lsst::afw::image::xOrY const xy) const
 Convert image index to image position. More...
 
geom::Extent2I getDimensions () const
 Return the image's size; useful for passing to constructors. More...
 
void swap (ImageBase &rhs)
 
Array getArray ()
 
ConstArray getArray () const
 
iterator begin () const
 
iterator end () const
 Return an STL compliant iterator to the end of the image. More...
 
reverse_iterator rbegin () const
 Return an STL compliant reverse iterator to the start of the image. More...
 
reverse_iterator rend () const
 Return an STL compliant reverse iterator to the end of the image. More...
 
iterator at (int x, int y) const
 Return an STL compliant iterator at the point (x, y) More...
 
fast_iterator begin (bool) const
 
fast_iterator end (bool) const
 
x_iterator row_begin (int y) const
 
x_iterator row_end (int y) const
 Return an x_iterator to the end of the y'th row. More...
 
x_iterator x_at (int x, int y) const
 Return an x_iterator to the point (x, y) in the image. More...
 
y_iterator col_begin (int x) const
 
y_iterator col_end (int x) const
 Return an y_iterator to the end of the y'th row. More...
 
y_iterator y_at (int x, int y) const
 Return an y_iterator to the point (x, y) in the image. More...
 
xy_locator xy_at (int x, int y) const
 
void setXY0 (geom::Point2I const origin)
 
void setXY0 (int const x0, int const y0)
 
geom::Box2I getBBox (ImageOrigin origin=PARENT) const
 
- Public Member Functions inherited from lsst::daf::base::Persistable
 Persistable (void)
 
virtual ~Persistable (void)
 
template<class Archive >
void serialize (Archive &, unsigned int const)
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 

Private Attributes

ImageSliceType _sliceType
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst.afw.image::Image< PixelT >
static Image readFits (std::string const &filename, int hdu=0)
 Read an Image from a regular FITS file. More...
 
static Image readFits (fits::MemFileManager &manager, int hdu=0)
 Read an Image from a FITS RAM file. More...
 
- Static Public Member Functions inherited from lsst.afw.image::ImageBase< PixelT >
template<typename SinglePixelT >
static SinglePixel PixelCast (SinglePixelT rhs)
 Convert a type to our SinglePixel type. More...
 
- Static Public Member Functions inherited from lsst::daf::base::Citizen
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector
< const Citizen * > * 
census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 
- Protected Member Functions inherited from lsst.afw.image::ImageBase< PixelT >
_view_t _getRawView () const
 
bool isContiguous () const
 
- Static Protected Member Functions inherited from lsst.afw.image::ImageBase< PixelT >
static _view_t _allocateView (geom::Extent2I const &dimensions, Manager::Ptr &manager)
 
static _view_t _makeSubView (geom::Extent2I const &dimensions, geom::Extent2I const &offset, const _view_t &view)
 

Detailed Description

template<typename PixelT>
class lsst.afw.image::ImageSlice< PixelT >

A class to specify a slice of an image.

Definition at line 54 of file ImageSlice.h.

Member Enumeration Documentation

template<typename PixelT>
enum lsst::afw::image::ImageSlice::ImageSliceType
Enumerator
ROW 
COLUMN 

Definition at line 56 of file ImageSlice.h.

Constructor & Destructor Documentation

template<typename PixelT >
lsst.afw.image::ImageSlice< PixelT >::ImageSlice ( image::Image< PixelT > const &  img)
explicit

Constructor for ImageSlice.

Parameters
imgThe image to represent as a slice.

Definition at line 46 of file ImageSlice.cc.

48  :
51 {
52 
53  // verify the img is a slice (row or column)
54  if (img.getWidth() != 1 && img.getHeight() != 1) {
55  throw LSST_EXCEPT(ex::OutOfRangeError, "Input image must be a slice (width or height == 1)");
56  } else if (img.getWidth() == 1 && img.getHeight() == 1) {
57  throw LSST_EXCEPT(ex::InvalidParameterError,
58  "1x1 image ambiguous (could be row or column). "
59  "Perhaps a constant would be better than a slice? ");
60  } else if (img.getWidth() == 1 && img.getHeight() != 1) {
62  } else if (img.getHeight() == 1 && img.getWidth() != 1) {
63  _sliceType = ROW;
64  }
65 
66  // what about 1xn images where a 1x1 row slice is desired? ... use a constant instead of a slice
67  // what about nx1 images wehre a 1x1 column slice is desired? ... use a constant instead of a slice
68 }
int getWidth() const
Return the number of columns in the image.
Definition: Image.h:237
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
ImageSliceType _sliceType
Definition: ImageSlice.h:63
int getHeight() const
Return the number of rows in the image.
Definition: Image.h:239
template<typename PixelT>
lsst.afw.image::ImageSlice< PixelT >::~ImageSlice ( )
inline

Definition at line 59 of file ImageSlice.h.

59 {}

Member Function Documentation

template<typename PixelT>
ImageSliceType lsst.afw.image::ImageSlice< PixelT >::getImageSliceType ( ) const
inline

Definition at line 60 of file ImageSlice.h.

60 { return _sliceType; }
ImageSliceType _sliceType
Definition: ImageSlice.h:63

Member Data Documentation

template<typename PixelT>
ImageSliceType lsst.afw.image::ImageSlice< PixelT >::_sliceType
private

Definition at line 63 of file ImageSlice.h.


The documentation for this class was generated from the following files: