Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* mln/core/def/coordf.hh: New.
---
milena/ChangeLog | 6 +++++
milena/mln/core/def/coordf.hh | 49 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/core/def/coordf.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4be6dc1..3f4208e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add a floating-point coordinate type.
+
+ * mln/core/def/coordf.hh: New.
+
2008-10-15 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make morpho meyer_wst practicable.
diff --git a/milena/mln/core/def/coordf.hh b/milena/mln/core/def/coordf.hh
new file mode 100644
index 0000000..f071af6
--- /dev/null
+++ b/milena/mln/core/def/coordf.hh
@@ -0,0 +1,49 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_DEF_COORDF_HH
+# define MLN_CORE_DEF_COORDF_HH
+
+/// \file mln/core/def/coordf.hh
+/// \brief Definition of the floating coordinate type.
+
+namespace mln
+{
+
+ namespace def
+ {
+
+ /// Definition of the floating coordinate type.
+ /* FIXME: We probably want something smarter than bare `float',
+ i.e., robust to comparisons, etc. */
+ typedef float coordf;
+
+ } // end of namespace mln::def
+
+} // end of namespace mln
+
+#endif // ! MLN_CORE_DEF_COORDF_HH
--
1.6.0.1
1
0
---
ChangeLog | 18 +++++++++++++-----
milena/mln/level/fill_with_image.hh | 2 +-
milena/mln/level/paste.hh | 2 +-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a5ed23d..e039de5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,21 @@
2008-16-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix ambiguous namespaces.
+ * milena/mln/level/fill_with_image.hh
+ * milena/mln/level/paste.hh:
+ Fix compilation error. It could not resolve the correct namespace
+ path.
+
+2008-16-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Update tutorial.
- * samples/ima2d-1.tex,
- * samples/ima2d-3.tex,
- * samples/paste-call-1.tex,
- * samples/point-1.tex:
+ * milena/doc/tutorial/samples/ima2d-1.tex,
+ * milena/doc/tutorial/samples/ima2d-3.tex,
+ * milena/doc/tutorial/samples/paste-call-1.tex,
+ * milena/doc/tutorial/samples/point-1.tex:
Add new sample code.
- * tutorial.tex:
+ * milena/doc/tutorial/tutorial.tex:
Mainly update image chapter.
Cleanup source.
diff --git a/milena/mln/level/fill_with_image.hh b/milena/mln/level/fill_with_image.hh
index 47b6e7f..d63d69d 100644
--- a/milena/mln/level/fill_with_image.hh
+++ b/milena/mln/level/fill_with_image.hh
@@ -103,7 +103,7 @@ namespace mln
I& ima = exact(ima_);
const J& data = exact(data_);
- internal::fill_with_image_tests(ima, data);
+ level::internal::fill_with_image_tests(ima, data);
mln_piter(I) p(ima.domain());
for_all(p)
diff --git a/milena/mln/level/paste.hh b/milena/mln/level/paste.hh
index 938d406..2821a04 100644
--- a/milena/mln/level/paste.hh
+++ b/milena/mln/level/paste.hh
@@ -103,7 +103,7 @@ namespace mln
{
trace::entering("level::impl::generic::paste");
- internal::paste_tests(data_, destination_);
+ level::internal::paste_tests(data_, destination_);
const I& data = exact(data_);
J& destination = exact(destination_);
--
1.5.6.5
1
0
---
ChangeLog | 13 +
milena/doc/tutorial/samples/ima2d-1.tex | 16 +-
milena/doc/tutorial/samples/ima2d-3.tex | 40 ++-
milena/doc/tutorial/samples/paste-call-1.tex | 25 +-
milena/doc/tutorial/samples/point-1.tex | 20 +-
milena/doc/tutorial/tutorial.tex | 472 +++++++++++++++++++++-----
6 files changed, 473 insertions(+), 113 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 87fe601..a5ed23d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-16-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Update tutorial.
+ * samples/ima2d-1.tex,
+ * samples/ima2d-3.tex,
+ * samples/paste-call-1.tex,
+ * samples/point-1.tex:
+ Add new sample code.
+
+ * tutorial.tex:
+ Mainly update image chapter.
+ Cleanup source.
+
2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
* milena/mln/doc/tutorial/samples/box2d-1.tex,
diff --git a/milena/doc/tutorial/samples/ima2d-1.tex b/milena/doc/tutorial/samples/ima2d-1.tex
index c89d3de..f792182 100644
--- a/milena/doc/tutorial/samples/ima2d-1.tex
+++ b/milena/doc/tutorial/samples/ima2d-1.tex
@@ -1,6 +1,12 @@
-box2d b(-2,3, 3,-5); // Define a box2d from (-2,3) to (3,-5).
-image2d<int> ima(b); // Define the domain of the image.
+#include <mln/core/alias/box2d.hh>
+#include <mln/core/image/image2d.hh>
+int main()
+{
+ // Define a box2d from (-2,3) to (3,-5).
+ box2d b(-2,3, 3,-5);
+ // Initialize an image with b as domain.
+ image2d<int> ima(b);
-cout << b << std::endl; // Display b
-
-cout << ima.domain() << std::endl; // Display b too
+ cout << "b = " << b << std::endl;
+ cout << "domain = " << ima.domain() << std::endl;
+}
diff --git a/milena/doc/tutorial/samples/ima2d-3.tex b/milena/doc/tutorial/samples/ima2d-3.tex
index a218061..8dd3c4d 100644
--- a/milena/doc/tutorial/samples/ima2d-3.tex
+++ b/milena/doc/tutorial/samples/ima2d-3.tex
@@ -1,12 +1,28 @@
-box2d b(2,3);
-image2d<int> ima(b);
-point2d p(1, 2);
-
-// Associate '9' as value for the site/point2d (1,2).
-// The value is returned by reference and can be changed.
-ima.at(1,2) = 9;
-cout << ima(p) << std::endl; // prints 9
-
-ima(p) = 2; // The value is returned by reference
-// and can be changed as well.
-cout << ima(p) << std::endl; // prints 2
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/box2d.hh>
+int main()
+{
+ box2d b(2,3);
+ image2d<int> ima(b);
+
+ // On image2d, Site <=> point2d
+ point2d p(1, 2);
+
+ // Associate '9' as value for the site/point2d (1,2).
+ // The value is returned by reference and can be changed.
+ ima.at(1,2) = 9;
+ std::cout << "ima.at(1,2) = " << ima.at(1,2)
+ << std::endl;
+ std::cout << "ima(p) = " << ima(p) << std::endl;
+
+ std::cout << "---" << std::endl;
+
+
+ // Associate '2' as value for the site/point2d (1,2).
+ // The value is returned by reference
+ // and can be changed as well.
+ ima(p) = 2;
+ std::cout << "ima.at(1,2) = " << ima.at(1,2)
+ << std::endl;
+ std::cout << "ima(p) = " << ima(p) << std::endl;
+}
diff --git a/milena/doc/tutorial/samples/paste-call-1.tex b/milena/doc/tutorial/samples/paste-call-1.tex
index c6dc124..50e4885 100644
--- a/milena/doc/tutorial/samples/paste-call-1.tex
+++ b/milena/doc/tutorial/samples/paste-call-1.tex
@@ -1,10 +1,21 @@
-image1d<char> imgb(5, 5, 14, 14);
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/level/fill.hh>
+#include <mln/level/paste.hh>
+#include <mln/debug/println.hh>
+int main()
+{
+ using namespace mln;
-// We initialize the image values.
-level::fill(imgb.rw(), 'b');
+ image2d<char> imgb(make::box2d(5,5, 7,8));
+ // Initialize imga with the same domain as imgb.
+ image2d<char> imga(imgb.domain());
-// Last we now paste the contents of img3b in img3a...
-level::paste(imgb, imga.rw()));
+ // Initialize the image values.
+ level::fill(imgb, 'b');
-// ...and print the result.
-debug::println(imga);
+ // Paste the content of imgb in imga.
+ level::paste(imgb, imga);
+
+ debug::println(imga);
+}
diff --git a/milena/doc/tutorial/samples/point-1.tex b/milena/doc/tutorial/samples/point-1.tex
index 30da933..01163df 100644
--- a/milena/doc/tutorial/samples/point-1.tex
+++ b/milena/doc/tutorial/samples/point-1.tex
@@ -1,4 +1,18 @@
-point2d p(9, 9);
+#include <core/image/image2d.hh>
+#include <core/alias/box2d.hh>
+int main()
+{
+ using namespace mln;
-// which gives 'true'.
-std::cout << (imga.has(p) ? "true" : "false") << std::endl;
+ image2d<bool> ima(box2d(0,0, 10,10));
+ mln_site(image2d<bool>) p1(9, 9);
+ mln_site(image2d<bool>) p2(10, 10);
+
+ std::cout << "has(p1)? "
+ << (img.has(p1) ? "true" : "false")
+ << std::endl;
+
+ std::cout << "has(p2)? "
+ << (img.has(p2) ? "true" : "false")
+ << std::endl;
+}
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 5481e60..f675045 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -43,13 +43,15 @@ showstringspaces=false,linewidth=14cm}
% #1 : sub page name
% #2 : sub page title
\newcommand{\doxychapter}[2]{%
+\label{#1}
\backslash endhtmlonly%
\backslash page #1 #2%
\backslash htmlonly%
}
-\newcommand{\doxysection}[1]{%
+\newcommand{\doxysection}[2]{%
+\label{#1}
\backslash endhtmlonly%
-\backslash section Tutorial #1%
+\backslash section #1 #2%
\backslash htmlonly%
}
\newcommand{\doxycode}[1]{
@@ -59,8 +61,8 @@ showstringspaces=false,linewidth=14cm}
}
%\begin{latexonly}
-\renewcommand{\doxychapter}[2]{\chapter{#2}}
-\renewcommand{\doxysection}[1]{\section{#1}}
+\renewcommand{\doxychapter}[2]{\chapter{#2}\label{#1}}
+\renewcommand{\doxysection}[2]{\section{#2}\label{#1}}
\renewcommand{\doxycode}[1]{\lstinputlisting[frame=single]{samples/#1}}
%\end{latexonly}
@@ -87,9 +89,11 @@ showstringspaces=false,linewidth=14cm}
\tableofcontents
\end{latexonly}
+%====================================
\doxychapter{foreword}{Foreword}
-\doxysection{Generality}
+%**************************
+\doxysection{generality}{Generality}
The following tutorial explains the basic concepts behind Olena and how to use
the most common objects and routines.
This tutorial includes many code examples and figures. In order to make this
@@ -123,7 +127,8 @@ Methods provided by objects in the library are in constant time. If you need
a specific method but you cannot find it, you may find an algorithm which can
compute the information you need.
-\doxysection{Directory hierarchy}
+%**************************
+\doxysection{dirtree}{Directory hierarchy}
Olena's tarball is structured as follow:
\begin{itemize}
@@ -148,6 +153,7 @@ Olena's tarball is structured as follow:
\end{itemize}
+%====================================
\clearpage
\newpage
\doxychapter{site}{Site}
@@ -197,7 +203,11 @@ means we have the following equivalence:
The site does not store any value but refer to an area where we will be able
to read its value.
+[Illustration : grille + intersection + pmin() + pmax() + distance entre 2
+points en x et en y = 1]\\
+
+%====================================
\clearpage
\newpage
\doxychapter{siteset}{Site set}
@@ -242,7 +252,8 @@ p\_vertices & set of graph vertices associated to sites.\\
All site sets are iterable. More detailed explanations are available in section \ref{iterators}.
-\doxysection{Basic interface}
+%**************************
+\doxysection{sitesetinterface}{Basic interface}
Common basic interface:\\
\begin{tabular}{|l|l|l|l|p{4cm}|}
@@ -256,7 +267,8 @@ bool & has & const P\& p & X & \\ \hline
\end{tabular} \\
-\doxysection{Optional interface}
+%**************************
+\doxysection{sitesetopinterface}{Optional interface}
Site sets may have other methods depending on their type: \\
\begin{tabular}{|l|l|l|l|p{4cm}|}
@@ -284,10 +296,16 @@ constant time retrieval.
\doxycode{box2d-2}
+
+
+%====================================
\clearpage
\newpage
\doxychapter{image}{Image}
+
+%**************************
+\doxysection{definition}{Definition}
An image is composed both of:
\begin{itemize}
\item A function $$
@@ -301,7 +319,8 @@ $$
\item A site set, also called the "domain".
\end{itemize}
-\doxysection{Possible value types}
+%**************************
+\doxysection{imavalues}{Possible value types}
Every image type must take its type of value as parameter.
The value type can be one of the builtins one:
@@ -347,6 +366,7 @@ rgb8.hh.
+%----------------
\subsection{About value, rvalue and lvalue}
Since the values are of a specific type, it exists a set of all the possible
@@ -378,7 +398,8 @@ With I being image2d$<$int\_u8$>$, we have :
I::value == int\_u8 but I::lvalue == int\_u8\&
\end{center}
-\doxysection{Domain}
+%**************************
+\doxysection{imadomain}{Domain}
The site set contains the sites which compose the image. Sites are based on a
grid so the image depends on that grid as well.
It means that an image 2D can only be defined by sites based on a 2D grid.
@@ -392,84 +413,135 @@ The following example shows that the definition domain and the site set are
exactly equivalent.
\doxycode{ima2d-1}
+Output:
+\doxycode{ima2d-1-output}
-\doxysection{Border and extension}
-// FIXME: COMPLETELY WRONG!!!
-// FIXME: Tell that the user can disable the border/extension: foo(ima | ima.domain())
-An image has a virtual border which is defined thanks to its domain. The
- border is virtual since the image can have an extended domain as well.
-That one is optional, it defines sites outside the virtual border which is
-useful in algorithms when working with sites being part of the domain but close
-to the borders. The extended domain can be defined thanks to a function, an
-image or a site set.
-//FIXME ADD FIGURE
+To know if a site belongs to an image domain or not, a method ``has()'' is
+available.
+\doxycode{point-1}
+Output:
+\doxycode{point-1-output}
-\doxysection{Morphed images}
-//FIXME: Write it!
-// Pas concrete, light, how to concrete
+Since the notion of site is independent from the image it applies on, we can
+form expressions where a site passed to several images:
+\doxycode{ima2d-4}
-\doxysection{Sample code}
-In order to create a 2D image, you have two possibilites:
-\doxycode{ima2d-2}
+%================================================
+\doxysection{imaborder}{Border and extension}
+Olena provides extension mechanisms for the
+image domain. In the library, both the concept of border and of extension can be encountered.
+These concepts are useful in many algorithms and can avoid costly tests while
+working with sites located on image edges.
-The empty image has no data and its definition domain is still unset. We do
-not know yet the number of sites it contains. However, it is really useful to
-have such an "empty image" because it is a placeholder for the result of some
-processing, or another image. Trying to access the site value from an empty
-image leads to an error at run-time.
+A border is a finite extension provided to a basic image type, such as
+image2d. By default, every image is created with a border. The default width is
+defined through the global variable border::thickness defined in
+mln/border/thickness.hh. Since this is a variable, it can be changed
+as shown in the following example.
-The following example illustrates how to map data to a site throughout the
-image.
+\doxycode{borderthickness}
-\doxycode{ima2d-3}
+Output:
-To know if a point belongs to an image domain or not, we can run this short
-test:
-\doxycode{point-1}
+\doxycode{borderthickness-output}
-Since the notion of site is independent from the image it applies on, we can
-form expressions where p is used on several images:
-\doxycode{ima2d-4}
+It is important to note that to display the border in the ouput, we use a
+special debug function, debug::print\_with\_border. Indeed, the border and the
+extension are considered as part of an image only in the algorithms. They are
+ignored while saving or printing an image.
-Images do not actually store the data in the class. Images store a pointer
-to an allocated space which can be shared with other objects. Once an image is
-assigned to another one, the two images share the same data so they have the
-same ID and point to the same memory space.
-Therefore, assigning an image to another one is NOT a costly operation. The new
-variable behaves like some mathematical variable. Put differently it is just a
-name to designate an image:
-\doxycode{ima2d-5}
+Some operations can be performed on the border. The functions are located in
+mln/border.\\
-If a deep copy of the image is needed, a method clone() is available:
-\doxycode{ima2d-6-clone}
+%
+\bigskip
+%
+\begin{tabular}{l|p{8cm}}
+Routine & Description \\
+\hline
+adjust & Increase the border thickness if it is inferior to a minimum. \\
+duplicate & Assign the border with the duplicate of the edges of this image.\\
+equalize & Equalize the border of two images so that their size is equal and is
+at least a minimum size.\\
+fill & Fill the border with a given value.\\
+find & Find the border thickness of an image.\\
+get & Get the border thickness of an image.\\
+mirror & Fills border using nearer pixels with a mirroring effect.\\
+resize & Set image border to a specific size.\\
+\end{tabular} \\
-[Illustration : grille + intersection + pmin() + pmax() + distance entre 2
-points en x et en y = 1]\\
-In the Olena library, all image types behave like image2d:
-\begin{itemize}
-\item An "empty" image is actually a mathematical variable.
+On morphed images, decribed in section \ref{imamorphed}, the border concept
+does not exist and is generalized to the extension concept.
+A simple example of a morphed image is a sub-image. A sub image does not have
+border nor extension by default.
+Thanks to mln/core/routine/extend.hh, an extension can be defined through a
+function. This means that the extension can be infinite.
+Another point is that an image can be used as extension. For instance, in the
+case of a sub-image, you may be interested in extending the sub-image with the
+image itself.
- $\rightarrow$ just think in a mathemetical way when dealing with images;
+[FIXME: schema - voir cahier]
-\item No dynamic memory allocation/deallocation is required.
- the user never has to use "new / delete" (the C++ equivalent for the C
- "malloc / free") so she does not have to manipulate pointers or to directly
- access memory.
-
- $\rightarrow$ Olena prevents the user from making mistakes;
+The extension supports the following operations. These functions are located in
+mln/extension.\\
-\item Image data/values can be shared between several variables and the memory
- used for image data is handled by the library.
-
- $\rightarrow$ Memory management is automatic.
-\end{itemize}
+%
+\bigskip
+%
+\begin{tabular}{l|p{10cm}}
+Routine & Description \\
+\hline
+fill & Fill the extension with a given value.\\
+\end{tabular} \\
+
+%----------------
+\subsection*{IMPORTANT NOTE}
+Many times, you may want to check if a site is part of the image before applying
+a treatment. All images provide a method ``has(Site)'' which can return this
+information.
+Be careful though, calling has() on the image returns true if the given site is
+part of the domain \textbf{OR} the the extension/border. All algorithms in Olena
+call that method which means that all the algorithms take in consideration the
+extension/border if it exists.
+
+Most of the time, this is the good behavior. For instance, if a rotation of 20
+degrees is applied to an image, sites which were not previously in the domain
+will be part of it. Thanks to the extension/border, these sites will be
+associated to the value they had when they were part of the extension/border.
+
+[Image+bord rotation 20degres, avant, apres]
+Sometimes taking the domain in consideration may not be the expected behavior.
+If you do not want to use the extension/border for a specific routine, simply
+restrict the image to its domain.
+\doxycode{extension-ignore}
+
+Note that:
+\begin{center}
+ima.domain().has() $\equiv$ (ima | ima.domain()).has()
+
+ and
+
+border::get(ima.domain()) == border::get(ima | ima.domain()) == 0
+\end{center}
+
+So it is also valid to write:
+\doxycode{extension-ignore2}
+
+
+%================================================
+\doxysection{imamorphed}{Morphed images}
+//FIXME: Write it!
+// Pas concrete, light, how to concrete
+%
-\doxysection{Interface}
+
+%================================================
+\doxysection{imainterface}{Interface}
\begin{tabular}{|l|l|l|l|p{4cm}|}
\hline
@@ -493,19 +565,117 @@ extended domain. \\ \hline
\end{tabular}
+
+%================================================
+\doxysection{imaio}{Load and save images}
+
+Currently, Olena supports the following input image formats:
+\begin{itemize}
+ \item PBM
+ \item PFM
+ \item PGM
+ \item PNM
+ \item PPM
+\end{itemize}
+
+This support is provided through two headers for each type, save.hh and load.hh.
+They are located in mln/io/$<$image-format$>$/.
+
+Once the right header is included, the image can be loaded:
+
+\doxycode{ima-load}
+
+Note that for the PBM format, you \textbf{MUST} use ``bool'' as value type.
+No special value type is required for other formats though.
+
+\doxycode{ima-save}
+%
+
+%================================================
+\doxysection{imacreate}{Create an image}
+
+Loading an image is not mandatory, an image can be created from scratch. There
+are two possibilites to do so:
+
+\doxycode{ima2d-2}
+
+Img1a has no data and its definition domain is still unset. We do
+not know yet the number of sites it contains. However, it is really useful to
+have such an "empty image" because it is a placeholder for the result of some
+processing, or another image. Trying to access the site value from an empty
+image leads to an error at run-time.
+Img1b is defined on a domain but does not have data yet.\\
+
+
+
+%================================================
+\doxysection{imaaccessmodval}{Access and modify values}
+
+There are several ways to access/modify an image ``ima'':
+\begin{itemize}
+\item ima.at(x, y, \dots)
+\item ima(Site)
+\end{itemize}
+
+Most of the time, images can be modified and these two methods can be used both
+to read a value and modify it. Both methods are equivalent.
+\doxycode{ima2d-3}
+Output:
+\doxycode{ima2d-3-output}
+
+Usually, you will want to use the functional way, ``ima(Site)'', more
+particularly while iterating over all the sites through an iterator. This use
+case will be detailed further in section \ref{iterators}.
+
+
+
+%================================================
+\doxysection{imasize}{Image size}
+Most typical image types owns special methods to retrieve the image size.
+
+\begin{tabular}{l|l}
+Image type & Methods \\
+\hline
+image1d & length()\\
+image2d & ncols(), nrows()\\
+image3d & ncols(), nrows(), nslis() \\
+\end{tabular}
+
+If you need a more generic way to get the size, you can use the routines
+provided in mln/geom in the following files:
+\begin{itemize}
+ \item ncols.hh
+ \item nrows.hh
+ \item nslis.hh
+\end{itemize}
+
+\doxycode{ima-size}
+Output:
+\doxycode{ima-size-output}
+
+
+
+%====================================
\clearpage
\newpage
\doxychapter{winneigh}{Window and neighborhood}
-\doxysection{FIXME}
+
+%**************************
+\doxysection{winfixme}{FIXME}
FIXME
\doxycode{ima2d-display-1}
+
+
+%====================================
\clearpage
\newpage
\doxychapter{sitesandco}{Sites, psites and dpoints}
-\doxysection{Need for site}
+
+%**************************
+\doxysection{sitessite}{Need for site}
As we have seen before, an image is defined on a grid. It has associated
data and a site set which defines the domain of the image on that grid.
@@ -526,7 +696,8 @@ Here we have:
where, roughly, point2d = \{ row, column \}.
-\doxysection{Need for psite}
+%**************************
+\doxysection{sitespsite}{Need for psite}
Sometimes, accessing a value in constant-time complexity, O(1), is not
possible with a site object.
@@ -569,7 +740,8 @@ where, roughly, pseudo\_site$<$point2d$>$ $=$ \{ i\_in\_p\_array, p\_array\_ptr
Psites contains all the needed information to access the values in
constant-time.
-\doxysection{From psite to site}
+%**************************
+\doxysection{sitespsitensite}{From psite to site}
In the last example there was an image of type I such as I::site != I::psite.
In that case, an object of type I::psite is actually convertible towards an
@@ -591,9 +763,13 @@ specialized for every site type; for instance, internal::site\_impl$<$point2d$>$
owns the method "coord row() const" which is defined as
"return exact(this)-$>$to\_site().row()"
-\doxysection{Need for dpoint}
+%**************************
+\doxysection{sitesdpoint}{Need for dpoint}
//FIXME
+
+
+%====================================
\clearpage
\newpage
\doxychapter{iterators}{Iterators}
@@ -663,32 +839,79 @@ loop: fill and paste.
\doxycode{paste}
+
+
+%================================================
+\clearpage
+\doxychapter{imamemmgmt}{Memory management}
+
+In the Olena library, all image types behave like image2d:
+\begin{itemize}
+\item An "empty" image is actually a mathematical variable.
+
+ $\rightarrow$ just think in a mathemetical way when dealing with images;
+
+\item No dynamic memory allocation/deallocation is required.
+ the user never has to use "new / delete" (the C++ equivalent for the C
+ "malloc / free") so she does not have to manipulate pointers or to directly
+ access memory.
+
+ $\rightarrow$ Olena prevents the user from making mistakes;
+
+\item Image data/values can be shared between several variables and the memory
+ used for image data is handled by the library.
+
+ $\rightarrow$ Memory management is automatic.
+\end{itemize}
+
+%----------------
+\subsection*{Exemple with image2d}
+
+Images do not actually store the data in the class. Images store a pointer
+to an allocated space which can be shared with other objects. Once an image is
+assigned to another one, the two images share the same data so they have the
+same ID and point to the same memory space.
+Therefore, assigning an image to another one is NOT a costly operation. The new
+variable behaves like some mathematical variable. Put differently it is just a
+name to designate an image:
+\doxycode{ima2d-5}
+
+If a deep copy of the image is needed, a method clone() is available:
+\doxycode{ima2d-6-clone}
+
+
+
+%====================================
\clearpage
\newpage
\doxychapter{basicops}{Basic operations}
//FIXME : illustrer
-\doxysection{Basic routines}
-\begin{tabular}{|l|p{8cm}|}
+%**************************
+\doxysection{basicroutines}{Basic routines}
+\begin{tabular}{l|p{8cm}}
\hline
Routine name & Description \\ \hline
level::clone() & creates a deep copy of an object. Any shared data is
-duplicated. \\ \hline
+duplicated. \\
-level::fill() & fill an object with a value. \\ \hline
+level::fill() & fill an object with a value. \\
-level::paste() & paste object data to another object. \\ \hline
+level::paste() & paste object data to another object. \\
labeling::blobs() & find and label the different components of an image. \\
+
+*::compute() & compute an accumulator on specific elements. \\
\hline
\end{tabular} \\
-\doxysection{Fill}
+%**************************
+\doxysection{fillop}{Fill}
First, create an image:
\doxycode{ima2d-decl-1}
Memory has been allocated so data can be stored but site values
-have not been initialized yet. So we fill img with the value 'a':
+have not been initialized yet. So we fill imga with the value 'a':
\doxycode{fill-call-1}
@@ -704,6 +927,7 @@ algorithm, the proper file shall be included. The file names of algorithms
strictly map their C++ name; so oln::level::fill is defined in the file
"oln/level/fill.hh".
+%----------------
\subsection*{Note}
Most algorithms in Olena are constructed following the classical scheme: "output
algo(input)", where the input image is only read. However some few algorithms
@@ -713,11 +937,14 @@ modified "read/write". The algorithm call shall be "level::fill(ima.rw(),
val)". When forgetting the "rw()" call it does not compile.
-\doxysection{Paste}
+%**************************
+\doxysection{pasteop}{Paste}
We then define below a second image to play with. As you can see this image has
data for the sites (5, 5) to (14, 14) (so it has 100 sites).
\doxycode{paste-call-1}
+Output:
+\doxycode{paste-call-1-output}
Before pasting, the couple of images looked like:
@@ -727,6 +954,7 @@ so after pasting we get:
//FIXME : ajouter des zolies zimages again.
+%----------------
\subsection*{Note}
With this simple example we can see that images defined on different domains (or
set of sites) can interoperate. The set of sites of an image is defined and
@@ -744,11 +972,77 @@ For instance, the algorithm level::paste tests that the set of sites of imgb
(whose values are to be pasted) is a subset of the destination image.
-\doxysection{Blobs}
+
+%====================================
+\doxysection{blobs}{Blobs}
//FIXME: write it!
-\newpage
-\doxysection{Working with parts of an image}
+%**************************
+\doxysection{compute}{Compute}
+
+There are several flavour of the compute routine, depending on what the kind of
+elements it computes.
+
+\begin{tabular}{l|p{8cm}}
+\hline
+labeling::compute() & compute an accumulator for each component in a labeled
+image. \\
+
+level::compute() & compute an accumulator on the values of an image. \\
+\end{tabular}
+
+An accumulator is a special object accumulating data while iterating all over
+the image values or sites. Hereby follows a list of accumulators available in
+Olena.
+
+%----------------
+\subsection*{Accumulators on sites}
+\begin{tabular}{l|p{8cm}}
+Name | Description \\
+\hline
+bbox & \\
+count\_adjacent\_vertices & \\
+count & \\
+height & \\
+volume & \\
+\end{tabular}
+
+%----------------
+\subsection*{Accumulators on values}
+\begin{tabular}{l|p{8cm}}
+Name | Description \\
+\hline
+histo & \\
+max & \\
+max\_h & \\
+mean & \\
+median\_alt & \\
+median\_h & \\
+min & \\
+min\_h & \\
+min\_max & \\
+rank\_bool & \\
+rank & \\
+rank\_high\_quant & \\
+sum & \\
+\end{tabular}
+
+%----------------
+\subsection*{Accumulators on values}
+\begin{tabular}{l|p{8cm}}
+Name | Description \\
+\hline
+pair & \\
+p & \\
+tuple & \\
+v & \\
+\end{tabular}
+
+//FIXME: write it!
+
+
+%====================================
+\doxysection{partima}{Working with parts of an image}
Sometime it may be interesting to work only on some parts of the image or to
extract only a sub set of that image. Olena enables that thoughout out the
@@ -810,6 +1104,7 @@ Here is an example using a C function:
\medskip
%
%
+%----------------
\subsection*{Important note}
When writing:
@@ -839,13 +1134,17 @@ In that case there is no restriction on the domain at all and the following exam
With this operator, an intersection is applied on the image domain and the
site set.
+
+
+%====================================
\newpage
\clearpage
\doxychapter{graphes}{Graphes and images}
//FIXME: REWRITE
-\doxysection{Description}
+%**************************
+\doxysection{graphdesc}{Description}
Olena enables the possibility of using graphes with images.
Graphes can help you to handle directly parts of an image and represent their
relationship.
@@ -853,7 +1152,8 @@ Specific data can be associated to each vertex and/or edges.
//FIXME: Add more explanations?
-\doxysection{Example}
+%**************************
+\doxysection{graphexample}{Example}
First, create a graph which looks like the following:
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make morpho meyer_wst practicable.
* mln/core/routine/ops.hh (FIXME): Resolve warning.
* mln/morpho/meyer_wst.hh (in_queue): New.
core/routine/ops.hh | 4 +---
morpho/meyer_wst.hh | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 8 deletions(-)
Index: mln/core/routine/ops.hh
--- mln/core/routine/ops.hh (revision 2565)
+++ mln/core/routine/ops.hh (working copy)
@@ -456,9 +456,7 @@
operator-(const Object<O>& rhs)
{
mlc_converts_to(literal::zero_t, O)::check();
- /* FIXME: The following statements trigger a warning:
- ``'p_zero' is used uninitialized in this function.'' */
- literal::zero_t* p_zero;
+ literal::zero_t* p_zero = 0;
return O(*p_zero) - exact(rhs);
}
Index: mln/morpho/meyer_wst.hh
--- mln/morpho/meyer_wst.hh (revision 2565)
+++ mln/morpho/meyer_wst.hh (working copy)
@@ -39,8 +39,6 @@
eaux. In: Actes du 8�me Congr�s AFCET, Lyon-Villeurbanne, France
(1991), pages 847--859. */
-# include <queue>
-
# include <mln/trait/ch_value.hh>
// FIXME: See below.
@@ -53,7 +51,6 @@
# include <mln/core/site_set/p_priority.hh>
-
namespace mln
{
@@ -130,7 +127,12 @@
// Ordered queue.
typedef p_queue_fast<psite> Q;
- p_priority<mln_value(I), Q> queue;
+ p_priority<V, Q> queue;
+
+ // In_queue structure to avoid processing sites several times.
+ mln_ch_value(I, bool) in_queue;
+ initialize(in_queue, input);
+ level::fill(in_queue, false);
// Insert every neighbor P of every marked area in a
// hierarchical queue, with a priority level corresponding to
@@ -143,6 +145,7 @@
if (output.domain().has(n) && output(n) != unmarked)
{
queue.push(max - input(p), p);
+ in_queue(p) = true;
break;
}
@@ -181,8 +184,12 @@
{
output(p) = adjacent_marker;
for_all(n)
- if (output.domain().has(n) && output(n) == unmarked)
+ if (output.domain().has(n) && output(n) == unmarked
+ && ! in_queue(n))
+ {
queue.push(max - input(n), n);
+ in_queue(n) = true;
+ }
}
}
return output;
1
0
---
ChangeLog | 45 ++
milena/doc/tutorial/samples/box2d-1.tex | 7 +
milena/doc/tutorial/samples/box2d-2.tex | 9 +
milena/doc/tutorial/samples/domain-display-1.tex | 4 +
.../doc/tutorial/samples/domain-display-out-1.tex | 2 +
milena/doc/tutorial/samples/fill-call-1.tex | 1 +
milena/doc/tutorial/samples/fill-part-1.tex | 16 +
milena/doc/tutorial/samples/fill-part-2.tex | 18 +
milena/doc/tutorial/samples/fill-part-3.tex | 10 +
milena/doc/tutorial/samples/fill.tex | 7 +
milena/doc/tutorial/samples/forall-piter-1.tex | 5 +
milena/doc/tutorial/samples/fun-p2b-1.tex | 4 +
milena/doc/tutorial/samples/fun-p2v-1.tex | 6 +
milena/doc/tutorial/samples/graph-output-1.tex | 7 +
milena/doc/tutorial/samples/ima2d-1.tex | 6 +
milena/doc/tutorial/samples/ima2d-2.tex | 4 +
milena/doc/tutorial/samples/ima2d-3.tex | 12 +
milena/doc/tutorial/samples/ima2d-4.tex | 5 +
milena/doc/tutorial/samples/ima2d-5.tex | 13 +
milena/doc/tutorial/samples/ima2d-6-clone.tex | 8 +
milena/doc/tutorial/samples/ima2d-decl-1.tex | 1 +
milena/doc/tutorial/samples/ima2d-decl-2.tex | 9 +
milena/doc/tutorial/samples/ima2d-display-1.tex | 7 +
milena/doc/tutorial/samples/ima2d-display-2.tex | 7 +
.../tutorial/samples/ima2d-display-output-1.tex | 2 +
.../tutorial/samples/ima2d-display-output-2.tex | 2 +
milena/doc/tutorial/samples/ima2d-restricted-1.tex | 1 +
milena/doc/tutorial/samples/ima2d-restricted-2.tex | 12 +
milena/doc/tutorial/samples/ima2d-restricted-3.tex | 1 +
.../samples/ima2d-restricted-display-1.tex | 7 +
milena/doc/tutorial/samples/mln_var-1.tex | 1 +
milena/doc/tutorial/samples/mln_var-2.tex | 1 +
milena/doc/tutorial/samples/mln_var-3.tex | 8 +
milena/doc/tutorial/samples/parray-append.tex | 6 +
milena/doc/tutorial/samples/parray-display-1.tex | 4 +
milena/doc/tutorial/samples/paste-call-1.tex | 10 +
milena/doc/tutorial/samples/paste.tex | 7 +
milena/doc/tutorial/samples/point-1.tex | 4 +
milena/doc/tutorial/samples/predicate-1.tex | 6 +
milena/doc/tutorial/tutorial.tex | 686 +++++++-------------
40 files changed, 534 insertions(+), 437 deletions(-)
create mode 100644 milena/doc/tutorial/samples/box2d-1.tex
create mode 100644 milena/doc/tutorial/samples/box2d-2.tex
create mode 100644 milena/doc/tutorial/samples/domain-display-1.tex
create mode 100644 milena/doc/tutorial/samples/domain-display-out-1.tex
create mode 100644 milena/doc/tutorial/samples/fill-call-1.tex
create mode 100644 milena/doc/tutorial/samples/fill-part-1.tex
create mode 100644 milena/doc/tutorial/samples/fill-part-2.tex
create mode 100644 milena/doc/tutorial/samples/fill-part-3.tex
create mode 100644 milena/doc/tutorial/samples/fill.tex
create mode 100644 milena/doc/tutorial/samples/forall-piter-1.tex
create mode 100644 milena/doc/tutorial/samples/fun-p2b-1.tex
create mode 100644 milena/doc/tutorial/samples/fun-p2v-1.tex
create mode 100644 milena/doc/tutorial/samples/graph-output-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-2.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-3.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-4.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-5.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-6-clone.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-decl-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-decl-2.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-display-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-display-2.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-display-output-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-display-output-2.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-restricted-1.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-restricted-2.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-restricted-3.tex
create mode 100644 milena/doc/tutorial/samples/ima2d-restricted-display-1.tex
create mode 100644 milena/doc/tutorial/samples/mln_var-1.tex
create mode 100644 milena/doc/tutorial/samples/mln_var-2.tex
create mode 100644 milena/doc/tutorial/samples/mln_var-3.tex
create mode 100644 milena/doc/tutorial/samples/parray-append.tex
create mode 100644 milena/doc/tutorial/samples/parray-display-1.tex
create mode 100644 milena/doc/tutorial/samples/paste-call-1.tex
create mode 100644 milena/doc/tutorial/samples/paste.tex
create mode 100644 milena/doc/tutorial/samples/point-1.tex
create mode 100644 milena/doc/tutorial/samples/predicate-1.tex
diff --git a/ChangeLog b/ChangeLog
index e8de481..87fe601 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,50 @@
2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * milena/mln/doc/tutorial/samples/box2d-1.tex,
+ * milena/mln/doc/tutorial/samples/box2d-2.tex,
+ * milena/mln/doc/tutorial/samples/domain-display-1.tex,
+ * milena/mln/doc/tutorial/samples/domain-display-out-1.tex,
+ * milena/mln/doc/tutorial/samples/fill-call-1.tex,
+ * milena/mln/doc/tutorial/samples/fill-part-1.tex,
+ * milena/mln/doc/tutorial/samples/fill-part-2.tex,
+ * milena/mln/doc/tutorial/samples/fill-part-3.tex,
+ * milena/mln/doc/tutorial/samples/fill.tex,
+ * milena/mln/doc/tutorial/samples/forall-piter-1.tex,
+ * milena/mln/doc/tutorial/samples/fun-p2b-1.tex,
+ * milena/mln/doc/tutorial/samples/fun-p2v-1.tex,
+ * milena/mln/doc/tutorial/samples/graph-output-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-2.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-3.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-4.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-5.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-6-clone.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-decl-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-decl-2.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-display-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-display-2.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-display-output-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-display-output-2.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-restricted-1.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-restricted-2.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-restricted-3.tex,
+ * milena/mln/doc/tutorial/samples/ima2d-restricted-display-1.tex,
+ * milena/mln/doc/tutorial/samples/mln_var-1.tex,
+ * milena/mln/doc/tutorial/samples/mln_var-2.tex,
+ * milena/mln/doc/tutorial/samples/mln_var-3.tex,
+ * milena/mln/doc/tutorial/samples/parray-append.tex,
+ * milena/mln/doc/tutorial/samples/parray-display-1.tex,
+ * milena/mln/doc/tutorial/samples/paste-call-1.tex,
+ * milena/mln/doc/tutorial/samples/paste.tex,
+ * milena/mln/doc/tutorial/samples/point-1.tex,
+ * milena/mln/doc/tutorial/samples/predicate-1.tex:
+ Move sample code from the tutorial to these files.
+
+ * milena/mln/doc/tutorial/tutorial.tex: various update.
+
+
+2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Update the prototype of labeling::compute().
* milena/mln/labeling/compute.hh: change the return type to an
util::array.
diff --git a/milena/doc/tutorial/samples/box2d-1.tex b/milena/doc/tutorial/samples/box2d-1.tex
new file mode 100644
index 0000000..07383a2
--- /dev/null
+++ b/milena/doc/tutorial/samples/box2d-1.tex
@@ -0,0 +1,7 @@
+box2d b(2,3);
+
+// The bbox can be retrived in constant time.
+std::cout << b.bbox() << std::endl;
+
+// nsites can be retrieved in constant time.
+std::cout << "nsites = " << b.nsites() << std::endl;
diff --git a/milena/doc/tutorial/samples/box2d-2.tex b/milena/doc/tutorial/samples/box2d-2.tex
new file mode 100644
index 0000000..6055d2d
--- /dev/null
+++ b/milena/doc/tutorial/samples/box2d-2.tex
@@ -0,0 +1,9 @@
+p_array<point2d> arr;
+
+// The bbox is computed thanks to bbox() algorithm.
+box2d box = geom::bbox(arr);
+std::cout << box << std::endl;
+
+// p_array provides nsites(),
+// it can be retrieved in constant time.
+std::cout << "nsites = " << arr.nsites() << std::endl;
diff --git a/milena/doc/tutorial/samples/domain-display-1.tex b/milena/doc/tutorial/samples/domain-display-1.tex
new file mode 100644
index 0000000..635b3eb
--- /dev/null
+++ b/milena/doc/tutorial/samples/domain-display-1.tex
@@ -0,0 +1,4 @@
+std::cout << "imga.domain() = " << imga.domain()
+<< std::endl;
+std::cout << "imgb.domain() = " << imgb.domain()
+<< std::endl;
diff --git a/milena/doc/tutorial/samples/domain-display-out-1.tex b/milena/doc/tutorial/samples/domain-display-out-1.tex
new file mode 100644
index 0000000..f021cef
--- /dev/null
+++ b/milena/doc/tutorial/samples/domain-display-out-1.tex
@@ -0,0 +1,2 @@
+imga.domain() = { (0,0) .. (19,19) }
+imgb.domain() = { (5,5) .. (14,14) }
diff --git a/milena/doc/tutorial/samples/fill-call-1.tex b/milena/doc/tutorial/samples/fill-call-1.tex
new file mode 100644
index 0000000..134df4f
--- /dev/null
+++ b/milena/doc/tutorial/samples/fill-call-1.tex
@@ -0,0 +1 @@
+level::fill(imga.rw(), 'a');
diff --git a/milena/doc/tutorial/samples/fill-part-1.tex b/milena/doc/tutorial/samples/fill-part-1.tex
new file mode 100644
index 0000000..b191156
--- /dev/null
+++ b/milena/doc/tutorial/samples/fill-part-1.tex
@@ -0,0 +1,16 @@
+p_array2d<bool> arr;
+
+// We add two points in the array.
+arr.append(point2d(0, 1));
+arr.append(point2d(4, 0));
+
+// We restrict the image to the sites
+// contained in arr and fill these ones
+// with 0.
+// We must call "rw()" here.
+fill((ima | arr).rw(), 0);
+
+
+mln_VAR(ima2, ima | arr);
+// We do not need to call "rw()" here.
+fill(ima2, 0);
diff --git a/milena/doc/tutorial/samples/fill-part-2.tex b/milena/doc/tutorial/samples/fill-part-2.tex
new file mode 100644
index 0000000..4f69cbc
--- /dev/null
+++ b/milena/doc/tutorial/samples/fill-part-2.tex
@@ -0,0 +1,18 @@
+using namespace mln;
+using value::int_u8;
+using value::rgb8;
+
+// Find and label the different components.
+int_u8 nlabels;
+image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels);
+
+// Store a boolean image. True if the site is part of
+// component 2, false otherwise.
+mln_VAR(lab_2b, lab | (pw::value(lab) == 2));
+
+// Get the sub site set containing only the sites
+// part of component 2.
+mln_VAR(lab_2, lab_2b.domain(true));
+
+// Fill the sites of component 2 with red.
+fill(lab_2, color::red);
diff --git a/milena/doc/tutorial/samples/fill-part-3.tex b/milena/doc/tutorial/samples/fill-part-3.tex
new file mode 100644
index 0000000..29c112a
--- /dev/null
+++ b/milena/doc/tutorial/samples/fill-part-3.tex
@@ -0,0 +1,10 @@
+using namespace mln;
+using value::int_u8;
+using value::rgb8;
+
+// Find and label the different components.
+int_u8 nlabels;
+image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels);
+
+// Fill the sites of component 2 with red.
+fill(lab.domain(2).rw(), color::red);
diff --git a/milena/doc/tutorial/samples/fill.tex b/milena/doc/tutorial/samples/fill.tex
new file mode 100644
index 0000000..ec9c43d
--- /dev/null
+++ b/milena/doc/tutorial/samples/fill.tex
@@ -0,0 +1,7 @@
+template <typename I>
+void fill(I& ima, mln_value(I) v)
+{
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ ima(p) = v;
+}
diff --git a/milena/doc/tutorial/samples/forall-piter-1.tex b/milena/doc/tutorial/samples/forall-piter-1.tex
new file mode 100644
index 0000000..f2ea498
--- /dev/null
+++ b/milena/doc/tutorial/samples/forall-piter-1.tex
@@ -0,0 +1,5 @@
+box2d b(3, 2);
+mln_piter(box2d) p(b);
+
+for_all(p)
+ std::cout << p; //prints every site coordinates.
diff --git a/milena/doc/tutorial/samples/fun-p2b-1.tex b/milena/doc/tutorial/samples/fun-p2b-1.tex
new file mode 100644
index 0000000..a43ca77
--- /dev/null
+++ b/milena/doc/tutorial/samples/fun-p2b-1.tex
@@ -0,0 +1,4 @@
+bool row_oddity(mln::point2d p)
+{
+return p.row() % 2;
+}
diff --git a/milena/doc/tutorial/samples/fun-p2v-1.tex b/milena/doc/tutorial/samples/fun-p2v-1.tex
new file mode 100644
index 0000000..96bae2b
--- /dev/null
+++ b/milena/doc/tutorial/samples/fun-p2v-1.tex
@@ -0,0 +1,6 @@
+unsigned my_values(const point2d& p)
+{
+ if (p.row() == 0)
+ return 8;
+ return 9;
+}
diff --git a/milena/doc/tutorial/samples/graph-output-1.tex b/milena/doc/tutorial/samples/graph-output-1.tex
new file mode 100644
index 0000000..d3bf445
--- /dev/null
+++ b/milena/doc/tutorial/samples/graph-output-1.tex
@@ -0,0 +1,7 @@
+0 1 2 3 4
+.-----------
+0 | 0 2
+1 | \ / |
+2 | 1 |
+3 | \ |
+4 | 3-4
diff --git a/milena/doc/tutorial/samples/ima2d-1.tex b/milena/doc/tutorial/samples/ima2d-1.tex
new file mode 100644
index 0000000..c89d3de
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-1.tex
@@ -0,0 +1,6 @@
+box2d b(-2,3, 3,-5); // Define a box2d from (-2,3) to (3,-5).
+image2d<int> ima(b); // Define the domain of the image.
+
+cout << b << std::endl; // Display b
+
+cout << ima.domain() << std::endl; // Display b too
diff --git a/milena/doc/tutorial/samples/ima2d-2.tex b/milena/doc/tutorial/samples/ima2d-2.tex
new file mode 100644
index 0000000..41ead50
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-2.tex
@@ -0,0 +1,4 @@
+// which builds an empty image;
+image2d<int> img1a;
+// which builds an image with 6 sites
+image2d<int> img1b(box2d(2, 3));
diff --git a/milena/doc/tutorial/samples/ima2d-3.tex b/milena/doc/tutorial/samples/ima2d-3.tex
new file mode 100644
index 0000000..a218061
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-3.tex
@@ -0,0 +1,12 @@
+box2d b(2,3);
+image2d<int> ima(b);
+point2d p(1, 2);
+
+// Associate '9' as value for the site/point2d (1,2).
+// The value is returned by reference and can be changed.
+ima.at(1,2) = 9;
+cout << ima(p) << std::endl; // prints 9
+
+ima(p) = 2; // The value is returned by reference
+// and can be changed as well.
+cout << ima(p) << std::endl; // prints 2
diff --git a/milena/doc/tutorial/samples/ima2d-4.tex b/milena/doc/tutorial/samples/ima2d-4.tex
new file mode 100644
index 0000000..2add937
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-4.tex
@@ -0,0 +1,5 @@
+// At index (9, 9), both values change.
+imga(p) = 'M', imgb(p) = 'W';
+
+debug::println(imga);
+debug::println(imgb);
diff --git a/milena/doc/tutorial/samples/ima2d-5.tex b/milena/doc/tutorial/samples/ima2d-5.tex
new file mode 100644
index 0000000..febbfa8
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-5.tex
@@ -0,0 +1,13 @@
+image2d<int> ima1(box2d(2, 3));
+image2d<int> ima2;
+point2d p(1,2);
+
+ima2 = ima1; // ima1.id() == ima2.id()
+// and both point to the same memory area.
+
+ima2(p) = 2; // ima1 is modified as well.
+
+// prints "2 - 2"
+std::cout << ima2(p) << " - " << ima1(p) << std::endl;
+// prints "true"
+std::cout << (ima2.id() == ima1.id()) << std::endl;
diff --git a/milena/doc/tutorial/samples/ima2d-6-clone.tex b/milena/doc/tutorial/samples/ima2d-6-clone.tex
new file mode 100644
index 0000000..396306a
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-6-clone.tex
@@ -0,0 +1,8 @@
+image2d<int> ima3 = ima1.clone(); // Makes a deep copy.
+
+ima3(p) = 3;
+
+// prints "3 - 2"
+std::cout << ima3(p) << " - " << ima1(p) << std::endl;
+// prints "false"
+std::cout << (ima3.id() == ima1.id()) << std::endl;
diff --git a/milena/doc/tutorial/samples/ima2d-decl-1.tex b/milena/doc/tutorial/samples/ima2d-decl-1.tex
new file mode 100644
index 0000000..9fa4fdd
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-decl-1.tex
@@ -0,0 +1 @@
+image2d<char> imga(0, 0, 20, 20);
diff --git a/milena/doc/tutorial/samples/ima2d-decl-2.tex b/milena/doc/tutorial/samples/ima2d-decl-2.tex
new file mode 100644
index 0000000..e7a0953
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-decl-2.tex
@@ -0,0 +1,9 @@
+bool vals[6][5] = {
+{0, 1, 1, 0, 0},
+{0, 1, 1, 0, 0},
+{0, 0, 0, 0, 0},
+{1, 1, 0, 1, 0},
+{1, 0, 1, 1, 1},
+{1, 0, 0, 0, 0}
+};
+image2d<bool> ima = make::image2d(vals);
diff --git a/milena/doc/tutorial/samples/ima2d-display-1.tex b/milena/doc/tutorial/samples/ima2d-display-1.tex
new file mode 100644
index 0000000..3929a1b
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-display-1.tex
@@ -0,0 +1,7 @@
+c 0 1 2 3
+r
++-+-+-+-+
+0 | |x| | |
++-+-+-+-+
+1 | | | | |
++-+-+-+-+
diff --git a/milena/doc/tutorial/samples/ima2d-display-2.tex b/milena/doc/tutorial/samples/ima2d-display-2.tex
new file mode 100644
index 0000000..cd5144f
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-display-2.tex
@@ -0,0 +1,7 @@
+c 6 7 8 9
+r
++-+-+-+
+3 | |x| |
++-+-+-+-+
+4 | | |
++-+-+
diff --git a/milena/doc/tutorial/samples/ima2d-display-output-1.tex b/milena/doc/tutorial/samples/ima2d-display-output-1.tex
new file mode 100644
index 0000000..d33f985
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-display-output-1.tex
@@ -0,0 +1,2 @@
+0 1 0
+1 1 1
diff --git a/milena/doc/tutorial/samples/ima2d-display-output-2.tex b/milena/doc/tutorial/samples/ima2d-display-output-2.tex
new file mode 100644
index 0000000..e01adbc
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-display-output-2.tex
@@ -0,0 +1,2 @@
+1
+1 1 1
diff --git a/milena/doc/tutorial/samples/ima2d-restricted-1.tex b/milena/doc/tutorial/samples/ima2d-restricted-1.tex
new file mode 100644
index 0000000..a10edd4
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-restricted-1.tex
@@ -0,0 +1 @@
+ima | sub_D
diff --git a/milena/doc/tutorial/samples/ima2d-restricted-2.tex b/milena/doc/tutorial/samples/ima2d-restricted-2.tex
new file mode 100644
index 0000000..4dc07f7
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-restricted-2.tex
@@ -0,0 +1,12 @@
+box2d b1(1,0, 1, 2);
+mln_VAR(imac, imab1 | b1);
+
+// Print:
+// 1 1 1
+debug::prinln(imac);
+
+box2d b2(0,0, 1, 1);
+// Will fail at runtime.
+// ima.domain().has((0,0)) is false.
+mln_VAR(imad, imab1 | b2);
+debug::prinln(imad);
diff --git a/milena/doc/tutorial/samples/ima2d-restricted-3.tex b/milena/doc/tutorial/samples/ima2d-restricted-3.tex
new file mode 100644
index 0000000..a803ace
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-restricted-3.tex
@@ -0,0 +1 @@
+ima / sub_D
diff --git a/milena/doc/tutorial/samples/ima2d-restricted-display-1.tex b/milena/doc/tutorial/samples/ima2d-restricted-display-1.tex
new file mode 100644
index 0000000..bbf94e2
--- /dev/null
+++ b/milena/doc/tutorial/samples/ima2d-restricted-display-1.tex
@@ -0,0 +1,7 @@
+void my_function()
+{
+ ...
+ // Prints only sites which are on odd lines.
+ debug::println(ima | row_oddity);
+ ...
+}
diff --git a/milena/doc/tutorial/samples/mln_var-1.tex b/milena/doc/tutorial/samples/mln_var-1.tex
new file mode 100644
index 0000000..d4142ae
--- /dev/null
+++ b/milena/doc/tutorial/samples/mln_var-1.tex
@@ -0,0 +1 @@
+mln_VAR(ima, my_values | arr);
diff --git a/milena/doc/tutorial/samples/mln_var-2.tex b/milena/doc/tutorial/samples/mln_var-2.tex
new file mode 100644
index 0000000..fe05d1e
--- /dev/null
+++ b/milena/doc/tutorial/samples/mln_var-2.tex
@@ -0,0 +1 @@
+mln_VAR(imab1, imab | (pw::value(imab) == 1u));
diff --git a/milena/doc/tutorial/samples/mln_var-3.tex b/milena/doc/tutorial/samples/mln_var-3.tex
new file mode 100644
index 0000000..240be1f
--- /dev/null
+++ b/milena/doc/tutorial/samples/mln_var-3.tex
@@ -0,0 +1,8 @@
+box2d b2(0,0, 1, 1);
+
+mln_VAR(imad, imab1 / b2);
+
+// Print
+// 1
+// 1 1
+debug::prinln(imad);
diff --git a/milena/doc/tutorial/samples/parray-append.tex b/milena/doc/tutorial/samples/parray-append.tex
new file mode 100644
index 0000000..544270e
--- /dev/null
+++ b/milena/doc/tutorial/samples/parray-append.tex
@@ -0,0 +1,6 @@
+p_array<point2d> arr;
+arr.append(point2d(3, 6));
+arr.append(point2d(3, 7));
+arr.append(point2d(3, 8));
+arr.append(point2d(4, 8));
+arr.append(point2d(4, 9));
diff --git a/milena/doc/tutorial/samples/parray-display-1.tex b/milena/doc/tutorial/samples/parray-display-1.tex
new file mode 100644
index 0000000..2003777
--- /dev/null
+++ b/milena/doc/tutorial/samples/parray-display-1.tex
@@ -0,0 +1,4 @@
+arr[] = 0 1 2 3 4
++-+-+-+-+-+
+| |x| | | |
++-+-+-+-+-+
diff --git a/milena/doc/tutorial/samples/paste-call-1.tex b/milena/doc/tutorial/samples/paste-call-1.tex
new file mode 100644
index 0000000..c6dc124
--- /dev/null
+++ b/milena/doc/tutorial/samples/paste-call-1.tex
@@ -0,0 +1,10 @@
+image1d<char> imgb(5, 5, 14, 14);
+
+// We initialize the image values.
+level::fill(imgb.rw(), 'b');
+
+// Last we now paste the contents of img3b in img3a...
+level::paste(imgb, imga.rw()));
+
+// ...and print the result.
+debug::println(imga);
diff --git a/milena/doc/tutorial/samples/paste.tex b/milena/doc/tutorial/samples/paste.tex
new file mode 100644
index 0000000..cf1bcf3
--- /dev/null
+++ b/milena/doc/tutorial/samples/paste.tex
@@ -0,0 +1,7 @@
+template <typename I, typename J>
+void paste(const I& data, J& dest)
+{
+mln_piter(I) p(data.domain());
+for_all(p)
+dest(p) = data(p);
+}
diff --git a/milena/doc/tutorial/samples/point-1.tex b/milena/doc/tutorial/samples/point-1.tex
new file mode 100644
index 0000000..30da933
--- /dev/null
+++ b/milena/doc/tutorial/samples/point-1.tex
@@ -0,0 +1,4 @@
+point2d p(9, 9);
+
+// which gives 'true'.
+std::cout << (imga.has(p) ? "true" : "false") << std::endl;
diff --git a/milena/doc/tutorial/samples/predicate-1.tex b/milena/doc/tutorial/samples/predicate-1.tex
new file mode 100644
index 0000000..bfa18f0
--- /dev/null
+++ b/milena/doc/tutorial/samples/predicate-1.tex
@@ -0,0 +1,6 @@
+//function_p2b
+bool my_function_p2b(mln::point2d p);
+
+//function_p2v
+//V is the value type used in the image.
+V my_function_p2v(mln::point2d p);
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 0a8a26a..5481e60 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -5,6 +5,7 @@
\usepackage{xcolor}
\usepackage{color}
\usepackage{html}
+\usepackage{tikz}
\newcommand{\img}[4]{
\begin{figure}[ht!]
@@ -26,51 +27,69 @@
\definecolor{cbg}{rgb}{0.95,0.95,0.95}
%%%LISTINGS SETTINGS
+%begin{latexonly}
\lstset{frameround=fttt}
\lstloadlanguages{C++}
\lstset{language=C++}
-%\lstset{backgroundcolor=\color{black},
-%basicstyle=\bfseries\color{white},
-%identifierstyle=\color{green},
-%stringstyle=\color{yellow},
-%commentstyle=\color{red},
-%showstringspaces=false,linewidth=14cm}
-
\lstset{backgroundcolor=\color{cbg},
basicstyle=\bfseries\color{black},
identifierstyle=\color{black},
stringstyle=\color{cstring},
commentstyle=\color{ccomment},
showstringspaces=false,linewidth=14cm}
-
-\newenvironment{doxycode}
-{% This is the begin code
-\begin{latexonly}%
-\begin{lstlisting}[frame=single]%
-\end{latexonly}%
-\begin{htmlonly}%
-\backslash code%
-\end{htmlonly}%
+%end{latexonly}
+
+% #1 : sub page name
+% #2 : sub page title
+\newcommand{\doxychapter}[2]{%
+\backslash endhtmlonly%
+\backslash page #1 #2%
+\backslash htmlonly%
+}
+\newcommand{\doxysection}[1]{%
+\backslash endhtmlonly%
+\backslash section Tutorial #1%
+\backslash htmlonly%
}
-{%
-\begin{htmlonly}%
-\backslash endcode%
-\end{htmlonly}%
-\begin{latexonly}%
-\end{lstlisting}%
-\end{latexonly}%
+\newcommand{\doxycode}[1]{
+\backslash endhtmlonly%
+\backslash include #1.tex%
+\backslash htmlonly%
}
+%\begin{latexonly}
+\renewcommand{\doxychapter}[2]{\chapter{#2}}
+\renewcommand{\doxysection}[1]{\section{#1}}
+\renewcommand{\doxycode}[1]{\lstinputlisting[frame=single]{samples/#1}}
+%\end{latexonly}
\begin{document}
+\begin{htmlonly}
+\backslash endhtmlonly
+\backslash page tutorial Tutorial
+- \backslash subpage foreword
+- \backslash subpage site
+- \backslash subpage siteset
+- \backslash subpage image
+- \backslash subpage winneigh
+- \backslash subpage sitesandco
+- \backslash subpage iterators
+- \backslash subpage basicops
+- \backslash subpage graphes
+\backslash htmlonly
+\end{htmlonly}
+
+\begin{latexonly}
\tableofcontents
+\end{latexonly}
-\chapter*{Foreword}
+\doxychapter{foreword}{Foreword}
+\doxysection{Generality}
The following tutorial explains the basic concepts behind Olena and how to use
the most common objects and routines.
This tutorial includes many code examples and figures. In order to make this
@@ -104,19 +123,44 @@ Methods provided by objects in the library are in constant time. If you need
a specific method but you cannot find it, you may find an algorithm which can
compute the information you need.
+\doxysection{Directory hierarchy}
+Olena's tarball is structured as follow:
+
+\begin{itemize}
+ \item milena
+ \begin{itemize}
+% \item apps :
+ \item doc
+ \begin{itemize}
+ \item benchmark: set of benchmark.
+ \item examples: more examples.
+ \item oldies: partialy not updated documentation. Not recommended for new users.
+ \item technical: technical doc.
+ \item tutorial: code sample and tutorial.
+ \end{itemize}
+ \item img: a set of sample images.
+ \item mesh: a full example which uses Olena.
+ \item mln: the library. Contains only headers.
+ \item tests: test suite.
+% \item tools :
+ \end{itemize}
+ \item swilena: Python bindings for Olena.
+\end{itemize}
+
+
\clearpage
\newpage
-\chapter{Site}
+\doxychapter{site}{Site}
Usually, when talking about images, we think about common images composed of a
set of pixels.
Since Olena is generic, we want to support many kind of images, even images
-which are not composed of a set of pixels, such as images of images.
+which are not composed of a set of pixels, such as images having images as sites.
In order to express this genericity, we have the ``site'' concept.
This concept allows us to divide a pixel into two information:
\begin{itemize}
- \item The coordinates (the site itself).
+ \item The pixel location, e.g. its coordinates (the site itself).
\item The value.
\end{itemize}
@@ -126,7 +170,24 @@ Let's say we have 2D grid like this:
[dessin de grille 2d, colonnes/lignes numerotees + repere x/y]
Intersection == point 2d == milieu d'un pixel \\
-On a regular grid like this, in 2D, we usually use a 2D point as a site which
+%FIXME: Find a way to get that figure in HTML output.
+\begin{latexonly}
+\begin{tikzpicture}[scale=2]
+
+\draw[blue!20, thick] (-2, -2) grid [right=0.5cm,above=0.5cm,step=1cm] (3, 3);
+\draw[line width=1mm] (-1, -1) grid [step=1cm] (3, 3);
+\draw[black,line width=2mm,->] (0, -2) node {y} -- (0, 4);
+\draw[black,line width=2mm,->] (-2, 3) node {x} -- (4, 3);
+
+\foreach \x in {-0.5, 0.5, 1.5, 2.5}
+ \foreach \y in {-0.5, 0.5, 1.5, 2.5}
+ \node at (\x, \y) [fill=blue!30] {};
+
+\draw[black] (2.5, 1.5) -- (4, 2) node {Point2d(2, 2)};
+\end{tikzpicture}
+\end{latexonly}
+
+On such a regular grid, in 2D, we usually use a 2D point as a site which
means we have the following equivalence:
\begin{center}
@@ -139,7 +200,7 @@ to read its value.
\clearpage
\newpage
-\chapter{Site set}
+\doxychapter{siteset}{Site set}
Site sets are used:
\begin{enumerate}
@@ -159,7 +220,7 @@ Site set & Description \\
p\_array & site array. \\
\hline
-p\_box & compact domain definde on a regular grid (in 2D, a rectangle). \\
+p\_box & compact domain defined on a regular grid (in 2D, a rectangle). \\
\hline
p\_if & site set verifying a predicate. \\
\hline
@@ -179,7 +240,9 @@ p\_vertices & set of graph vertices associated to sites.\\
\hline
\end{tabular}
-\section{Basic interface}
+All site sets are iterable. More detailed explanations are available in section \ref{iterators}.
+
+\doxysection{Basic interface}
Common basic interface:\\
\begin{tabular}{|l|l|l|l|p{4cm}|}
@@ -193,7 +256,7 @@ bool & has & const P\& p & X & \\ \hline
\end{tabular} \\
-\section{Optional interface}
+\doxysection{Optional interface}
Site sets may have other methods depending on their type: \\
\begin{tabular}{|l|l|l|l|p{4cm}|}
@@ -209,42 +272,21 @@ The previous methods are available depending on the site set. A box
will have the bbox() method since it can be retrived in constant time: a box
is it's own bounding box.
-\begin{lstlisting}[frame=single]
- box2d b(2,3);
-
- // The bbox can be retrived in constant time.
- std::cout << b.bbox() << std::endl;
-
- // nsites can be retrieved in constant time.
- std::cout << "nsites = " << b.nsites() << std::endl;
-\end{lstlisting}
+\doxycode{box2d-1}
A p\_array does not have this
method since sites do not have to be adjacent. Maintaining such information, in
order to keep getting the bbox in constant time, would be time and memory
consuming. Instead of providing a method directly in p\_array, an algorithm is
available if this information is needed.
-P\_array and box both have a nsites method since the internal structure allow a
+p\_array and box both have a nsites method since the internal structure allows a
constant time retrieval.
-%\begin{doxycode}
-\begin{lstlisting}[frame=single]
- p_array<point2d> arr;
-
- // The bbox is computed thanks to bbox() algorithm.
- box2d box = geom::bbox(arr);
- std::cout << box << std::endl;
-
- // p_array provides nsites(),
- // it can be retrieved in constant time.
- std::cout << "nsites = " << arr.nsites() << std::endl;
-\end{lstlisting}
-%\end{doxycode}
-
+\doxycode{box2d-2}
\clearpage
\newpage
-\chapter{Image}
+\doxychapter{image}{Image}
An image is composed both of:
\begin{itemize}
@@ -259,7 +301,53 @@ $$
\item A site set, also called the "domain".
\end{itemize}
-\section{About value, rvalue and lvalue}
+\doxysection{Possible value types}
+
+Every image type must take its type of value as parameter.
+The value type can be one of the builtins one:
+\begin{itemize}
+ \item bool
+ \item char
+ \item unsigned
+ \item int
+ \item short
+ \item long
+ \item float
+ \item double
+\end{itemize}
+
+Other data types are also available:
+
+\begin{tabular}{l|l}
+Value type & underlying data type \\
+\hline
+float01\_8 & unsigned long \\
+float01\_16 & unsigned long \\
+float01\_f & float \\
+gl8 & unsigned char \\
+gl16 & unsigned short \\
+glf & float \\
+hsi\_d & double \\
+hsi\_f & float \\
+int\_s8 & char \\
+int\_s16 & short \\
+int\_s32 & int \\
+int\_u8 & unsigned char \\
+int\_u16 & unsigned short \\
+int\_u32 & unsigned int \\
+rgb16 & mln::util::vec$<$unsigned short$>$ \\
+rgb8 & mln::util::vec$<$unsigned char$>$ \\
+\end{tabular} \\
+
+
+All these types are available in mln/value and accessible in the mln::value namespace.
+Most of the time, the name of the header which must be included to use one of these data
+types is actually ``type\_name.hh". For instance, for rgb8 the header will be
+rgb8.hh.
+
+
+
+\subsection{About value, rvalue and lvalue}
Since the values are of a specific type, it exists a set of all the possible
site values. This set is called "destination" set. It may be iterable and
@@ -290,7 +378,7 @@ With I being image2d$<$int\_u8$>$, we have :
I::value == int\_u8 but I::lvalue == int\_u8\&
\end{center}
-\section{Domain}
+\doxysection{Domain}
The site set contains the sites which compose the image. Sites are based on a
grid so the image depends on that grid as well.
It means that an image 2D can only be defined by sites based on a 2D grid.
@@ -303,17 +391,9 @@ For instance, defining a 2D image with a box2d starting from point (-20, -20)
The following example shows that the definition domain and the site set are
exactly equivalent.
-\begin{lstlisting}[frame=single]
- box2d b(-2,3, 3,-5); // Define a box2d from (-2,3) to (3,-5).
- image2d<int> ima(b); // Define the domain of the image.
+\doxycode{ima2d-1}
- cout << b << std::endl; // Display b
-
- cout << ima.domain() << std::endl; // Display b too
-\end{lstlisting}
-
-
-\section{Border and extension}
+\doxysection{Border and extension}
// FIXME: COMPLETELY WRONG!!!
// FIXME: Tell that the user can disable the border/extension: foo(ima | ima.domain())
An image has a virtual border which is defined thanks to its domain. The
@@ -325,18 +405,14 @@ image or a site set.
//FIXME ADD FIGURE
-\section{Morphed images}
+\doxysection{Morphed images}
//FIXME: Write it!
// Pas concrete, light, how to concrete
-\section{Sample code}
+\doxysection{Sample code}
In order to create a 2D image, you have two possibilites:
-\begin{lstlisting}[frame=single]
- // which builds an empty image;
- image2d<int> img1a;
- // which builds an image with 6 sites
- image2d<int> img1b(box2d(2, 3));
-\end{lstlisting}
+
+\doxycode{ima2d-2}
The empty image has no data and its definition domain is still unset. We do
not know yet the number of sites it contains. However, it is really useful to
@@ -347,41 +423,15 @@ image leads to an error at run-time.
The following example illustrates how to map data to a site throughout the
image.
-\begin{lstlisting}[frame=single]
- box2d b(2,3);
- image2d<int> ima(b);
- point2d p(1, 2);
-
- // Associate '9' as value for the site/point2d (1,2).
- // The value is returned by reference and can be changed.
- ima.at(1,2) = 9;
- cout << ima(p) << std::endl; // prints 9
-
- ima(p) = 2; // The value is returned by reference
- // and can be changed as well.
- cout << ima(p) << std::endl; // prints 2
-\end{lstlisting}
-
+\doxycode{ima2d-3}
To know if a point belongs to an image domain or not, we can run this short
test:
-\begin{lstlisting}[frame=single]
-point2d p(9, 9);
-
-// which gives 'true'.
-std::cout << (imga.has(p) ? "true" : "false") << std::endl;
-\end{lstlisting}
+\doxycode{point-1}
Since the notion of site is independent from the image it applies on, we can
form expressions where p is used on several images:
-\begin{lstlisting}[frame=single]
-// At index (9, 9), both values change.
-imga(p) = 'M', imgb(p) = 'W';
-
-debug::println(imga);
-debug::println(imgb);
-\end{lstlisting}
-
+\doxycode{ima2d-4}
Images do not actually store the data in the class. Images store a pointer
to an allocated space which can be shared with other objects. Once an image is
@@ -390,33 +440,10 @@ same ID and point to the same memory space.
Therefore, assigning an image to another one is NOT a costly operation. The new
variable behaves like some mathematical variable. Put differently it is just a
name to designate an image:
-\begin{lstlisting}[frame=single]
- image2d<int> ima1(box2d(2, 3));
- image2d<int> ima2;
- point2d p(1,2);
-
- ima2 = ima1; // ima1.id() == ima2.id()
- // and both point to the same memory area.
-
- ima2(p) = 2; // ima1 is modified as well.
-
- // prints "2 - 2"
- std::cout << ima2(p) << " - " << ima1(p) << std::endl;
- // prints "true"
- std::cout << (ima2.id() == ima1.id()) << std::endl;
-\end{lstlisting}
+\doxycode{ima2d-5}
If a deep copy of the image is needed, a method clone() is available:
-\begin{lstlisting}[frame=single]
- image2d<int> ima3 = ima1.clone(); // Makes a deep copy.
-
- ima3(p) = 3;
-
- // prints "3 - 2"
- std::cout << ima3(p) << " - " << ima1(p) << std::endl;
- // prints "false"
- std::cout << (ima3.id() == ima1.id()) << std::endl;
-\end{lstlisting}
+\doxycode{ima2d-6-clone}
[Illustration : grille + intersection + pmin() + pmax() + distance entre 2
points en x et en y = 1]\\
@@ -442,7 +469,7 @@ In the Olena library, all image types behave like image2d:
-\section{Interface}
+\doxysection{Interface}
\begin{tabular}{|l|l|l|l|p{4cm}|}
\hline
@@ -468,16 +495,17 @@ extended domain. \\ \hline
\clearpage
\newpage
-\chapter{Window and Neighborhood}
-
-
+\doxychapter{winneigh}{Window and neighborhood}
+\doxysection{FIXME}
+FIXME
+\doxycode{ima2d-display-1}
\clearpage
\newpage
-\chapter{Sites, psites and dpoints}
+\doxychapter{sitesandco}{Sites, psites and dpoints}
-\section{Need for site}
+\doxysection{Need for site}
As we have seen before, an image is defined on a grid. It has associated
data and a site set which defines the domain of the image on that grid.
@@ -485,16 +513,7 @@ Usually, we need to access a value by its coordinates. With default images it
can be done easily, at no cost.
Example with an image2d:
-
-\begin{lstlisting}[frame=single]
- c 0 1 2 3
- r
- +-+-+-+-+
- 0 | |x| | |
- +-+-+-+-+
- 1 | | | | |
- +-+-+-+-+
-\end{lstlisting}
+\doxycode{ima2d-display-1}
The site x is the point (0, 1). The image values are stored in a
multi-dimensional array. The point coordinates can be used directly. The site
@@ -507,7 +526,7 @@ Here we have:
where, roughly, point2d = \{ row, column \}.
-\section{Need for psite}
+\doxysection{Need for psite}
Sometimes, accessing a value in constant-time complexity, O(1), is not
possible with a site object.
@@ -515,55 +534,25 @@ possible with a site object.
Let's have a small example. Define a function returning a value for a given
point:
\clearpage
-\begin{lstlisting}[frame=single]
- unsigned my_values(const point2d& p)
- {
- if (p.row() == 0)
- return 8;
- return 9;
- }
-\end{lstlisting}
+\doxycode{fun-p2v-1}
+
So, for each point having (0, x) as coordinate, this function will return 8,
otherwise it will be 9.
Then, define a p\_array with few point2d:
-
-\begin{lstlisting}[frame=single]
- p_array<point2d> arr;
- arr.append(point2d(3, 6));
- arr.append(point2d(3, 7));
- arr.append(point2d(3, 8));
- arr.append(point2d(4, 8));
- arr.append(point2d(4, 9));
-\end{lstlisting}
+\doxycode{parray-append}
Now, create a point-wise image from this function and this p\_array:
-\begin{lstlisting}[frame=single]
- mln_VAR(ima, my_values | arr);
-\end{lstlisting}
+\doxycode{mln_var-1}
Ima is actually that image:
-\begin{lstlisting}[frame=single]
- c 6 7 8 9
- r
- +-+-+-+
- 3 | |x| |
- +-+-+-+-+
- 4 | | |
- +-+-+
-\end{lstlisting}
+\doxycode{ima2d-display-2}
However, in memory, since it is based on a p\_array, sites are stored in a
vector.
The site x is the point (3, 7) which corresponds to the cell 1 in the p\_array.
-
-\begin{lstlisting}[frame=single]
-arr[] = 0 1 2 3 4
- +-+-+-+-+-+
- | |x| | | |
- +-+-+-+-+-+
-\end{lstlisting}
+\doxycode{parray-display-1}
Obviously, we cannot check in constant time whether the site x, point2d here,
is part of that image or not: knowing the point coordinates is not enough.
@@ -572,15 +561,15 @@ the psites.
Here we have:
- I::site == point2d but I::psite == pseudo\_site$<$point2d$>$
+ I::site $==$ point2d but I::psite $==$ pseudo\_site$<$point2d$>$
-where, roughly, pseudo\_site$<$point2d$>$ = \{ i\_in\_p\_array, p\_array\_ptr
+where, roughly, pseudo\_site$<$point2d$>$ $=$ \{ i\_in\_p\_array, p\_array\_ptr
\}.
Psites contains all the needed information to access the values in
constant-time.
-\section{From psite to site}
+\doxysection{From psite to site}
In the last example there was an image of type I such as I::site != I::psite.
In that case, an object of type I::psite is actually convertible towards an
@@ -602,12 +591,12 @@ specialized for every site type; for instance, internal::site\_impl$<$point2d$>$
owns the method "coord row() const" which is defined as
"return exact(this)-$>$to\_site().row()"
-\section{Need for dpoint}
+\doxysection{Need for dpoint}
//FIXME
\clearpage
\newpage
-\chapter{Iterators}
+\doxychapter{iterators}{Iterators}
Each container object in Olena like site sets or images have iterators.
The iteration mechanism for images is directly derived from the mechanism
@@ -660,13 +649,7 @@ Example of different forward iterations:
A for\_all() macro is available to iterate over all the sites: \\
-\begin{lstlisting}[frame=single]
- box2d b(3, 2);
- mln_piter(box2d) p(b);
-
- for_all(p)
- std::cout << p; //prints every site coordinates.
-\end{lstlisting}
+\doxycode{forall-piter-1}
Note that when you declare an iterator, prefer using the "mln\_*iter" macros.
They resolve the iterator type automatically from the given container type
@@ -676,33 +659,16 @@ site sets.
Here follow an example with the implemantions of the most basic routines which use the for\_all
loop: fill and paste.
-\begin{lstlisting}[frame=single]
-template <typename I>
-void fill(I& ima, mln_value(I) v)
-{
- mln_piter(I) p(ima.domain());
- for_all(p)
- ima(p) = v;
-}
-\end{lstlisting}
-
+\doxycode{fill}
-\begin{lstlisting}[frame=single]
-template <typename I, typename J>
-void paste(const I& data, J& dest)
-{
- mln_piter(I) p(data.domain());
- for_all(p)
- dest(p) = data(p);
-}
-\end{lstlisting}
+\doxycode{paste}
\clearpage
\newpage
-\chapter{Basic operations}
+\doxychapter{basicops}{Basic operations}
//FIXME : illustrer
-\section{Basic routines}
+\doxysection{Basic routines}
\begin{tabular}{|l|p{8cm}|}
\hline
Routine name & Description \\ \hline
@@ -717,17 +683,14 @@ labeling::blobs() & find and label the different components of an image. \\
\hline
\end{tabular} \\
-\section{Fill}
+\doxysection{Fill}
First, create an image:
-\begin{lstlisting}[frame=single]
- image2d<char> imga(0, 0, 20, 20);
-\end{lstlisting}
+\doxycode{ima2d-decl-1}
Memory has been allocated so data can be stored but site values
have not been initialized yet. So we fill img with the value 'a':
-\begin{lstlisting}[frame=single]
- level::fill(imga.rw(), 'a');
-\end{lstlisting}
+
+\doxycode{fill-call-1}
The "fill" algorithm is located in the sub-namespace "level" since this
algorithm deals with the "level" of site values.
@@ -750,22 +713,11 @@ modified "read/write". The algorithm call shall be "level::fill(ima.rw(),
val)". When forgetting the "rw()" call it does not compile.
-\section{Paste}
+\doxysection{Paste}
We then define below a second image to play with. As you can see this image has
data for the sites (5, 5) to (14, 14) (so it has 100 sites).
-\begin{lstlisting}[frame=single]
- image1d<char> imgb(5, 5, 14, 14);
-
- // We initialize the image values.
- level::fill(imgb.rw(), 'b');
-
- // Last we now paste the contents of img3b in img3a...
- level::paste(imgb, imga.rw()));
-
- // ...and print the result.
- debug::println(imga);
-\end{lstlisting}
+\doxycode{paste-call-1}
Before pasting, the couple of images looked like:
@@ -780,18 +732,10 @@ With this simple example we can see that images defined on different domains (or
set of sites) can interoperate. The set of sites of an image is defined and
can be accessed and printed. The following code:
-\begin{lstlisting}[frame=single]
- std::cout << "imga.domain() = " << imga.domain()
- << std::endl;
- std::cout << "imgb.domain() = " << imgb.domain()
- << std::endl;
-\end{lstlisting}
+\doxycode{domain-display-1}
Gives:
-\begin{lstlisting}[frame=single]
- imga.domain() = { (0,0) .. (19,19) }
- imgb.domain() = { (5,5) .. (14,14) }
-\end{lstlisting}
+\doxycode{domain-display-out-1}
The notion of site sets plays an important role in Olena. Many tests are
performed at run-time to ensure that the program is correct.
@@ -800,11 +744,11 @@ For instance, the algorithm level::paste tests that the set of sites of imgb
(whose values are to be pasted) is a subset of the destination image.
-\section{Blobs}
+\doxysection{Blobs}
//FIXME: write it!
\newpage
-\section{Working with parts of an image}
+\doxysection{Working with parts of an image}
Sometime it may be interesting to work only on some parts of the image or to
extract only a sub set of that image. Olena enables that thoughout out the
@@ -837,14 +781,7 @@ The following sample codes illustrate this feature.
In order to use C functions as predicate, they must have one of the following
prototype if you work on 2D images:
-\begin{lstlisting}[frame=single]
-//function_p2b
-bool my_function_p2b(mln::point2d p);
-
-//function_p2v
-//V is the value type used in the image.
-V my_function_p2v(mln::point2d p);
-\end{lstlisting}
+\doxycode{predicate-1}
Of course, you just need to change the point type if you use another image
type. For instance, you would use point3d with 3D images.
The returned value type V for function\_p2v depends on the image value type.
@@ -852,91 +789,23 @@ With image2d$<$int$>$, V would be int.
In this section, all along the examples, the image "ima" will refer to the
following declaration:
-\begin{lstlisting}[frame=single]
- bool vals[6][5] = {
- {0, 1, 1, 0, 0},
- {0, 1, 1, 0, 0},
- {0, 0, 0, 0, 0},
- {1, 1, 0, 1, 0},
- {1, 0, 1, 1, 1},
- {1, 0, 0, 0, 0}
- };
- image2d<bool> ima = make::image2d(vals);
-\end{lstlisting}
+\doxycode{ima2d-decl-2}
A simple example is to fill only a part of an image with a specific value:
-\begin{lstlisting}[frame=single]
-p_array2d<bool> arr;
-
-// We add two points in the array.
-arr.append(point2d(0, 1));
-arr.append(point2d(4, 0));
-
-// We restrict the image to the sites
-// contained in arr and fill these ones
-// with 0.
-// We must call "rw()" here.
-fill((ima | arr).rw(), 0);
-
-
-mln_VAR(ima2, ima | arr);
-// We do not need to call "rw()" here.
-fill(ima2, 0);
-\end{lstlisting}
+\doxycode{fill-part-1}
The two next examples extract a specific component from an image and fill a new
image with red only in the extracted component's domain.
-\begin{lstlisting}[frame=single]
- using namespace mln;
- using value::int_u8;
- using value::rgb8;
-
- // Find and label the different components.
- int_u8 nlabels;
- image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels);
-
- // Store a boolean image. True if the site is part of
- // component 2, false otherwise.
- mln_VAR(lab_2b, lab | (pw::value(lab) == 2));
-
- // Get the sub site set containing only the sites
- // part of component 2.
- mln_VAR(lab_2, lab_2b.domain(true));
-
- // Fill the sites of component 2 with red.
- fill(lab_2, color::red);
-\end{lstlisting}
+\doxycode{fill-part-2}
The previous example can be written more quickly:
-\begin{lstlisting}[frame=single]
- using namespace mln;
- using value::int_u8;
- using value::rgb8;
-
- // Find and label the different components.
- int_u8 nlabels;
- image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels);
-
- // Fill the sites of component 2 with red.
- fill(lab.domain(2).rw(), color::red);
-\end{lstlisting}
+\doxycode{fill-part-3}
Here is an example using a C function:
-\begin{lstlisting}[frame=single]
-bool row_oddity(mln::point2d p)
-{
- return p.row() % 2;
-}
+\doxycode{fun-p2b-1}
+
+\doxycode{ima2d-restricted-display-1}
-void my_function()
-{
- ...
- //Prints only sites which are on odd lines.
- debug::println(ima | row_oddity};
- ...
-}
-\end{lstlisting}
-%
%
\medskip
%
@@ -944,75 +813,39 @@ void my_function()
\subsection*{Important note}
When writing:
-\begin{lstlisting}[frame=single]
- ima | sub_D
-\end{lstlisting}
+\doxycode{ima2d-restricted-1}
sub\_D must be included in ima.domain().
Let's have an image, \textit{imab}, like this:
-\begin{lstlisting}[frame=single]
-0 1 0
-1 1 1
-\end{lstlisting}
+\doxycode{ima2d-display-output-1}
Extract a sub image from \textit{imab} with sites having their value set to 1.
-\begin{lstlisting}[frame=single]
-mln_VAR(imab1, imab | (pw::value(imab) == 1u));
-\end{lstlisting}
-
+\doxycode{mln_var-2}
Then, \textit{imab1} looks like:
-\begin{lstlisting}[frame=single]
- 1
-1 1 1
-\end{lstlisting}
+\doxycode{ima2d-display-output-2}
Now, if we want to extract a sub image it may fail, depending on the site set
used:
-\begin{lstlisting}[frame=single]
-box2d b1(1,0, 1, 2);
-mln_VAR(imac, imab1 | b1);
-
-// Print:
-// 1 1 1
-debug::prinln(imac);
-
-box2d b2(0,0, 1, 1);
-// Will fail at runtime.
-// ima.domain().has((0,0)) is false.
-mln_VAR(imad, imab1 | b2);
-debug::prinln(imad);
-\end{lstlisting}
-
+\doxycode{ima2d-restricted-2}
If you do not want this constraint, you may want to use an alternative
operator:
-
-\begin{lstlisting}[frame=single]
- ima / sub_D
-\end{lstlisting}
+\doxycode{ima2d-restricted-3}
In that case there is no restriction on the domain at all and the following example will work.
-\begin{lstlisting}[frame=single]
-box2d b2(0,0, 1, 1);
-
-mln_VAR(imad, imab1 / b2);
+\doxycode{mln_var-3}
-// Print
-// 1
-// 1 1
-debug::prinln(imad);
-\end{lstlisting}
With this operator, an intersection is applied on the image domain and the
site set.
\newpage
\clearpage
-\chapter{Graphes and images}
+\doxychapter{graphes}{Graphes and images}
//FIXME: REWRITE
-\section{Description}
+\doxysection{Description}
Olena enables the possibility of using graphes with images.
Graphes can help you to handle directly parts of an image and represent their
relationship.
@@ -1020,40 +853,19 @@ Specific data can be associated to each vertex and/or edges.
//FIXME: Add more explanations?
-\section{Example}
+\doxysection{Example}
First, create a graph which looks like the following:
-\begin{lstlisting}[frame=single]
- 0 1 2 3 4
- .-----------
- 0 | 0 2
- 1 | \ / |
- 2 | 1 |
- 3 | \ |
- 4 | 3-4
-\end{lstlisting}
-
-To do so, we need to create a site set containing the sites we are going to use
-as vertices:
+\doxycode{graph-output-1}
-\begin{lstlisting}
-std::vector<point2d> sites;
-
-// Site associated to...
-sites.push_back(point2d(0,0)); // ... vertex 0.
-sites.push_back(point2d(2,2)); // ... vertex 1.
-sites.push_back(point2d(0,4)); // ... vertex 2.
-sites.push_back(point2d(4,3)); // ... vertex 3.
-sites.push_back(point2d(4,4)); // ... vertex 4.
-\end{lstlisting}
+First we need to add vertices:
-Then populate the graph with vertices:
\begin{lstlisting}
-util::graph<point2d> g;
+util::graph g;
-for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+for (unsigned i = 0; i < 5; ++i)
+ g.add_vertex () // Associated to vertex 'i';
\end{lstlisting}
Finally, populate the graph with edges:
@@ -1065,49 +877,49 @@ g.add_edge(3, 4); // Associated to edge 3.
g.add_edge(4, 2); // Associated to edge 4.
\end{lstlisting}
-Now, a graph structure is created but contains only site relationship
-information. We may like to map data to it. Vertices and edges are mapped to
-indexes. Indexes start from 0 and respect the insertion order.
-Therefore, the idea is to provide a function which returns the associated data
-according to the index given as parameter. Combining this function and the
-graph, which is actually a sort of site set, we get an image. Since this is an
-image, you can use it with algorithms and for\_all loops.
+Now there is a graph topology and we want to associate elements of this graph
+to a site in the image.
+The idea is to use specific site sets such as p\_vertices and p\_edges.
+Let's associate the vertices with sites. To do so we need to create a functor
+which for a given vertex returns a site.
\begin{lstlisting}[frame=single]
-
-Value my_data_fun(vertex_index_t index)
+struct assoc_fun : public Function_v2v< assoc_fun >
{
- if (index == 0)
- return value1;
- else if (index > 1 && < 4)
- return value2;
- return value3;
-}
+ typedef const point2d& result;
-Value my_data_fun(edge_index_t index)
+ inline
+ const point2d& operator()(const vertex<graph::util>& v) const
+ {
+ ...
+ }
+
+};
+\end{lstlisting}
+
+Then declare a p\_vertices:
+\begin{lstlisting}[frame=single]
+p_vertices<util::graph, assoc_fun> pv(g, assoc_fun());
+\end{lstlisting}
+
+Thanks to the p\_vertices there is now a mapping between vertices and sites.
+We may like to map data to it. The idea is to provide a function which returns the associated data
+according to the site given as parameter. Combining this function and the
+p\_vertices, we get an image. Since this is an image, you can use it with algorithms and for\_all loops.
+
+\begin{lstlisting}[frame=single]
+
+template <typename I>
+mln_rvalue(I) my_data_fun(mln_site(I) site)
{
- if (index == 0)
- return value1;
- else if (index > 1 && < 4)
- return value2;
- return value3;
+ ...
}
void my_fun()
{
...
- // Constructs an image which associates
- // data and edges. A site is actually an edge.
- mln_VAR(graph_edge_ima, my_data_fun | g.edges());
-
- //Prints each edge.
- mln_piter p(graph_edge_ima);
- for_all(p)
- std::cout << p << std::endl;
-
- // Constructs an image which associates
- // data and vertices. A site is actually a vertex.
- mln_VAR(graph_vertices_ima, my_data_fun2 | g.vertices());
+ // Constructs an image
+ mln_VAR(graph_vertices_ima, my_data_fun | pv);
//Prints each vertex
mln_piter p(graph_vertices_ima);
--
1.5.6.5
1
0
---
ChangeLog | 10 ++++++++++
milena/mln/labeling/compute.hh | 36 ++++++++++++++----------------------
milena/sandbox/scribo/demat.hh | 7 +++----
milena/tests/labeling/compute.cc | 5 +++--
4 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d1e291a..e8de481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Update the prototype of labeling::compute().
+ * milena/mln/labeling/compute.hh: change the return type to an
+ util::array.
+
+ * milena/sandbox/scribo/demat.hh,
+ * milena/tests/labeling/compute.cc: update according the new
+ prototype.
+
+2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Remove the useless '_' postfix in all the accumulators.
* milena/doc/examples/tuto_bis.cc,
* milena/doc/tutorial/examples/accu.cc,
diff --git a/milena/mln/labeling/compute.hh b/milena/mln/labeling/compute.hh
index e68ac30..cea30b1 100644
--- a/milena/mln/labeling/compute.hh
+++ b/milena/mln/labeling/compute.hh
@@ -57,7 +57,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename I, typename J>
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels);
@@ -75,7 +75,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename I, typename J>
- p_array<mlc_unqualif(mln_accu_with(A, mln_value(I))::result)>
+ util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>& a,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels);
@@ -92,7 +92,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename J>
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<J>& label, mln_value(J) nlabels);
@@ -108,7 +108,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename J>
- p_array<mlc_unqualif(mln_accu_with(A, mln_psite(J))::result)>
+ util::array<mln_accu_with(A, mln_psite(J))::result>
compute(const Meta_Accumulator<A>& a,
const Image<J>& label, mln_value(J) nlabels);
@@ -121,7 +121,7 @@ namespace mln
template <typename A, typename I, typename J>
inline
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>&,
const Image<I>& input_,
const Image<J>& label_, mln_value(J) nlabels)
@@ -132,19 +132,15 @@ namespace mln
const J& label = exact(label_);
util::array<A> accus;
- for (mln_value(J) i = 0; i < nlabels; ++i)
+ for (mln_value(J) i = 0; i <= nlabels; ++i)
accus.append(A());
mln_piter(I) p(input.domain());
mln_value(J) l;
for_all(p)
- {
- l = label(p) - 1;
- if (l >= 0)
- accus[l].take(input(p));
- }
+ accus[label(p)].take(input(p));
- p_array<mln_result(A)> results;
+ util::array<mln_result(A)> results;
for (unsigned i = 0; i < accus.nelements(); ++i)
results.append(accus[i]);
@@ -154,7 +150,7 @@ namespace mln
template <typename A, typename I, typename J>
inline
- p_array<mlc_unqualif(mln_accu_with(A, mln_value(I))::result)>
+ util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>&,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels)
@@ -166,7 +162,7 @@ namespace mln
template <typename A, typename J>
inline
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<J>& label_, mln_value(J) nlabels)
{
@@ -175,19 +171,15 @@ namespace mln
const J& label = exact(label_);
util::array<A> accus;
- for (mln_value(J) i = 0; i < nlabels; ++i)
+ for (mln_value(J) i = 0; i <= nlabels; ++i)
accus.append(exact(a));
mln_piter(J) p(label.domain());
mln_value(J) l;
for_all(p)
- {
- l = label(p) - 1;
- if (l >= 0)
- accus[l].take(p);
- }
+ accus[label(p)].take(p);
- p_array<mlc_unqualif(mln_result(A))> results;
+ util::array<mln_result(A)> results;
for (unsigned i = 0; i < accus.nelements(); ++i)
results.append(accus[i]);
@@ -198,7 +190,7 @@ namespace mln
template <typename A, typename J>
inline
- p_array<mlc_unqualif(mln_accu_with(A, mln_psite(J))::result)>
+ util::array<mln_accu_with(A, mln_psite(J))::result>
compute(const Meta_Accumulator<A>&,
const Image<J>& label, mln_value(J) nlabels)
{
diff --git a/milena/sandbox/scribo/demat.hh b/milena/sandbox/scribo/demat.hh
index bba9105..7a35ee9 100644
--- a/milena/sandbox/scribo/demat.hh
+++ b/milena/sandbox/scribo/demat.hh
@@ -73,17 +73,16 @@ namespace scribo
typedef image2d<int_u8> I;
typedef mln_accu_with_(accu::meta::bbox, mln_psite_(I)) A;
- typedef p_array<mlc_unqualif_(A::result)> boxes_t;
+ typedef util::array<A::result> boxes_t;
int_u8 nlabels;
I lbl = labeling::blobs(filter, c4(), nlabels);
boxes_t boxes = labeling::compute(accu::meta::bbox(), lbl, nlabels);
- mln_piter_(boxes_t) p(boxes);
- for_all(p)
+ for (unsigned i = 1; i <= nlabels; ++i)
level::paste(pw::cst(false)
- | p.to_site().to_larger(bbox_larger),
+ | boxes[i].to_larger(bbox_larger),
ima);
}
diff --git a/milena/tests/labeling/compute.cc b/milena/tests/labeling/compute.cc
index e333ab9..070dc6c 100644
--- a/milena/tests/labeling/compute.cc
+++ b/milena/tests/labeling/compute.cc
@@ -37,6 +37,7 @@
#include <mln/accu/count.hh>
#include <mln/accu/sum.hh>
#include <mln/value/int_u8.hh>
+#include <mln/util/array.hh>
int main()
{
@@ -55,7 +56,7 @@ int main()
int_u8 nlabels = 3;
accu::sum<int_u8> sum;
- p_array<float> sums = labeling::compute(sum, ima, ima, nlabels);
+ util::array<float> sums = labeling::compute(sum, ima, ima, nlabels);
mln_assertion(sums[0] == 0);
mln_assertion(sums[1] == 4);
mln_assertion(sums[2] == 8);
@@ -68,7 +69,7 @@ int main()
mln_assertion(sums[3] == 12);
accu::count<mln_site_(image2d<int_u8>)> count;
- p_array<unsigned int> counts = labeling::compute(count, ima, nlabels);
+ util::array<unsigned int> counts = labeling::compute(count, ima, nlabels);
mln_assertion(counts[0] == 18);
mln_assertion(counts[1] == 4);
mln_assertion(counts[2] == 4);
--
1.5.6.5
1
0
15 Oct '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Fix my previous patch (convert::to_image).
* mln/convert/to_image.hh: Fix proto also.
to_image.hh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: mln/convert/to_image.hh
--- mln/convert/to_image.hh (revision 2564)
+++ mln/convert/to_image.hh (working copy)
@@ -125,8 +125,8 @@
mln_image_from(W, mln_weight(W)) to_image(const Weighted_Window<W>& w_win);
/// Convert an histo \p h into an image1d<std::size_t>.
- template <typename S>
- image1d<std::size_t> to_image(const mln::histo::data<S>& h);
+ template <typename T>
+ image1d<T> to_image(const histo::data<T>& h)
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Fix convert::to_image(histo::data<T>).
* mln/convert/to_image.hh: Replace suspicous use of size_t by T.
Now return an image1d<T> instead of image1d<std::size_t>
to_image.hh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: mln/convert/to_image.hh
--- mln/convert/to_image.hh (revision 2563)
+++ mln/convert/to_image.hh (working copy)
@@ -192,12 +192,11 @@
template <typename T>
inline
- image1d<std::size_t> to_image(const histo::data<T>& h)
+ image1d<T> to_image(const histo::data<T>& h)
{
- mln_value(histo::data<T>)
- v_min = h.vset()[0],
+ T v_min = h.vset()[0],
v_max = h.vset()[h.vset().nvalues() - 1];
- image1d<std::size_t> ima(make::box1d(v_min, v_max));
+ image1d<T> ima(make::box1d(v_min, v_max));
for (unsigned i = 0; i < h.vset().nvalues(); ++i)
ima(point1d(i)) = h[i];
return ima;
1
0
15 Oct '08
---
ChangeLog | 49 +++++++++++++++++-
milena/doc/examples/tuto_bis.cc | 8 ++--
milena/doc/tutorial/examples/accu.cc | 4 +-
milena/mln/accu/bbox.hh | 2 +-
milena/mln/accu/count.hh | 34 ++++++------
milena/mln/accu/count_adjacent_vertices.hh | 43 ++++++++-------
milena/mln/accu/height.hh | 44 ++++++++--------
milena/mln/accu/histo.hh | 2 +-
milena/mln/accu/max_h.hh | 4 +-
milena/mln/accu/mean.hh | 26 +++++-----
milena/mln/accu/median_alt.hh | 17 ++++++
milena/mln/accu/median_h.hh | 18 ++++++
milena/mln/accu/nil.hh | 22 ++++----
milena/mln/accu/p.hh | 46 +++++++++-------
milena/mln/accu/rank.hh | 30 +++++-----
milena/mln/accu/rank_bool.hh | 24 ++++----
milena/mln/accu/rank_high_quant.hh | 30 +++++-----
milena/mln/accu/sum.hh | 22 ++++----
milena/mln/accu/tuple.hh | 62 +++++++++++-----------
milena/mln/accu/v.hh | 30 +++++-----
milena/mln/accu/volume.hh | 48 ++++++++--------
milena/mln/canvas/morpho/algebraic_union_find.hh | 4 +-
milena/mln/estim/mean.hh | 2 +-
milena/mln/estim/sum.hh | 2 +-
milena/mln/make/voronoi.hh | 2 +-
milena/mln/morpho/closing_area.hh | 2 +-
milena/mln/morpho/closing_area_on_vertices.hh | 2 +-
milena/mln/morpho/closing_height.hh | 2 +-
milena/mln/morpho/closing_volume.hh | 2 +-
milena/mln/morpho/erosion.spe.hh | 16 +++---
milena/mln/morpho/opening_area.hh | 2 +-
milena/mln/morpho/opening_area_on_vertices.hh | 2 +-
milena/mln/morpho/opening_height.hh | 2 +-
milena/mln/morpho/opening_volume.hh | 2 +-
milena/mln/morpho/rank_filter.hh | 2 +-
milena/tests/accu/all_accus.cc | 16 +++---
milena/tests/accu/count.cc | 4 +-
milena/tests/accu/nil.cc | 2 +-
milena/tests/accu/pair.cc | 2 +-
milena/tests/accu/rank.cc | 18 +++---
milena/tests/accu/tuple.cc | 4 +-
milena/tests/labeling/compute.cc | 4 +-
42 files changed, 374 insertions(+), 285 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3652625..d1e291a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,51 @@
-2008-14-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Remove the useless '_' postfix in all the accumulators.
+ * milena/doc/examples/tuto_bis.cc,
+ * milena/doc/tutorial/examples/accu.cc,
+ * milena/mln/accu/bbox.hh,
+ * milena/mln/accu/count.hh,
+ * milena/mln/accu/count_adjacent_vertices.hh,
+ * milena/mln/accu/height.hh,
+ * milena/mln/accu/histo.hh,
+ * milena/mln/accu/max_h.hh,
+ * milena/mln/accu/mean.hh,
+ * milena/mln/accu/median_alt.hh,
+ * milena/mln/accu/median_h.hh,
+ * milena/mln/accu/nil.hh,
+ * milena/mln/accu/p.hh,
+ * milena/mln/accu/rank.hh,
+ * milena/mln/accu/rank_bool.hh,
+ * milena/mln/accu/rank_high_quant.hh,
+ * milena/mln/accu/sum.hh,
+ * milena/mln/accu/tuple.hh,
+ * milena/mln/accu/v.hh,
+ * milena/mln/accu/volume.hh,
+ * milena/mln/canvas/morpho/algebraic_union_find.hh,
+ * milena/mln/estim/mean.hh,
+ * milena/mln/estim/sum.hh,
+ * milena/mln/make/voronoi.hh,
+ * milena/mln/morpho/closing_area.hh,
+ * milena/mln/morpho/closing_area_on_vertices.hh,
+ * milena/mln/morpho/closing_height.hh,
+ * milena/mln/morpho/closing_volume.hh,
+ * milena/mln/morpho/erosion.spe.hh,
+ * milena/mln/morpho/opening_area.hh,
+ * milena/mln/morpho/opening_area_on_vertices.hh,
+ * milena/mln/morpho/opening_height.hh,
+ * milena/mln/morpho/opening_volume.hh,
+ * milena/mln/morpho/rank_filter.hh,
+ * milena/tests/accu/all_accus.cc,
+ * milena/tests/accu/count.cc,
+ * milena/tests/accu/nil.cc,
+ * milena/tests/accu/pair.cc,
+ * milena/tests/accu/rank.cc,
+ * milena/tests/accu/tuple.cc,
+ * milena/tests/labeling/compute.cc:
+ Update.
+
+
+2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
Update accus to make them work with the new q_result typedef.
* milena/mln/accu/bbox.hh,
diff --git a/milena/doc/examples/tuto_bis.cc b/milena/doc/examples/tuto_bis.cc
index 48a79d4..047ee86 100644
--- a/milena/doc/examples/tuto_bis.cc
+++ b/milena/doc/examples/tuto_bis.cc
@@ -50,7 +50,7 @@ namespace mln
ima.at(nrows, c) = v;
}
}
-
+
} // mln::border
namespace accu
@@ -63,7 +63,7 @@ namespace mln
const Image<L>& label_,
V& v)
{
- mlc_is_a(A_, Meta_Accumulator)::check();
+ mlc_is_a(A_, Meta_Accumulator)::check();
trace::entering("accu::compute");
const I& input = exact(input_);
@@ -94,7 +94,7 @@ namespace mln
{
mln_concrete(I) output;
initialize(output, input);
- accu::min_max_<mln_value(I)> mm;
+ accu::min_max<mln_value(I)> mm;
mln_piter(I) p(input.domain());
mln_niter(N) n(nbh, p);
@@ -117,7 +117,7 @@ namespace mln
mln_concrete(I) output;
initialize(output, input);
- accu::max_<V> m;
+ accu::max<V> m;
mln_piter(I) p(input.domain());
mln_niter(N) n(nbh, p);
diff --git a/milena/doc/tutorial/examples/accu.cc b/milena/doc/tutorial/examples/accu.cc
index 20fd6cb..a0c68bd 100644
--- a/milena/doc/tutorial/examples/accu.cc
+++ b/milena/doc/tutorial/examples/accu.cc
@@ -5,9 +5,9 @@ int main()
{
using namespace mln;
- mlc_bool(accu::mean_<int>::proxy_level == 1)::check();
+ mlc_bool(accu::mean<int>::proxy_level == 1)::check();
- accu::mean_<int> m;
+ accu::mean<int> m;
m.take(100);
m.take(2);
mln_assertion(m == 51);
diff --git a/milena/mln/accu/bbox.hh b/milena/mln/accu/bbox.hh
index ce143a4..4066428 100644
--- a/milena/mln/accu/bbox.hh
+++ b/milena/mln/accu/bbox.hh
@@ -88,7 +88,7 @@ namespace mln
template <typename T>
struct with
{
- typedef mln::accu::bbox<T> ret;
+ typedef accu::bbox<T> ret;
};
};
diff --git a/milena/mln/accu/count.hh b/milena/mln/accu/count.hh
index c2c1f02..f13462c 100644
--- a/milena/mln/accu/count.hh
+++ b/milena/mln/accu/count.hh
@@ -43,17 +43,17 @@ namespace mln
/// \brief Generic counter accumulator class.
/// The parameter \a T is the type to be count.
template <typename T>
- struct count_ : public mln::accu::internal::base< std::size_t , count_<T> >
+ struct count : public mln::accu::internal::base< std::size_t , count<T> >
{
typedef T argument;
- count_();
+ count();
/// Manipulators.
/// \{
void init();
void take(const argument&);
- void take(const count_<T>& other);
+ void take(const count<T>& other);
/// Force the value of the counter to \a c.
void set_value(std::size_t c);
@@ -68,7 +68,7 @@ namespace mln
protected:
/// The value of the counter.
- std::size_t count__;
+ std::size_t count_;
};
namespace meta
@@ -80,7 +80,7 @@ namespace mln
template <typename T>
struct with
{
- typedef count_<T> ret;
+ typedef accu::count<T> ret;
};
};
@@ -91,7 +91,7 @@ namespace mln
template <typename T>
inline
- count_<T>::count_()
+ count<T>::count()
{
init();
}
@@ -99,47 +99,47 @@ namespace mln
template <typename T>
inline
void
- count_<T>::init()
+ count<T>::init()
{
- count__ = 0;
+ count_ = 0;
}
template <typename T>
inline
void
- count_<T>::take(const argument&)
+ count<T>::take(const argument&)
{
- ++count__;
+ ++count_;
}
template <typename T>
inline
void
- count_<T>::take(const count_<T>& other)
+ count<T>::take(const count<T>& other)
{
- count__ += other.count__;
+ count_ += other.count_;
}
template <typename T>
inline
std::size_t
- count_<T>::to_result() const
+ count<T>::to_result() const
{
- return count__;
+ return count_;
}
template <typename T>
inline
void
- count_<T>::set_value(std::size_t c)
+ count<T>::set_value(std::size_t c)
{
- count__ = c;
+ count_ = c;
}
template <typename T>
inline
bool
- count_<T>::is_valid() const
+ count<T>::is_valid() const
{
return true;
}
diff --git a/milena/mln/accu/count_adjacent_vertices.hh b/milena/mln/accu/count_adjacent_vertices.hh
index 58e7921..a4b6b51 100644
--- a/milena/mln/accu/count_adjacent_vertices.hh
+++ b/milena/mln/accu/count_adjacent_vertices.hh
@@ -53,21 +53,21 @@ namespace mln
/// This accumulator is used by mln::closing_area_on_vertices and
/// mln::opening_area_on_vertices.
template <typename P, typename V>
- struct count_adjacent_vertices_
+ struct count_adjacent_vertices
: public mln::accu::internal::base< std::size_t,
- count_adjacent_vertices_<P, V> >
+ count_adjacent_vertices<P, V> >
{
typedef mln::util::pix< mln::line_graph_image<P, V> > argument;
- count_adjacent_vertices_();
+ count_adjacent_vertices();
/// Manipulators.
/// \{
void init();
void take(const argument& arg);
- void take(const count_adjacent_vertices_<P, V>& other);
+ void take(const count_adjacent_vertices<P, V>& other);
- /// Force the value of the counter to \a c.
+ /// Force the value of the counter to \a c.
void set_value(std::size_t c);
/// \}
@@ -86,23 +86,28 @@ namespace mln
};
- /// \brief Meta accumulator for count_adjacent_vertices.
- struct count_adjacent_vertices
- : public Meta_Accumulator< count_adjacent_vertices >
+ namespace meta
{
- template <typename P, typename V>
- struct with
+
+ /// \brief Meta accumulator for count_adjacent_vertices.
+ struct count_adjacent_vertices
+ : public Meta_Accumulator< count_adjacent_vertices >
{
- typedef count_adjacent_vertices_<P, V> ret;
+ template <typename P, typename V>
+ struct with
+ {
+ typedef accu::count_adjacent_vertices<P, V> ret;
+ };
};
- };
+
+ } // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
template <typename P, typename V>
inline
- count_adjacent_vertices_<P, V>::count_adjacent_vertices_()
+ count_adjacent_vertices<P, V>::count_adjacent_vertices()
{
init();
}
@@ -110,7 +115,7 @@ namespace mln
template <typename P, typename V>
inline
void
- count_adjacent_vertices_<P, V>::init()
+ count_adjacent_vertices<P, V>::init()
{
vertices_.clear();
update_();
@@ -119,7 +124,7 @@ namespace mln
template <typename P, typename V>
inline
void
- count_adjacent_vertices_<P, V>::take(const argument& arg)
+ count_adjacent_vertices<P, V>::take(const argument& arg)
{
vertices_.insert(arg.p().first_id());
vertices_.insert(arg.p().second_id());
@@ -129,7 +134,7 @@ namespace mln
template <typename P, typename V>
inline
void
- count_adjacent_vertices_<P, V>::take(const count_adjacent_vertices_<P, V>& other)
+ count_adjacent_vertices<P, V>::take(const count_adjacent_vertices<P, V>& other)
{
vertices_.insert (other.vertices_.begin(), other.vertices_.end());
update_();
@@ -138,7 +143,7 @@ namespace mln
template <typename P, typename V>
inline
std::size_t
- count_adjacent_vertices_<P, V>::to_result() const
+ count_adjacent_vertices<P, V>::to_result() const
{
return count__;
}
@@ -146,7 +151,7 @@ namespace mln
template <typename P, typename V>
inline
void
- count_adjacent_vertices_<P, V>::set_value(std::size_t c)
+ count_adjacent_vertices<P, V>::set_value(std::size_t c)
{
count__ = c;
/// Reset the other member.
@@ -156,7 +161,7 @@ namespace mln
template <typename P, typename V>
inline
void
- count_adjacent_vertices_<P, V>::update_()
+ count_adjacent_vertices<P, V>::update_()
{
count__ = vertices_.size();
}
diff --git a/milena/mln/accu/height.hh b/milena/mln/accu/height.hh
index 80dc28d..def9d5d 100644
--- a/milena/mln/accu/height.hh
+++ b/milena/mln/accu/height.hh
@@ -35,7 +35,7 @@
This accumulator uses an mln::util::pix (pixel) to update the
height information of the component.
- The class mln/accu/height_ is not a general-purpose accumulator;
+ The class mln/accu/height is not a general-purpose accumulator;
it is used to implement height-based connected filters.
\see mln::morpho::closing_height
\see mln::morpho::opening_height */
@@ -58,8 +58,8 @@ namespace mln
/// The parameter \p I is the image type on which the accumulator
/// of pixels is built.
template <typename I>
- struct height_
- : public mln::accu::internal::base< std::size_t , height_<I> >
+ struct height
+ : public mln::accu::internal::base< std::size_t , height<I> >
{
/// \brief The accumulated data type.
///
@@ -71,13 +71,13 @@ namespace mln
/// The value type associated to the pixel type.
typedef typename argument::value value;
- height_();
+ height();
/// Manipulators.
/// \{
void init();
void take(const argument&);
- void take(const height_<I>& other);
+ void take(const height<I>& other);
/// Force the value of the counter to \a h.
void set_value(std::size_t h);
@@ -96,7 +96,7 @@ namespace mln
/// The maximum level in the component.
value max_level__;
/// The height of the component.
- std::size_t height__;
+ std::size_t height_;
};
@@ -107,10 +107,10 @@ namespace mln
struct height : public Meta_Accumulator< height >
{
template <typename I>
- struct with
- {
- typedef height_<I> ret;
- };
+ struct with
+ {
+ typedef accu::height<I> ret;
+ };
};
} // end of namespace mln::accu::meta
@@ -119,7 +119,7 @@ namespace mln
template <typename I>
inline
- height_<I>::height_()
+ height<I>::height()
{
init();
}
@@ -127,47 +127,47 @@ namespace mln
template <typename I>
inline
void
- height_<I>::init()
+ height<I>::init()
{
min_level__ = mln_max(value);
max_level__ = mln_min(value);
- height__ = 0;
+ height_ = 0;
}
template <typename I>
inline
void
- height_<I>::take(const argument& t)
+ height<I>::take(const argument& t)
{
min_level__ = math::min(min_level__, t.v());
max_level__ = math::max(max_level__, t.v());
- height__ = max_level__ - min_level__;
+ height_ = max_level__ - min_level__;
}
template <typename I>
inline
void
- height_<I>::take(const height_<I>& other)
+ height<I>::take(const height<I>& other)
{
min_level__ = math::min(min_level__, other.min_level__);
max_level__ = math::max(max_level__, other.max_level__);
- height__ = max_level__ - min_level__;
+ height_ = max_level__ - min_level__;
}
template <typename I>
inline
std::size_t
- height_<I>::to_result() const
+ height<I>::to_result() const
{
- return height__;
+ return height_;
}
template <typename I>
inline
void
- height_<I>::set_value(std::size_t h)
+ height<I>::set_value(std::size_t h)
{
- height__ = h;
+ height_ = h;
// Reset the other members.
min_level__ = mln_max(value);
max_level__ = mln_min(value);
@@ -176,7 +176,7 @@ namespace mln
template <typename I>
inline
bool
- height_<I>::is_valid() const
+ height<I>::is_valid() const
{
return true;
}
diff --git a/milena/mln/accu/histo.hh b/milena/mln/accu/histo.hh
index ddf3aec..6a653fb 100644
--- a/milena/mln/accu/histo.hh
+++ b/milena/mln/accu/histo.hh
@@ -106,7 +106,7 @@ namespace mln
template <typename V>
struct with
{
- typedef mln::accu::histo<V> ret;
+ typedef accu::histo<V> ret;
};
};
diff --git a/milena/mln/accu/max_h.hh b/milena/mln/accu/max_h.hh
index 6d861df..edf16a0 100644
--- a/milena/mln/accu/max_h.hh
+++ b/milena/mln/accu/max_h.hh
@@ -101,9 +101,7 @@ namespace mln
namespace meta
{
- /*!
- * \brief Meta accumulator for max.
- */
+ /// Meta accumulator for max.
struct max_h : public Meta_Accumulator< max_h >
{
template <typename T>
diff --git a/milena/mln/accu/mean.hh b/milena/mln/accu/mean.hh
index 09fa92c..855bd65 100644
--- a/milena/mln/accu/mean.hh
+++ b/milena/mln/accu/mean.hh
@@ -58,17 +58,17 @@ namespace mln
template <typename T,
typename S = mln_sum(T),
typename M = S>
- struct mean_ : public mln::accu::internal::base< M , mean_<T,S,M> >
+ struct mean : public mln::accu::internal::base< M , mean<T,S,M> >
{
typedef T argument;
- mean_();
+ mean();
/// Manipulators.
/// \{
void init();
void take(const argument& t);
- void take(const mean_<T,S,M>& other);
+ void take(const mean<T,S,M>& other);
/// \}
/// Get the value of the accumulator.
@@ -80,14 +80,14 @@ namespace mln
protected:
- accu::count_<T> count_;
- accu::sum_<T,S> sum_;
+ accu::count<T> count_;
+ accu::sum<T,S> sum_;
};
template <typename I, typename S, typename M>
- struct mean_< util::pix<I>, S,M >;
+ struct mean< util::pix<I>, S,M >;
namespace meta
@@ -101,7 +101,7 @@ namespace mln
typename M = S >
struct with
{
- typedef mean_<T,S,M> ret;
+ typedef accu::mean<T,S,M> ret;
};
};
@@ -112,7 +112,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
- mean_<T,S,M>::mean_()
+ mean<T,S,M>::mean()
{
init();
}
@@ -120,7 +120,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
void
- mean_<T,S,M>::init()
+ mean<T,S,M>::init()
{
count_.init();
sum_.init();
@@ -128,7 +128,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
- void mean_<T,S,M>::take(const argument& t)
+ void mean<T,S,M>::take(const argument& t)
{
count_.take(t);
sum_.take(t);
@@ -137,7 +137,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
void
- mean_<T,S,M>::take(const mean_<T,S,M>& other)
+ mean<T,S,M>::take(const mean<T,S,M>& other)
{
count_.take(other.count_);
sum_.take(other.sum_);
@@ -146,7 +146,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
M
- mean_<T,S,M>::to_result() const
+ mean<T,S,M>::to_result() const
{
return sum_.to_result() / count_.to_result();
}
@@ -154,7 +154,7 @@ namespace mln
template <typename T, typename S, typename M>
inline
bool
- mean_<T,S,M>::is_valid() const
+ mean<T,S,M>::is_valid() const
{
return count_.to_result() != 0;
}
diff --git a/milena/mln/accu/median_alt.hh b/milena/mln/accu/median_alt.hh
index d22206b..7434d06 100644
--- a/milena/mln/accu/median_alt.hh
+++ b/milena/mln/accu/median_alt.hh
@@ -96,6 +96,23 @@ namespace mln
};
+ namespace meta
+ {
+
+ /// Meta accumulator for median_alt.
+
+ struct median_alt : public Meta_Accumulator< median_alt >
+ {
+ template <typename V>
+ struct with
+ {
+ typedef accu::median_alt<V> ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta
+
+
template <typename T>
struct median_alt_on : public median_alt< value::set<T> >
{
diff --git a/milena/mln/accu/median_h.hh b/milena/mln/accu/median_h.hh
index de863f9..c3a0520 100644
--- a/milena/mln/accu/median_h.hh
+++ b/milena/mln/accu/median_h.hh
@@ -92,6 +92,24 @@ namespace mln
};
+ namespace meta
+ {
+
+ /// Meta accumulator for median_h.
+
+ struct median_h : public Meta_Accumulator< median_h >
+ {
+ template <typename V>
+ struct with
+ {
+ typedef accu::median_h<V> ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta
+
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename V>
diff --git a/milena/mln/accu/nil.hh b/milena/mln/accu/nil.hh
index cc93ff3..0887715 100644
--- a/milena/mln/accu/nil.hh
+++ b/milena/mln/accu/nil.hh
@@ -51,18 +51,18 @@ namespace mln
* \brief Define an accumulator that does nothing.
*/
template <typename T>
- struct nil_ : public mln::accu::internal::base< util::ignore , nil_<T> >
+ struct nil : public mln::accu::internal::base< util::ignore , nil<T> >
{
typedef util::eat argument;
- nil_();
+ nil();
/// Manipulators.
/// \{
void init();
void take_as_init(const argument&);
void take(const argument&);
- void take(const nil_<T>&);
+ void take(const nil<T>&);
/// \}
/// Get the value of the accumulator.
@@ -84,7 +84,7 @@ namespace mln
template <typename V>
struct with
{
- typedef nil_<V> ret;
+ typedef accu::nil<V> ret;
};
};
@@ -95,42 +95,42 @@ namespace mln
template <typename T>
inline
- nil_<T>::nil_()
+ nil<T>::nil()
{
}
template <typename T>
inline
void
- nil_<T>::init()
+ nil<T>::init()
{
}
template <typename T>
inline
void
- nil_<T>::take(const argument&)
+ nil<T>::take(const argument&)
{
}
template <typename T>
inline
void
- nil_<T>::take_as_init(const argument&)
+ nil<T>::take_as_init(const argument&)
{
}
template <typename T>
inline
void
- nil_<T>::take(const nil_<T>&)
+ nil<T>::take(const nil<T>&)
{
}
template <typename T>
inline
util::ignore
- nil_<T>::to_result() const
+ nil<T>::to_result() const
{
return util::ignore();
}
@@ -138,7 +138,7 @@ namespace mln
template <typename T>
inline
bool
- nil_<T>::is_valid() const
+ nil<T>::is_valid() const
{
return true;
}
diff --git a/milena/mln/accu/p.hh b/milena/mln/accu/p.hh
index 53bc001..bcb36c2 100644
--- a/milena/mln/accu/p.hh
+++ b/milena/mln/accu/p.hh
@@ -52,19 +52,19 @@ namespace mln
* The parameter \c V is the type of values.
*/
template <typename A>
- struct p_ : public mln::accu::internal::base< const mln_result(A)& , p_<A> >
+ struct p : public mln::accu::internal::base< const mln_result(A)& , p<A> >
{
typedef mln_argument(A) argument;
- p_();
- p_(const A& a);
+ p();
+ p(const A& a);
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const p_<A>& other);
+ void take(const p<A>& other);
/// \}
/// Get the value of the accumulator.
@@ -79,32 +79,36 @@ namespace mln
};
- /*!
- * \brief Meta accumulator for p.
- */
- template <typename mA>
- struct p : public Meta_Accumulator< p<mA> >
+ namespace meta
{
- template <typename V>
- struct with
+
+ /// Meta accumulator for p.
+
+ template <typename mA>
+ struct p : public Meta_Accumulator< p<mA> >
{
- typedef mln_accu_with(mA, mln_psite(V)) ret;
+ template <typename V>
+ struct with
+ {
+ typedef p<V> ret;
+ };
};
- };
+
+ } // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
template <typename A>
inline
- p_<A>::p_()
+ p<A>::p()
{
init();
}
template <typename A>
inline
- p_<A>::p_(const A& a)
+ p<A>::p(const A& a)
: a_(a)
{
init();
@@ -113,7 +117,7 @@ namespace mln
template <typename A>
inline
void
- p_<A>::init()
+ p<A>::init()
{
a_.init();
}
@@ -121,7 +125,7 @@ namespace mln
template <typename A>
inline
void
- p_<A>::take_as_init(const argument& t)
+ p<A>::take_as_init(const argument& t)
{
a_.take_as_init(t.p()); // FIXME: Generalize with "psite(t)".
}
@@ -129,7 +133,7 @@ namespace mln
template <typename A>
inline
void
- p_<A>::take(const argument& t)
+ p<A>::take(const argument& t)
{
a_.take(t.p());
}
@@ -137,7 +141,7 @@ namespace mln
template <typename A>
inline
void
- p_<A>::take(const p_<A>& other)
+ p<A>::take(const p<A>& other)
{
a_.take(other.a_);
}
@@ -145,7 +149,7 @@ namespace mln
template <typename A>
inline
const mln_result(A)&
- p_<A>::to_result() const
+ p<A>::to_result() const
{
return a_.to_result();
}
@@ -153,7 +157,7 @@ namespace mln
template <typename A>
inline
bool
- p_<A>::is_valid() const
+ p<A>::is_valid() const
{
return a_.is_valid();
}
diff --git a/milena/mln/accu/rank.hh b/milena/mln/accu/rank.hh
index 005d934..c29a56e 100644
--- a/milena/mln/accu/rank.hh
+++ b/milena/mln/accu/rank.hh
@@ -53,18 +53,18 @@ namespace mln
* The parameter \c T is the type of values.
*/
template <typename T>
- struct rank_ : public mln::accu::internal::base< const T&, rank_<T> >
+ struct rank : public mln::accu::internal::base< const T&, rank<T> >
{
typedef T argument;
typedef mln::value::set<T> S;
- rank_(unsigned k, unsigned n);
+ rank(unsigned k, unsigned n);
/// Manipulators.
/// \{
void init();
void take(const argument& t);
- void take(const rank_<T>& other);
+ void take(const rank<T>& other);
void untake(const argument& t);
/// \}
@@ -98,7 +98,7 @@ namespace mln
};
- template <typename I> struct rank_< util::pix<I> >;
+ template <typename I> struct rank< util::pix<I> >;
namespace meta
@@ -111,7 +111,7 @@ namespace mln
template <typename T>
struct with
{
- typedef rank_<T> ret;
+ typedef accu::rank<T> ret;
};
};
@@ -124,7 +124,7 @@ namespace mln
template <typename T>
inline
- rank_<T>::rank_(unsigned k, unsigned n)
+ rank<T>::rank(unsigned k, unsigned n)
: k_(k),
n_(n),
h_(),
@@ -138,7 +138,7 @@ namespace mln
template <typename T>
inline
- void rank_<T>::take(const argument& t)
+ void rank<T>::take(const argument& t)
{
h_.take(t);
@@ -154,7 +154,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::take(const rank_<T>& other)
+ rank<T>::take(const rank<T>& other)
{
// h_
h_.take(other.h_);
@@ -175,7 +175,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::untake(const argument& t)
+ rank<T>::untake(const argument& t)
{
mln_precondition(h_(t) != 0);
h_.untake(t);
@@ -192,7 +192,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::update_() const
+ rank<T>::update_() const
{
valid_ = true;
@@ -218,7 +218,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::go_minus_() const
+ rank<T>::go_minus_() const
{
do
{
@@ -235,7 +235,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::go_plus_() const
+ rank<T>::go_plus_() const
{
do
{
@@ -252,7 +252,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::init()
+ rank<T>::init()
{
h_.init();
sum_minus_ = 0;
@@ -266,7 +266,7 @@ namespace mln
template <typename T>
inline
const T&
- rank_<T>::to_result() const
+ rank<T>::to_result() const
{
if (! valid_)
update_();
@@ -276,7 +276,7 @@ namespace mln
template <typename T>
inline
bool
- rank_<T>::is_valid() const
+ rank<T>::is_valid() const
{
return valid_;
}
diff --git a/milena/mln/accu/rank_bool.hh b/milena/mln/accu/rank_bool.hh
index a60ff7e..879f0d1 100644
--- a/milena/mln/accu/rank_bool.hh
+++ b/milena/mln/accu/rank_bool.hh
@@ -28,7 +28,7 @@
#ifndef MLN_ACCU_RANK_BOOL_HH
# define MLN_ACCU_RANK_BOOL_HH
-/*! \file mln/accu/rank_bool.hh
+/*! \file mln/accu/rankbool.hh
*
* \brief Define an rank accumulator.
*/
@@ -47,24 +47,24 @@ namespace mln
{
// Fwd declaration.
- template <typename T> struct rank_;
+ template <typename T> struct rank;
/*! \brief rank accumulator class for boolean.
*
*/
template <>
- struct rank_<bool> : public mln::accu::internal::base< bool, rank_<bool> >
+ struct rank<bool> : public mln::accu::internal::base< bool, rank<bool> >
{
typedef bool argument;
- rank_(unsigned k, unsigned n);
+ rank(unsigned k, unsigned n);
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const rank_<bool>& other);
+ void take(const rank<bool>& other);
/// \}
/// Get the value of the accumulator.
@@ -84,7 +84,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
inline
- rank_<bool>::rank_(unsigned k, unsigned n)
+ rank<bool>::rank(unsigned k, unsigned n)
: nfalse_(0),
k_(k),
n_(n)
@@ -96,21 +96,21 @@ namespace mln
inline
void
- rank_<bool>::init()
+ rank<bool>::init()
{
nfalse_ = 0;
}
inline
- void rank_<bool>::take_as_init(const argument& t)
+ void rank<bool>::take_as_init(const argument& t)
{
nfalse_ += !t;
}
inline
- void rank_<bool>::take(const argument& t)
+ void rank<bool>::take(const argument& t)
{
nfalse_ += !t;
}
@@ -118,7 +118,7 @@ namespace mln
inline
void
- rank_<bool>::take(const rank_<bool>& other)
+ rank<bool>::take(const rank<bool>& other)
{
nfalse_ += other.nfalse_;
}
@@ -126,7 +126,7 @@ namespace mln
inline
bool
- rank_<bool>::to_result() const
+ rank<bool>::to_result() const
{
mln_assertion(nfalse_ <= n_);
return k_ >= nfalse_;
@@ -134,7 +134,7 @@ namespace mln
inline
bool
- rank_<bool>::is_valid() const
+ rank<bool>::is_valid() const
{
return nfalse_ <= n_;
}
diff --git a/milena/mln/accu/rank_high_quant.hh b/milena/mln/accu/rank_high_quant.hh
index 95c56ec..b4d69a1 100644
--- a/milena/mln/accu/rank_high_quant.hh
+++ b/milena/mln/accu/rank_high_quant.hh
@@ -52,18 +52,18 @@ namespace mln
* The parameter \c T is the type of values.
*/
template <typename T>
- struct rank_ : public mln::accu::internal::base< const T&, rank_<T> >
+ struct rank : public mln::accu::internal::base< const T&, rank<T> >
{
typedef T argument;
- rank_(unsigned k, unsigned n);
+ rank(unsigned k, unsigned n);
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const rank_<T>& other);
+ void take(const rank<T>& other);
void sort();
/// \}
@@ -83,7 +83,7 @@ namespace mln
};
- template <typename I> struct rank_< util::pix<I> >;
+ template <typename I> struct rank< util::pix<I> >;
namespace meta
@@ -96,7 +96,7 @@ namespace mln
template <typename T>
struct with
{
- typedef rank_<T> ret;
+ typedef accu::rank<T> ret;
};
};
@@ -107,7 +107,7 @@ namespace mln
template <typename T>
inline
- rank_<T>::rank_(unsigned k, unsigned n)
+ rank<T>::rank(unsigned k, unsigned n)
: k_(k),
n_(n),
is_sorted_(false)
@@ -119,14 +119,14 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::init()
+ rank<T>::init()
{
elts_.clear();
}
template <typename T>
inline
- void rank_<T>::take_as_init(const argument& t)
+ void rank<T>::take_as_init(const argument& t)
{
elts_.push_back(t);
is_sorted_ = false;
@@ -134,7 +134,7 @@ namespace mln
template <typename T>
inline
- void rank_<T>::take(const argument& t)
+ void rank<T>::take(const argument& t)
{
elts_.push_back(t);
is_sorted_ = false;
@@ -143,7 +143,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::take(const rank_<T>& other)
+ rank<T>::take(const rank<T>& other)
{
elts_.insert(elts_.end(),
other.elts_.begin(),
@@ -154,9 +154,9 @@ namespace mln
template <typename T>
inline
const T&
- rank_<T>::to_result() const
+ rank<T>::to_result() const
{
- const_cast<rank_<T>&>(*this).sort();
+ const_cast<rank<T>&>(*this).sort();
if (n_ == elts_.size())
return elts_[k_];
@@ -168,7 +168,7 @@ namespace mln
template <typename T>
inline
bool
- rank_<T>::is_valid() const
+ rank<T>::is_valid() const
{
return true;
}
@@ -176,7 +176,7 @@ namespace mln
template <typename T>
inline
void
- rank_<T>::sort()
+ rank<T>::sort()
{
if (! is_sorted_)
{
@@ -191,6 +191,6 @@ namespace mln
} // end of namespace mln
-#include <mln/accu/rank_bool.hh>
+#include <mln/accu/rankbool.hh>
#endif // ! MLN_ACCU_RANK_HH
diff --git a/milena/mln/accu/sum.hh b/milena/mln/accu/sum.hh
index 484def9..fcfc3ba 100644
--- a/milena/mln/accu/sum.hh
+++ b/milena/mln/accu/sum.hh
@@ -57,17 +57,17 @@ namespace mln
* \c S is the summation type (property) of \c T.
*/
template <typename T, typename S = mln_sum(T)>
- struct sum_ : public mln::accu::internal::base< const S&, sum_<T,S> >
+ struct sum : public mln::accu::internal::base< const S&, sum<T,S> >
{
typedef T argument;
- sum_();
+ sum();
/// Manipulators.
/// \{
void init();
void take(const argument& t);
- void take(const sum_<T,S>& other);
+ void take(const sum<T,S>& other);
/// \}
/// Get the value of the accumulator.
@@ -84,7 +84,7 @@ namespace mln
template <typename I, typename S>
- struct sum_< util::pix<I>, S >;
+ struct sum< util::pix<I>, S >;
namespace meta
{
@@ -95,7 +95,7 @@ namespace mln
template <typename T, typename S = mln_sum(T)>
struct with
{
- typedef sum_<T, S> ret;
+ typedef accu::sum<T, S> ret;
};
};
@@ -106,7 +106,7 @@ namespace mln
template <typename T, typename S>
inline
- sum_<T,S>::sum_()
+ sum<T,S>::sum()
{
init();
}
@@ -114,14 +114,14 @@ namespace mln
template <typename T, typename S>
inline
void
- sum_<T,S>::init()
+ sum<T,S>::init()
{
s_ = literal::zero;
}
template <typename T, typename S>
inline
- void sum_<T,S>::take(const argument& t)
+ void sum<T,S>::take(const argument& t)
{
s_ += t;
}
@@ -129,7 +129,7 @@ namespace mln
template <typename T, typename S>
inline
void
- sum_<T,S>::take(const sum_<T,S>& other)
+ sum<T,S>::take(const sum<T,S>& other)
{
s_ += other.s_;
}
@@ -137,7 +137,7 @@ namespace mln
template <typename T, typename S>
inline
const S&
- sum_<T,S>::to_result() const
+ sum<T,S>::to_result() const
{
return s_;
}
@@ -145,7 +145,7 @@ namespace mln
template <typename T, typename S>
inline
bool
- sum_<T,S>::is_valid() const
+ sum<T,S>::is_valid() const
{
return true;
}
diff --git a/milena/mln/accu/tuple.hh b/milena/mln/accu/tuple.hh
index 00300e2..f70882b 100644
--- a/milena/mln/accu/tuple.hh
+++ b/milena/mln/accu/tuple.hh
@@ -47,7 +47,7 @@
# include "boost/preprocessor/repetition/enum_params.hpp"
# include "boost/preprocessor/repetition/enum_params_with_a_default.hpp"
-# define RESULT_ACCU(z, n, data) BOOST_PP_COMMA_IF(n) typename internal::tuple_helper_<T ## n>::result
+# define RESULT_ACCU(z, n, data) BOOST_PP_COMMA_IF(n) typename internal::tuplehelper_<T ## n>::result
# define ARG(z, n, data) BOOST_PP_COMMA_IF(n) const T ## n& p ## n = T ## n()
# define BOOST_PP_LOCAL_MACRO(n) typedef mln_accu_with(T ## n, A) AT ## n;
# define BOOST_PP_LOCAL_LIMITS (0, 9)
@@ -61,8 +61,8 @@ namespace mln
namespace internal
{
// Fwd decl.
- template <typename T> struct tuple_helper_;
- template <unsigned n, typename T> struct tuple_helper;
+ template <typename T> struct tuplehelper_;
+ template <unsigned n, typename T> struct tuplehelper;
}
/*! \brief Generic tuple of accumulators.
@@ -71,23 +71,23 @@ namespace mln
*
*/
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(10, typename T, boost::tuples::null_type)>
- struct tuple_
- : public mln::accu::internal::base< boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !) >, tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)> >
+ struct tuple
+ : public mln::accu::internal::base< boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !) >, tuple<A, n, BOOST_PP_ENUM_PARAMS(10, T)> >
{
typedef A argument;
typedef boost::tuple< BOOST_PP_REPEAT(10, RESULT_ACCU, Le Ricard ya que ca de vrai !)> res;
typedef boost::tuple< BOOST_PP_ENUM_PARAMS(10, T)> intern;
- typedef tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)> self;
+ typedef tuple<A, n, BOOST_PP_ENUM_PARAMS(10, T)> self;
- tuple_();
+ tuple();
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, T)>& other);
+ void take(const tuple<A, n, BOOST_PP_ENUM_PARAMS(10, T)>& other);
/// \}
/// Get the value of the accumulator.
@@ -115,7 +115,7 @@ namespace mln
{
# include BOOST_PP_LOCAL_ITERATE()
- typedef tuple_<A, n, BOOST_PP_ENUM_PARAMS(10, AT)> ret;
+ typedef accu::tuple<A, n, BOOST_PP_ENUM_PARAMS(10, AT)> ret;
};
};
@@ -128,53 +128,53 @@ namespace mln
{
template <typename T>
- struct tuple_helper_
+ struct tuplehelper_
{
typedef typename T::result result;
};
template <>
- struct tuple_helper_<boost::tuples::null_type>
+ struct tuplehelper_<boost::tuples::null_type>
{
typedef boost::tuples::null_type result;
};
template <unsigned n, typename T>
- struct tuple_helper
+ struct tuplehelper
{
static void init(typename T::intern& a)
{
boost::get<n - 1>(a).init();
- tuple_helper<n - 1, T>::init(a);
+ tuplehelper<n - 1, T>::init(a);
}
static void take_as_init(typename T::intern& a, const typename T::argument& argument)
{
boost::get<n - 1>(a).take_as_init(argument);
- tuple_helper<n - 1, T>::take_as_init(a, argument);
+ tuplehelper<n - 1, T>::take_as_init(a, argument);
}
static void take(typename T::intern& a, const typename T::argument& argument)
{
boost::get<n - 1>(a).take(argument);
- tuple_helper<n - 1, T>::take(a, argument);
+ tuplehelper<n - 1, T>::take(a, argument);
}
static void take(typename T::intern& a, const typename T::intern& other)
{
boost::get<n - 1>(a).take(boost::get<n - 1>(other));
- tuple_helper<n - 1, T>::take(a, other);
+ tuplehelper<n - 1, T>::take(a, other);
}
static void to_result(const typename T::intern& a, typename T::result& res)
{
boost::get<n - 1>(res) = boost::get<n - 1>(a).to_result();
- tuple_helper<n - 1, T>::to_result(a, res);
+ tuplehelper<n - 1, T>::to_result(a, res);
}
};
template <typename T>
- struct tuple_helper<0, T>
+ struct tuplehelper<0, T>
{
static void init(typename T::intern&) {}
static void take_as_init(typename T::intern&, const typename T::argument&) {}
@@ -186,7 +186,7 @@ namespace mln
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::tuple_()
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::tuple()
{
init();
}
@@ -194,49 +194,49 @@ namespace mln
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
void
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::init()
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::init()
{
- internal::tuple_helper<n, self>::init(this->a_);
+ internal::tuplehelper<n, self>::init(this->a_);
}
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
void
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take_as_init(const argument& t)
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take_as_init(const argument& t)
{
- internal::tuple_helper<n, self>::take_as_init(this->a_, t);
+ internal::tuplehelper<n, self>::take_as_init(this->a_, t);
}
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
void
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const argument& t)
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const argument& t)
{
- internal::tuple_helper<n, self>::take(this->a_, t);
+ internal::tuplehelper<n, self>::take(this->a_, t);
}
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
void
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >& other)
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::take(const tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >& other)
{
- internal::tuple_helper<n, self>::take(this->a_, other.a_);
+ internal::tuplehelper<n, self>::take(this->a_, other.a_);
}
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
- typename tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::res
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::to_result() const
+ typename tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::res
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::to_result() const
{
res tmp;
- internal::tuple_helper<n, self>::to_result(this->a_, tmp);
+ internal::tuplehelper<n, self>::to_result(this->a_, tmp);
return tmp;
}
template <typename A, unsigned n, BOOST_PP_ENUM_PARAMS(10, typename T)>
inline
bool
- tuple_<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::is_valid() const
+ tuple<A,n,BOOST_PP_ENUM_PARAMS(10,T) >::is_valid() const
{
return true;
}
diff --git a/milena/mln/accu/v.hh b/milena/mln/accu/v.hh
index af00fe2..a7f4cdf 100644
--- a/milena/mln/accu/v.hh
+++ b/milena/mln/accu/v.hh
@@ -49,19 +49,19 @@ namespace mln
/// Generic val of accumulators.
template <typename A>
- struct val_ : public mln::accu::internal::base< const mln_result(A)& , val_<A> >
+ struct val : public mln::accu::internal::base< const mln_result(A)& , val<A> >
{
typedef mln_argument(A) argument;
- val_();
- val_(const A& a);
+ val();
+ val(const A& a);
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const val_<A>& other);
+ void take(const val<A>& other);
template <typename I>
void take_as_init(const util::pix<I>& pix);
template <typename I>
@@ -92,7 +92,7 @@ namespace mln
struct with
{
typedef mln_accu_with(mA, mln_value(V)) A;
- typedef val_<A> ret;
+ typedef val<A> ret;
};
};
@@ -102,14 +102,14 @@ namespace mln
template <typename A>
inline
- val_<A>::val_()
+ val<A>::val()
{
init();
}
template <typename A>
inline
- val_<A>::val_(const A& a)
+ val<A>::val(const A& a)
: a_(a)
{
init();
@@ -118,7 +118,7 @@ namespace mln
template <typename A>
inline
void
- val_<A>::init()
+ val<A>::init()
{
a_.init();
}
@@ -126,7 +126,7 @@ namespace mln
template <typename A>
inline
void
- val_<A>::take_as_init(const argument& t)
+ val<A>::take_as_init(const argument& t)
{
a_.take_as_init(t);
}
@@ -134,7 +134,7 @@ namespace mln
template <typename A>
inline
void
- val_<A>::take(const argument& t)
+ val<A>::take(const argument& t)
{
a_.take(t);
}
@@ -142,7 +142,7 @@ namespace mln
template <typename A>
inline
void
- val_<A>::take(const val_<A>& other)
+ val<A>::take(const val<A>& other)
{
a_.take(other.a_);
}
@@ -151,7 +151,7 @@ namespace mln
template <typename I>
inline
void
- val_<A>::take_as_init(const util::pix<I>& pix)
+ val<A>::take_as_init(const util::pix<I>& pix)
{
a_.take_as_init(pix.v()); // FIXME: Generalize with "value(pix)".
}
@@ -160,7 +160,7 @@ namespace mln
template <typename I>
inline
void
- val_<A>::take(const util::pix<I>& pix)
+ val<A>::take(const util::pix<I>& pix)
{
a_.take(pix.v());
}
@@ -168,7 +168,7 @@ namespace mln
template <typename A>
inline
const mln_result(A)&
- val_<A>::to_result() const
+ val<A>::to_result() const
{
return a_.to_result();
}
@@ -176,7 +176,7 @@ namespace mln
template <typename A>
inline
bool
- val_<A>::is_valid() const
+ val<A>::is_valid() const
{
return a_.is_valid();
}
diff --git a/milena/mln/accu/volume.hh b/milena/mln/accu/volume.hh
index aed5a51..299a09d 100644
--- a/milena/mln/accu/volume.hh
+++ b/milena/mln/accu/volume.hh
@@ -35,7 +35,7 @@
This accumulator uses an mln::util::pix (pixel) to update the
reference level, area and volume information of the component.
- The class mln/accu/volume_ is not a general-purpose accumulator;
+ The class mln/accu/volume is not a general-purpose accumulator;
it is used to implement volume-based connected filters.
\see mln::morpho::closing_volume
\see mln::morpho::opening_volume */
@@ -57,8 +57,8 @@ namespace mln
/// The parameter \p I is the image type on which the accumulator
/// of pixels is built.
template <typename I>
- struct volume_
- : public mln::accu::internal::base< std::size_t , volume_<I> >
+ struct volume
+ : public mln::accu::internal::base< std::size_t , volume<I> >
{
/// \brief The accumulated data type.
///
@@ -70,13 +70,13 @@ namespace mln
/// The value type associated to the pixel type.
typedef typename argument::value value;
- volume_();
+ volume();
/// Manipulators.
/// \{
void init();
void take(const argument& pixel);
- void take(const volume_<I>& other);
+ void take(const volume<I>& other);
/// Force the value of the counter to \a v.
void set_value(std::size_t v);
@@ -95,7 +95,7 @@ namespace mln
/// The area of the component.
std::size_t area__;
/// The volume of the component.
- std::size_t volume__;
+ std::size_t volume_;
};
@@ -107,10 +107,10 @@ namespace mln
struct volume : public Meta_Accumulator< volume >
{
template <typename I>
- struct with
- {
- typedef volume_<I> ret;
- };
+ struct with
+ {
+ typedef accu::volume<I> ret;
+ };
};
} // end of namespace mln::accu::meta
@@ -120,7 +120,7 @@ namespace mln
template <typename I>
inline
- volume_<I>::volume_()
+ volume<I>::volume()
{
init();
}
@@ -128,17 +128,17 @@ namespace mln
template <typename I>
inline
void
- volume_<I>::init()
+ volume<I>::init()
{
ref_level__ = literal::zero;
- volume__ = 0;
+ volume_ = 0;
area__ = 0;
}
template <typename I>
inline
void
- volume_<I>::take(const argument& pixel)
+ volume<I>::take(const argument& pixel)
{
/* FIXME: Growing a component using this particular `take'
routine won't work, since the update does not take care of
@@ -148,27 +148,27 @@ namespace mln
1. the empty accumulator case (which corresponds to the
following code);
2. the non-empty accumulator case (which sohuld act as in
- `take(const volume_<I>& other)').
+ `take(const volume<I>& other)').
Currently, the implementation is only valid if the
accumulator was initialy empty before the call to
`take(const argument&)'. */
ref_level__ = pixel.v();
++area__;
- ++volume__;
+ ++volume_;
}
template <typename I>
inline
void
- volume_<I>::take(const volume_<I>& other)
+ volume<I>::take(const volume<I>& other)
{
area__ += other.area__;
/* FIXME: Is it `t.area__' or `area__' ? Théo said it was
the latter, but both the ISMM 2005 paper and Olena 0.11 use
the former. */
- volume__ +=
- other.volume__ +
+ volume_ +=
+ other.volume_ +
other.area__ * math::abs(other.ref_level__ - ref_level__);
// Member ref_level__ is not touched.
}
@@ -176,17 +176,17 @@ namespace mln
template <typename I>
inline
std::size_t
- volume_<I>::to_result() const
+ volume<I>::to_result() const
{
- return volume__;
+ return volume_;
}
template <typename I>
inline
void
- volume_<I>::set_value(std::size_t v)
+ volume<I>::set_value(std::size_t v)
{
- volume__ = v;
+ volume_ = v;
// Reset the other members.
ref_level__ = literal::zero;
area__ = 0;
@@ -195,7 +195,7 @@ namespace mln
template <typename I>
inline
bool
- volume_<I>::is_valid() const
+ volume<I>::is_valid() const
{
return true;
}
diff --git a/milena/mln/canvas/morpho/algebraic_union_find.hh b/milena/mln/canvas/morpho/algebraic_union_find.hh
index 33528df..b61616d 100644
--- a/milena/mln/canvas/morpho/algebraic_union_find.hh
+++ b/milena/mln/canvas/morpho/algebraic_union_find.hh
@@ -121,7 +121,7 @@ namespace mln
{
parent(p) = p;
/* FIXME: What if the value_type of DATA (i.e., A) were not
- based on a accu::count_<mln::pix>? Currently, nothing
+ based on a accu::count<mln::pix>? Currently, nothing
enforces this, but the code below expects this line to be
valid:
@@ -138,7 +138,7 @@ namespace mln
be passed as an argument to the canvas' ctor.
Of course, we might want to restrict attributes to the
- accumulator accu::count_<mln::pix> (which is perfectly
+ accumulator accu::count<mln::pix> (which is perfectly
acceptable), but then this class should statically check
the conformance of the template parameter A to this
constraint. */
diff --git a/milena/mln/estim/mean.hh b/milena/mln/estim/mean.hh
index 46fb4ed..0c6fbdb 100644
--- a/milena/mln/estim/mean.hh
+++ b/milena/mln/estim/mean.hh
@@ -79,7 +79,7 @@ namespace mln
void mean(const Image<I>& input, M& result)
{
mln_precondition(exact(input).has_data());
- accu::mean_<mln_value(I), S, M> a;
+ accu::mean<mln_value(I), S, M> a;
result = level::compute(a, input);
}
diff --git a/milena/mln/estim/sum.hh b/milena/mln/estim/sum.hh
index 96ff335..2defc4f 100644
--- a/milena/mln/estim/sum.hh
+++ b/milena/mln/estim/sum.hh
@@ -78,7 +78,7 @@ namespace mln
void sum(const Image<I>& input, S& result)
{
mln_precondition(exact(input).has_data());
- accu::sum_<mln_value(I), S> a;
+ accu::sum<mln_value(I), S> a;
result = level::compute(a, input);
}
diff --git a/milena/mln/make/voronoi.hh b/milena/mln/make/voronoi.hh
index 2cf7a37..3f1bbe0 100644
--- a/milena/mln/make/voronoi.hh
+++ b/milena/mln/make/voronoi.hh
@@ -83,7 +83,7 @@ namespace mln
estim::min_max (ima, min, max);
unsigned nb = max - min + 1;
std::vector<P> v(nb);
- std::vector< accu::mean_< X > > tab_mean (nb);
+ std::vector< accu::mean< X > > tab_mean (nb);
std::map<std::pair<V, V>, bool> m;
/// Take original point.
diff --git a/milena/mln/morpho/closing_area.hh b/milena/mln/morpho/closing_area.hh
index 5512d83..bccee58 100644
--- a/milena/mln/morpho/closing_area.hh
+++ b/milena/mln/morpho/closing_area.hh
@@ -63,7 +63,7 @@ namespace mln
mln_precondition(exact(output).domain() == exact(input).domain());
typedef util::pix<I> pix_t;
// FIXME: Change sig of closing_attribute!
- closing_attribute< accu::count_<pix_t> >(input, nbh, lambda, output);
+ closing_attribute< accu::count<pix_t> >(input, nbh, lambda, output);
}
template <typename I, typename N>
diff --git a/milena/mln/morpho/closing_area_on_vertices.hh b/milena/mln/morpho/closing_area_on_vertices.hh
index 51fc4cb..7ac3f7a 100644
--- a/milena/mln/morpho/closing_area_on_vertices.hh
+++ b/milena/mln/morpho/closing_area_on_vertices.hh
@@ -61,7 +61,7 @@ namespace mln
std::size_t lambda, Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- typedef accu::count_adjacent_vertices_<P, V> attribute_t;
+ typedef accu::count_adjacent_vertices<P, V> attribute_t;
// FIXME: Change sig of closing_attribute!
closing_attribute<attribute_t>(input, nbh, lambda, output);
}
diff --git a/milena/mln/morpho/closing_height.hh b/milena/mln/morpho/closing_height.hh
index 400f815..72b856b 100644
--- a/milena/mln/morpho/closing_height.hh
+++ b/milena/mln/morpho/closing_height.hh
@@ -56,7 +56,7 @@ namespace mln
{
mln_precondition(exact(output).domain() == exact(input).domain());
// FIXME: Change sig of closing_attribute!
- closing_attribute< accu::height_<I> >(input, nbh, lambda, output);
+ closing_attribute< accu::height<I> >(input, nbh, lambda, output);
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/closing_volume.hh b/milena/mln/morpho/closing_volume.hh
index 1845864..bf5c608 100644
--- a/milena/mln/morpho/closing_volume.hh
+++ b/milena/mln/morpho/closing_volume.hh
@@ -56,7 +56,7 @@ namespace mln
{
mln_precondition(exact(output).domain() == exact(input).domain());
// FIXME: Change sig of closing_attribute!
- closing_attribute< accu::volume_<I> >(input, nbh, lambda, output);
+ closing_attribute< accu::volume<I> >(input, nbh, lambda, output);
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/erosion.spe.hh b/milena/mln/morpho/erosion.spe.hh
index 30e671a..ec125e4 100644
--- a/milena/mln/morpho/erosion.spe.hh
+++ b/milena/mln/morpho/erosion.spe.hh
@@ -103,7 +103,7 @@ namespace mln
const W& win = exact(win_);
// FIXME: border::adjust(input, win.delta());
- extension::fill(input, mln_max(mln_value(I)));
+ extension::fill(input, mln_max(mln_value(I)));
O output;
initialize(output, input);
@@ -136,7 +136,7 @@ namespace mln
const W& win = exact(win_);
// FIXME: border::adjust(input, win.delta());
- extension::fill(input, true);
+ extension::fill(input, true);
O output;
initialize(output, input);
@@ -169,7 +169,7 @@ namespace mln
const W& win = exact(win_);
// FIXME: border::adjust(input, win.delta());
- extension::fill(input, true);
+ extension::fill(input, true);
O output;
output = clone(input);
@@ -200,7 +200,7 @@ namespace mln
const W& win = exact(win_);
// FIXME: border::adjust(input, win.delta());
- extension::fill(input, true);
+ extension::fill(input, true);
O output;
output = clone(input);
@@ -251,7 +251,7 @@ namespace mln
p, len,
win_half_length,
output);
-
+
for (int c = dim - 1; c >= 0; --c)
{
if (c == int(Dir))
@@ -358,7 +358,7 @@ namespace mln
win_left_bkd(win::shift(win_left_fwd, mln::right)),
win_right_bkd(win::shift(win_right_fwd, mln::right)),
- win_bot_up(win::shift(win, mln::down) - win),
+ win_bot_up(win::shift(win, mln::down) - win),
win_top_up(win - win::shift(win, mln::down)),
win_bot_down(win::shift(win_bot_up, mln::up)),
win_top_down(win::shift(win_top_up, mln::up)),
@@ -461,7 +461,7 @@ namespace mln
typedef erosion_arbitrary_2d_fastest_functor<I, W> F;
F f(exact(input), exact(win));
- canvas::browsing::snake_generic(f);
+ canvas::browsing::snake_generic(f);
trace::exiting("morpho::impl:erosion_arbitrary_2d_fastest");
@@ -516,7 +516,7 @@ namespace mln
win_left_bkd(win::shift(win_left_fwd, mln::right)),
win_right_bkd(win::shift(win_right_fwd, mln::right)),
- win_bot_up(win::shift(win, mln::down) - win),
+ win_bot_up(win::shift(win, mln::down) - win),
win_top_up(win - win::shift(win, mln::down)),
win_bot_down(win::shift(win_bot_up, mln::up)),
win_top_down(win::shift(win_top_up, mln::up)),
diff --git a/milena/mln/morpho/opening_area.hh b/milena/mln/morpho/opening_area.hh
index 580b3f8..5e6e280 100644
--- a/milena/mln/morpho/opening_area.hh
+++ b/milena/mln/morpho/opening_area.hh
@@ -59,7 +59,7 @@ namespace mln
mln_precondition(exact(output).domain() == exact(input).domain());
typedef util::pix<I> pix_t;
// FIXME: Change sig of opening_attribute!
- opening_attribute< accu::count_<pix_t> >(input, nbh, lambda, output);
+ opening_attribute< accu::count<pix_t> >(input, nbh, lambda, output);
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening_area_on_vertices.hh b/milena/mln/morpho/opening_area_on_vertices.hh
index 1c98024..b5c9c04 100644
--- a/milena/mln/morpho/opening_area_on_vertices.hh
+++ b/milena/mln/morpho/opening_area_on_vertices.hh
@@ -60,7 +60,7 @@ namespace mln
std::size_t lambda, Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- typedef accu::count_adjacent_vertices_<P, V> attribute_t;
+ typedef accu::count_adjacent_vertices<P, V> attribute_t;
// FIXME: Change sig of opening_attribute!
opening_attribute<attribute_t>(input, nbh, lambda, output);
}
diff --git a/milena/mln/morpho/opening_height.hh b/milena/mln/morpho/opening_height.hh
index f5c1fe1..bbd9d6c 100644
--- a/milena/mln/morpho/opening_height.hh
+++ b/milena/mln/morpho/opening_height.hh
@@ -56,7 +56,7 @@ namespace mln
{
mln_precondition(exact(output).domain() == exact(input).domain());
// FIXME: Change sig of opening_attribute!
- opening_attribute< accu::height_<I> >(input, nbh, lambda, output);
+ opening_attribute< accu::height<I> >(input, nbh, lambda, output);
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening_volume.hh b/milena/mln/morpho/opening_volume.hh
index 2845ca6..def2c5d 100644
--- a/milena/mln/morpho/opening_volume.hh
+++ b/milena/mln/morpho/opening_volume.hh
@@ -56,7 +56,7 @@ namespace mln
{
mln_precondition(exact(output).domain() == exact(input).domain());
// FIXME: Change sig of opening_attribute!
- opening_attribute< accu::volume_<I> >(input, nbh, lambda, output);
+ opening_attribute< accu::volume<I> >(input, nbh, lambda, output);
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/rank_filter.hh b/milena/mln/morpho/rank_filter.hh
index 7cf24b3..94a0a27 100644
--- a/milena/mln/morpho/rank_filter.hh
+++ b/milena/mln/morpho/rank_filter.hh
@@ -69,7 +69,7 @@ namespace mln
mln_concrete(I) output;
initialize(output, input);
- accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites());
+ accu::rank<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites());
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
diff --git a/milena/tests/accu/all_accus.cc b/milena/tests/accu/all_accus.cc
index 394d750..6cd29fa 100644
--- a/milena/tests/accu/all_accus.cc
+++ b/milena/tests/accu/all_accus.cc
@@ -39,16 +39,16 @@ int main()
using namespace mln::accu;
bbox<point2d> b;
- count_<int> c;
+ count<int> c;
mln::accu::histo<bool> h;
- max_<int> ma;
- mean_<int> me;
+ max<int> ma;
+ mean<int> me;
// median< value::set<bool> > med; // FIXME: bool has no min so workaround!
- min_<int> mi;
+ min<int> mi;
// min_h< value::set<bool> > mh; // OK: do not work since bool has
// no min/max :)
- min_max_<int> mm;
- nil_<int> n;
- pair_< min_<int>, max_<int> > p;
- sum_<int> s;
+ min_max<int> mm;
+ nil<int> n;
+ pair< min<int>, max<int> > p;
+ sum<int> s;
}
diff --git a/milena/tests/accu/count.cc b/milena/tests/accu/count.cc
index 832c02b..bdf9ffe 100644
--- a/milena/tests/accu/count.cc
+++ b/milena/tests/accu/count.cc
@@ -40,12 +40,12 @@ int main()
using namespace mln;
{
- accu::count_<value::int_u8> accu;
+ accu::count<value::int_u8> accu;
mln_assertion(accu.to_result() == 0);
}
{
- accu::count_<value::int_u8> accu;
+ accu::count<value::int_u8> accu;
for (int i = 0; i < 200; i++)
accu.take(i);
mln_assertion(accu.to_result() == 200);
diff --git a/milena/tests/accu/nil.cc b/milena/tests/accu/nil.cc
index f2421ff..15afbf0 100644
--- a/milena/tests/accu/nil.cc
+++ b/milena/tests/accu/nil.cc
@@ -42,7 +42,7 @@ int main()
using namespace mln;
image2d<value::int_u8> ima(3, 3);
- accu::nil_<value::int_u8> a;
+ accu::nil<value::int_u8> a;
level::compute(a, ima);
level::compute(accu::meta::nil(), ima);
diff --git a/milena/tests/accu/pair.cc b/milena/tests/accu/pair.cc
index 6927334..2d57ed7 100644
--- a/milena/tests/accu/pair.cc
+++ b/milena/tests/accu/pair.cc
@@ -42,7 +42,7 @@ int main()
using namespace mln;
{
- accu::pair<accu::mean_<int>, accu::max<int> > mean;
+ accu::pair<accu::mean<int>, accu::max<int> > mean;
mean.take(10);
mean.take(9);
diff --git a/milena/tests/accu/rank.cc b/milena/tests/accu/rank.cc
index 7a7fbea..0037d06 100644
--- a/milena/tests/accu/rank.cc
+++ b/milena/tests/accu/rank.cc
@@ -52,47 +52,47 @@ void fill(Accumulator<A>& accu_)
int main()
{
{
- accu::rank_<value::int_u8> accu(0, 8);
+ accu::rank<value::int_u8> accu(0, 8);
fill(accu);
mln_assertion(accu.to_result() == 1u);
}
{
- accu::rank_<value::int_u8> accu(1, 8);
+ accu::rank<value::int_u8> accu(1, 8);
fill(accu);
mln_assertion(accu.to_result() == 2u);
}
{
- accu::rank_<value::int_u8> accu(2, 8);
+ accu::rank<value::int_u8> accu(2, 8);
fill(accu);
mln_assertion(accu.to_result() == 2u);
}
{
- accu::rank_<value::int_u8> accu(3, 8);
+ accu::rank<value::int_u8> accu(3, 8);
fill(accu);
mln_assertion(accu.to_result() == 3u);
}
{
- accu::rank_<value::int_u8> accu(4, 8);
+ accu::rank<value::int_u8> accu(4, 8);
fill(accu);
mln_assertion(accu.to_result() == 4u);
}
{
- accu::rank_<value::int_u8> accu(5, 8);
+ accu::rank<value::int_u8> accu(5, 8);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank_<value::int_u8> accu(6, 8);
+ accu::rank<value::int_u8> accu(6, 8);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank_<value::int_u8> accu(7, 8);
+ accu::rank<value::int_u8> accu(7, 8);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank_<bool> accu_bool(1, 5);
+ accu::rank<bool> accu_bool(1, 5);
accu_bool.take(true);
accu_bool.take(true);
accu_bool.take(true);
diff --git a/milena/tests/accu/tuple.cc b/milena/tests/accu/tuple.cc
index 1b65caa..a83fabb 100644
--- a/milena/tests/accu/tuple.cc
+++ b/milena/tests/accu/tuple.cc
@@ -46,9 +46,9 @@ int main()
{
using namespace mln;
- typedef accu::tuple_<int, 4, accu::count_<int>, accu::max<int>, accu::min<int>, accu::mean_<int> > teratuple;
+ typedef accu::tuple<int, 4, accu::count<int>, accu::max<int>, accu::min<int>, accu::mean<int> > teratuple;
- teratuple tuple1;
+ teratuple tuple1;
teratuple tuple2;
int i1 = 7;
diff --git a/milena/tests/labeling/compute.cc b/milena/tests/labeling/compute.cc
index cd36ae3..e333ab9 100644
--- a/milena/tests/labeling/compute.cc
+++ b/milena/tests/labeling/compute.cc
@@ -54,7 +54,7 @@ int main()
image2d<int_u8> ima = make::image2d(vals);
int_u8 nlabels = 3;
- accu::sum_<int_u8> sum;
+ accu::sum<int_u8> sum;
p_array<float> sums = labeling::compute(sum, ima, ima, nlabels);
mln_assertion(sums[0] == 0);
mln_assertion(sums[1] == 4);
@@ -67,7 +67,7 @@ int main()
mln_assertion(sums[2] == 8);
mln_assertion(sums[3] == 12);
- accu::count_<mln_site_(image2d<int_u8>)> count;
+ accu::count<mln_site_(image2d<int_u8>)> count;
p_array<unsigned int> counts = labeling::compute(count, ima, nlabels);
mln_assertion(counts[0] == 18);
mln_assertion(counts[1] == 4);
--
1.5.6.5
1
0
cleanup-2008 2562: Remove the useless '_' postfix in some accumulators.
by Thierry Geraud 15 Oct '08
by Thierry Geraud 15 Oct '08
15 Oct '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Remove the useless '_' postfix in some accumulators.
* mln/core/site_set/p_priority.hh (front): Fix.
* mln/accu/min.hh (min_): Rename as...
(min): ...this.
* mln/accu/max.hh (max_): Rename as...
(max): ...this.
* mln/accu/min_max.hh (min_max_): Rename as...
(min_max): ...this.
* mln/accu/pair.hh (pair_): Rename as...
(pair): ...this.
* mln/morpho/dilation_elementary.hh,
* mln/morpho/erosion.spe.hh,
* mln/morpho/erosion.hh,
* mln/morpho/dilation.hh,
* mln/morpho/meyer_wst.hh,
* sandbox/geraud/cs2d/cs2d_morpho.hh,
* sandbox/folio/dt/canvas_dt.hh,
* tests/level/compute_full.cc,
* tests/level/compute.cc,
* tests/level/update.cc,
* tests/accu/pair.cc,
* tests/accu/min.cc,
* tests/accu/max.cc,
* tests/accu/min_max.cc,
* tests/accu/tuple.cc,
* doc/examples/tuto_bis.cc,
* mln/debug/println.spe.hh: Update.
doc/examples/tuto_bis.cc | 10 ++++----
mln/accu/max.hh | 25 +++++++++++-----------
mln/accu/min.hh | 24 ++++++++++-----------
mln/accu/min_max.hh | 6 ++---
mln/accu/pair.hh | 42 ++++++++++++++++++-------------------
mln/core/site_set/p_priority.hh | 2 -
mln/debug/println.spe.hh | 2 -
mln/morpho/dilation.hh | 2 -
mln/morpho/dilation_elementary.hh | 2 -
mln/morpho/erosion.hh | 2 -
mln/morpho/erosion.spe.hh | 2 -
mln/morpho/meyer_wst.hh | 24 +++++++++++----------
sandbox/folio/dt/canvas_dt.hh | 4 +--
sandbox/geraud/cs2d/cs2d_morpho.hh | 2 -
tests/accu/max.cc | 4 +--
tests/accu/min.cc | 4 +--
tests/accu/min_max.cc | 22 ++++++++++---------
tests/accu/pair.cc | 4 +--
tests/accu/tuple.cc | 2 -
tests/level/compute.cc | 4 +--
tests/level/compute_full.cc | 20 ++++++++---------
tests/level/update.cc | 4 +--
22 files changed, 109 insertions(+), 104 deletions(-)
Index: tests/level/compute_full.cc
--- tests/level/compute_full.cc (revision 2561)
+++ tests/level/compute_full.cc (working copy)
@@ -113,8 +113,8 @@
{
- accu::min_<I> acu_min;
- accu::max_<I> acu_max;
+ accu::min<I> acu_min;
+ accu::max<I> acu_max;
I min = level::compute(acu_min, ima);
I max = level::compute(acu_max, ima);
@@ -125,8 +125,8 @@
{
sub_image<image1d<I>, box1d> sub_ima (ima, b1);
- accu::min_<I> acu_min;
- accu::max_<I> acu_max;
+ accu::min<I> acu_min;
+ accu::max<I> acu_max;
I min = level::compute(acu_min, sub_ima);
I max = level::compute(acu_max, sub_ima);
@@ -138,8 +138,8 @@
f_box1d_t f_b(b1);
image_if<image1d<I>, f_box1d_t> if_ima(ima, f_b);
- accu::min_<I> acu_min;
- accu::max_<I> acu_max;
+ accu::min<I> acu_min;
+ accu::max<I> acu_max;
I min = level::compute(acu_min, if_ima);
I max = level::compute(acu_max, if_ima);
@@ -173,8 +173,8 @@
}
{
- accu::min_<I> acu_min;
- accu::max_<I> acu_max;
+ accu::min<I> acu_min;
+ accu::max<I> acu_max;
I min = level::compute(acu_min, ima);
I max = level::compute(acu_max, ima);
@@ -204,8 +204,8 @@
else
real_max = (I)(slis * rows * cols);
{
- accu::min_<I> acu_min;
- accu::max_<I> acu_max;
+ accu::min<I> acu_min;
+ accu::max<I> acu_max;
I min = level::compute(acu_min, ima);
I max = level::compute(acu_max, ima);
Index: tests/level/compute.cc
--- tests/level/compute.cc (revision 2561)
+++ tests/level/compute.cc (working copy)
@@ -45,11 +45,11 @@
image2d<int> ima(size, size);
debug::iota(ima);
- accu::min_<int> m;
+ accu::min<int> m;
int min = level::compute(m, ima);
mln_assertion(min == 1);
- accu::max_<int> M;
+ accu::max<int> M;
int max = level::compute(M, ima);
mln_assertion(max == 40000);
}
Index: tests/level/update.cc
--- tests/level/update.cc (revision 2561)
+++ tests/level/update.cc (working copy)
@@ -44,8 +44,8 @@
const unsigned size = 200;
image2d<int> ima(size, size);
- accu::min_<int> m;
- accu::max_<int> M;
+ accu::min<int> m;
+ accu::max<int> M;
debug::iota(ima);
level::update(m, ima);
Index: tests/accu/pair.cc
--- tests/accu/pair.cc (revision 2561)
+++ tests/accu/pair.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -42,7 +42,7 @@
using namespace mln;
{
- accu::pair_<accu::mean_<int>, accu::max_<int> > mean;
+ accu::pair<accu::mean_<int>, accu::max<int> > mean;
mean.take(10);
mean.take(9);
Index: tests/accu/min.cc
--- tests/accu/min.cc (revision 2561)
+++ tests/accu/min.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -49,6 +49,6 @@
debug::iota(ima);
mln_assertion(level::compute(accu::meta::min(), ima) == 1);
- accu::min_<int> m;
+ accu::min<int> m;
mln_assertion(level::compute(m, ima) == 1);
}
Index: tests/accu/max.cc
--- tests/accu/max.cc (revision 2561)
+++ tests/accu/max.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,6 +48,6 @@
image2d<int> ima(3, 3);
debug::iota(ima);
mln_assertion(level::compute(accu::meta::max(), ima) == 9);
- accu::max_<int> M;
+ accu::max<int> M;
mln_assertion(level::compute(M, ima) == 9);
}
Index: tests/accu/min_max.cc
--- tests/accu/min_max.cc (revision 2561)
+++ tests/accu/min_max.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -51,19 +51,21 @@
{
mln_accu_with_(accu::meta::min_max, int) accu;
- accu.take(10);
- accu.take(9);
- accu.take(8);
- accu.take(7);
+ accu.take(2);
+ accu.take(1);
+ accu.take(0);
+
accu.take(6);
accu.take(5);
accu.take(4);
accu.take(3);
- accu.take(2);
- accu.take(1);
- accu.take(0);
- mln_assertion(accu.to_result().first == 0);
- mln_assertion(accu.to_result().second == 10);
+ accu.take(10);
+ accu.take(9);
+ accu.take(8);
+ accu.take(7);
+
+ mln_assertion(accu.first() == 0);
+ mln_assertion(accu.second() == 10);
}
}
Index: tests/accu/tuple.cc
--- tests/accu/tuple.cc (revision 2561)
+++ tests/accu/tuple.cc (working copy)
@@ -46,7 +46,7 @@
{
using namespace mln;
- typedef accu::tuple_<int, 4, accu::count_<int>, accu::max_<int>, accu::min_<int>, accu::mean_<int> > teratuple;
+ typedef accu::tuple_<int, 4, accu::count_<int>, accu::max<int>, accu::min<int>, accu::mean_<int> > teratuple;
teratuple tuple1;
teratuple tuple2;
Index: doc/examples/tuto_bis.cc
--- doc/examples/tuto_bis.cc (revision 2561)
+++ doc/examples/tuto_bis.cc (working copy)
@@ -342,11 +342,11 @@
for (unsigned i = 1; i <= nbasins; ++i)
std::cout << "mean value of basin #" << i << " is " << m(i) << std::endl;
- level::fill(cell, level::transform(lab, m));
- debug::println(cell);
- // 2 2 2
- //
- // 5 5 5
+// level::fill(cell, level::transform(lab, m));
+// debug::println(cell);
+// // 2 2 2
+// //
+// // 5 5 5
// DONE!
Index: mln/debug/println.spe.hh
--- mln/debug/println.spe.hh (revision 2561)
+++ mln/debug/println.spe.hh (working copy)
@@ -82,7 +82,7 @@
void
println(const box2d& b, const I& input)
{
- accu::max_<unsigned> len_;
+ accu::max<unsigned> len_;
mln_piter(I) p(input.domain());
for_all(p)
{
Index: mln/core/site_set/p_priority.hh
--- mln/core/site_set/p_priority.hh (revision 2561)
+++ mln/core/site_set/p_priority.hh (working copy)
@@ -275,7 +275,7 @@
p_priority<P,Q>::front() const
{
mln_precondition(! this->is_empty()); // Also test invariants.
- std::map<P,Q>& q__ = const_cast< std::map<P,Q>& >(q_);
+ q_type_& q__ = const_cast< q_type_& >(q_);
return q__[highest_priority()].front();
}
Index: mln/accu/min.hh
--- mln/accu/min.hh (revision 2561)
+++ mln/accu/min.hh (working copy)
@@ -51,18 +51,18 @@
* The parameter \c T is the type of values.
*/
template <typename T>
- struct min_ : public mln::accu::internal::base< const T&, min_<T> >
+ struct min : public mln::accu::internal::base< const T&, min<T> >
{
typedef T argument;
- min_();
+ min();
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const min_<T>& other);
+ void take(const min<T>& other);
/// \}
/// Get the value of the accumulator.
@@ -78,7 +78,7 @@
};
- template <typename I> struct min_< util::pix<I> >;
+ template <typename I> struct min< util::pix<I> >;
@@ -92,7 +92,7 @@
template <typename T>
struct with
{
- typedef min_<T> ret;
+ typedef accu::min<T> ret;
};
};
@@ -104,7 +104,7 @@
template <typename T>
inline
- min_<T>::min_()
+ min<T>::min()
{
init();
}
@@ -112,21 +112,21 @@
template <typename T>
inline
void
- min_<T>::init()
+ min<T>::init()
{
t_ = mln_max(T);
}
template <typename T>
inline
- void min_<T>::take_as_init(const argument& t)
+ void min<T>::take_as_init(const argument& t)
{
t_ = t;
}
template <typename T>
inline
- void min_<T>::take(const argument& t)
+ void min<T>::take(const argument& t)
{
if (t < t_)
t_ = t;
@@ -135,7 +135,7 @@
template <typename T>
inline
void
- min_<T>::take(const min_<T>& other)
+ min<T>::take(const min<T>& other)
{
if (other.t_ < t_)
t_ = other.t_;
@@ -144,7 +144,7 @@
template <typename T>
inline
const T&
- min_<T>::to_result() const
+ min<T>::to_result() const
{
return t_;
}
@@ -152,7 +152,7 @@
template <typename T>
inline
bool
- min_<T>::is_valid() const
+ min<T>::is_valid() const
{
return true;
}
Index: mln/accu/max.hh
--- mln/accu/max.hh (revision 2561)
+++ mln/accu/max.hh (working copy)
@@ -51,18 +51,18 @@
* The parameter \c T is the type of values.
*/
template <typename T>
- struct max_ : public mln::accu::internal::base< const T& , max_<T> >
+ struct max : public mln::accu::internal::base< const T& , max<T> >
{
typedef T argument;
- max_();
+ max();
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const max_<T>& other);
+ void take(const max<T>& other);
/// \}
/// Get the value of the accumulator.
@@ -78,7 +78,7 @@
};
- template <typename I> struct max_< util::pix<I> >;
+ template <typename I> struct max< util::pix<I> >;
namespace meta
@@ -91,18 +91,19 @@
template <typename T>
struct with
{
- typedef max_<T> ret;
+ typedef accu::max<T> ret;
};
};
} // end of namespace mln::accu::meta
+
# ifndef MLN_INCLUDE_ONLY
template <typename T>
inline
- max_<T>::max_()
+ max<T>::max()
{
init();
}
@@ -110,7 +111,7 @@
template <typename T>
inline
void
- max_<T>::init()
+ max<T>::init()
{
t_ = mln_min(T);
}
@@ -118,7 +119,7 @@
template <typename T>
inline
void
- max_<T>::take_as_init(const argument& t)
+ max<T>::take_as_init(const argument& t)
{
t_ = t;
}
@@ -126,7 +127,7 @@
template <typename T>
inline
void
- max_<T>::take(const argument& t)
+ max<T>::take(const argument& t)
{
if (t > t_)
t_ = t;
@@ -135,7 +136,7 @@
template <typename T>
inline
void
- max_<T>::take(const max_<T>& other)
+ max<T>::take(const max<T>& other)
{
if (other.t_ > t_)
t_ = other.t_;
@@ -144,7 +145,7 @@
template <typename T>
inline
const T&
- max_<T>::to_result() const
+ max<T>::to_result() const
{
return t_;
}
@@ -152,7 +153,7 @@
template <typename T>
inline
bool
- max_<T>::is_valid() const
+ max<T>::is_valid() const
{
return true;
}
Index: mln/accu/min_max.hh
--- mln/accu/min_max.hh (revision 2561)
+++ mln/accu/min_max.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -55,12 +55,12 @@
* The parameter \c V is the type of values.
*/
template <typename V>
- struct min_max_ : public pair_< min_<V>, max_<V> >
+ struct min_max : public pair< min<V>, max<V> >
{
};
- template <typename I> struct min_max_< util::pix<I> >;
+ template <typename I> struct min_max< util::pix<I> >;
namespace meta
Index: mln/accu/pair.hh
--- mln/accu/pair.hh (revision 2561)
+++ mln/accu/pair.hh (working copy)
@@ -56,28 +56,28 @@
* \todo Check that, when T is not provided, A1 and A2 have the same value.
*/
template <typename A1, typename A2, typename T = mln_argument(A1)>
- struct pair_ : public mln::accu::internal::base< std::pair< mlc_unqualif(mln_result(A1)) , mlc_unqualif(mln_result(A2)) > , pair_<A1,A2,T> >
+ struct pair : public mln::accu::internal::base< std::pair<mln_result(A1), mln_result(A2)>,
+ pair<A1,A2,T> >
{
typedef T argument;
- typedef mlc_unqualif(mln_result(A1)) result_1;
- typedef mlc_unqualif(mln_result(A2)) result_2;
- typedef std::pair<result_1, result_2> result;
+ typedef mln_result(A1) result_1;
+ typedef mln_result(A2) result_2;
- pair_();
- pair_(const A1& a1, const A2& a2);
+ pair();
+ pair(const A1& a1, const A2& a2);
/// Manipulators.
/// \{
void init();
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const pair_<A1,A2,T>& other);
+ void take(const pair<A1,A2,T>& other);
/// \}
/// Get the value of the accumulator.
/// \{
- result to_result() const;
+ std::pair<mln_result(A1), mln_result(A2)> to_result() const;
void get_result(result_1& r1, result_2& r2) const;
/// \}
@@ -107,7 +107,7 @@
{
typedef mln_accu_with(A1, T) A1_T;
typedef mln_accu_with(A2, T) A2_T;
- typedef pair_<A1_T, A2_T, T> ret;
+ typedef accu::pair<A1_T, A2_T, T> ret;
};
};
@@ -118,7 +118,7 @@
template <typename A1, typename A2, typename T>
inline
- pair_<A1,A2,T>::pair_()
+ pair<A1,A2,T>::pair()
{
init();
}
@@ -126,7 +126,7 @@
template <typename A1, typename A2, typename T>
inline
void
- pair_<A1,A2,T>::init()
+ pair<A1,A2,T>::init()
{
a1_.init();
a2_.init();
@@ -135,7 +135,7 @@
template <typename A1, typename A2, typename T>
inline
void
- pair_<A1,A2,T>::take_as_init(const argument& t)
+ pair<A1,A2,T>::take_as_init(const argument& t)
{
a1_.take_as_init(t);
a2_.take_as_init(t);
@@ -144,7 +144,7 @@
template <typename A1, typename A2, typename T>
inline
void
- pair_<A1,A2,T>::take(const argument& t)
+ pair<A1,A2,T>::take(const argument& t)
{
a1_.take(t);
a2_.take(t);
@@ -153,7 +153,7 @@
template <typename A1, typename A2, typename T>
inline
void
- pair_<A1,A2,T>::take(const pair_<A1,A2,T>& other)
+ pair<A1,A2,T>::take(const pair<A1,A2,T>& other)
{
a1_.take(other.a1_);
a2_.take(other.a2_);
@@ -161,17 +161,17 @@
template <typename A1, typename A2, typename T>
inline
- typename pair_<A1,A2,T>::result
- pair_<A1,A2,T>::to_result() const
+ std::pair<mln_result(A1), mln_result(A2)>
+ pair<A1,A2,T>::to_result() const
{
- result tmp(a1_.to_result(), a2_.to_result());
+ std::pair<mln_result(A1), mln_result(A2)> tmp(a1_.to_result(), a2_.to_result());
return tmp;
}
template <typename A1, typename A2, typename T>
inline
void
- pair_<A1,A2,T>::get_result(result_1& r1,
+ pair<A1,A2,T>::get_result(result_1& r1,
result_2& r2) const
{
r1 = a1_.to_result();
@@ -181,7 +181,7 @@
template <typename A1, typename A2, typename T>
inline
mln_result(A1)
- pair_<A1,A2,T>::first() const
+ pair<A1,A2,T>::first() const
{
return a1_.to_result();
}
@@ -189,7 +189,7 @@
template <typename A1, typename A2, typename T>
inline
mln_result(A2)
- pair_<A1,A2,T>::second() const
+ pair<A1,A2,T>::second() const
{
return a2_.to_result();
}
@@ -197,7 +197,7 @@
template <typename A1, typename A2, typename T>
inline
bool
- pair_<A1,A2,T>::is_valid() const
+ pair<A1,A2,T>::is_valid() const
{
return a1_.is_valid() && a2_.is_valid();
}
Index: mln/morpho/dilation_elementary.hh
--- mln/morpho/dilation_elementary.hh (revision 2561)
+++ mln/morpho/dilation_elementary.hh (working copy)
@@ -76,7 +76,7 @@
mln_concrete(I) output;
initialize(output, input);
- accu::min_max_<mln_value(I)> m;
+ accu::min_max<mln_value(I)> m;
mln_piter(I) p(input.domain());
mln_niter(N) n(nbh, p);
for_all(p)
Index: mln/morpho/erosion.spe.hh
--- mln/morpho/erosion.spe.hh (revision 2561)
+++ mln/morpho/erosion.spe.hh (working copy)
@@ -111,7 +111,7 @@
mln_pixter(const I) p(input);
mln_pixter(O) o(output);
mln_qixter(const I, W) q(p, win);
- accu::min_<mln_value(I)> min;
+ accu::min<mln_value(I)> min;
for_all_2(p, o)
{
min.init();
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 2561)
+++ mln/morpho/erosion.hh (working copy)
@@ -78,7 +78,7 @@
mln_concrete(I) output;
initialize(output, input);
- accu::min_<mln_value(I)> min;
+ accu::min<mln_value(I)> min;
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
Index: mln/morpho/dilation.hh
--- mln/morpho/dilation.hh (revision 2561)
+++ mln/morpho/dilation.hh (working copy)
@@ -97,7 +97,7 @@
// FIXME: border::adjust(input, win.delta());
extension::fill(input, mln_min(mln_value(I)));
- accu::max_<mln_value(I)> max;
+ accu::max<mln_value(I)> max;
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
Index: mln/morpho/meyer_wst.hh
--- mln/morpho/meyer_wst.hh (revision 2561)
+++ mln/morpho/meyer_wst.hh (working copy)
@@ -49,6 +49,10 @@
# include <mln/literal/zero.hh>
# include <mln/labeling/regional_minima.hh>
+# include <mln/core/site_set/p_queue_fast.hh>
+# include <mln/core/site_set/p_priority.hh>
+
+
namespace mln
{
@@ -115,6 +119,9 @@
typedef L marker;
const marker unmarked = literal::zero;
+ typedef mln_value(I) V;
+ const V max = mln_max(V);
+
// Initialize the output with the markers (minima components).
mln_ch_value(I, marker) output =
labeling::regional_minima (input, nbh, nbasins);
@@ -122,13 +129,8 @@
typedef mln_psite(I) psite;
// Ordered queue.
- /* FIXME: Milena probably already provides an ordered queue
- facility via the mln::p_priority class. Try to use it
- instead, and get rid of mln/util/greater_psite.hh. */
- typedef
- std::priority_queue< psite, std::vector<psite>, util::greater_psite<I> >
- ordered_queue_type;
- ordered_queue_type queue(util::make_greater_psite(input));
+ typedef p_queue_fast<psite> Q;
+ p_priority<mln_value(I), Q> queue;
// Insert every neighbor P of every marked area in a
// hierarchical queue, with a priority level corresponding to
@@ -140,16 +142,16 @@
for_all(n)
if (output.domain().has(n) && output(n) != unmarked)
{
- queue.push(p);
+ queue.push(max - input(p), p);
break;
}
/* Until the queue is empty, extract a psite P from the
hierarchical queue, at the highest priority level, that is,
the lowest level. */
- while (!queue.empty())
+ while (! queue.is_empty())
{
- psite p = queue.top();
+ psite p = queue.front();
queue.pop();
// Last seen marker adjacent to P.
marker adjacent_marker = unmarked;
@@ -180,7 +182,7 @@
output(p) = adjacent_marker;
for_all(n)
if (output.domain().has(n) && output(n) == unmarked)
- queue.push(n);
+ queue.push(max - input(n), n);
}
}
return output;
Index: sandbox/geraud/cs2d/cs2d_morpho.hh
--- sandbox/geraud/cs2d/cs2d_morpho.hh (revision 2561)
+++ sandbox/geraud/cs2d/cs2d_morpho.hh (working copy)
@@ -45,7 +45,7 @@
mln_concrete(I) output;
initialize(output, input);
- accu::min_max_<mln_value(I)> m;
+ accu::min_max<mln_value(I)> m;
mln_piter(I) p(input.domain());
mln_niter(N) n(nbh, p);
Index: sandbox/folio/dt/canvas_dt.hh
--- sandbox/folio/dt/canvas_dt.hh (revision 2561)
+++ sandbox/folio/dt/canvas_dt.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -97,7 +97,7 @@
initialize(distance, f.input);
// Mod determination.
- mln::accu::max_<unsigned> accu;
+ mln::accu::max<unsigned> accu;
mln_fwd_piter(I) p(f.input.domain());
mln_qiter(N) n(f.nbh, p);
for_all(n)
1
0