2006-08-25 Roland Levillain <roland(a)lrde.epita.fr>
Clean up.
* oln/lrde/ufmt/bin/fiorio.cc: Remove dead code.
* oln/lrde/ufmt/fiorio-1.hh, oln/lrde/ufmt/fiorio-2.hh: Likewise.
Adjust header guards.
Don't use non-ASCII characters.
* oln/lrde/ufmt/README (find_root): Don't use non-ASCII
characters.
--- 10.250/olena/oln/lrde/ufmt/README Fri, 25 Aug 2006 17:56:35 +0200 levill_r
(oln/x/22_README 1.3 644)
+++ 10.251/olena/oln/lrde/ufmt/README Fri, 25 Aug 2006 18:19:26 +0200 levill_r
(oln/x/22_README 1.4 644)
@@ -134,4 +134,4 @@
** fiorio-2.hh
My second implementation of the max-tree computation using Fiorio's and
-Gustedt's algorithm, using routines of Tho's (anc, insert, etc.)
+Gustedt's algorithm, using routines of Theo's (anc, insert, etc.)
--- 10.250/olena/oln/lrde/ufmt/fiorio-1.hh Fri, 25 Aug 2006 17:56:35 +0200 levill_r
(oln/x/27_fiorio-1.h 1.1 644)
+++ 10.251/olena/oln/lrde/ufmt/fiorio-1.hh Fri, 25 Aug 2006 18:19:26 +0200 levill_r
(oln/x/27_fiorio-1.h 1.2 644)
@@ -37,8 +37,8 @@
started to work on August 25th, 2006. */
-#ifndef OLENA_LRDE_UFMT_FIORIO_HH
-# define OLENA_LRDE_UFMT_FIORIO_HH
+#ifndef OLENA_LRDE_UFMT_FIORIO_1_HH
+# define OLENA_LRDE_UFMT_FIORIO_1_HH
# include <algorithm>
@@ -59,27 +59,18 @@
typedef oln_point_type(I) point;
typedef oln_value_type(I) value;
typedef oln_iter_type(I) piter;
- // typedef oln_neighborhood_type(I) Nbh;
- // typedef oln_iter_type(Nbh) niter;
typedef typename mute<I, point>::ret parent_type;
- // FIXME: Should be elsewhere!
- typedef oln::image2d<unsigned> area_type;
-
public:
fiorio(const abstract::image<I>& ima) :
ima_(ima.exact().clone()), parent_(ima.size())
, n_level_roots_cpt_(ima.npoints())
-// , area_(ima_.size())
{
// Init the image of parents.
piter p (parent_);
for_all (p)
parent_[p] = p;
- // FIXME: Should be elsewhere!
- // Init the image of data.
-// oln::level::fill (area_, 1);
}
/// Entry point of the algorithm.
@@ -144,7 +135,7 @@
protected:
- // Improve to handle other neighborhoods than 4-c.
+ // FIXME: Improve to handle other neighborhoods than 4-c.
void scan_line()
{
// Special treatment of the first line (no merge).
@@ -184,13 +175,9 @@
{
point p (row, col );
point upper (row - 1, col );
- point left (row, col - 1);
- // FIXME: Disabled, since /a priori/ useless.
- // (Remove it?)
-#if 0
- // Merge with left pixel.
- merge(p, left);
-#endif
+
+ // Note: merging with the left pixel is useless.
+
// Merge with upper pixel.
merge(p, upper);
}
@@ -198,7 +185,7 @@
// FIXME: Turn this recursive method into a loop!
// FIXME: Get rid of the swap, using an introductory method.
- /// \note Th�o calls this method ``update'.
+ /// \note Theo calls this method ``update'.
void merge(const point& p, const point& q)
{
point r = find_level_root(p);
@@ -227,7 +214,7 @@
merge(t, s);
}
- /// \note Th�o calls this function ``is_root'.
+ /// \note Theo calls this function ``is_root'.
bool is_top(const point& p) const
{
return parent_[p] == p;
@@ -257,60 +244,13 @@
}
protected:
- /// \note Th�o calls this image ``f''.
+ /// \note Theo calls this image ``f''.
I ima_;
- /// \note Th�o calls this image ``par''.
+ /// \note Theo calls this image ``par''.
parent_type parent_;
// Counter of level roots (method 1).
unsigned n_level_roots_cpt_;
-
-
-// ----------------------------------------------------------------
-
-// FIXME: Should be elsewhere!
-
-// public:
-// void area_opening (unsigned size)
-// {
-// oln_iter_type_(area_type) p(area_);
-
-// // First pass: sum areas.
-// for_all(p)
-// {
-// point p_parent = parent_[p];
-// while (p != p_parent)
-// {
-// area_[p_parent] += 1;
-// }
-// }
-
-// // Second pass: cut branches in the max-tree.
-// for_all(p)
-// merge(p, size);
-// }
-
-// protected:
-// // Attach P to Q.
-// // FIXME: The criterion should be passed as a function object.
-// point merge (const point& p, unsigned size)
-// {
-// if (not is_top(p) && area_[p] < size)
-// {
-// // Find the component satisfying the criterion.
-// point new_level_root = merge(parent_[p], size);
-// // Attach P to its new component representant (level root).
-// parent_[p] = new_level_root;
-// // Take the color of the new component.
-// ima_[p] = ima_[new_level_root];
-// return new_level_root;
-// }
-// else
-// return p;
-// }
-
-// protected:
-// area_type area_;
};
} // end of namespace oln::lrde::ufmt
@@ -319,4 +259,4 @@
} // end of namespace oln
-#endif // ! OLENA_LRDE_UFMT_FIORIO_HH
+#endif // ! OLENA_LRDE_UFMT_FIORIO_1_HH
--- 10.250/olena/oln/lrde/ufmt/fiorio-2.hh Fri, 25 Aug 2006 17:56:35 +0200 levill_r
(oln/x/28_fiorio-2.h 1.1 644)
+++ 10.251/olena/oln/lrde/ufmt/fiorio-2.hh Fri, 25 Aug 2006 18:19:26 +0200 levill_r
(oln/x/28_fiorio-2.h 1.2 644)
@@ -34,11 +34,11 @@
Science, 1996.
\note This is the second version of my implementation, augmented
- with Th�o's (better) routines and ideas. */
+ with Theo's (better) routines and ideas. */
-#ifndef OLENA_LRDE_UFMT_FIORIO_HH
-# define OLENA_LRDE_UFMT_FIORIO_HH
+#ifndef OLENA_LRDE_UFMT_FIORIO_2_HH
+# define OLENA_LRDE_UFMT_FIORIO_2_HH
# include <algorithm>
@@ -59,27 +59,17 @@
typedef oln_point_type(I) point;
typedef oln_value_type(I) value;
typedef oln_iter_type(I) piter;
- // typedef oln_neighborhood_type(I) Nbh;
- // typedef oln_iter_type(Nbh) niter;
typedef typename mute<I, point>::ret parent_type;
- // FIXME: Should be elsewhere!
- typedef oln::image2d<unsigned> area_type;
-
public:
fiorio(const abstract::image<I>& ima) :
ima_(ima.exact().clone()), parent_(ima.size())
, n_level_roots_cpt_(ima.npoints())
-// , area_(ima_.size())
{
// Init the image of parents.
piter p (parent_);
for_all (p)
parent_[p] = p;
-
- // FIXME: Should be elsewhere!
- // Init the image of data.
-// oln::level::fill (area_, 1);
}
/// Entry point of the algorithm.
@@ -144,7 +134,7 @@
protected:
- // Improve to handle other neighborhoods than 4-c.
+ // FIXME: Improve to handle other neighborhoods than 4-c.
void scan_line()
{
// Special treatment of the first line (no merge).
@@ -204,7 +194,8 @@
}
}
- /// Front-end to \a merge_.
+ /// \brief Front-end to \a merge_.
+ /// \note Theo calls this method ``update'.
void merge(const point& p, const point& q)
{
// The \a merge_ routine assumes that P has a value greater
@@ -216,8 +207,6 @@
}
// FIXME: Turn this recursive method into a loop!
- // FIXME: Get rid of the swap, using an introductory method.
- /// \note Th�o calls this method ``update'.
void merge_(const point& p, const point& q)
{
precondition (p != q);
@@ -231,9 +220,6 @@
if (r == s)
return;
- // FIXME: Have a look at Th�o's ``update'' routine to see
- // if we can improve this method.
- // \{
point t = parent_[s];
if (ima_[s] == ima_[r])
@@ -251,7 +237,7 @@
merge_(r, t);
}
- /// \note Th�o calls this function ``is_root'.
+ /// \note Theo calls this function ``is_root'.
bool is_top(const point& p) const
{
return parent_[p] == p;
@@ -265,7 +251,7 @@
}
/// \brief Find the level root of the component that P belongs to.
- /// \note From Th�o.
+ /// \note From Theo.
point find_level_root(const point& p)
{
// Is P a level root at the end the routine?
@@ -276,8 +262,8 @@
return parent_[p] = find_level_root(parent_[p]);
}
- /// \note From Th�o.
- /// \note Th�o calls this method ``anc''.
+ /// \note From Theo.
+ /// \note Theo calls this method ``anc''.
point find_ancestor(point p, const value& level)
{
while (not is_top(p) and ima_[parent_[p]] >= level)
@@ -286,60 +272,13 @@
}
protected:
- /// \note Th�o calls this image ``f''.
+ /// \note Theo calls this image ``f''.
I ima_;
- /// \note Th�o calls this image ``par''.
+ /// \note Theo calls this image ``par''.
parent_type parent_;
// Counter of level roots (method 1).
unsigned n_level_roots_cpt_;
-
-
-// ----------------------------------------------------------------
-
-// FIXME: Should be elsewhere!
-
-// public:
-// void area_opening (unsigned size)
-// {
-// oln_iter_type_(area_type) p(area_);
-
-// // First pass: sum areas.
-// for_all(p)
-// {
-// point p_parent = parent_[p];
-// while (p != p_parent)
-// {
-// area_[p_parent] += 1;
-// }
-// }
-
-// // Second pass: cut branches in the max-tree.
-// for_all(p)
-// merge(p, size);
-// }
-
-// protected:
-// // Attach P to Q.
-// // FIXME: The criterion should be passed as a function object.
-// point merge (const point& p, unsigned size)
-// {
-// if (not is_top(p) && area_[p] < size)
-// {
-// // Find the component satisfying the criterion.
-// point new_level_root = merge(parent_[p], size);
-// // Attach P to its new component representant (level root).
-// parent_[p] = new_level_root;
-// // Take the color of the new component.
-// ima_[p] = ima_[new_level_root];
-// return new_level_root;
-// }
-// else
-// return p;
-// }
-
-// protected:
-// area_type area_;
};
} // end of namespace oln::lrde::ufmt
@@ -348,4 +287,4 @@
} // end of namespace oln
-#endif // ! OLENA_LRDE_UFMT_FIORIO_HH
+#endif // ! OLENA_LRDE_UFMT_FIORIO_2_HH
--- 10.250/olena/oln/lrde/ufmt/bin/fiorio.cc Fri, 25 Aug 2006 17:56:35 +0200 levill_r
(oln/x/30_fiorio.cc 1.1 644)
+++ 10.251/olena/oln/lrde/ufmt/bin/fiorio.cc Fri, 25 Aug 2006 18:19:26 +0200 levill_r
(oln/x/30_fiorio.cc 1.2 644)
@@ -16,69 +16,29 @@
void usage(char* argv[])
{
- std::cerr << "usage: " << argv[0] << " input.pgm
"//"level-roots.pbm"
+ std::cerr << "usage: " << argv[0] << "
input.pgm"
<< std::endl
<< "Max-tree computation with Fiorio's and Gustedt's
algorithm."
<< std::endl;
- // FIXME: get precise description...
exit(1);
}
int main(int argc, char* argv[])
{
-// if (argc != 3)
-// usage(argv);
if (argc != 2)
usage(argv);
typedef oln::image2d<ntg::int_u8> image_type;
-
image_type input = oln::io::load(argv[1]);
typedef oln::lrde::ufmt::fiorio<image_type> algorithm_type;
-
algorithm_type run(input);
- std::cout << "npoint = " <<
run.ima().npoints()
+ std::cout << "npoint = " <<
run.ima().npoints()
<< std::endl;
run.go();
- std::cout << "n level roots (first version) = " <<
run.n_level_roots1()
+ std::cout << "n level roots (first method) = " <<
run.n_level_roots1()
<< std::endl
- << "n level roots (second version) = " <<
run.n_level_roots2()
+ << "n level roots (second method) = " << run.n_level_roots2()
<< std::endl;
-
-// // Save the image of level roots.
-// oln::save(run.level_roots(), argv[2]);
-
-#if 0
- // Create an image of components.
- image_type output (input.size());
- oln::level::fill (output, 0);
- unsigned color = 1;
- oln_iter_type_(image_type) p(algo.parent());
- for_all(p)
- {
- oln::point2d root = algo.parent()[p];
- // Assign a color to the root point of the component if not yet
- // done.
- if (output[root] == 0)
- output[root] = color;
- // If P is not a root, assign it the color of its root.
- if (p != root)
- output[p] = output[root];
-
- // Increment the color, handling overflows (sigh). This is
- // quick and dirty, but allows us to view the output image
- // easily.
- color =
- color >= 255 ?
- 1 :
- color + 1;
- }
-#endif
-
-#if 0
- algo.area_opening (5);
- oln::io::save (algo.ima(), argv[2]);
-#endif
}
--- 10.250/oln.prj
+++ 10.251/oln.prj
@@ -1,26 +1,21 @@
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Olena")
-(Project-Version oln 10 250)
-(Parent-Version oln 10 248)
+(Project-Version oln 10 251)
+(Parent-Version oln 10 250)
(Version-Log "2006-08-25 Roland Levillain <roland(a)lrde.epita.fr>
- Max-tree computation based on Fiorio's and Gustedt's labelling
- algorithm.
+ Clean up.
- * oln/lrde/ufmt/fiorio-1.hh, oln/lrde/ufmt/fiorio-2.hh: New.
- * oln/lrde/ufmt/bin/fiorio.cc: New.
- * oln/lrde/ufmt/README: Update.
-
- Make the the olena/oln/lrde/ufmt hierarchy a full-fledged part of
- the autoconfiscated package.
-
- * oln/lrde/Makefile.am, oln/lrde/ufmt/Makefile.am,
- * oln/lrde/ufmt/bin/Makefile.am: New.
- * TODO: New.
+ * oln/lrde/ufmt/bin/fiorio.cc: Remove dead code.
+ * oln/lrde/ufmt/fiorio-1.hh, oln/lrde/ufmt/fiorio-2.hh: Likewise.
+ Adjust header guards.
+ Don't use non-ASCII characters.
+ * oln/lrde/ufmt/README (find_root): Don't use non-ASCII
+ characters.
")
(New-Version-Log "")
-(Checkin-Time "Fri, 25 Aug 2006 17:56:35 +0200")
+(Checkin-Time "Fri, 25 Aug 2006 18:19:26 +0200")
(Checkin-Login levill_r)
;; diff-ignore tests/data/.*pbm$
;; diff-ignore .*\.pbm$
@@ -137,7 +132,7 @@
(doc/ChangeLog (oln/o/31_ChangeLog 1.38.1.7.1.5.1.14.1.17 600))
(integre/ChangeLog (oln/q/35_ChangeLog 1.12.1.2.1.51 600))
(metalic/ChangeLog (oln/q/30_ChangeLog 1.3.1.44 600))
- (olena/ChangeLog (oln/o/30_ChangeLog 1.27.1.36.1.3.1.11.1.5.1.64.1.47.1.93.1.27.2.13
600))
+ (olena/ChangeLog (oln/o/30_ChangeLog 1.27.1.36.1.3.1.11.1.5.1.64.1.47.1.93.1.27.2.14
600))
(tools/ChangeLog (oln/o/32_ChangeLog 1.10.1.17 600))
(tools/swilena/ChangeLog (oln/n/37_ChangeLog 1.7.1.48 600))
@@ -1573,7 +1568,7 @@
- (olena/oln/lrde/ufmt/README (oln/x/22_README 1.3 644))
+ (olena/oln/lrde/ufmt/README (oln/x/22_README 1.4 644))
;; Files deleted by depopulate at Fri, 04 Aug 2006 18:41:16 +0200,
;; from version 10.245(w), by theo:
@@ -1603,19 +1598,10 @@
(olena/TODO (oln/x/24_TODO 1.1 644))
(olena/oln/lrde/Makefile.am (oln/x/25_Makefile.a 1.1 644))
(olena/oln/lrde/ufmt/Makefile.am (oln/x/26_Makefile.a 1.1 644))
- (olena/oln/lrde/ufmt/fiorio-1.hh (oln/x/27_fiorio-1.h 1.1 644))
- (olena/oln/lrde/ufmt/fiorio-2.hh (oln/x/28_fiorio-2.h 1.1 644))
+ (olena/oln/lrde/ufmt/fiorio-1.hh (oln/x/27_fiorio-1.h 1.2 644))
+ (olena/oln/lrde/ufmt/fiorio-2.hh (oln/x/28_fiorio-2.h 1.2 644))
(olena/oln/lrde/ufmt/bin/Makefile.am (oln/x/29_Makefile.a 1.1 644))
- (olena/oln/lrde/ufmt/bin/fiorio.cc (oln/x/30_fiorio.cc 1.1 644))
-)
-(Merge-Parents
- (10.249 complete
- (ChangeLog ChangeLog ChangeLog r) (olena/oln/lrde/ufmt/bin/basic_salembier.cc
olena/oln/lrde/ufmt/bin/basic_salembier.cc olena/oln/lrde/ufmt/bin/basic_salembier.cc r)
- (olena/oln/lrde/ufmt/log.hh olena/oln/lrde/ufmt/log.hh olena/oln/lrde/ufmt/log.hh r)
(olena/oln/lrde/ufmt/ad_maxtree.hh olena/oln/lrde/ufmt/ai_maxtree.hh
olena/oln/lrde/ufmt/ad_maxtree.hh r)
- (olena/oln/lrde/ufmt/hdc_maxtree.hh olena/oln/lrde/ufmt/si_maxtree.hh
olena/oln/lrde/ufmt/hdc_maxtree.hh r) (olena/oln/lrde/ufmt/rpc_maxtree.hh
olena/oln/lrde/ufmt/rup_maxtree.hh olena/oln/lrde/ufmt/rpc_maxtree.hh r)
- (olena/oln/lrde/ufmt/hpc_maxtree.hh olena/oln/lrde/ufmt/sp_maxtree.hh
olena/oln/lrde/ufmt/hpc_maxtree.hh r) (olena/oln/lrde/ufmt/ap_maxtree.hh
olena/oln/lrde/ufmt/ap_maxtree.hh olena/oln/lrde/ufmt/ap_maxtree.hh r)
- (olena/oln/lrde/ufmt/r1ic_maxtree.hh olena/oln/lrde/ufmt/r1_maxtree.hh
olena/oln/lrde/ufmt/r1ic_maxtree.hh r) (olena/oln/lrde/ufmt/bin/rpc_maxtree.cc
olena/oln/lrde/ufmt/bin/rup_maxtree.cc olena/oln/lrde/ufmt/bin/rpc_maxtree.cc r)
- (olena/oln/lrde/ufmt/bin/hdc_maxtree.cc olena/oln/lrde/ufmt/bin/si_maxtree.cc
olena/oln/lrde/ufmt/bin/hdc_maxtree.cc r) (olena/oln/lrde/ufmt/bin/hpc_maxtree.cc
olena/oln/lrde/ufmt/bin/sp_maxtree.cc olena/oln/lrde/ufmt/bin/hpc_maxtree.cc r)
- (olena/oln/lrde/ufmt/bin/r1ic_maxtree.cc olena/oln/lrde/ufmt/bin/r1_maxtree.cc
olena/oln/lrde/ufmt/bin/r1ic_maxtree.cc r) (olena/oln/lrde/ufmt/README
olena/oln/lrde/ufmt/README olena/oln/lrde/ufmt/README m))
+ (olena/oln/lrde/ufmt/bin/fiorio.cc (oln/x/30_fiorio.cc 1.2 644))
)
+(Merge-Parents)
(New-Merge-Parents)