Public Types | Public Member Functions | Protected Attributes | Private Types

mln::image2d< T > Class Template Reference
[Basic types]

Basic 2D image class. More...

#include <image2d.hh>

Inheritance diagram for mln::image2d< T >:
Inheritance graph

List of all members.

Public Types

typedef mln::box2d::bkd_piter bkd_piter
 Backward Site_Iterator associated type.
typedef Image< void > category
typedef mln::box2d domain_t
 Site_Set associated type.
typedef image2d< T > exact_t
typedef mln::box2d::fwd_piter fwd_piter
 Forward Site_Iterator associated type.
typedef T & lvalue
 Return type of read-write access.
typedef fwd_piter piter
 Site_Iterator associated type; default definition is fwd_piter.
typedef mln::box2d::psite psite
 Point_Site associated type.
typedef const T & rvalue
 Return type of read-only access.
typedef mln::box2d::site site
 Site associated type.
typedef image2d< tag::value_< T > > skeleton
 Skeleton.
typedef mln::value::set< T > t_eligible_values_set
 Eligible-value-set associated type.
typedef mln::value::set
< typename
mln::value::super_value< T >
::ret > 
t_values_space
 Value space associated type.
typedef T value
 Value associated type.

Public Member Functions

template<typename P >
T & alt (const P &p)
const T & at_ (mln::def::coord row, mln::def::coord col) const
 Read-only access to the image value located at (row, col).
T & at_ (mln::def::coord row, mln::def::coord col)
 Read-write access to the image value located at (row, col).
const box2dbbox () const
 Give the bounding box domain.
unsigned border () const
 Give the border thickness.
const T * buffer () const
 Give a hook to the value buffer.
T * buffer ()
 Give a hook to the value buffer.
int delta_index (const dpoint2d &dp) const
 Give the delta-index corresponding to the delta-point dp.
void destroy ()
 Detach data from an image (free it if nobody else hold it).
const box2ddomain () const
 Give the definition domain.
const T & element (unsigned i) const
 Read-only access to the image value located at index i.
T & element (unsigned i)
 Read-write access to the image value located at index i.
bool has (const point2d &p) const
 Test if p is valid.
const util::tracked_ptr
< internal::data< image2d< T > > > & 
hook_data_ () const
 Hook to the image data.
const void * id_ () const
 Give an identifier of this image.
 image2d (int nrows, int ncols, unsigned bdr=border::thickness)
 Constructor with the numbers of rows and columns and the border thickness.
 image2d ()
 Constructor without argument.
 image2d (const box2d &b, unsigned bdr=border::thickness)
 Constructor with a box and the border thickness (default is 3).
unsigned index_of_point (const P &p) const
 Give the offset of the site p.
void init_ (const box2d &b, unsigned bdr=border::thickness)
 Initialize an empty image.
bool is_valid () const
 Test if this image has been initialized; default impl.
unsigned ncols () const
 Give the number of columns.
unsigned nelements () const
 Give the number of elements (points including border ones).
unsigned nrows () const
 Give the number of rows.
std::size_t nsites () const
 Give the number of sites of the image domain.
const T & operator() (const point2d &p) const
 Read-only access to the image value located at point p.
T & operator() (const point2d &p)
 Read-write access to the image value located at point p.
point2d point_at_index (unsigned i) const
 Give the point corresponding to the index i.
void resize_ (unsigned new_border)
 Resize image border with new_border.
const t_eligible_values_setvalues_eligible () const
const t_values_spacevalues_space () const
 Return the value space of the image.

Protected Attributes

util::tracked_ptr
< internal::data< image2d< T > > > 
data_

Private Types

typedef
internal::image_primary< T,
mln::box2d, image2d< T > > 
super_

Detailed Description

template<typename T>
class mln::image2d< T >

Basic 2D image class.

The parameter T is the type of pixel values. This image class stores data in memory and has a virtual border with constant thickness around data.


Member Typedef Documentation

Backward Site_Iterator associated type.

typedef Image<void> mln::Image< image2d< T > >::category [inherited]

Reimplemented from mln::Object< image2d< T > >.

typedef mln::box2d mln::internal::image_base< T, mln::box2d , image2d< T > >::domain_t [inherited]

Site_Set associated type.

typedef image2d< T > mln::Object< image2d< T > >::exact_t [inherited]

Forward Site_Iterator associated type.

template<typename T>
typedef T& mln::image2d< T >::lvalue

Return type of read-write access.

typedef fwd_piter mln::internal::image_base< T, mln::box2d , image2d< T > >::piter [inherited]

Site_Iterator associated type; default definition is fwd_piter.

typedef mln::box2d ::psite mln::internal::image_base< T, mln::box2d , image2d< T > >::psite [inherited]

Point_Site associated type.

template<typename T>
typedef const T& mln::image2d< T >::rvalue

Return type of read-only access.

typedef mln::box2d ::site mln::internal::image_base< T, mln::box2d , image2d< T > >::site [inherited]

Site associated type.

template<typename T>
typedef image2d< tag::value_<T> > mln::image2d< T >::skeleton

Skeleton.

template<typename T>
typedef internal::image_primary< T, mln::box2d, image2d<T> > mln::image2d< T >::super_ [private]

Eligible-value-set associated type.

Value space associated type.

template<typename T>
typedef T mln::image2d< T >::value

Constructor & Destructor Documentation

template<typename T >
mln::image2d< T >::image2d (  )  [inline]

Constructor without argument.

template<typename T >
mln::image2d< T >::image2d ( int  nrows,
int  ncols,
unsigned  bdr = border::thickness 
) [inline]

Constructor with the numbers of rows and columns and the border thickness.

References mln::make::box2d(), and mln::image2d< T >::init_().

template<typename T >
mln::image2d< T >::image2d ( const box2d b,
unsigned  bdr = border::thickness 
) [inline]

Constructor with a box and the border thickness (default is 3).

References mln::image2d< T >::init_().


Member Function Documentation

template<typename T>
template<typename P >
T& mln::image2d< T >::alt ( const P &  p  )  [inline]
template<typename T >
const T & mln::image2d< T >::at_ ( mln::def::coord  row,
mln::def::coord  col 
) const [inline]

Read-only access to the image value located at (row, col).

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().

Referenced by mln::world::binary_2d::reduce().

template<typename T >
T & mln::image2d< T >::at_ ( mln::def::coord  row,
mln::def::coord  col 
) [inline]

Read-write access to the image value located at (row, col).

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().

template<typename T >
const box2d & mln::image2d< T >::bbox (  )  const [inline]
template<typename T >
unsigned mln::image2d< T >::border (  )  const [inline]
template<typename T >
const T * mln::image2d< T >::buffer (  )  const [inline]
template<typename T >
T * mln::image2d< T >::buffer (  )  [inline]
template<typename T >
int mln::image2d< T >::delta_index ( const dpoint2d dp  )  const [inline]
void mln::internal::image_base< T, mln::box2d , image2d< T > >::destroy (  )  [inherited]

Detach data from an image (free it if nobody else hold it).

template<typename T >
const box2d & mln::image2d< T >::domain (  )  const [inline]
template<typename T >
const T & mln::image2d< T >::element ( unsigned  i  )  const [inline]

Read-only access to the image value located at index i.

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().

template<typename T >
T & mln::image2d< T >::element ( unsigned  i  )  [inline]

Read-write access to the image value located at index i.

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().

template<typename T >
bool mln::image2d< T >::has ( const point2d p  )  const [inline]
const util::tracked_ptr< internal::data<image2d< T > > >& mln::internal::image_base< T, mln::box2d , image2d< T > >::hook_data_ (  )  const [inherited]

Hook to the image data.

const void* mln::internal::image_base< T, mln::box2d , image2d< T > >::id_ (  )  const [inherited]

Give an identifier of this image.

When several image variables designate the same image, they share the same identifier.

unsigned mln::internal::check::image_fastest_< image2d< T > , mln::metal::equal< mln_trait_image_speed(image2d< T >), trait::image::speed::fastest >::eval >::index_of_point ( const P &  p  )  const [inherited]

Give the offset of the site p.

Parameters:
[in] p A site.
Warning:
This method is final.
Precondition:
The image has to be initialized and to own the point p.
Postcondition:
p == point_at_index(result)
template<typename T >
void mln::image2d< T >::init_ ( const box2d b,
unsigned  bdr = border::thickness 
) [inline]
bool mln::internal::image_base< T, mln::box2d , image2d< T > >::is_valid (  )  const [inherited]
template<typename T >
unsigned mln::image2d< T >::ncols (  )  const [inline]
template<typename T >
unsigned mln::image2d< T >::nelements (  )  const [inline]
template<typename T >
unsigned mln::image2d< T >::nrows (  )  const [inline]
std::size_t mln::internal::image_base< T, mln::box2d , image2d< T > >::nsites (  )  const [inherited]

Give the number of sites of the image domain.

template<typename T >
T & mln::image2d< T >::operator() ( const point2d p  )  [inline]

Read-write access to the image value located at point p.

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().

template<typename T >
const T & mln::image2d< T >::operator() ( const point2d p  )  const [inline]

Read-only access to the image value located at point p.

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().

template<typename T >
point2d mln::image2d< T >::point_at_index ( unsigned  i  )  const [inline]

Give the point corresponding to the index i.

References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().

template<typename T >
void mln::image2d< T >::resize_ ( unsigned  new_border  )  [inline]
const t_eligible_values_set& mln::internal::image_base< T, mln::box2d , image2d< T > >::values_eligible (  )  const [inherited]
const t_values_space& mln::internal::image_base< T, mln::box2d , image2d< T > >::values_space (  )  const [inherited]

Return the value space of the image.


Member Data Documentation

util::tracked_ptr< internal::data<image2d< T > > > mln::internal::image_base< T, mln::box2d , image2d< T > >::data_ [protected, inherited]