Morpher providing an improved interface for labeled image. More...
#include <labeled_image.hh>
Public Types | |
typedef accu::shape::bbox < typename I::psite >::result | bbox_t |
Type of the bounding component bounding boxes. | |
typedef I::domain_t::bkd_piter | bkd_piter |
Backward Site_Iterator associated type. | |
typedef Image< void > | category |
typedef const I | delegatee |
Delegatee associated type. | |
typedef I::domain_t | domain_t |
Site_Set associated type. | |
typedef labeled_image< I > | exact_t |
typedef I::domain_t::fwd_piter | fwd_piter |
Forward Site_Iterator associated type. | |
typedef internal::morpher_lvalue_ < const I >::ret | lvalue |
Return type of read-write access. | |
typedef fwd_piter | piter |
Site_Iterator associated type; default definition is fwd_piter. | |
typedef I::domain_t::psite | psite |
Point_Site associated type. | |
typedef const I::rvalue | rvalue |
Return type of read-only access. | |
typedef I::domain_t::site | site |
Site associated type. | |
typedef labeled_image < tag::image_< I > > | skeleton |
Skeleton. | |
typedef mln::value::set< const I::value > | t_eligible_values_set |
Eligible-value-set associated type. | |
typedef mln::value::set < typename mln::value::super_value< const I::value >::ret > | t_values_space |
Value space associated type. | |
typedef const I | unmorph |
Unmorph image associated type. | |
typedef const I::value | value |
Value associated type. | |
Public Member Functions | |
const bbox_t & | bbox (const typename I::value &label) const |
Return the bounding box of the component label . | |
const util::array< bbox_t > & | bboxes () const |
Return the component bounding boxes. | |
mln::metal::const_< const I > ::ret * | delegatee_ () const |
Return the delegatee_ pointer; default code. | |
const I * | delegatee_ () |
Return the delegatee_ pointer (non-const version); default code. | |
void | destroy () |
Detach data from an image (free it if nobody else hold it). | |
const const I::domain_t & | domain () const |
bool | has (const typename const I::psite &p) const |
bool | has (const psite &p) const |
Test if p belongs to the image domain. | |
const util::tracked_ptr < internal::data < labeled_image< I > > > & | hook_data_ () const |
Hook to the image data. | |
const void * | id_ () const |
Give an identifier of this image. | |
unsigned | index_of_point (const P &p) const |
Give the offset of the site p . | |
void | init_ (const I &ima, const typename I::value &nlabels) |
Deferred initialization from a labeled image ima and the number of labels nlabels . | |
void | init_from_ (const labeled_image< I > &model) |
Duplicate the underlying image and create a new labeled_image. | |
bool | is_valid () const |
Test if this image has been initialized; default impl. | |
I::value | nlabels () const |
Return the number of labels;. | |
std::size_t | nsites () const |
Give the number of sites of the image domain. | |
rvalue | operator() (const typename I::domain_t::psite &p) const |
Read-only access of pixel value at point site p . | |
lvalue | operator() (const typename I::domain_t::psite &p) |
Read-write access of pixel value at point site p . | |
void | pack_ () |
Pack labeling. Relabel if the labeling is not contiguous. | |
labeled_image< I > & | rw () |
State that the morpher is writable. | |
p_if< mln_box(I), fun::eq_v2b_expr_< pw::value_ < I >, pw::cst_< typename I::value > > > | subdomain (const typename I::value &label) const |
Return the domain of the component with label label . | |
mln::metal::const_< const I > ::ret & | unmorph_ () const |
Give the morphed image (const version). | |
const I & | unmorph_ () |
Give the morphed image (mutable version). | |
void | update_ () |
Update bounding boxes information. | |
const t_eligible_values_set & | values_eligible () const |
const t_values_space & | values_space () const |
Return the value space of the image. | |
labeled_image () | |
ConstructorsConstructor without argument. | |
labeled_image (const I &ima, const typename I::value &nlabels) | |
Constructor from an image ima and the number of labels nlabels . | |
template<typename F > | |
void | relabel (const Function_v2v< F > &f) |
Relabel according to a function. | |
template<typename F > | |
void | relabel (const Function_v2b< F > &f) |
Labels may be removed. | |
Protected Attributes | |
util::tracked_ptr < internal::data < labeled_image< I > > > | data_ |
Private Types | |
typedef internal::image_identity < const I, typename I::domain_t, labeled_image< I > > | super_ |
Morpher providing an improved interface for labeled image.
I | The label image type. |
This image type allows to access every site set at a given label.
This image type guaranties that labels are contiguous (from 1 to n).
typedef accu::shape::bbox<typename I ::psite>::result mln::labeled_image< I >::bbox_t |
Type of the bounding component bounding boxes.
typedef I::domain_t ::bkd_piter mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::bkd_piter [inherited] |
Backward Site_Iterator associated type.
typedef Image<void> mln::Image< labeled_image< I > >::category [inherited] |
Reimplemented from mln::Object< labeled_image< I > >.
typedef const I mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::delegatee [inherited] |
Delegatee associated type.
typedef I::domain_t mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::domain_t [inherited] |
Site_Set associated type.
typedef labeled_image< I > mln::Object< labeled_image< I > >::exact_t [inherited] |
typedef I::domain_t ::fwd_piter mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::fwd_piter [inherited] |
Forward Site_Iterator associated type.
typedef internal::morpher_lvalue_< const I >::ret mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::lvalue [inherited] |
Return type of read-write access.
typedef fwd_piter mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::piter [inherited] |
Site_Iterator associated type; default definition is fwd_piter.
typedef I::domain_t ::psite mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::psite [inherited] |
Point_Site associated type.
typedef const I ::rvalue mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::rvalue [inherited] |
Return type of read-only access.
typedef I::domain_t ::site mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::site [inherited] |
Site associated type.
typedef labeled_image< tag::image_<I> > mln::labeled_image< I >::skeleton |
Skeleton.
typedef internal::image_identity< const I, typename I ::domain_t, labeled_image<I> > mln::labeled_image< I >::super_ [private] |
typedef mln::value::set<const I::value > mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::t_eligible_values_set [inherited] |
Eligible-value-set associated type.
typedef mln::value::set< typename mln::value::super_value<const I::value >::ret > mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::t_values_space [inherited] |
Value space associated type.
typedef const I mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::unmorph [inherited] |
Unmorph image associated type.
typedef const I ::value mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::value [inherited] |
Value associated type.
Reimplemented from mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >.
mln::labeled_image< I >::labeled_image | ( | ) | [inline] |
ConstructorsConstructor without argument.
mln::labeled_image< I >::labeled_image | ( | const I & | ima, | |
const typename I::value & | nlabels | |||
) | [inline] |
Constructor from an image ima
and the number of labels nlabels
.
References mln::labeled_image< I >::init_().
const labeled_image< I >::bbox_t & mln::labeled_image< I >::bbox | ( | const typename I::value & | label | ) | const |
Return the bounding box of the component label
.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_.
Referenced by mln::labeled_image< I >::subdomain(), and mln::test_image().
const util::array< typename labeled_image< I >::bbox_t > & mln::labeled_image< I >::bboxes | ( | ) | const |
Return the component bounding boxes.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_.
mln::metal::const_< const I >::ret* mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::delegatee_ | ( | ) | const [inherited] |
Return the delegatee_ pointer; default code.
const I * mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::delegatee_ | ( | ) | [inherited] |
Return the delegatee_ pointer (non-const version); default code.
void mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::destroy | ( | ) | [inherited] |
Detach data from an image (free it if nobody else hold it).
const const I ::domain_t& mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::domain | ( | ) | const [inherited] |
bool mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::has | ( | const typename const I ::psite & | p | ) | const [inherited] |
bool mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::has | ( | const psite & | p | ) | const [inherited] |
Test if p
belongs to the image domain.
const util::tracked_ptr< internal::data<labeled_image< I > > >& mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::hook_data_ | ( | ) | const [inherited] |
Hook to the image data.
Referenced by mln::labeled_image< I >::init_from_().
const void* mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::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_< labeled_image< I > , mln::metal::equal< mln_trait_image_speed(labeled_image< I >), 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::labeled_image< I >::init_ | ( | const I & | ima, | |
const typename I::value & | nlabels | |||
) | [inline] |
Deferred initialization from a labeled image ima
and the number of labels nlabels
.
References mln::data::compute(), mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, and mln::labeled_image< I >::update_().
Referenced by mln::init_(), and mln::labeled_image< I >::labeled_image().
void mln::labeled_image< I >::init_from_ | ( | const labeled_image< I > & | model | ) | [inline] |
Duplicate the underlying image and create a new labeled_image.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, mln::duplicate(), mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::hook_data_(), and mln::labeled_image< I >::nlabels().
bool mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::is_valid | ( | ) | const [inherited] |
Test if this image has been initialized; default impl.
Reimplemented from mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >.
I::value mln::labeled_image< I >::nlabels | ( | ) | const [inline] |
Return the number of labels;.
Referenced by mln::init_(), and mln::labeled_image< I >::init_from_().
std::size_t mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::nsites | ( | ) | const [inherited] |
Give the number of sites of the image domain.
lvalue mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::operator() | ( | const typename I::domain_t ::psite & | p | ) | [inherited] |
Read-write access of pixel value at point site p
.
rvalue mln::internal::image_identity< const I , I::domain_t , labeled_image< I > >::operator() | ( | const typename I::domain_t ::psite & | p | ) | const [inherited] |
Read-only access of pixel value at point site p
.
void mln::labeled_image< I >::pack_ | ( | ) | [inline] |
Pack labeling. Relabel if the labeling is not contiguous.
FIXME: could be highly improved: reorder the attributes according to the way the labels are packed.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, mln::labeling::pack_inplace(), and mln::labeled_image< I >::update_().
Referenced by mln::labeled_image< I >::relabel().
void mln::labeled_image< I >::relabel | ( | const Function_v2b< F > & | f | ) | [inline] |
Labels may be removed.
This overload make sure the labeling is still contiguous.
FIXME: could be highly improved: reorder the attributes according to the function f.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, mln::exact(), mln::labeling::relabel_inplace(), and mln::labeled_image< I >::update_().
void mln::labeled_image< I >::relabel | ( | const Function_v2v< F > & | f | ) | [inline] |
Relabel according to a function.
Labels may be removed and the labeling may not be contiguous afterwards. FIXME: currently the labels are packed after relabeling for performance reasons. Do we want to be less restrictive?
We MUST be sure that the labeling is contiguous in order to compute attributes. FIXME: do we want to be less restrictive?
FIXME: could be highly improved: reorder the attributes according to the function f.
References mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, mln::exact(), mln::labeled_image< I >::pack_(), mln::labeling::relabel_inplace(), and mln::labeled_image< I >::update_().
labeled_image< I > & mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::rw | ( | ) | [inherited] |
State that the morpher is writable.
This allows for C++ to use it as a mutable object even if it is a temporary object.
p_if< mln_box(I), fun::eq_v2b_expr_< pw::value_< I >, pw::cst_< typename I::value > > > mln::labeled_image< I >::subdomain | ( | const typename I::value & | label | ) | const |
Return the domain of the component with label label
.
References mln::labeled_image< I >::bbox(), mln::pw::cst(), mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_, and mln::pw::value().
const I & mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::unmorph_ | ( | ) | [inherited] |
Give the morphed image (mutable version).
mln::metal::const_< const I >::ret& mln::internal::image_morpher< const I , const I::value , I::domain_t , labeled_image< I > >::unmorph_ | ( | ) | const [inherited] |
Give the morphed image (const version).
void mln::labeled_image< I >::update_ | ( | ) |
Update bounding boxes information.
References mln::labeling::compute(), and mln::internal::image_base< const I::value, I::domain_t, labeled_image< I > >::data_.
Referenced by mln::labeled_image< I >::init_(), mln::labeled_image< I >::pack_(), and mln::labeled_image< I >::relabel().
const t_eligible_values_set& mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::values_eligible | ( | ) | const [inherited] |
const t_values_space& mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::values_space | ( | ) | const [inherited] |
Return the value space of the image.
util::tracked_ptr< internal::data<labeled_image< I > > > mln::internal::image_base< const I::value , I::domain_t , labeled_image< I > >::data_ [protected, inherited] |
Referenced by mln::labeled_image< I >::bbox(), mln::labeled_image< I >::bboxes(), mln::labeled_image< I >::init_(), mln::labeled_image< I >::init_from_(), mln::labeled_image< I >::pack_(), mln::labeled_image< I >::relabel(), mln::labeled_image< I >::subdomain(), and mln::labeled_image< I >::update_().