[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

BasicImage< PIXELTYPE, Alloc > Class Template Reference

Fundamental class template for images. More...

`#include <vigra/basicimage.hxx>`

## Public Types

typedef IteratorTraits< traverser >::DefaultAccessor | Accessor
typedef Alloc | allocator_type
typedef traverser::column_iterator | column_iterator
typedef const_traverser::column_iterator | const_column_iterator
typedef PIXELTYPE const * | const_iterator
typedef PIXELTYPE const * | const_pointer
typedef PIXELTYPE const & | const_reference
typedef const_traverser::row_iterator | const_row_iterator
typedef ConstBasicImageIterator< PIXELTYPE, PIXELTYPE ** > | const_traverser
typedef IteratorTraits< const_traverser >::DefaultAccessor | ConstAccessor
typedef ConstBasicImageIterator< PIXELTYPE, PIXELTYPE ** > | ConstIterator
typedef PIXELTYPE const * | ConstScanOrderIterator
typedef Diff2D | difference_type
typedef PIXELTYPE * | iterator
typedef BasicImageIterator< PIXELTYPE, PIXELTYPE ** > | Iterator
typedef PIXELTYPE | PixelType
typedef PIXELTYPE * | pointer
typedef PIXELTYPE & | reference
typedef traverser::row_iterator | row_iterator
typedef PIXELTYPE * | ScanOrderIterator
typedef Size2D | size_type
typedef BasicImageIterator< PIXELTYPE, PIXELTYPE ** > | traverser
typedef PIXELTYPE | value_type

## Public Member Functions

Accessor | accessor ()
ConstAccessor | accessor () const
| BasicImage ()
| BasicImage (Alloc const &alloc)
| BasicImage (const BasicImage &rhs)
| BasicImage (difference_type const &size, Alloc const &alloc=Alloc())
| BasicImage (difference_type const &size, const_pointer d, Alloc const &alloc=Alloc())
| BasicImage (difference_type const &size, SkipInitializationTag, Alloc const &alloc=Alloc())
| BasicImage (difference_type const &size, value_type const &d, Alloc const &alloc=Alloc())
| BasicImage (std::ptrdiff_t width, std::ptrdiff_t height, Alloc const &alloc=Alloc())
| BasicImage (std::ptrdiff_t width, std::ptrdiff_t height, const_pointer d, Alloc const &alloc=Alloc())
| BasicImage (std::ptrdiff_t width, std::ptrdiff_t height, SkipInitializationTag, Alloc const &alloc=Alloc())
| BasicImage (std::ptrdiff_t width, std::ptrdiff_t height, value_type const &d, Alloc const &alloc=Alloc())
iterator | begin ()
const_iterator | begin () const
column_iterator | columnBegin (std::ptrdiff_t x)
const_column_iterator | columnBegin (std::ptrdiff_t x) const
column_iterator | columnEnd (std::ptrdiff_t x)
const_column_iterator | columnEnd (std::ptrdiff_t x) const
const_pointer | data () const
iterator | end ()
const_iterator | end () const
std::ptrdiff_t | height () const
BasicImage & | init (value_type const &pixel)
bool | isInside (difference_type const &d) const
traverser | lowerRight ()
const_traverser | lowerRight () const
reference | operator() (std::ptrdiff_t dx, std::ptrdiff_t dy)
const_reference | operator() (std::ptrdiff_t dx, std::ptrdiff_t dy) const
BasicImage & | operator= (const BasicImage &rhs)
BasicImage & | operator= (value_type pixel)
reference | operator[] (difference_type const &d)
const_reference | operator[] (difference_type const &d) const
pointer | operator[] (std::ptrdiff_t dy)
const_pointer | operator[] (std::ptrdiff_t dy) const
void | resize (difference_type const &size)
void | resize (std::ptrdiff_t width, std::ptrdiff_t height)
void | resize (std::ptrdiff_t width, std::ptrdiff_t height, SkipInitializationTag)
void | resize (std::ptrdiff_t width, std::ptrdiff_t height, value_type const &d)
void | resizeCopy (const BasicImage &rhs)
void | resizeCopy (std::ptrdiff_t width, std::ptrdiff_t height, const_pointer data)
row_iterator | rowBegin (std::ptrdiff_t y)
const_row_iterator | rowBegin (std::ptrdiff_t y) const
row_iterator | rowEnd (std::ptrdiff_t y)
const_row_iterator | rowEnd (std::ptrdiff_t y) const
size_type | size () const
void | swap (BasicImage &rhs)
traverser | upperLeft ()
const_traverser | upperLeft () const
std::ptrdiff_t | width () const
| ~BasicImage ()

## Detailed Description

template<class PIXELTYPE, class Alloc = std::allocator<PIXELTYPE>>
class vigra::BasicImage< PIXELTYPE, Alloc >

Fundamental class template for images.

deprecated, use vigra::MultiArray instead

A customized memory allocator can be specified as a templated argument and passed in the constructor.

#include <vigra/basicimage.hxx>
Namespace: vigra

## Member Typedef Documentation

## ◆ value_type

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE value_type

the BasicImage's pixel type

## ◆ PixelType

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE PixelType

the BasicImage's pixel type

## ◆ reference

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE& reference

the BasicImage's reference type (i.e. the return type of `image[diff]` and `image(dx,dy)`)

## ◆ const_reference

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE const& const_reference

the BasicImage's const reference type (i.e. the return type of `image[diff]` and `image(dx,dy)` when `image` is const)

## ◆ pointer

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE* pointer

the BasicImage's pointer type

## ◆ const_pointer

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE const* const_pointer

the BasicImage's const pointer type

## ◆ iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE* iterator

the BasicImage's 1D random access iterator (note: lower case 'iterator' is a STL compatible 1D random access iterator, don't confuse with capitalized Iterator)

## ◆ ScanOrderIterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE* ScanOrderIterator

deprecated, use `iterator` instead

## ◆ const_iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE const* const_iterator

the BasicImage's 1D random access const iterator (note: lower case 'const_iterator' is a STL compatible 1D random access const iterator)

## ◆ ConstScanOrderIterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef PIXELTYPE const* ConstScanOrderIterator

deprecated, use `const_iterator` instead

## ◆ traverser

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef BasicImageIterator<PIXELTYPE, PIXELTYPE **> traverser

the BasicImage's 2D random access iterator ('traverser')

## ◆ Iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef BasicImageIterator<PIXELTYPE, PIXELTYPE **> Iterator

deprecated, use `traverser` instead

## ◆ const_traverser

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef ConstBasicImageIterator<PIXELTYPE, PIXELTYPE **> const_traverser

the BasicImage's 2D random access const iterator ('const traverser')

## ◆ ConstIterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef ConstBasicImageIterator<PIXELTYPE, PIXELTYPE **> ConstIterator

deprecated, use `const_traverser` instead

## ◆ row_iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef traverser::row_iterator row_iterator

the row iterator associated with the traverser

## ◆ const_row_iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef const_traverser::row_iterator const_row_iterator

the const row iterator associated with the const_traverser

## ◆ column_iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef traverser::column_iterator column_iterator

the column iterator associated with the traverser

## ◆ const_column_iterator

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef const_traverser::column_iterator const_column_iterator

the const column iterator associated with the const_traverser

## ◆ difference_type

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef Diff2D difference_type

the BasicImage's difference type (argument type of image[diff])

## ◆ size_type

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef Size2D size_type

the BasicImage's size type (result type of image.size())

## ◆ Accessor

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef IteratorTraits<traverser>::DefaultAccessor Accessor

the BasicImage's default accessor

## ◆ ConstAccessor

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef IteratorTraits<const_traverser>::DefaultAccessor ConstAccessor

the BasicImage's default const accessor

## ◆ allocator_type

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

typedef Alloc allocator_type

the BasicImage's allocator (default: std::allocator<value_type>)

## Constructor & Destructor Documentation

## ◆ BasicImage() [1/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( |  | ) |

construct image of size 0x0

## ◆ BasicImage() [2/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | Alloc const & | alloc | ) |

explicit

construct image of size 0x0, use the specified allocator.

## ◆ BasicImage() [3/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

construct image of size width x height, use the specified allocator.

## ◆ BasicImage() [4/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | difference_type const & | size,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

explicit

construct image of size size.x x size.y, use the specified allocator.

## ◆ BasicImage() [5/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | value_type const & | d,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

construct image of size width*height and initialize every pixel with the value d (use this constructor, if value_type doesn't have a default constructor). Use the specified allocator.

## ◆ BasicImage() [6/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | SkipInitializationTag | ,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

construct image of size width*height and try to skip initialization of the memory (see BasicImage::resize for details). Use the specified allocator.

## ◆ BasicImage() [7/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | difference_type const & | size,
|  | value_type const & | d,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

explicit

construct image of size size.x x size.y and initialize every pixel with given data (use this constructor, if value_type doesn't have a default constructor). Use the specified allocator.

## ◆ BasicImage() [8/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | difference_type const & | size,
|  | SkipInitializationTag | ,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

explicit

construct image of size size.x x size.y and try to skip initialization of the memory (see BasicImage::resize for details). Use the specified allocator.

## ◆ BasicImage() [9/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | const_pointer | d,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

construct image of size width*height and copy the data from the given C-style array d. Use the specified allocator.

## ◆ BasicImage() [10/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | difference_type const & | size,
|  | const_pointer | d,
|  | Alloc const & | alloc = `Alloc()`
| ) |  |

explicit

construct image of size size.x x size.y and copy the data from the given C-style array. Use the specified allocator.

## ◆ BasicImage() [11/11]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

BasicImage | ( | const BasicImage< PIXELTYPE, Alloc > & | rhs | ) |

copy rhs image

## ◆ ~BasicImage()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

~BasicImage | ( |  | ) |

destructor

## Member Function Documentation

## ◆ operator=() [1/2]

template<class PIXELTYPE , class Alloc >

BasicImage< PIXELTYPE, Alloc > & operator= | ( | const BasicImage< PIXELTYPE, Alloc > & | rhs | ) |

copy rhs image (image is resized if necessary)

## ◆ operator=() [2/2]

template<class PIXELTYPE , class Alloc >

BasicImage< PIXELTYPE, Alloc > & operator= | ( | value_type | pixel | ) |

Deprecated:
  set Image with const value

## ◆ init()

template<class PIXELTYPE , class Alloc >

BasicImage< PIXELTYPE, Alloc > & init | ( | value_type const & | pixel | ) |

set Image with const value

## ◆ resize() [1/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

void resize | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height
| ) |  |

reset image to specified size (dimensions must not be negative) (old data are kept if new size matches old size)

## ◆ resize() [2/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

void resize | ( | difference_type const & | size | ) |

reset image to specified size (dimensions must not be negative) (old data are kept if new size matches old size)

## ◆ resize() [3/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

void resize | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | value_type const & | d
| ) |  |

reset image to specified size and initialize it with given data (use this if value_type doesn't have a default constructor, dimensions must not be negative, old data are kept if new size matches old size)

## ◆ resize() [4/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

void resize | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | SkipInitializationTag |
| ) |  |

reset image to specified size and skip initialization if possible (use this if `value_type` is a built-in type or `TinyVector<builtin&gt&` and the data is immediately overridden afterwards). If `value_type` requires initialization, `SkipInitialization` is ignored.

Usage:

image.resize(new_width, new_height, SkipInitialization);
vigra::RGBValue
Class for a single RGB value.
Definition rgbvalue.hxx:128

## ◆ resizeCopy() [1/2]

template<class PIXELTYPE , class Alloc >

void resizeCopy | ( | std::ptrdiff_t | width,
|  | std::ptrdiff_t | height,
|  | const_pointer | data
| ) |  |

resize image to given size and initialize by copying data from the C-style array data.

## ◆ resizeCopy() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

void resizeCopy | ( | const BasicImage< PIXELTYPE, Alloc > & | rhs | ) |

resize image to size of other image and copy its data

## ◆ swap()

template<class PIXELTYPE , class Alloc >

void swap | ( | BasicImage< PIXELTYPE, Alloc > & | rhs | ) |

swap the internal data with the rhs image in constant time

## ◆ width()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

std::ptrdiff_t width | ( |  | ) | const

width of Image

## ◆ height()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

std::ptrdiff_t height | ( |  | ) | const

height of Image

## ◆ size()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

size_type size | ( |  | ) | const

size of Image

## ◆ isInside()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

bool isInside | ( | difference_type const & | d | ) | const

test whether a given coordinate is inside the image

## ◆ operator[]() [1/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

reference operator[] | ( | difference_type const & | d | ) |

access pixel at given location.
usage: `value_type value = image[Diff2D(1,2)]`

## ◆ operator[]() [2/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_reference operator[] | ( | difference_type const & | d | ) | const

read pixel at given location.
usage: `value_type value = image[Diff2D(1,2)]`

## ◆ operator()() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

reference operator() | ( | std::ptrdiff_t | dx,
|  | std::ptrdiff_t | dy
| ) |  |

access pixel at given location.
usage: `value_type value = image(1,2)`

## ◆ operator()() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_reference operator() | ( | std::ptrdiff_t | dx,
|  | std::ptrdiff_t | dy
| ) |  | const

read pixel at given location.
usage: `value_type value = image(1,2)`

## ◆ operator[]() [3/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

pointer operator[] | ( | std::ptrdiff_t | dy | ) |

access pixel at given location. Note that the 'x' index is the trailing index.
usage: `value_type value = image[2][1]`

## ◆ operator[]() [4/4]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_pointer operator[] | ( | std::ptrdiff_t | dy | ) | const

read pixel at given location. Note that the 'x' index is the trailing index.
usage: `value_type value = image[2][1]`

## ◆ upperLeft() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

traverser upperLeft | ( |  | ) |

init 2D random access iterator pointing to upper left pixel

## ◆ lowerRight() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

traverser lowerRight | ( |  | ) |

init 2D random access iterator pointing to pixel(width, height), i.e. one pixel right and below lower right corner of the image as is common in C/C++.

## ◆ upperLeft() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_traverser upperLeft | ( |  | ) | const

init 2D random access const iterator pointing to upper left pixel

## ◆ lowerRight() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_traverser lowerRight | ( |  | ) | const

init 2D random access const iterator pointing to pixel(width, height), i.e. one pixel right and below lower right corner of the image as is common in C/C++.

## ◆ begin() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

iterator begin | ( |  | ) |

init 1D random access iterator pointing to first pixel

## ◆ end() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

iterator end | ( |  | ) |

init 1D random access iterator pointing past the end

## ◆ begin() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_iterator begin | ( |  | ) | const

init 1D random access const iterator pointing to first pixel

## ◆ end() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_iterator end | ( |  | ) | const

init 1D random access const iterator pointing past the end

## ◆ rowBegin() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

row_iterator rowBegin | ( | std::ptrdiff_t | y | ) |

init 1D random access iterator pointing to first pixel of row y

## ◆ rowEnd() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

row_iterator rowEnd | ( | std::ptrdiff_t | y | ) |

init 1D random access iterator pointing past the end of row y

## ◆ rowBegin() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_row_iterator rowBegin | ( | std::ptrdiff_t | y | ) | const

init 1D random access const iterator pointing to first pixel of row y

## ◆ rowEnd() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_row_iterator rowEnd | ( | std::ptrdiff_t | y | ) | const

init 1D random access const iterator pointing past the end of row y

## ◆ columnBegin() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

column_iterator columnBegin | ( | std::ptrdiff_t | x | ) |

init 1D random access iterator pointing to first pixel of column x

## ◆ columnEnd() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

column_iterator columnEnd | ( | std::ptrdiff_t | x | ) |

init 1D random access iterator pointing past the end of column x

## ◆ columnBegin() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_column_iterator columnBegin | ( | std::ptrdiff_t | x | ) | const

init 1D random access const iterator pointing to first pixel of column x

## ◆ columnEnd() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_column_iterator columnEnd | ( | std::ptrdiff_t | x | ) | const

init 1D random access const iterator pointing past the end of column x

## ◆ data()

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

const_pointer data | ( |  | ) | const

get a pointer to the internal data

## ◆ accessor() [1/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

Accessor accessor | ( |  | ) |

return default accessor

## ◆ accessor() [2/2]

template<class PIXELTYPE , class Alloc = std::allocator<PIXELTYPE>>

ConstAccessor accessor | ( |  | ) | const

return default const accessor

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

- vigra/basicimage.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.12.1