$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mln::box2d Class Reference

#include <mln/core/alias/box2d.hh>

Public Member Functions

 box2d ()
 box2d (const point2d &pmin, const point2d &pmax)
 box2d (typename mln::point2d::coord nrows, typename mln::point2d::coord ncols)
const box< mln::point2d > & bbox () const
void crop_wrt (const box< mln::point2d > &b)
void enlarge (unsigned b)
void enlarge (unsigned dim, unsigned b)
bool has (const mln::point2d &p) const
bool is_empty () const
bool is_valid () const
unsigned len (unsigned i) const
std::size_t memory_size () const
void merge (const box< mln::point2d > &b)
unsigned nsites () const
mln::point2d pcenter () const
mln::point2d pmax () const
mln::point2dpmax ()
mln::point2d pmin () const
mln::point2dpmin ()
box< mln::point2dto_larger (unsigned b) const

Protected Attributes

mln::point2d pmax_
mln::point2d pmin_

Public Types

enum  
typedef box_bkd_piter_
< mln::point2d
bkd_piter
typedef Site_Set< void > category
typedef mln::point2d element
typedef box< mln::point2dexact_t
typedef box_fwd_piter_
< mln::point2d
fwd_piter
typedef fwd_piter piter
typedef mln::point2d psite
typedef const box< mln::point2d > & q_box
typedef mln::point2d site

Detailed Description

A box defined on the 2D square grid with integer coordinates.

This class is a site set of mln::point2d. It represents a rectangle of mln::point2d which is usually used as domain for a mln::image2d.

mln::box2d is a typedef of box<mln::point2d>.

Iteration over the mln::point2d of a mln::box2d relies on p-iterators and it can be performed using the following code:

box2d b(3,3);
mln_piter(box2d) p(b);
for_all(p)
std::cout << p << std::endl;

Common sites can be retrieved through pmin(), pmax() and pcenter().

pmin
  X------------.---------->
  |   pcenter  |
  |      X     |
  |            |
  .------------X
  |           pmax
  |
  |
  v
See Also
mln::make::box2d.

Definition at line 6 of file box2d.dox.

Constructor & Destructor Documentation

mln::box2d::box2d ( )

Constructor without argument.

mln::box2d::box2d ( const point2d pmin,
const point2d pmax 
)

Constructor of a box going from pmin to pmax.

See Also
mln::make::box2d.
mln::box2d::box2d ( typename mln::point2d::coord  nrows,
typename mln::point2d::coord  ncols 
)

Construct a box2d with nrows rows and ncols columns.

The pmin() site is set to mln::point2d(0,0).

See Also
mln::make::box2d.

Member Function Documentation

const box< mln::point2d > & mln::Box< box< mln::point2d > >::bbox ( ) const
inherited

Give the bounding box of this site set.

Return the bounding box of this site set, so that is itself. This method is declared by the mln::Site_Set concept.

Warning
This method is final for all box classes.
void mln::box< mln::point2d >::crop_wrt ( const box< mln::point2d > &  b)
inherited

Crop this bbox in order to fit in the reference box b.

void mln::box< mln::point2d >::enlarge ( unsigned  b)
inherited

Enlarge the box with a border b.

void mln::box< mln::point2d >::enlarge ( unsigned  dim,
unsigned  b 
)
inherited

Enlarge the box with a border b for dimension dim.

bool mln::box< mln::point2d >::has ( const mln::point2d p) const
inherited

Test if p belongs to the box.

Parameters
[in]pA point site.
bool mln::Box< box< mln::point2d > >::is_empty ( ) const
inherited

Test if this box is empty.

bool mln::box< mln::point2d >::is_valid ( ) const
inherited

Test that the box owns valid data, i.e., is initialized and with pmin being 'less-than' pmax.

unsigned mln::Box< box< mln::point2d > >::len ( unsigned  i) const
inherited

Give the length of the i-th side of the box.

Precondition
i < site::dim
Warning
This method is final for all box classes.
std::size_t mln::box< mln::point2d >::memory_size ( ) const
inherited

Return the size of this site set in memory.

void mln::box< mln::point2d >::merge ( const box< mln::point2d > &  b)
inherited

Merge inplace with another box.

unsigned mln::Box< box< mln::point2d > >::nsites ( ) const
inherited

Give the number of sites of this box.

Return the number of sites of this box. This method is declared by the mln::Site_Set concept.

Warning
This method is final for all box classes.
mln::point2d mln::box< mln::point2d >::pcenter ( ) const
inherited

Return the approximated central site of this box.

mln::point2d mln::box< mln::point2d >::pmax ( ) const
inherited

Maximum point.

mln::point2d & mln::box< mln::point2d >::pmax ( )
inherited

Reference to the maximum point.

mln::point2d mln::box< mln::point2d >::pmin ( ) const
inherited

Minimum point.

mln::point2d & mln::box< mln::point2d >::pmin ( )
inherited

Reference to the minimum point.

box<mln::point2d > mln::box< mln::point2d >::to_larger ( unsigned  b) const
inherited

Give a larger box.

Member Data Documentation

mln::point2d mln::box< mln::point2d >::pmax_
protectedinherited

Definition at line 165 of file core/site_set/box.hh.

mln::point2d mln::box< mln::point2d >::pmin_
protectedinherited

Definition at line 165 of file core/site_set/box.hh.

Member Typedef Documentation

Backward Site_Iterator associated type.

Definition at line 105 of file core/site_set/box.hh.

typedef Site_Set<void> mln::Site_Set< box< mln::point2d > >::category
inherited

Definition at line 74 of file core/concept/site_set.hh.

typedef mln::point2d mln::box< mln::point2d >::element
inherited

Element associated type.

Definition at line 90 of file core/site_set/box.hh.

typedef box< mln::point2d > mln::Object< box< mln::point2d > >::exact_t
inherited

Definition at line 105 of file object.hh.

Forward Site_Iterator associated type.

Definition at line 99 of file core/site_set/box.hh.

typedef fwd_piter mln::box< mln::point2d >::piter
inherited

Site_Iterator associated type.

Definition at line 102 of file core/site_set/box.hh.

typedef mln::point2d mln::box< mln::point2d >::psite
inherited

Psite associated type.

Definition at line 93 of file core/site_set/box.hh.

typedef const box< mln::point2d > & mln::Box< box< mln::point2d > >::q_box
inherited

Definition at line 64 of file core/concept/box.hh.

typedef mln::point2d mln::box< mln::point2d >::site
inherited

Site associated type.

Definition at line 96 of file core/site_set/box.hh.

Member Enumeration Documentation

anonymous enum
inherited

Dimension.

Definition at line 87 of file core/site_set/box.hh.