vil1_memory_image_of< T > Class Template Reference

#include <vil1_memory_image_of.h>

Inheritance diagram for vil1_memory_image_of< T >:

vil1_memory_image vil1_image List of all members.

Detailed Description

template<class T>
class vil1_memory_image_of< T >

Image stored entirely in RAM.

vil1_memory_image_of<Type> provides a templated interface to a vil1_memory_image. It is assumed that the user has queried the pixel size of the image and is instantiating an ImageBuffer of the appropriate type.

This allows C-efficiency access with C++ notational convenience after the type has been ascertained. Note that this should not be used for images too large to fit in memory.

CAVEAT PROGRAMMER: Each raster (row) is stored in a contiguous chunk of memory and the operator [] method gives a pointer to the beginning of a raster. Thus image[i][j] is the element in the i-th row and j-th column. However, image(x, y) is the element in the x-th column and y-th row.

Definition at line 46 of file vil1_memory_image_of.h.


Public Types

typedef T pixel_type
typedef T * iterator
typedef T const * const_iterator

Public Member Functions

iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
unsigned size () const
 vil1_memory_image_of ()
 Empty image.
 vil1_memory_image_of (vil1_memory_image_of< T > const &)
 This is a copy constructor, but it doesn't make a new buffer.
 vil1_memory_image_of (vil1_image const &image)
 Copy given image into a memory buffer.
 vil1_memory_image_of (int sizex, int sizey)
 Construct a w x h image, pixel format is determined from T.
 vil1_memory_image_of (T *buf, int sizex, int sizey)
 Construct a w x h image, pixel format is determined from T from memory previously created and pointed to by buf.
 ~vil1_memory_image_of ()
 Clearly, this will deallocate the memory buffer.
vil1_memory_image_of< T > & operator= (vil1_memory_image_of< T > const &)
 This method hides the operator= in the base class.
vil1_memory_image_of< T > & operator= (vil1_image const &)
 Copy a vil1_image, only if it's in an appropriate format.
void set (vil1_image const &image)
 Load image.
void resize (int width, int height)
 These override the methods in the base class.
T & operator() (int x, int y)
 Return read/write reference to pixel at (x,y).
T const & operator() (int x, int y) const
T * operator[] (int y)
 Return pointer to raster y.
T const * operator[] (int y) const
T *const * row_array ()
 Return pointer to array of rasters. aka known as data_array() for matrices.
T const *const * row_array () const
T * get_buffer ()
 Return pointer to the memory buffer.
T const * get_buffer () const
bool in_range (int x, int y) const
 Return true if (x,y) is a valid index into this buffer.
bool in_range_window (int x, int y, int w) const
 Return true if (x+/-w,y+/-h) are valid indices into this buffer.
bool in_range (int x, int y, unsigned w, unsigned h) const
 Return true if the region of size w,h starting at x,y is valid in this buffer.
void fill (T const &)
 Fill with given value.
int width () const
 Dimensions: Planes x W x H x Components.
int height () const
 Dimensions: Planes x W x H x Components.
void assert_size (int width, int height) const
void recache_from_impl ()
 Reset this class's member variables from the image implementation.
int planes () const
 Dimensions: Planes x W x H x Components.
int components () const
 Dimensions: Planes x W x H x Components.
int bits_per_component () const
 Format.
enum vil1_component_format component_format () const
 Format.
vil1_image get_plane (unsigned int p) const
 return the ith plane.
bool get_section (void *buf, int x0, int y0, int wd, int ht) const
 Copy from image to buf.
bool put_section (void const *buf, int x0, int y0, int wd, int ht)
 Copy from buf to image.
bool get_property (char const *tag, void *property_value=0) const
 Getting property information.
bool set_property (char const *tag, void const *property_value=0)
 Setting property information.
char const * file_format () const
 Return a string describing the file format.
int rows () const
 Number of rows.
int cols () const
 Number of columns.
int get_size_bytes () const
 return size in bytes.
vcl_ostream & print (vcl_ostream &) const
 Print a 1-line summary of contents.
bool operator== (vil1_image const &that) const
 equality means equality of implementation, not pixels.
bool operator< (vil1_image const &that) const
 needed for sorted containers of images.
 operator safe_bool () const
 conversion to bool.
bool operator! () const
 inverse conversion to bool.
vil1_image_implimpl () const
 use "sptr.impl()" to get a pointer to the impl object.

Protected Attributes

int width_
int height_
void ** rows0_
vil1_image_implptr

Private Member Functions

void resize (int planes, int width, int height)

Member Typedef Documentation

template<class T>
typedef T vil1_memory_image_of< T >::pixel_type

Definition at line 50 of file vil1_memory_image_of.h.

template<class T>
typedef T* vil1_memory_image_of< T >::iterator

Definition at line 53 of file vil1_memory_image_of.h.

template<class T>
typedef T const* vil1_memory_image_of< T >::const_iterator

Definition at line 57 of file vil1_memory_image_of.h.


Constructor & Destructor Documentation

template<class T>
vil1_memory_image_of< T >::vil1_memory_image_of (  ) 

Empty image.

Definition at line 15 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T >::vil1_memory_image_of ( vil1_memory_image_of< T > const &   ) 

This is a copy constructor, but it doesn't make a new buffer.

Definition at line 21 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T >::vil1_memory_image_of ( vil1_image const &  image  )  [explicit]

Copy given image into a memory buffer.

If it's already a memory image, do as the copy constructor (above) does.

Definition at line 27 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T >::vil1_memory_image_of ( int  sizex,
int  sizey 
)

Construct a w x h image, pixel format is determined from T.

Definition at line 38 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T >::vil1_memory_image_of ( T *  buf,
int  sizex,
int  sizey 
)

Construct a w x h image, pixel format is determined from T from memory previously created and pointed to by buf.

Definition at line 46 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T >::~vil1_memory_image_of (  )  [inline]

Clearly, this will deallocate the memory buffer.

Definition at line 84 of file vil1_memory_image_of.h.


Member Function Documentation

template<class T>
iterator vil1_memory_image_of< T >::begin (  )  [inline]

Definition at line 54 of file vil1_memory_image_of.h.

template<class T>
iterator vil1_memory_image_of< T >::end (  )  [inline]

Definition at line 55 of file vil1_memory_image_of.h.

template<class T>
const_iterator vil1_memory_image_of< T >::begin (  )  const [inline]

Definition at line 58 of file vil1_memory_image_of.h.

template<class T>
const_iterator vil1_memory_image_of< T >::end (  )  const [inline]

Definition at line 59 of file vil1_memory_image_of.h.

template<class T>
unsigned vil1_memory_image_of< T >::size (  )  const [inline]

Definition at line 61 of file vil1_memory_image_of.h.

template<class T>
vil1_memory_image_of< T > & vil1_memory_image_of< T >::operator= ( vil1_memory_image_of< T > const &   ) 

This method hides the operator= in the base class.

Definition at line 71 of file vil1_memory_image_of.txx.

template<class T>
vil1_memory_image_of< T > & vil1_memory_image_of< T >::operator= ( vil1_image const &   ) 

Copy a vil1_image, only if it's in an appropriate format.

This routine does not try to guess how to convert images which are not compatible with T.

Reimplemented from vil1_image.

Definition at line 78 of file vil1_memory_image_of.txx.

template<class T>
void vil1_memory_image_of< T >::set ( vil1_image const &  image  ) 

Load image.

Definition at line 64 of file vil1_memory_image_of.txx.

template<class T>
void vil1_memory_image_of< T >::resize ( int  width,
int  height 
)

These override the methods in the base class.

Reimplemented from vil1_memory_image.

Definition at line 86 of file vil1_memory_image_of.txx.

template<class T>
void vil1_memory_image_of< T >::resize ( int  planes,
int  width,
int  height 
) [private]

Reimplemented from vil1_memory_image.

Definition at line 95 of file vil1_memory_image_of.txx.

template<class T>
T& vil1_memory_image_of< T >::operator() ( int  x,
int  y 
) [inline]

Return read/write reference to pixel at (x,y).

Definition at line 107 of file vil1_memory_image_of.h.

template<class T>
T const& vil1_memory_image_of< T >::operator() ( int  x,
int  y 
) const [inline]

Definition at line 108 of file vil1_memory_image_of.h.

template<class T>
T* vil1_memory_image_of< T >::operator[] ( int  y  )  [inline]

Return pointer to raster y.

Definition at line 111 of file vil1_memory_image_of.h.

template<class T>
T const* vil1_memory_image_of< T >::operator[] ( int  y  )  const [inline]

Definition at line 112 of file vil1_memory_image_of.h.

template<class T>
T* const* vil1_memory_image_of< T >::row_array (  )  [inline]

Return pointer to array of rasters. aka known as data_array() for matrices.

Definition at line 115 of file vil1_memory_image_of.h.

template<class T>
T const* const* vil1_memory_image_of< T >::row_array (  )  const [inline]

Definition at line 116 of file vil1_memory_image_of.h.

template<class T>
T* vil1_memory_image_of< T >::get_buffer (  )  [inline]

Return pointer to the memory buffer.

Reimplemented from vil1_memory_image.

Definition at line 119 of file vil1_memory_image_of.h.

template<class T>
T const* vil1_memory_image_of< T >::get_buffer (  )  const [inline]

Definition at line 120 of file vil1_memory_image_of.h.

template<class T>
bool vil1_memory_image_of< T >::in_range ( int  x,
int  y 
) const [inline]

Return true if (x,y) is a valid index into this buffer.

Definition at line 123 of file vil1_memory_image_of.h.

template<class T>
bool vil1_memory_image_of< T >::in_range_window ( int  x,
int  y,
int  w 
) const [inline]

Return true if (x+/-w,y+/-h) are valid indices into this buffer.

Definition at line 126 of file vil1_memory_image_of.h.

template<class T>
bool vil1_memory_image_of< T >::in_range ( int  x,
int  y,
unsigned  w,
unsigned  h 
) const [inline]

Return true if the region of size w,h starting at x,y is valid in this buffer.

Definition at line 131 of file vil1_memory_image_of.h.

template<class T>
void vil1_memory_image_of< T >::fill ( T const &   ) 

Fill with given value.

Definition at line 102 of file vil1_memory_image_of.txx.

int vil1_memory_image::width (  )  const [inline, inherited]

Dimensions: Planes x W x H x Components.

Reimplemented from vil1_image.

Definition at line 59 of file vil1_memory_image.h.

int vil1_memory_image::height (  )  const [inline, inherited]

Dimensions: Planes x W x H x Components.

Reimplemented from vil1_image.

Definition at line 60 of file vil1_memory_image.h.

void vil1_memory_image::assert_size ( int  width,
int  height 
) const [inherited]

Definition at line 137 of file vil1_memory_image.cxx.

void vil1_memory_image::recache_from_impl (  )  [inherited]

Reset this class's member variables from the image implementation.

This is is useful if the impl object has been modified outside the control of this object.

Definition at line 189 of file vil1_memory_image.cxx.

int vil1_image::planes (  )  const [inline, inherited]

Dimensions: Planes x W x H x Components.

Definition at line 36 of file vil1_image.h.

int vil1_image::components (  )  const [inline, inherited]

Dimensions: Planes x W x H x Components.

Definition at line 45 of file vil1_image.h.

int vil1_image::bits_per_component (  )  const [inline, inherited]

Format.

Definition at line 48 of file vil1_image.h.

enum vil1_component_format vil1_image::component_format (  )  const [inline, inherited]

Format.

Definition at line 51 of file vil1_image.h.

vil1_image vil1_image::get_plane ( unsigned int  p  )  const [inline, inherited]

return the ith plane.

Definition at line 55 of file vil1_image.h.

bool vil1_image::get_section ( void *  buf,
int  x0,
int  y0,
int  wd,
int  ht 
) const [inline, inherited]

Copy from image to buf.

Definition at line 58 of file vil1_image.h.

bool vil1_image::put_section ( void const *  buf,
int  x0,
int  y0,
int  wd,
int  ht 
) [inline, inherited]

Copy from buf to image.

Definition at line 62 of file vil1_image.h.

bool vil1_image::get_property ( char const *  tag,
void *  property_value = 0 
) const [inline, inherited]

Getting property information.

Definition at line 66 of file vil1_image.h.

bool vil1_image::set_property ( char const *  tag,
void const *  property_value = 0 
) [inline, inherited]

Setting property information.

Definition at line 70 of file vil1_image.h.

char const* vil1_image::file_format (  )  const [inline, inherited]

Return a string describing the file format.

Only file images have a format, others return 0

Definition at line 75 of file vil1_image.h.

int vil1_image::rows (  )  const [inline, inherited]

Number of rows.

Definition at line 81 of file vil1_image.h.

int vil1_image::cols (  )  const [inline, inherited]

Number of columns.

Definition at line 83 of file vil1_image.h.

int vil1_image::get_size_bytes (  )  const [inherited]

return size in bytes.

Definition at line 37 of file vil1_image.cxx.

vcl_ostream & vil1_image::print ( vcl_ostream &   )  const [inherited]

Print a 1-line summary of contents.

Definition at line 13 of file vil1_image.cxx.

bool vil1_image::operator== ( vil1_image const &  that  )  const [inline, inherited]

equality means equality of implementation, not pixels.

Definition at line 132 of file vil1_image.h.

bool vil1_image::operator< ( vil1_image const &  that  )  const [inline, inherited]

needed for sorted containers of images.

Definition at line 137 of file vil1_image.h.

vil1_image::operator safe_bool (  )  const [inline, inherited]

conversion to bool.

Definition at line 142 of file vil1_image.h.

bool vil1_image::operator! (  )  const [inline, inherited]

inverse conversion to bool.

Definition at line 146 of file vil1_image.h.

vil1_image_impl* vil1_image::impl (  )  const [inline, inherited]

use "sptr.impl()" to get a pointer to the impl object.

Definition at line 150 of file vil1_image.h.


Member Data Documentation

int vil1_memory_image::width_ [protected, inherited]

Definition at line 69 of file vil1_memory_image.h.

int vil1_memory_image::height_ [protected, inherited]

Definition at line 70 of file vil1_memory_image.h.

void** vil1_memory_image::rows0_ [protected, inherited]

Definition at line 71 of file vil1_memory_image.h.

vil1_image_impl* vil1_image::ptr [protected, inherited]

Definition at line 155 of file vil1_image.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 22 05:08:32 2008 for core/vil1 by  doxygen 1.5.1