* doc/scribo/core/component_set.dox: Remove and move documentation...
* scribo/core/component_set.hh: ... here.
---
scribo/ChangeLog | 8 +++
scribo/doc/scribo/core/component_set.dox | 90 ------------------------------
scribo/scribo/core/component_set.hh | 88 +++++++++++++++++++++++++++++
3 files changed, 96 insertions(+), 90 deletions(-)
delete mode 100644 scribo/doc/scribo/core/component_set.dox
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 3d971b9..39b46c5 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,13 @@
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Move documentation of component_set in its corresponding header.
+
+ * doc/scribo/core/component_set.dox: Remove and move documentation...
+
+ * scribo/core/component_set.hh: ... here.
+
+2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* doc/Doxyfile.in: Expand more macros.
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/doc/scribo/core/component_set.dox b/scribo/doc/scribo/core/component_set.dox
deleted file mode 100644
index ccde17c..0000000
--- a/scribo/doc/scribo/core/component_set.dox
+++ /dev/null
@@ -1,90 +0,0 @@
-/*!
- \class scribo::component_set
-
- This structure is used to store rich information related to
- components in an image.
-
- It can be constructed directly from a labeled image and the number
- of components, or using primitive::extract::components (easier and
- recommanded) with a binary image.
-
- \code
- mln::image2d<bool> ima;
- mln::io::pbm::load(ima, "document.pbm");
-
- typedef scribo::def::lbl_type V;
- typedef mln::image2d<V> L;
- V ncomps;
- component_set<L> comps = primitive::extract::components(ima, c4(), ncomps);
- \endcode
-
- Each component is associated to an id, \ref component_id_t. This
- id is equivalent to the component label in the label image (\ref
- labeled_image()).
-
- A component_set is considered as valid if it has been initialized
- (i.e. not instantiated with the default constructor).
-
- On construction, information is automatically computed for each
- components. To iterate over all the components and get that
- information, use operator()() or info():
-
- \code
- for_all_comps(c,comps)
- {
- const scribo::component_info<L>& comp_info = comps.info(c);
-
- // Some code here...
- }
- \endcode
-
- Among component information, a component::Tag tag is stored and
- used to mark specific components. This tag can be massively
- updated for all components using update_tags(). The function
- passed to this method must implement the following interface:
-
- \code
- template <typename L>
- struct my_function
- : mln::Function_v2b< my_function<L> >
- {
- // Constructor
- my_function(const scribo::component_set<L>& components)
- : components_(components)
- {
- }
-
- // Core function
- bool operator()(const mln_value(L)& l) const
- {
- if (l == mln::literal::zero)
- return false;
- return true;// your test here
- }
-
- /// Component set.
- scribo::component_set<L> components_;
- };
- \endcode
-
- Tags can be used to filter/make a selection of
- components. Routines performing this selection/filtering
- automatically are listed in \ref grpalgofiltercomp section.
-
- Components considered as separators in the input image (lines,
- blocks, ...) may be processed separately and are useful of the
- rest of the layout analysis. This structure allows you to store a
- binary image of separators which will be used in some routines to
- prevent wrong regrouping. Note that no component information will
- be computed for separators. The separator image can be managed
- with has_separators(), add_separators(), separators(), and
- clear_separators().
-
- scribo::component_set is the first data structure in the
- hierarchical representation of a document as explained in \ref
- grpstruct.
-
- \sa component_info, component::Tag, component::Type, grpstruct,
- grpalgofiltercomp.
-
-*/
\ No newline at end of file
diff --git a/scribo/scribo/core/component_set.hh b/scribo/scribo/core/component_set.hh
index eea385b..72bdbcd 100644
--- a/scribo/scribo/core/component_set.hh
+++ b/scribo/scribo/core/component_set.hh
@@ -123,6 +123,94 @@ namespace scribo
/*! \brief Represents all the components in a document image.
+ This structure is used to store rich information related to
+ components in an image.
+
+ It can be constructed directly from a labeled image and the number
+ of components, or using primitive::extract::components (easier and
+ recommanded) with a binary image.
+
+ \code
+ mln::image2d<bool> ima;
+ mln::io::pbm::load(ima, "document.pbm");
+
+ typedef scribo::def::lbl_type V;
+ typedef mln::image2d<V> L;
+ V ncomps;
+ component_set<L> comps = primitive::extract::components(ima, c4(), ncomps);
+ \endcode
+
+ Each component is associated to an id, \ref component_id_t. This
+ id is equivalent to the component label in the label image (\ref
+ labeled_image()). They are labeled from 1 to nelements()
+ included. Id 0 is reserved for the background which is not
+ considered as an actual component.
+
+ A component_set is considered as valid if it has been initialized
+ (i.e. not instantiated with the default constructor).
+
+ On construction, information is automatically computed for each
+ components. To iterate over all the components and get that
+ information, use operator()() or info():
+
+ \code
+ for_all_comps(c,comps)
+ {
+ const scribo::component_info<L>& comp_info = comps.info(c);
+
+ // Some code here...
+ }
+ \endcode
+
+ Among component information, a component::Tag tag is stored and
+ used to mark specific components. This tag can be massively
+ updated for all components using update_tags(). The function
+ passed to this method must implement the following interface:
+
+ \code
+ template <typename L>
+ struct my_function
+ : mln::Function_v2b< my_function<L> >
+ {
+ // Constructor
+ my_function(const scribo::component_set<L>& components)
+ : components_(components)
+ {
+ }
+
+ // Core function
+ bool operator()(const mln_value(L)& l) const
+ {
+ if (l == mln::literal::zero)
+ return false;
+ return true;// your test here
+ }
+
+ /// Component set.
+ scribo::component_set<L> components_;
+ };
+ \endcode
+
+ Tags can be used to filter/make a selection of
+ components. Routines performing this selection/filtering
+ automatically are listed in \ref grpalgofiltercomp section.
+
+ Components considered as separators in the input image (lines,
+ blocks, ...) may be processed separately and are useful of the
+ rest of the layout analysis. This structure allows you to store a
+ binary image of separators which will be used in some routines to
+ prevent wrong regrouping. Note that no component information will
+ be computed for separators. The separator image can be managed
+ with has_separators(), add_separators(), separators(), and
+ clear_separators().
+
+ scribo::component_set is the first data structure in the
+ hierarchical representation of a document as explained in \ref
+ grpstruct.
+
+ \sa component_info, component::Tag, component::Type, grpstruct,
+ grpalgofiltercomp.
+
\ingroup grpstruct
*/
template <typename L>
--
1.7.2.5
* doc/mln/labeling/labeling.dox: New. Introduce labeling module.
* mln/labeling/background.hh,
* mln/labeling/colorize.hh,
* mln/labeling/compute.hh,
* mln/labeling/compute_image.hh,
* mln/labeling/flat_zones.hh,
* mln/labeling/foreground.hh,
* mln/labeling/mean_values.hh,
* mln/labeling/pack.hh,
* mln/labeling/regional_maxima.hh,
* mln/labeling/regional_minima.hh,
* mln/labeling/relabel.hh,
* mln/labeling/superpose.hh,
* mln/labeling/value.hh,
* mln/labeling/value_and_compute.hh,
* mln/labeling/wrap.hh: Set documentation as part of the labeling
group.
---
milena/ChangeLog | 23 +++++++
milena/doc/mln/labeling/labeling.dox | 6 ++
milena/mln/labeling/background.hh | 4 +-
milena/mln/labeling/colorize.hh | 42 ++++++++-----
milena/mln/labeling/compute.hh | 100 ++++++++++++++++-------------
milena/mln/labeling/compute_image.hh | 74 ++++++++++++----------
milena/mln/labeling/flat_zones.hh | 18 +++---
milena/mln/labeling/foreground.hh | 8 ++-
milena/mln/labeling/mean_values.hh | 11 +++-
milena/mln/labeling/pack.hh | 34 +++++++---
milena/mln/labeling/regional_maxima.hh | 19 +++---
milena/mln/labeling/regional_minima.hh | 19 +++---
milena/mln/labeling/relabel.hh | 71 ++++++++++++---------
milena/mln/labeling/superpose.hh | 5 +-
milena/mln/labeling/value.hh | 24 ++++---
milena/mln/labeling/value_and_compute.hh | 22 ++++---
milena/mln/labeling/wrap.hh | 35 ++++++----
17 files changed, 314 insertions(+), 201 deletions(-)
create mode 100644 milena/doc/mln/labeling/labeling.dox
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 706b503..3275cd1 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,28 @@
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add labeling module in documentation.
+
+ * doc/mln/labeling/labeling.dox: New. Introduce labeling module.
+
+ * mln/labeling/background.hh,
+ * mln/labeling/colorize.hh,
+ * mln/labeling/compute.hh,
+ * mln/labeling/compute_image.hh,
+ * mln/labeling/flat_zones.hh,
+ * mln/labeling/foreground.hh,
+ * mln/labeling/mean_values.hh,
+ * mln/labeling/pack.hh,
+ * mln/labeling/regional_maxima.hh,
+ * mln/labeling/regional_minima.hh,
+ * mln/labeling/relabel.hh,
+ * mln/labeling/superpose.hh,
+ * mln/labeling/value.hh,
+ * mln/labeling/value_and_compute.hh,
+ * mln/labeling/wrap.hh: Set documentation as part of the labeling
+ group.
+
+2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add documentation for mln_concrete and mln_ch_value.
* mln/trait/ch_value.hh,
diff --git a/milena/doc/mln/labeling/labeling.dox b/milena/doc/mln/labeling/labeling.dox
new file mode 100644
index 0000000..c0b09c4
--- /dev/null
+++ b/milena/doc/mln/labeling/labeling.dox
@@ -0,0 +1,6 @@
+/*! \defgroup labeling Image Labeling
+ *
+ * \brief All labeling routines provided in Milena.
+ *
+ * \ingroup modroutines
+ */
diff --git a/milena/mln/labeling/background.hh b/milena/mln/labeling/background.hh
index 7441504..b60dbb2 100644
--- a/milena/mln/labeling/background.hh
+++ b/milena/mln/labeling/background.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -54,6 +55,7 @@ namespace mln
* value set to \c false.
*
* \see mln::labeling::value
+ * \ingroup labeling
*/
template <typename I, typename N, typename L>
mln_ch_value(I, L)
diff --git a/milena/mln/labeling/colorize.hh b/milena/mln/labeling/colorize.hh
index 52a76fd..1e39e78 100644
--- a/milena/mln/labeling/colorize.hh
+++ b/milena/mln/labeling/colorize.hh
@@ -57,17 +57,19 @@ namespace mln
}
- /// 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.
- *
- * \param[in] value value type used in the returned image.
- * \param[in] labeled_image A labeled image (\sa labeling::blobs).
- * \param[in] nlabels Number of labels.
+ /*! \brief 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.
+
+ \param[in] value value type used in the returned image.
+ \param[in] labeled_image A labeled image (\sa labeling::blobs).
+ \param[in] nlabels Number of labels.
+
+ \ingroup labeling
*/
template <typename V, typename L>
mln_ch_value(L, V)
@@ -76,16 +78,26 @@ namespace mln
const mln_value(L)& nlabels);
- /// \overload
- //
+ /*! \overload
+ The number of labels is re-computed.
+
+ \warning Computing the number of labels shall add extra
+ computation time.
+
+ \ingroup labeling
+ */
template <typename V, typename L>
mln_ch_value(L, V)
colorize(const V& value,
const Image<L>& labeled_image);
- /// \overload
- //
+ /*! \overload
+
+ Colorize labeled image with value::rgb8.
+
+ \ingroup labeling
+ */
template <typename L>
mln_ch_value(L, mln::value::rgb8)
colorize(const Image<L>& input,
diff --git a/milena/mln/labeling/compute.hh b/milena/mln/labeling/compute.hh
index cc4c234..cd7d727 100644
--- a/milena/mln/labeling/compute.hh
+++ b/milena/mln/labeling/compute.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2008, 2009, 2010, 2012 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2010, 2012, 2013 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -60,15 +60,17 @@ namespace mln
namespace labeling
{
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] a An accumulator.
- /// \param[in] input The input image.
- /// \param[in] label The labeled image.
- /// \param[in] nlabels The number of labels in \p label.
- /// \return A util::array of accumulator result (one result per label).
- //
+ /*! \brief Compute an accumulator onto the pixel values of the image \p input.
+ for each component of the image \p label.
+
+ \param[in] a An accumulator.
+ \param[in] input The input image.
+ \param[in] label The labeled image.
+ \param[in] nlabels The number of labels in \p label.
+ \return A util::array of accumulator result (one result per label).
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
@@ -77,15 +79,17 @@ namespace mln
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] a A meta-accumulator.
- /// \param[in] input The input image.
- /// \param[in] label The labeled image.
- /// \param[in] nlabels The number of labels in \p label.
- /// \return A util::array of accumulator result (one result per label).
- //
+ /*! \brief Compute an accumulator onto the pixel values of the image \p input.
+ for each component of the image \p label.
+
+ \param[in] a A meta-accumulator.
+ \param[in] input The input image.
+ \param[in] label The labeled image.
+ \param[in] nlabels The number of labels in \p label.
+ \return A util::array of accumulator result (one result per label).
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
util::array<mln_meta_accu_result(A, mln_value(I))>
compute(const Meta_Accumulator<A>& a,
@@ -94,14 +98,16 @@ namespace mln
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel sites of each component domain of
- /// \p label.
- ///
- /// \param[in] a An accumulator.
- /// \param[in] label The labeled image.
- /// \param[in] nlabels The number of labels in \p label.
- /// \return A util::array of accumulator result (one result per label).
- //
+ /*! Compute an accumulator onto the pixel sites of each component domain of
+ \p label.
+
+ \param[in] a An accumulator.
+ \param[in] label The labeled image.
+ \param[in] nlabels The number of labels in \p label.
+ \return A util::array of accumulator result (one result per label).
+
+ \ingroup labeling
+ */
template <typename A, typename L>
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
@@ -109,14 +115,16 @@ namespace mln
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel sites of each component domain of
- /// \p label.
- ///
- /// \param[in] a A meta-accumulator.
- /// \param[in] label The labeled image.
- /// \param[in] nlabels The number of labels in \p label.
- /// \return A util::array of accumulator result (one result per label).
- //
+ /*! \brief Compute an accumulator onto the pixel sites of each component domain of
+ \p label.
+
+ \param[in] a A meta-accumulator.
+ \param[in] label The labeled image.
+ \param[in] nlabels The number of labels in \p label.
+ \return A util::array of accumulator result (one result per label).
+
+ \ingroup labeling
+ */
template <typename A, typename L>
util::array<mln_meta_accu_result(A, mln_psite(L))>
compute(const Meta_Accumulator<A>& a,
@@ -124,15 +132,17 @@ namespace mln
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] a An array of accumulator.
- /// \param[in] input The input image.
- /// \param[in] label The labeled image.
- /// \param[in] nlabels The number of labels in \p label.
- /// \return A util::array of accumulator result (one result per label).
- //
+ /*! \brief Compute an accumulator onto the pixel values of the image \p input.
+ for each component of the image \p label.
+
+ \param[in] a An array of accumulator.
+ \param[in] input The input image.
+ \param[in] label The labeled image.
+ \param[in] nlabels The number of labels in \p label.
+ \return A util::array of accumulator result (one result per label).
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
util::array<mln_result(A)>
compute(util::array<A>& a,
diff --git a/milena/mln/labeling/compute_image.hh b/milena/mln/labeling/compute_image.hh
index 4baea29..6de1d88 100644
--- a/milena/mln/labeling/compute_image.hh
+++ b/milena/mln/labeling/compute_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -49,16 +50,19 @@ namespace mln
namespace labeling
{
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] a The mln::p_array of accumulator result.
- /// \param[in] input The input image (values).
- /// \param[in] labels The label image.
- /// \param[in] nlabels The count of labels.
- ///
- /// \return The image where labels are replaced by the result of
- /// the accumulator.
+ /*! Compute an accumulator onto the pixel values of the image \p input.
+ for each component of the image \p label.
+
+ \param[in] a The mln::p_array of accumulator result.
+ \param[in] input The input image (values).
+ \param[in] labels The label image.
+ \param[in] nlabels The count of labels.
+
+ \return The image where labels are replaced by the result of
+ the accumulator.
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
mln_ch_value(L, mln_result(A))
compute_image(const util::array<mln_result(A)>& a,
@@ -66,17 +70,19 @@ namespace mln
const Image<L>& labels,
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] accu The accumulator.
- /// \param[in] input The input image (values).
- /// \param[in] labels The label image.
- /// \param[in] nlabels The count of labels.
- ///
- /// \return The image where labels are replaced by the result of
- /// the accumulator.
- ///
+ /*! \brief Compute an accumulator onto the pixel values of the
+ image \p input. for each component of the image \p label.
+
+ \param[in] accu The accumulator.
+ \param[in] input The input image (values).
+ \param[in] labels The label image.
+ \param[in] nlabels The count of labels.
+
+ \return The image where labels are replaced by the result of
+ the accumulator.
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
inline
mln_ch_value(L, mln_result(A))
@@ -86,17 +92,19 @@ namespace mln
const mln_value(L)& nlabels);
- /// Compute an accumulator onto the pixel values of the image \p input.
- /// for each component of the image \p label.
- ///
- /// \param[in] accu The meta-accumulator.
- /// \param[in] input The input image (values).
- /// \param[in] labels The label image.
- /// \param[in] nlabels The count of labels.
- ///
- /// \return The image where labels are replaced by the result of
- /// the accumulator.
- ///
+ /*! \brief Compute an accumulator onto the pixel values of the
+ image \p input. for each component of the image \p label.
+
+ \param[in] accu The meta-accumulator.
+ \param[in] input The input image (values).
+ \param[in] labels The label image.
+ \param[in] nlabels The count of labels.
+
+ \return The image where labels are replaced by the result of
+ the accumulator.
+
+ \ingroup labeling
+ */
template <typename A, typename I, typename L>
inline
mln_ch_value(L, mln_meta_accu_result(A, mln_value(I)))
diff --git a/milena/mln/labeling/flat_zones.hh b/milena/mln/labeling/flat_zones.hh
index 683a17d..2d32eb4 100644
--- a/milena/mln/labeling/flat_zones.hh
+++ b/milena/mln/labeling/flat_zones.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
@@ -42,13 +42,15 @@ namespace mln
namespace labeling
{
- /// Connected component labeling of the flat zones of an image.
- ///
- /// \param[in] input The input image.
- /// \param[in] nbh The connexity of the flat zones.
- /// \param[out] nlabels The number of labels.
- /// \return The label image.
- ///
+ /*! \brief Connected component labeling of the flat zones of an image.
+
+ \param[in] input The input image.
+ \param[in] nbh The connexity of the flat zones.
+ \param[out] nlabels The number of labels.
+ \return The label image.
+
+ \ingroup labeling
+ */
template <typename I, typename N, typename L>
mln_ch_value(I, L)
flat_zones(const Image<I>& input, const Neighborhood<N>& nbh,
diff --git a/milena/mln/labeling/foreground.hh b/milena/mln/labeling/foreground.hh
index cb9c891..06bc148 100644
--- a/milena/mln/labeling/foreground.hh
+++ b/milena/mln/labeling/foreground.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,8 +41,8 @@ namespace mln
namespace labeling
{
- /*! Connected component labeling of the object part in a binary
- * image.
+ /*! \brief Connected component labeling of the object part in a
+ * binary image.
*
* \param[in] input The input image.
* \param[in] nbh The connexity of the foreground.
@@ -54,6 +55,7 @@ namespace mln
* value set to \c true.
*
* \see mln::labeling::value
+ * \ingroup labeling
*/
template <typename I, typename N, typename L>
mln_ch_value(I, L)
diff --git a/milena/mln/labeling/mean_values.hh b/milena/mln/labeling/mean_values.hh
index b8cef49..6bb4cd0 100644
--- a/milena/mln/labeling/mean_values.hh
+++ b/milena/mln/labeling/mean_values.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -60,6 +61,14 @@ namespace mln
namespace labeling
{
+ /*! \brief Construct an image of mean values from a labeled image.
+
+ \param[in] input An image.
+ \param[in] lbl A labeled image.
+ \param[in] nlabels The number of computed labels.
+
+ \ingroup labeling
+ */
template <typename I, typename L>
mln_concrete(I)
mean_colors(const Image<I>& input,
diff --git a/milena/mln/labeling/pack.hh b/milena/mln/labeling/pack.hh
index 999f129..1f10ef8 100644
--- a/milena/mln/labeling/pack.hh
+++ b/milena/mln/labeling/pack.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -48,21 +49,34 @@ namespace mln
namespace labeling
{
- /// Relabel a labeled image in order to have a contiguous labeling.
- ///
- /// \param[in] label The labeled image.
- /// \param[out] new_nlabels The number of labels after relabeling.
- /// \param[out] repack_fun The function used to repack the labels.
- ///
- /// \return The relabeled image.
- //
+ /*! \brief Relabel a labeled image in order to have a contiguous
+ labeling.
+
+ \param[in] label The labeled image.
+ \param[out] new_nlabels The number of labels after relabeling.
+ \param[out] repack_fun The function used to repack the labels.
+
+ \return The relabeled image.
+
+ \ingroup labeling
+ */
template <typename I>
mln_concrete(I)
pack(const Image<I>& label, mln_value(I)& new_nlabels,
fun::i2v::array<mln_value(I)>& repack_fun);
- /// \overload
+ /*! \overload
+
+ Rely on a default relabeling function that guaranty contiguous
+ labeling.
+
+ \warning Don't expect any label from \p label to be preserved.
+
+ \sa make::relabelfun
+
+ \ingroup labeling
+ */
template <typename I>
mln_concrete(I)
pack(const Image<I>& label, mln_value(I)& new_nlabels);
diff --git a/milena/mln/labeling/regional_maxima.hh b/milena/mln/labeling/regional_maxima.hh
index 568fde8..da2a4c3 100644
--- a/milena/mln/labeling/regional_maxima.hh
+++ b/milena/mln/labeling/regional_maxima.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -44,14 +44,15 @@ namespace mln
namespace labeling
{
- /*! Connected component labeling of the regional maxima of an
- * image.
- *
- * \param[in] input The input image.
- * \param[in] nbh The connexity of the regional maxima.
- * \param[out] nlabels The number of labeled regions.
- * \return The label image.
- *
+ /*! \brief Connected component labeling of the regional maxima of an
+ image.
+
+ \param[in] input The input image.
+ \param[in] nbh The connexity of the regional maxima.
+ \param[out] nlabels The number of labeled regions.
+ \return The label image.
+
+ \ingroup labeling
*/
template <typename I, typename N, typename L>
mln_ch_value(I, L)
diff --git a/milena/mln/labeling/regional_minima.hh b/milena/mln/labeling/regional_minima.hh
index 5a6271e..ffc4de6 100644
--- a/milena/mln/labeling/regional_minima.hh
+++ b/milena/mln/labeling/regional_minima.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -44,14 +44,15 @@ namespace mln
namespace labeling
{
- /*! Connected component labeling of the regional minima of an
- * image.
- *
- * \param[in] input The input image.
- * \param[in] nbh The connexity of the regional minima.
- * \param[out] nlabels The number of labeled regions.
- * \return The label image.
- *
+ /*! \brief Connected component labeling of the regional minima of
+ an image.
+
+ \param[in] input The input image.
+ \param[in] nbh The connexity of the regional minima.
+ \param[out] nlabels The number of labeled regions.
+ \return The label image.
+
+ \ingroup labeling
*/
template <typename I, typename N, typename L>
mln_ch_value(I, L)
diff --git a/milena/mln/labeling/relabel.hh b/milena/mln/labeling/relabel.hh
index 7f304ee..1683e7d 100644
--- a/milena/mln/labeling/relabel.hh
+++ b/milena/mln/labeling/relabel.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+// Copyright (C) 2008, 2009, 2010, 2013 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -47,15 +47,18 @@ namespace mln
namespace labeling
{
- /// Remove components and relabel a labeled image.
- /// \param[in] label the labeled image.
- /// \param[in] nlabels the number of labels in \p label.
- /// \param[out] new_nlabels the number of labels after relabeling.
- /// \param[in] fv2b function returning whether a label must be replaced
- /// by the background.
- ///
- /// \return the relabeled image.
- //
+ /*! \brief Remove components and relabel a labeled image.
+
+ \param[in] label the labeled image.
+ \param[in] nlabels the number of labels in \p label.
+ \param[out] new_nlabels the number of labels after relabeling.
+ \param[in] fv2b function returning whether a label must be replaced
+ by the background.
+
+ \return the relabeled image.
+
+ \ingroup labeling
+ */
template <typename I, typename F>
mln_concrete(I)
relabel(const Image<I>& label,
@@ -64,14 +67,16 @@ namespace mln
const Function_v2b<F>& fv2b);
- /// Remove components and relabel a labeled image.
- /// \param[in] label the labeled image.
- /// \param[in] nlabels the number of labels in \p label.
- /// \param[in] fv2v function returning the new component id for each pixel
- /// value.
- ///
- /// \return the relabeled image.
- //
+ /*! \brief Remove components and relabel a labeled image.
+
+ \param[in] label the labeled image.
+ \param[in] nlabels the number of labels in \p label.
+ \param[in] fv2v function returning the new component id for each pixel
+ value.
+
+ \return the relabeled image.
+ \ingroup labeling
+ */
template <typename I, typename F>
mln_concrete(I)
relabel(const Image<I>& label,
@@ -79,12 +84,15 @@ namespace mln
const Function_v2v<F>& fv2v);
- /// Remove components and relabel a labeled image inplace.
- /// \param[in, out] label the labeled image.
- /// \param[in] nlabels the number of labels in \p label.
- /// \param[in] fv2b function returning whether a label must be replaced
- /// by the background.
- //
+ /*! \brief Remove components and relabel a labeled image inplace.
+
+ \param[in, out] label the labeled image.
+ \param[in] nlabels the number of labels in \p label.
+ \param[in] fv2b function returning whether a label must be replaced
+ by the background.
+
+ \ingroup labeling
+ */
template <typename I, typename F>
void
relabel_inplace(Image<I>& label,
@@ -92,12 +100,15 @@ namespace mln
const Function_v2b<F>& fv2b);
- /// Remove components and relabel a labeled image inplace.
- /// \param[in, out] label the labeled image.
- /// \param[in] nlabels the number of labels in \p label.
- /// \param[in] fv2v function returning the new component id for each
- /// pixel value.
- //
+ /*! \brief Remove components and relabel a labeled image inplace.
+
+ \param[in, out] label the labeled image.
+ \param[in] nlabels the number of labels in \p label.
+ \param[in] fv2v function returning the new component id for each
+ pixel value.
+
+ \ingroup labeling
+ */
template <typename I, typename F>
void
relabel_inplace(Image<I>& label,
diff --git a/milena/mln/labeling/superpose.hh b/milena/mln/labeling/superpose.hh
index 641b4bb..2b4a7d7 100644
--- a/milena/mln/labeling/superpose.hh
+++ b/milena/mln/labeling/superpose.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2013 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -66,6 +66,7 @@ namespace mln
@pre \p rhs and lhs must have the same domain.
@pre \p The value type of rhs must be convertible towards lhs's.
+ \ingroup labeling
*/
template <typename I, typename J>
mln_concrete(I)
diff --git a/milena/mln/labeling/value.hh b/milena/mln/labeling/value.hh
index 069b2a1..6a60ee5 100644
--- a/milena/mln/labeling/value.hh
+++ b/milena/mln/labeling/value.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2013 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,15 +44,17 @@ namespace mln
namespace labeling
{
- /// \brief Connected component labeling of the image sites at a given
- /// value.
- ///
- /// \param[in] input The input image.
- /// \param[in] val The value to consider.
- /// \param[in] nbh The connectivity of components.
- /// \param[out] nlabels The number of labels.
- /// \return The label image.
- //
+ /*! \brief Connected component labeling of the image sites at a
+ given value.
+
+ \param[in] input The input image.
+ \param[in] val The value to consider.
+ \param[in] nbh The connectivity of components.
+ \param[out] nlabels The number of labels.
+ \return The label image.
+
+ \ingroup labeling
+ */
template <typename I, typename N, typename L>
mln_ch_value(I, L)
value(const Image<I>& input, const mln_value(I)& val,
diff --git a/milena/mln/labeling/value_and_compute.hh b/milena/mln/labeling/value_and_compute.hh
index 4619e1a..913d571 100644
--- a/milena/mln/labeling/value_and_compute.hh
+++ b/milena/mln/labeling/value_and_compute.hh
@@ -46,16 +46,18 @@ namespace mln
namespace labeling
{
- /// \brief Connected component labeling of the image sites at a given
- /// value.
- ///
- /// \param[in] input The input image.
- /// \param[in] val The value to consider.
- /// \param[in] nbh The connectivity of components.
- /// \param[out] nlabels The number of labels.
- /// \param[in] accu The accumulator to be computed.
- /// \return The label image.
- //
+ /*! \brief Connected component labeling of the image sites at a given
+ value.
+
+ \param[in] input The input image.
+ \param[in] val The value to consider.
+ \param[in] nbh The connectivity of components.
+ \param[out] nlabels The number of labels.
+ \param[in] accu The accumulator to be computed.
+ \return The label image.
+
+ \ingroup labeling
+ */
template <typename I, typename N, typename L, typename A>
util::couple<mln_ch_value(I,L),
util::couple<util::array<mln_result(A)>,
diff --git a/milena/mln/labeling/wrap.hh b/milena/mln/labeling/wrap.hh
index 76426f2..1c5b64f 100644
--- a/milena/mln/labeling/wrap.hh
+++ b/milena/mln/labeling/wrap.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -45,23 +46,29 @@ namespace mln
namespace labeling
{
- /// Wrap labels such as 0 -> 0 and [1, lmax] maps to [1,
- /// Lmax] (using modulus).
- ///
- /// \param[in] value_type The type used to wrap the label type.
- /// \param[in] input The label image.
- ///
- /// \return A new image with values wrapped with type V.
+ /*! \brief Wrap labels such as 0 -> 0 and [1, lmax] maps to [1,
+ Lmax] (using modulus).
+
+ \param[in] value_type The type used to wrap the label type.
+ \param[in] input The label image.
+
+ \return A new image with values wrapped with type V.
+
+ \ingroup labeling
+ */
template <typename V, typename I>
mln_ch_value(I,V)
wrap(const V& value_type, const Image<I>& input);
- /// Wrap labels such as 0 -> 0 and [1, lmax] maps to [1,
- /// Lmax] (using modulus). Use label_8 as label type.
- ///
- /// \param[in] input The label image.
- ///
- /// \return A new image with values wrapped with type label_8.
+ /*! \brief Wrap labels such as 0 -> 0 and [1, lmax] maps to [1,
+ Lmax] (using modulus). Use label_8 as label type.
+
+ \param[in] input The label image.
+
+ \return A new image with values wrapped with type label_8.
+
+ \ingroup labeling
+ */
template <typename I>
mln_ch_value(I, mln::value::label_8)
wrap(const Image<I>& input);
--
1.7.2.5
* mln/trait/ch_value.hh,
* mln/trait/concrete.hh: Here.
---
milena/ChangeLog | 7 ++++
milena/mln/trait/ch_value.hh | 66 +++++++++++++++++++++++++++++++++++++++++-
milena/mln/trait/concrete.hh | 65 ++++++++++++++++++++++++++++++++++++++++-
3 files changed, 135 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 76aef9a..706b503 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add documentation for mln_concrete and mln_ch_value.
+
+ * mln/trait/ch_value.hh,
+ * mln/trait/concrete.hh: Here.
+
+2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add explanations on compilation with multiple files.
* doc/examples/multi_files_f1.cc.raw,
diff --git a/milena/mln/trait/ch_value.hh b/milena/mln/trait/ch_value.hh
index eb120a1..87afc0a 100644
--- a/milena/mln/trait/ch_value.hh
+++ b/milena/mln/trait/ch_value.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -36,7 +36,16 @@
# include <mln/trait/ch_function_value.hh>
+/*! Macros provided for convenience. Should be used in a templated
+ function only.
+ \relates mln::trait::ch_value
+*/
# define mln_ch_value(I, V) typename mln::trait::ch_value< I, V >::ret
+
+/*! Macros provided for convenience. Should be used in a
+ non-templated function only.
+ \relates mln::trait::ch_value
+*/
# define mln_ch_value_(I, V) mln::trait::ch_value< I, V >::ret
@@ -217,6 +226,61 @@ namespace mln
} // end of namespace mln::trait::impl
+
+ /*! \brief Compute the concrete type of an image type and change
+ the value type.
+
+ \tparam I An image type.
+
+ This macro is used to compute the most appropriate concrete image
+ type to be used to store a copy of an image of type I.
+
+ A concrete image type is an image type storing all its site
+ values in a single memory buffer. For instance, mln::image1d,
+ mln::image2d, mln::image3d are considered as concrete types.
+ Image morphers are not concrete types since they can alter, on
+ the fly, the domain and the values.
+
+ This macro is usually used while writing generic algorithms to
+ handle all possible cases while image morphers and concrete images
+ are interacting.
+
+ Compared to mln::trait::concrete, this trait can change the
+ value type of the computed image type.
+
+ Few examples:
+ \code
+ mln_ch_value(mln::image2d<int>,int) => mln::image2d<int>
+ mln_ch_value(mln::image2d<int>,bool) => mln::image2d<bool>
+ \endcode
+
+ Therefore, you can safely write the following code:
+ \code
+ template<typename I>
+ mln_ch_value(I,bool) my_function(const Image<I>& ima)
+ {
+ mln_ch_value(I,bool) output;
+ ...
+ return output;
+ }
+
+ int main()
+ {
+ image2d<int> ima;
+ image2d<bool> result = my_function(ima);
+ }
+ \endcode
+
+ Computing a type with trait::concrete can be done using macros
+ mln_ch_value() and mln_ch_value_().
+
+ Note that, due to C++ syntax ambiguities, mln_ch_value() should
+ be used in a templated function whereas mln_ch_value_() shoud be
+ used in a non-templated function.
+
+ If you are not sure of the concrete type that should be returned
+ by the macro, take a look at mln_var() which can guess it for you.
+ */
template <typename I, typename V>
struct ch_value
{
diff --git a/milena/mln/trait/concrete.hh b/milena/mln/trait/concrete.hh
index 935cc9a..590409c 100644
--- a/milena/mln/trait/concrete.hh
+++ b/milena/mln/trait/concrete.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -32,8 +33,16 @@
# include <mln/trait/ch_value.hh>
-
+/*! Macros provided for convenience. Should be used in a templated
+ function only.
+ \relates mln::trait::concrete
+*/
# define mln_concrete(I) typename mln::trait::concrete< I >::ret
+
+/*! Macros provided for convenience. Should be used in a
+ non-templated function only.
+ \relates mln::trait::concrete
+*/
# define mln_concrete_(I) mln::trait::concrete< I >::ret
@@ -43,6 +52,58 @@ namespace mln
namespace trait
{
+ /*!
+ \brief Compute the concrete type of an image type.
+
+ \tparam I An image type.
+
+ This macro is used to compute the most appropriate concrete image
+ type to be used to store a copy of an image of type I.
+
+ A concrete image type is an image type storing all its site
+ values in a single memory buffer. For instance, mln::image1d,
+ mln::image2d, mln::image3d are considered as concrete types.
+ Image morphers are not concrete types since they can alter, on
+ the fly, the domain and the values.
+
+ This macro is usually used while writing generic algorithms to
+ handle all possible cases while image morphers and concrete images
+ are interacting.
+
+ Few examples:
+
+ \code
+ mln_concrete(mln::image2d<int>) => mln::image2d<int>
+ mln_concrete(mln::extended<mln::image2d<int> >) => mln::image2d<int>
+ \endcode
+
+ Therefore, you can safely write the following code:
+ \code
+ template<typename I>
+ mln_concrete(I) my_function(const Image<I>& ima)
+ {
+ mln_ch_value(I,bool) output;
+ ...
+ return output;
+ }
+
+ int main()
+ {
+ image2d<int> ima;
+ image2d<int> result = my_function(ima);
+ }
+ \endcode
+
+ Computing a type with trait::concrete can be done using macros
+ mln_concrete() and mln_concrete_().
+
+ Note that, due to C++ syntax ambiguities, mln_concrete() should
+ be used in a templated function whereas mln_concrete_() shoud be
+ used in a non-templated function.
+
+ If you are not sure of the concrete type that should be returned
+ by the macro, take a look at mln_var() which can guess it for you.
+ */
template <typename I>
struct concrete
{
--
1.7.2.5