Basic 2D image class. More...
#include <image2d.hh>
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 box2d & | bbox () 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 box2d & | domain () 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 () | |
Constructor without argument. | |
image2d (int nrows, int ncols, unsigned bdr=border::thickness) | |
Constructor with the numbers of rows and columns and the border thickness. | |
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. | |
T & | operator() (const point2d &p) |
Read-write access to the image value located at point p . | |
const T & | operator() (const point2d &p) const |
Read-only 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_set & | values_eligible () const |
const t_values_space & | values_space () const |
Return the value space of the image. | |
const box2d & | vbbox () const |
Protected Attributes | |
util::tracked_ptr < internal::data< image2d< T > > > | data_ |
Private Types | |
typedef internal::image_primary< T, mln::box2d, image2d< T > > | super_ |
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.
Definition at line 136 of file core/image/image2d.hh.
typedef mln::box2d ::bkd_piter mln::internal::image_base< T, mln::box2d , image2d< T > >::bkd_piter [inherited] |
Backward Site_Iterator associated type.
Definition at line 118 of file core/internal/image_base.hh.
typedef Image<void> mln::Image< image2d< T > >::category [inherited] |
Reimplemented from mln::Object< image2d< T > >.
Definition at line 75 of file core/concept/image.hh.
typedef mln::box2d mln::internal::image_base< T, mln::box2d , image2d< T > >::domain_t [inherited] |
Site_Set associated type.
Definition at line 105 of file core/internal/image_base.hh.
typedef image2d< T > mln::Object< image2d< T > >::exact_t [inherited] |
typedef mln::box2d ::fwd_piter mln::internal::image_base< T, mln::box2d , image2d< T > >::fwd_piter [inherited] |
Forward Site_Iterator associated type.
Definition at line 115 of file core/internal/image_base.hh.
typedef T& mln::image2d< T >::lvalue |
Return type of read-write access.
Definition at line 148 of file core/image/image2d.hh.
typedef fwd_piter mln::internal::image_base< T, mln::box2d , image2d< T > >::piter [inherited] |
Site_Iterator associated type; default definition is fwd_piter.
Definition at line 123 of file core/internal/image_base.hh.
typedef mln::box2d ::psite mln::internal::image_base< T, mln::box2d , image2d< T > >::psite [inherited] |
Point_Site associated type.
Definition at line 108 of file core/internal/image_base.hh.
typedef const T& mln::image2d< T >::rvalue |
Return type of read-only access.
Definition at line 145 of file core/image/image2d.hh.
typedef mln::box2d ::site mln::internal::image_base< T, mln::box2d , image2d< T > >::site [inherited] |
Site associated type.
Definition at line 111 of file core/internal/image_base.hh.
typedef image2d< tag::value_<T> > mln::image2d< T >::skeleton |
Skeleton.
Definition at line 152 of file core/image/image2d.hh.
typedef internal::image_primary< T, mln::box2d, image2d<T> > mln::image2d< T >::super_ [private] |
Definition at line 138 of file core/image/image2d.hh.
typedef mln::value::set<T> mln::internal::image_base< T, mln::box2d , image2d< T > >::t_eligible_values_set [inherited] |
Eligible-value-set associated type.
Definition at line 91 of file core/internal/image_base.hh.
typedef mln::value::set< typename mln::value::super_value<T>::ret > mln::internal::image_base< T, mln::box2d , image2d< T > >::t_values_space [inherited] |
Value space associated type.
Definition at line 98 of file core/internal/image_base.hh.
typedef T mln::image2d< T >::value |
Value associated type.
Reimplemented from mln::internal::image_base< T, mln::box2d, image2d< T > >.
Definition at line 142 of file core/image/image2d.hh.
mln::image2d< T >::image2d | ( | ) | [inline] |
Constructor without argument.
Definition at line 394 of file core/image/image2d.hh.
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.
Definition at line 400 of file core/image/image2d.hh.
References mln::make::box2d(), and mln::image2d< T >::init_().
mln::image2d< T >::image2d | ( | const box2d & | b, | |
unsigned | bdr = border::thickness | |||
) | [inline] |
Constructor with a box and the border thickness (default is 3).
Definition at line 407 of file core/image/image2d.hh.
References mln::image2d< T >::init_().
Definition at line 191 of file core/image/image2d.hh.
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
).
Definition at line 481 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().
Referenced by mln::world::binary_2d::reduce().
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
).
Definition at line 490 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().
const box2d & mln::image2d< T >::bbox | ( | ) | const [inline] |
Give the bounding box domain.
Definition at line 433 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
unsigned mln::image2d< T >::border | ( | ) | const [inline] |
Give the border thickness.
Definition at line 520 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::init_().
const T * mln::image2d< T >::buffer | ( | ) | const [inline] |
Give a hook to the value buffer.
Definition at line 556 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
T * mln::image2d< T >::buffer | ( | ) | [inline] |
Give a hook to the value buffer.
Definition at line 565 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
int mln::image2d< T >::delta_index | ( | const dpoint2d & | dp | ) | const [inline] |
Give the delta-index corresponding to the delta-point dp
.
Definition at line 574 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::world::binary_2d::subsample().
void mln::internal::image_base< T, mln::box2d , image2d< T > >::destroy | ( | ) | [inherited] |
Detach data from an image (free it if nobody else hold it).
const box2d & mln::image2d< T >::domain | ( | ) | const [inline] |
Give the definition domain.
Definition at line 424 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::morpho::line_gradient(), mln::make_debug_graph_image(), debug::println_graph(), mln::world::binary_2d::reduce(), mln::io::txt::save(), and convert::to_complex_image().
T & mln::image2d< T >::element | ( | unsigned | i | ) | [inline] |
Read-write access to the image value located at index i
.
Definition at line 547 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().
const T & mln::image2d< T >::element | ( | unsigned | i | ) | const [inline] |
Read-only access to the image value located at index i
.
Definition at line 538 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().
bool mln::image2d< T >::has | ( | const point2d & | p | ) | const [inline] |
Test if p
is valid.
Reimplemented from mln::internal::image_base< T, mln::box2d, image2d< T > >.
Definition at line 451 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::image2d< bool >::alt(), mln::image2d< T >::at_(), mln::image2d< T >::operator()(), and mln::debug::put_word().
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
.
[in] | p | A site. |
p
. void mln::image2d< T >::init_ | ( | const box2d & | b, | |
unsigned | bdr = border::thickness | |||
) | [inline] |
Initialize an empty image.
Definition at line 415 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::image2d< T >::image2d(), and mln::init_().
bool mln::internal::image_base< T, mln::box2d , image2d< T > >::is_valid | ( | ) | const [inherited] |
Test if this image has been initialized; default impl.
Referenced by mln::image2d< T >::bbox(), mln::image2d< T >::border(), mln::image2d< T >::buffer(), mln::image2d< T >::delta_index(), mln::image2d< T >::domain(), mln::image2d< T >::has(), mln::image2d< T >::init_(), mln::morpho::line_gradient(), mln::image2d< T >::ncols(), mln::image2d< T >::nelements(), mln::image2d< T >::nrows(), mln::image2d< T >::resize_(), mln::io::txt::save(), and mln::image2d< T >::vbbox().
unsigned mln::image2d< T >::ncols | ( | ) | const [inline] |
Give the number of columns.
Definition at line 508 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::world::binary_2d::impl::enlargex2(), debug::println_graph(), mln::world::binary_2d::reduce(), and mln::world::binary_2d::subsample().
unsigned mln::image2d< T >::nelements | ( | ) | const [inline] |
Give the number of elements (points including border ones).
Definition at line 529 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::image2d< T >::element(), and mln::image2d< T >::point_at_index().
unsigned mln::image2d< T >::nrows | ( | ) | const [inline] |
Give the number of rows.
Definition at line 499 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
Referenced by mln::util::internal::adjacency_matrix_impl_selector< V, Q >::add(), mln::util::internal::adjacency_matrix_impl_selector< V, Q >::are_adjacent(), mln::world::binary_2d::impl::enlargex2(), debug::println_graph(), mln::world::binary_2d::reduce(), mln::util::internal::adjacency_matrix_impl_selector< V, Q >::remove(), and mln::world::binary_2d::subsample().
std::size_t mln::internal::image_base< T, mln::box2d , image2d< T > >::nsites | ( | ) | const [inherited] |
Give the number of sites of the image domain.
const T & mln::image2d< T >::operator() | ( | const point2d & | p | ) | const [inline] |
Read-only access to the image value located at point p
.
Definition at line 460 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().
T & mln::image2d< T >::operator() | ( | const point2d & | p | ) | [inline] |
Read-write access to the image value located at point p
.
Definition at line 469 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::has().
point2d mln::image2d< T >::point_at_index | ( | unsigned | i | ) | const [inline] |
Give the point corresponding to the index i
.
Definition at line 584 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::image2d< T >::nelements().
void mln::image2d< T >::resize_ | ( | unsigned | new_border | ) | [inline] |
Resize image border with new_border.
Definition at line 600 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
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.
const box2d & mln::image2d< T >::vbbox | ( | ) | const [inline] |
Definition at line 442 of file core/image/image2d.hh.
References mln::internal::image_base< T, mln::box2d, image2d< T > >::data_, and mln::internal::image_base< T, mln::box2d, image2d< T > >::is_valid().
util::tracked_ptr< internal::data<image2d< T > > > mln::internal::image_base< T, mln::box2d , image2d< T > >::data_ [protected, inherited] |
Definition at line 163 of file core/internal/image_base.hh.
Referenced by mln::image2d< bool >::alt(), mln::image2d< T >::at_(), mln::image2d< T >::bbox(), mln::image2d< T >::border(), mln::image2d< T >::buffer(), mln::image2d< T >::delta_index(), mln::image2d< T >::domain(), mln::image2d< T >::element(), mln::image2d< T >::has(), mln::image2d< T >::init_(), mln::image2d< T >::ncols(), mln::image2d< T >::nelements(), mln::image2d< T >::nrows(), mln::image2d< T >::operator()(), mln::image2d< T >::point_at_index(), mln::image2d< T >::resize_(), and mln::image2d< T >::vbbox().