Namespaces | Functions

mln::labeling Namespace Reference

Namespace of labeling routines. More...

Namespaces

namespace  impl
 

Implementation namespace of labeling namespace.


Functions

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret background (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret blobs (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
 Connected component labeling of the binary objects of a binary image.
template<typename I , typename N , typename L , typename A >
util::couple
< mln::trait::ch_value< I, L >
::ret, util::couple
< util::array< typename
A::result >, util::array< A > > > 
blobs_and_compute (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels, const Accumulator< A > &accu)
template<typename V , typename L >
mln::trait::ch_value< L, V >::ret colorize (const V &value, const Image< L > &labeled_image, const typename L::value &nlabels)
 Create a new color image from a labeled image and fill each component with a random color.
template<typename V , typename L >
mln::trait::ch_value< L, V >::ret colorize (const V &value, const Image< L > &labeled_image)
template<typename L >
mln::trait::ch_value< L,
mln::value::rgb8 >::ret 
colorize (const Image< L > &input, const typename L::value &nlabels)
template<typename A , typename I , typename L >
util::array
< mln_meta_accu_result(A,
typename I::value)> 
compute (const Meta_Accumulator< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename A , typename L >
util::array< typename A::result > compute (const Accumulator< A > &a, const Image< L > &label, const typename L::value &nlabels)
 Compute an accumulator onto the pixel sites of each component domain of label.
template<typename A , typename L >
util::array
< mln_meta_accu_result(A,
typename L::psite)> 
compute (const Meta_Accumulator< A > &a, const Image< L > &label, const typename L::value &nlabels)
 Compute an accumulator onto the pixel sites of each component domain of label.
template<typename A , typename I , typename L >
util::array< typename A::result > compute (util::array< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename A , typename I , typename L >
util::array< typename A::result > compute (const Accumulator< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename A::result >::ret 
compute_image (const util::array< typename A::result > &a, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename A::result >::ret 
compute_image (const Accumulator< A > &accu, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename
mln::internal::meta_accu_ret_result_helper
< A, typename I::value >
::result >::ret 
compute_image (const Meta_Accumulator< A > &accu, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
 Compute an accumulator onto the pixel values of the image input.
template<typename I , typename N , typename L >
mln::trait::concrete< I >::ret fill_holes (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
 Filling holes of a single object in a binary image.
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret flat_zones (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
 Connected component labeling of the flat zones of an image.
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret foreground (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I >
mln::trait::concrete< I >::ret pack (const Image< I > &label, typename I::value &new_nlabels, fun::i2v::array< typename I::value > &repack_fun)
 Relabel a labeled image in order to have a contiguous labeling.
template<typename I >
mln::trait::concrete< I >::ret pack (const Image< I > &label, typename I::value &new_nlabels)
template<typename I >
void pack_inplace (Image< I > &label, typename I::value &new_nlabels)
template<typename I >
void pack_inplace (Image< I > &label, typename I::value &new_nlabels, fun::i2v::array< typename I::value > &repack_fun)
 Relabel inplace a labeled image in order to have a contiguous labeling.
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret regional_maxima (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret regional_minima (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename F >
mln::trait::concrete< I >::ret relabel (const Image< I > &label, const typename I::value &nlabels, typename I::value &new_nlabels, const Function_v2b< F > &fv2b)
 Remove components and relabel a labeled image.
template<typename I , typename F >
mln::trait::concrete< I >::ret relabel (const Image< I > &label, const typename I::value &nlabels, const Function_v2v< F > &fv2v)
 Remove components and relabel a labeled image.
template<typename I , typename F >
void relabel_inplace (Image< I > &label, const typename I::value &nlabels, const Function_v2v< F > &fv2v)
 Remove components and relabel a labeled image inplace.
template<typename I , typename F >
void relabel_inplace (Image< I > &label, const typename I::value &nlabels, const Function_v2b< F > &fv2b)
 Remove components and relabel a labeled image inplace.
template<typename I , typename J >
mln::trait::concrete< I >::ret superpose (const Image< I > &lhs, const typename I::value &lhs_nlabels, const Image< J > &rhs, const typename J::value &rhs_nlabels, typename I::value &new_nlabels)
 Superpose two labeled image.
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret value (const Image< I > &input, const typename I::value &val, const Neighborhood< N > &nbh, L &nlabels)
 Connected component labeling of the image sites at a given value.
template<typename I , typename N , typename L , typename A >
util::couple
< mln::trait::ch_value< I, L >
::ret, util::couple
< util::array< typename
A::result >, util::array< A > > > 
value_and_compute (const Image< I > &input, const typename I::value &val, const Neighborhood< N > &nbh, L &nlabels, const Accumulator< A > &accu)
 Connected component labeling of the image sites at a given value.
template<typename V , typename I >
mln::trait::ch_value< I, V >::ret wrap (const V &value_type, const Image< I > &input)
 Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus).
template<typename I >
mln::trait::ch_value< I,
mln::value::label_8 >::ret 
wrap (const Image< I > &input)
 Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus).

Detailed Description

Namespace of labeling routines.


Function Documentation

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::background ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
) [inline]

Connected component labeling of the background part in a binary image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the background.
[out] nlabels The number of labels.
Returns:
The label image.
Precondition:
The input image has to be binary (checked at compile-time).

This routine actually calls mln::labeling::value with the value set to false.

See also:
mln::labeling::value

Definition at line 69 of file background.hh.

References value().

Referenced by fill_holes().

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::blobs ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
) [inline]

Connected component labeling of the binary objects of a binary image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the objects.
[out] nlabels The Number of labels. Its value is set in the algorithms.
Returns:
The label image.
Precondition:
The input image has to be binary (checked at compile-time).

A fast queue is used so that the algorithm is not recursive and can handle large binary objects (blobs).

Definition at line 102 of file labeling/blobs.hh.

Referenced by blobs_and_compute(), and mln::graph::labeling().

template<typename I , typename N , typename L , typename A >
util::couple< mln::trait::ch_value< I, L >::ret, util::couple< util::array< typename A::result >, util::array< A > > > mln::labeling::blobs_and_compute ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels,
const Accumulator< A > &  accu 
)

Label an image and compute given accumulators.

Parameters:
[in] input A binary image.
[in] nbh A neighborhood used for labeling.
[in,out] nlabels The number of labels found.
[in] accu An accumulator to be computed while labeling.
Returns:
The labeled image, computed attributes for each regions and an array of the accumulators used to compute the attributes.

Definition at line 160 of file blobs_and_compute.hh.

References blobs(), and mln::make::couple().

template<typename V , typename L >
mln::trait::ch_value< L, V >::ret mln::labeling::colorize ( const V &  value,
const Image< L > &  labeled_image,
const typename L::value &  nlabels 
) [inline]

Create a new color image from a labeled image and fill each component with a random color.

litera::black is used for component 0, e.g. the background. Min and max values for RGB values can be set through the global variables mln::labeling::colorize_::min_value and mln::labeling::colorize_::max_value.

Parameters:
[in] value value type used in the returned image.
[in] labeled_image A labeled image (
See also:
labeling::blobs).
Parameters:
[in] nlabels Number of labels.

Definition at line 190 of file colorize.hh.

References mln::literal::black, and mln::data::transform().

Referenced by colorize().

template<typename V , typename L >
mln::trait::ch_value< L, V >::ret mln::labeling::colorize ( const V &  value,
const Image< L > &  labeled_image 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 228 of file colorize.hh.

References colorize(), and compute().

template<typename L >
mln::trait::ch_value< L, mln::value::rgb8 >::ret mln::labeling::colorize ( const Image< L > &  input,
const typename L::value &  nlabels 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 247 of file colorize.hh.

References colorize().

template<typename A , typename I , typename L >
util::array< mln_meta_accu_result(A, typename I::value)> mln::labeling::compute ( const Meta_Accumulator< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] a A meta-accumulator.
[in] input The input image.
[in] label The labeled image.
[in] nlabels The number of labels in label.
Returns:
A util::array of accumulator result (one result per label).

Definition at line 734 of file labeling/compute.hh.

References compute().

template<typename A , typename L >
util::array< typename A::result > mln::labeling::compute ( const Accumulator< A > &  a,
const Image< L > &  label,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel sites of each component domain of label.

Parameters:
[in] a An accumulator.
[in] label The labeled image.
[in] nlabels The number of labels in label.
Returns:
A util::array of accumulator result (one result per label).

Definition at line 771 of file labeling/compute.hh.

template<typename A , typename L >
util::array< mln_meta_accu_result(A, typename L::psite)> mln::labeling::compute ( const Meta_Accumulator< A > &  a,
const Image< L > &  label,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel sites of each component domain of label.

Parameters:
[in] a A meta-accumulator.
[in] label The labeled image.
[in] nlabels The number of labels in label.
Returns:
A util::array of accumulator result (one result per label).

Definition at line 792 of file labeling/compute.hh.

References compute().

template<typename A , typename I , typename L >
util::array< typename A::result > mln::labeling::compute ( util::array< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] a An array of accumulator.
[in] input The input image.
[in] label The labeled image.
[in] nlabels The number of labels in label.
Returns:
A util::array of accumulator result (one result per label).

Definition at line 696 of file labeling/compute.hh.

template<typename A , typename I , typename L >
util::array< typename A::result > mln::labeling::compute ( const Accumulator< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] a An accumulator.
[in] input The input image.
[in] label The labeled image.
[in] nlabels The number of labels in label.
Returns:
A util::array of accumulator result (one result per label).

Definition at line 715 of file labeling/compute.hh.

Referenced by colorize(), compute(), compute_image(), fill_holes(), mln::make::p_edges_with_mass_centers(), mln::make::p_vertices_with_mass_centers(), pack(), and pack_inplace().

template<typename A , typename I , typename L >
mln::trait::ch_value< L , typename A ::result >::ret mln::labeling::compute_image ( const util::array< typename A::result > &  a,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] a The mln::p_array of accumulator result.
[in] input The input image (values).
[in] labels The label image.
[in] nlabels The count of labels.
Returns:
The image where labels are replaced by the result of the accumulator.

Referenced by compute_image().

template<typename A , typename I , typename L >
mln::trait::ch_value< L, typename A::result >::ret mln::labeling::compute_image ( const Accumulator< A > &  accu,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] accu The accumulator.
[in] input The input image (values).
[in] labels The label image.
[in] nlabels The count of labels.
Returns:
The image where labels are replaced by the result of the accumulator.

Definition at line 161 of file compute_image.hh.

References compute(), and compute_image().

template<typename A , typename I , typename L >
mln::trait::ch_value< L, typename mln::internal::meta_accu_ret_result_helper< A, typename I::value >::result >::ret mln::labeling::compute_image ( const Meta_Accumulator< A > &  accu,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
) [inline]

Compute an accumulator onto the pixel values of the image input.

for each component of the image label.

Parameters:
[in] accu The meta-accumulator.
[in] input The input image (values).
[in] labels The label image.
[in] nlabels The count of labels.
Returns:
The image where labels are replaced by the result of the accumulator.

Definition at line 181 of file compute_image.hh.

References compute(), and compute_image().

template<typename I , typename N , typename L >
mln::trait::concrete< I >::ret mln::labeling::fill_holes ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
) [inline]

Filling holes of a single object in a binary image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the background.
[out] nlabels The number of labels.
Returns:
The binary image with a simple object without holes.
Precondition:
The input image has to be binary (checked at compile-time).

This routine actually calls mln::labeling::background

See also:
mln::labeling::background

Definition at line 73 of file fill_holes.hh.

References background(), compute(), mln::util::array< T >::nelements(), and mln::data::transform().

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::flat_zones ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the flat zones of an image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the flat zones.
[out] nlabels The number of labels.
Returns:
The label image.

Definition at line 124 of file flat_zones.hh.

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::foreground ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
) [inline]

Connected component labeling of the object part in a binary image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the foreground.
[out] nlabels The number of labels.
Returns:
The label image.
Precondition:
The input image has to be binary (checked at compile-time).

This routine actually calls mln::labeling::value with the value set to true.

See also:
mln::labeling::value

Definition at line 69 of file foreground.hh.

References value().

template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack ( const Image< I > &  label,
typename I::value &  new_nlabels,
fun::i2v::array< typename I::value > &  repack_fun 
)

Relabel a labeled image in order to have a contiguous labeling.

Parameters:
[in] label The labeled image.
[out] new_nlabels The number of labels after relabeling.
[out] repack_fun The function used to repack the labels.
Returns:
The relabeled image.

Definition at line 124 of file pack.hh.

References compute(), mln::make::relabelfun(), and mln::data::transform().

Referenced by pack().

template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack ( const Image< I > &  label,
typename I::value &  new_nlabels 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 115 of file pack.hh.

References pack().

template<typename I >
void mln::labeling::pack_inplace ( Image< I > &  label,
typename I::value &  new_nlabels 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 148 of file pack.hh.

References pack_inplace().

template<typename I >
void mln::labeling::pack_inplace ( Image< I > &  label,
typename I::value &  new_nlabels,
fun::i2v::array< typename I::value > &  repack_fun 
)

Relabel inplace a labeled image in order to have a contiguous labeling.

Parameters:
[in] label The labeled image.
[out] new_nlabels The number of labels after relabeling.
[out] repack_fun The function used to repack the labels.

Definition at line 157 of file pack.hh.

References compute(), mln::make::relabelfun(), and mln::data::transform().

Referenced by pack_inplace().

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::regional_maxima ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the regional maxima of an image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the regional maxima.
[out] nlabels The number of labeled regions.
Returns:
The label image.

Definition at line 130 of file regional_maxima.hh.

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::regional_minima ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the regional minima of an image.

Parameters:
[in] input The input image.
[in] nbh The connexity of the regional minima.
[out] nlabels The number of labeled regions.
Returns:
The label image.

Definition at line 140 of file regional_minima.hh.

Referenced by mln::morpho::meyer_wst().

template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel ( const Image< I > &  label,
const typename I::value &  nlabels,
typename I::value &  new_nlabels,
const Function_v2b< F > &  fv2b 
) [inline]

Remove components and relabel a labeled image.

Parameters:
[in] label the labeled image.
[in] nlabels the number of labels in label.
[out] new_nlabels the number of labels after relabeling.
[in] fv2b function returning whether a label must be replaced by the background.
Returns:
the relabeled image.

Definition at line 200 of file relabel.hh.

References mln::make::relabelfun().

Referenced by superpose().

template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel ( const Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2v< F > &  fv2v 
) [inline]

Remove components and relabel a labeled image.

Parameters:
[in] label the labeled image.
[in] nlabels the number of labels in label.
[in] fv2v function returning the new component id for each pixel value.
Returns:
the relabeled image.

Definition at line 179 of file relabel.hh.

References mln::data::transform().

template<typename I , typename F >
void mln::labeling::relabel_inplace ( Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2v< F > &  fv2v 
) [inline]

Remove components and relabel a labeled image inplace.

Parameters:
[in,out] label the labeled image.
[in] nlabels the number of labels in label.
[in] fv2v function returning the new component id for each pixel value.

Definition at line 221 of file relabel.hh.

References mln::data::transform_inplace().

template<typename I , typename F >
void mln::labeling::relabel_inplace ( Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2b< F > &  fv2b 
) [inline]

Remove components and relabel a labeled image inplace.

Parameters:
[in,out] label the labeled image.
[in] nlabels the number of labels in label.
[in] fv2b function returning whether a label must be replaced by the background.

Definition at line 240 of file relabel.hh.

References mln::make::relabelfun().

Referenced by mln::labeled_image_base< I, E >::relabel().

template<typename I , typename J >
mln::trait::concrete< I >::ret mln::labeling::superpose ( const Image< I > &  lhs,
const typename I::value &  lhs_nlabels,
const Image< J > &  rhs,
const typename J::value &  rhs_nlabels,
typename I::value &  new_nlabels 
)

Superpose two labeled image.

Labels in lhs are preserved in the output. Labels of rhs are renumbered from the last label value of lhs. It avoids duplicate label values in several components.

Parameters:
[in] lhs A labeled image.
[in] lhs_nlabels The number of labels in lhs.
[in] rhs A labeled image.
[in] rhs_nlabels The number of labels in rhs.
[out] new_nlabels The number of labels in the output image.
Returns:
An image with all the components of rhs and lhs.
Precondition:
rhs and lhs must have the same domain.
The value type of rhs must be convertible towards lhs's.

Definition at line 83 of file labeling/superpose.hh.

References mln::duplicate(), mln::value::equiv(), mln::data::paste(), relabel(), and mln::literal::zero.

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::value ( const Image< I > &  input,
const typename I::value &  val,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the image sites at a given value.

Parameters:
[in] input The input image.
[in] val The value to consider.
[in] nbh The connectivity of components.
[out] nlabels The number of labels.
Returns:
The label image.

Definition at line 149 of file labeling/value.hh.

Referenced by background(), and foreground().

template<typename I , typename N , typename L , typename A >
util::couple< mln::trait::ch_value< I, L >::ret, util::couple< util::array< typename A::result >, util::array< A > > > mln::labeling::value_and_compute ( const Image< I > &  input,
const typename I::value &  val,
const Neighborhood< N > &  nbh,
L &  nlabels,
const Accumulator< A > &  accu 
)

Connected component labeling of the image sites at a given value.

Parameters:
[in] input The input image.
[in] val The value to consider.
[in] nbh The connectivity of components.
[out] nlabels The number of labels.
Returns:
The label image.

Definition at line 212 of file value_and_compute.hh.

References mln::make::couple().

template<typename V , typename I >
mln::trait::ch_value< I, V >::ret mln::labeling::wrap ( const V &  value_type,
const Image< I > &  input 
) [inline]

Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus).

Parameters:
[in] value_type The type used to wrap the label type.
[in] input The label image.
Returns:
A new image with values wrapped with type V.

Definition at line 75 of file labeling/wrap.hh.

References mln::data::transform().

Referenced by wrap().

template<typename I >
mln::trait::ch_value< I, mln::value::label_8 >::ret mln::labeling::wrap ( const Image< I > &  input  )  [inline]

Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus).

Use label_8 as label type.

Parameters:
[in] input The label image.
Returns:
A new image with values wrapped with type label_8.

Definition at line 93 of file labeling/wrap.hh.

References wrap().