2007-02-08 Roland Levillain <roland(a)lrde.epita.fr>
Add new binaries for Salembier et al. algorithm.
* oln/lrde/ufmt/generic_salembier.hh
(generic_salembier::npoints) [DEBUG]: New attribute.
(generic_salembier::generic_salembier) [DEBUG]: Initialize it.
(generic_salembier::update_status) [DEBUG]: New function.
(generic_salembier::flood) [DEBUG]: Use it.
* oln/lrde/ufmt/generic_simplified_salembier.hh
(generic_simplified_salembier::npoints) [DEBUG]: New attribute.
(generic_simplified_salembier::generic_simplified_salembier)
[DEBUG]: Initialize it.
(generic_simplified_salembier::update_status) [DEBUG]: New
function.
(generic_simplified_salembier::flood) [DEBUG]: Use it.
* oln/lrde/ufmt/bin/basic_salembier_float_via_16b.cc,
* oln/lrde/ufmt/bin/generic_salembier_float_via_16b.cc: New.
* oln/lrde/ufmt/bin/Makefile.am (check_PROGRAMS): Add
basic_salembier_float_via_16b and generic_salembier_float_via_16b.
(basic_salembier_float_via_16b_SOURCES)
(basic_salembier_float_via_16b_LDFLAGS)
(generic_salembier_float_via_16b_SOURCES)
(generic_salembier_float_via_16b_LDFLAGS): New.
* oln/lrde/ufmt/README: Typo.
New tool: pfm-crop.
* oln/lrde/efigi/misc.hh (crop): New function.
* oln/lrde/efigi/req.hh (equalize_16): New function.
* oln/lrde/efigi/pfm-crop.cc: New.
* oln/lrde/efigi/Makefile.am (check_PROGRAMS): Add pfm-crop.
(pfm_crop_SOURCES): New.
--- 10.270/configure.ac Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/3_configure.
1.47.1.1.1.1.1.4.1.15.1.16.1.11 600)
+++ 10.271/configure.ac Thu, 08 Feb 2007 12:40:28 +0100 levill_r (oln/3_configure.
1.47.1.1.1.1.1.4.1.15.1.16.1.12 600)
@@ -465,9 +465,9 @@
## -- FIXME: Improve integration. ----------------------------------------
##
-## The contents of `olena/lrde' should be moved to subdirectory of
-## `olena/oln', and the contents of `olena/lrde/ufmt/bin to `olena/tests'
-## or to `tools'.
+## The contents of `olena/oln/lrde' should be moved to another subdirectory
+## of `olena/oln/', and the contents of `olena/lrde/ufmt/bin to
+## `olena/tests' or to `tools'.
AC_CONFIG_FILES([olena/oln/lrde/Makefile
olena/oln/lrde/efigi/Makefile
olena/oln/lrde/ufmt/Makefile
--- 10.270/olena/oln/lrde/ufmt/README Wed, 03 Jan 2007 15:17:57 +0100 levill_r
(oln/x/22_README 1.7 644)
+++ 10.271/olena/oln/lrde/ufmt/README Thu, 08 Feb 2007 12:40:28 +0100 levill_r
(oln/x/22_README 1.8 644)
@@ -157,7 +157,7 @@
** naive_generic_salembier
-A previous version of generic_simplified_salembier, probablt no longer
+A previous version of generic_simplified_salembier, probably no longer
useful.
flooding
--- 10.270/olena/oln/lrde/ufmt/bin/Makefile.am Wed, 03 Jan 2007 15:17:57 +0100 levill_r
(oln/x/29_Makefile.a 1.5 644)
+++ 10.271/olena/oln/lrde/ufmt/bin/Makefile.am Thu, 08 Feb 2007 12:40:28 +0100 levill_r
(oln/x/29_Makefile.a 1.6 644)
@@ -6,14 +6,19 @@
generic_salembier_int_u8 generic_salembier_float generic_salembier_float2 \
generic_simplified_salembier_float \
naive_generic_salembier_float \
+ basic_salembier_float_via_16b \
+ generic_salembier_float_via_16b \
fiorio-1 fiorio-2 fiorio-3 \
hdc_maxtree hpc_maxtree r1ic_maxtree rpc_maxtree
basic_maxtree_SOURCES = basic_maxtree.cc
basic_najman_SOURCES = basic_najman.cc
-basic_salembier_SOURCES = basic_salembier.cc
+# Salembier - Unsigned integer versions.
+basic_salembier_SOURCES = basic_salembier.cc
generic_salembier_int_u8_SOURCES = generic_salembier_int_u8.cc
+
+# Salembier - Float versions.
generic_salembier_float_SOURCES = generic_salembier_float.cc
generic_salembier_float_LDFLAGS = -lcfitsio $(ZLIB_LDFLAGS)
generic_salembier_float2_SOURCES = generic_salembier_float2.cc
@@ -23,6 +28,13 @@
naive_generic_salembier_float_SOURCES = naive_generic_salembier_float.cc
naive_generic_salembier_float_LDFLAGS = -lcfitsio $(ZLIB_LDFLAGS)
+# Salembier - Float versions, using a 16-bits equalization step.
+basic_salembier_float_via_16b_SOURCES = basic_salembier_float_via_16b.cc
+basic_salembier_float_via_16b_LDFLAGS = -lcfitsio $(ZLIB_LDFLAGS)
+generic_salembier_float_via_16b_SOURCES = generic_salembier_float_via_16b.cc
+generic_salembier_float_via_16b_LDFLAGS = -lcfitsio $(ZLIB_LDFLAGS)
+
+
fiorio_1_SOURCES = fiorio.cc
fiorio_2_SOURCES = fiorio.cc
fiorio_2_CPPFLAGS = -DFIORIO_VERSION=2
--- 10.270/olena/oln/lrde/efigi/misc.hh Fri, 15 Dec 2006 10:22:33 +0100 theo
(oln/x/50_misc.hh 1.1 644)
+++ 10.271/olena/oln/lrde/efigi/misc.hh Thu, 08 Feb 2007 12:40:28 +0100 levill_r
(oln/x/50_misc.hh 1.2 644)
@@ -150,6 +150,24 @@
}
+ // Crop a 2-D image.
+ template <typename T>
+ image2d<T>
+ crop(const image2d<T>& input, coord x, coord y, coord dx, coord dy)
+ {
+ assertion (dx > 0);
+ assertion (dy > 0);
+ assertion(ima.hold(point2d(x, y)));
+ assertion(ima.hold(point2d(x + dx, y + dy)));
+
+ image2d<float> output(dx, dy);
+ for (coord row = 0; row < dx; ++row)
+ for (coord col = 0; col < dy; ++col)
+ output(row, col) = input(x + row, y + col);
+ return output;
+ }
+
+
} // end of namespace oln::efigi
} // end of namespace oln
--- 10.270/olena/oln/lrde/efigi/req.hh Fri, 15 Dec 2006 10:22:33 +0100 theo
(oln/y/0_req.hh 1.1 644)
+++ 10.271/olena/oln/lrde/efigi/req.hh Thu, 08 Feb 2007 12:40:28 +0100 levill_r
(oln/y/0_req.hh 1.2 644)
@@ -160,6 +160,30 @@
return output;
}
+ image2d<unsigned short>
+ equalize_16(const image2d<float>& input)
+ {
+ std::vector<pix> v = efigi::sort(input);
+ const int nrows = input.nrows(), ncols = input.ncols();
+ image2d<unsigned short> output(nrows, ncols);
+
+ unsigned n = unsigned((nrows * ncols) / 65536.f + 1.f);
+ unsigned l = 0;
+ for (;;)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ {
+ unsigned j = l * n + i;
+ if (j >= v.size())
+ return output;
+ pix& p = v[l * n + i];
+ output(p.row, p.col) = l;
+ }
+ ++l;
+ }
+ return output;
+ }
+
image2d<bool>
lab2bin(const image2d<unsigned char>& input)
--- 10.270/olena/oln/lrde/efigi/Makefile.am Wed, 20 Dec 2006 14:46:12 +0100 levill_r
(oln/y/6_Makefile.a 1.1 644)
+++ 10.271/olena/oln/lrde/efigi/Makefile.am Thu, 08 Feb 2007 12:40:28 +0100 levill_r
(oln/y/6_Makefile.a 1.2 644)
@@ -21,12 +21,14 @@
check_PROGRAMS = \
gaussian \
+ pfm-crop \
pfm2pgm \
pgm2pfm \
pgm2pfm_wo_noise \
wst
gaussian_SOURCES = gaussian.cc
+pfm_crop_SOURCES = pfm-crop.cc
pfm2pgm_SOURCES = pfm2pgm.cc
pgm2pfm_wo_noise_SOURCES = pgm2pfm_wo_noise.cc
pgm2pfm_SOURCES = pgm2pfm.cc
--- 10.270/olena/oln/lrde/ufmt/generic_salembier.hh Wed, 03 Jan 2007 15:17:57 +0100
levill_r (oln/y/8_generic_sa 1.2 644)
+++ 10.271/olena/oln/lrde/ufmt/generic_salembier.hh Thu, 08 Feb 2007 12:40:28 +0100
levill_r (oln/y/8_generic_sa 1.3 644)
@@ -153,6 +153,9 @@
typedef std::pair<unsigned, value> pair_t;
std::map<pair_t, pair_t> father;
+# ifdef OLN_DEBUG
+ unsigned npoints;
+# endif // OLN_DEBUG
generic_salembier(const abstract::image<I>& f,
const oln_neighborhood_type(I)& nbh) :
@@ -161,6 +164,9 @@
// FIXME: status should NOT be initialized here!
// (but in "init()") (??)
status(f.size())
+# ifdef OLN_DEBUG
+ , npoints(f.npoints())
+# endif // OLN_DEBUG
{
}
@@ -195,6 +201,25 @@
}
+# ifdef OLN_DEBUG
+ void update_status (std::ostream& ostr)
+ {
+ static unsigned nupdates = 0;
+ static const unsigned step = 1;
+ static unsigned next_step = step;
+ ++nupdates;
+ unsigned percent = nupdates * 100 / npoints;
+ if (percent >= next_step)
+ {
+ // Print.
+ std::cerr << percent << "% points processed" <<
std::endl;
+ // Increase the next step.
+ while (percent >= next_step)
+ next_step += step;
+ }
+ }
+# endif // OLN_DEBUG
+
level_iterator flood(const value& h)
{
level_iterator m;
@@ -203,6 +228,9 @@
point p = hqueue.first(h);
status[p] = get(number_nodes, h, 0u);
+# ifdef OLN_DEBUG
+ update_status(std::cerr);
+# endif // OLN_DEBUG
oln_neighb_type(Nbh) q(nbh, p);
for_all(q)
--- 10.270/olena/oln/lrde/ufmt/generic_simplified_salembier.hh Wed, 03 Jan 2007 15:17:57
+0100 levill_r (oln/y/14_generic_si 1.1 644)
+++ 10.271/olena/oln/lrde/ufmt/generic_simplified_salembier.hh Thu, 08 Feb 2007 12:40:28
+0100 levill_r (oln/y/14_generic_si 1.2 644)
@@ -251,6 +251,9 @@
std::map<point, point, point_less<I, point> > father;
+# ifdef OLN_DEBUG
+ unsigned npoints;
+# endif // OLN_DEBUG
generic_simplified_salembier(const abstract::image<I>& f,
const oln_neighborhood_type(I)& nbh) :
@@ -261,6 +264,9 @@
pset(point_less<I, point>(f.exact())),
sites(point_greater<I, point>(f.exact())),
father(point_less<I, point>(f.exact()))
+# ifdef OLN_DEBUG
+ , npoints(f.npoints())
+# endif // OLN_DEBUG
{
}
@@ -306,6 +312,26 @@
// // --------------------------------------------------- DEBUG --
}
+# ifdef OLN_DEBUG
+ void update_status (std::ostream& ostr)
+ {
+ static unsigned nupdates = 0;
+ static const unsigned step = 1;
+ static unsigned next_step = step;
+ ++nupdates;
+ unsigned percent = nupdates * 100 / npoints;
+ if (percent >= next_step)
+ {
+ // Print.
+ std::cerr << percent << "% points processed" <<
std::endl;
+ // Increase the next step.
+ while (percent >= next_step)
+ next_step += step;
+ }
+ }
+# endif // OLN_DEBUG
+
+
// H is a point here, not a level!
// FIXME: Change the name of this argument, as it's confusing.
site_iterator flood(const point& h)
@@ -343,6 +369,9 @@
pset.erase(i);
status[p] = true;
+#ifdef OLN_DEBUG
+ update_status(std::cerr);
+#endif // OLN_DEBUG
// // -- DEBUG -----------------------------------------------
// std::cerr << " status = " << std::endl;
Index: 10.270/oln.prj
--- 10.270/oln.prj
+++ 10.271/oln.prj
@@ -1,47 +1,46 @@
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Olena")
-(Project-Version oln 10 270)
-(Parent-Version oln 10 269)
-(Version-Log "2007-01-03 Roland Levillain <roland(a)lrde.epita.fr>
+(Project-Version oln 10 271)
+(Parent-Version oln 10 270)
+(Version-Log "2007-02-08 Roland Levillain <roland(a)lrde.epita.fr>
- New versions of Salembier et al. algorithm.
+ Add new binaries for Salembier et al. algorithm.
* oln/lrde/ufmt/generic_salembier.hh
- (oln::lrde::ufmt::generic_salembier): Add a second template
- parameter, defaulting to std::greater< oln_value_type(I) >. Use
- this parameter for comparisons, to have the algorithm be more
- flexible.
- * oln/lrde/ufmt/bin/generic_salembier_float2.cc: New.
- Use the second template parameter of
- oln::lrde::ufmt::generic_salembier to create a more flexible
- version of generic_salembier_float where float comparisons are
- performed using a maxium relative error and a maximum absolute
- error.
- * oln/lrde/ufmt/generic_simplified_salembier.hh: New.
- A simplified version of oln::lrde::ufmt::generic_salembier,
- specially useful on float images.
- * oln/lrde/ufmt/bin/generic_simplified_salembier_float.cc: New.
- * oln/lrde/ufmt/naive_generic_salembier.hh: New.
- A previous attempt before generic_simplified_salembier.
- * oln/lrde/ufmt/basic_salembier.hh: More documentation.
- * oln/lrde/ufmt/bin/basic_najman.cc: Typo.
- * oln/lrde/ufmt/README: Document Salembier et al. algorithm variants.
+ (generic_salembier::npoints) [DEBUG]: New attribute.
+ (generic_salembier::generic_salembier) [DEBUG]: Initialize it.
+ (generic_salembier::update_status) [DEBUG]: New function.
+ (generic_salembier::flood) [DEBUG]: Use it.
+ * oln/lrde/ufmt/generic_simplified_salembier.hh
+ (generic_simplified_salembier::npoints) [DEBUG]: New attribute.
+ (generic_simplified_salembier::generic_simplified_salembier)
+ [DEBUG]: Initialize it.
+ (generic_simplified_salembier::update_status) [DEBUG]: New
+ function.
+ (generic_simplified_salembier::flood) [DEBUG]: Use it.
+ * oln/lrde/ufmt/bin/basic_salembier_float_via_16b.cc,
+ * oln/lrde/ufmt/bin/generic_salembier_float_via_16b.cc: New.
* oln/lrde/ufmt/bin/Makefile.am (check_PROGRAMS): Add
- generic_salembier_float2, generic_simplified_salembier_float
- and naive_generic_salembier_float.
- (generic_salembier_float2_SOURCES)
- (generic_salembier_float2_LDFLAGS)
- (generic_simplified_salembier_float_SOURCES)
- (generic_simplified_salembier_float_LDFLAGS)
- (naive_generic_salembier_float_SOURCES)
- (naive_generic_salembier_float_LDFLAGS): New.
- * oln/lrde/ufmt/Makefile.am (noinst_HEADERS): Add
- generic_simplified_salembier.hh and naive_generic_salembier.hh.
+ basic_salembier_float_via_16b and generic_salembier_float_via_16b.
+ (basic_salembier_float_via_16b_SOURCES)
+ (basic_salembier_float_via_16b_LDFLAGS)
+ (generic_salembier_float_via_16b_SOURCES)
+ (generic_salembier_float_via_16b_LDFLAGS): New.
+ * oln/lrde/ufmt/README: Typo.
+
+
+ New tool: pfm-crop.
+
+ * oln/lrde/efigi/misc.hh (crop): New function.
+ * oln/lrde/efigi/req.hh (equalize_16): New function.
+ * oln/lrde/efigi/pfm-crop.cc: New.
+ * oln/lrde/efigi/Makefile.am (check_PROGRAMS): Add pfm-crop.
+ (pfm_crop_SOURCES): New.
")
(New-Version-Log "")
-(Checkin-Time "Wed, 03 Jan 2007 15:17:57 +0100")
+(Checkin-Time "Thu, 08 Feb 2007 12:40:28 +0100")
(Checkin-Login levill_r)
;; diff-ignore tests/data/.*pbm$
;; diff-ignore .*\.pbm$
@@ -154,11 +153,11 @@
(Project-Keywords)
(Files
- (ChangeLog (oln/o/33_ChangeLog 1.37.1.16.1.17.1.19.1.30 600))
+ (ChangeLog (oln/o/33_ChangeLog 1.37.1.16.1.17.1.19.1.31 600))
(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.18.1.9 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.18.1.10 600))
(tools/ChangeLog (oln/o/32_Index: 10.270/ChangeLog
Index: 10.270/olena/ChangeLog
ChangeLog 1.10.1.17 600))
(tools/swilena/ChangeLog (oln/n/37_ChangeLog 1.7.1.52 600))
@@ -170,7 +169,7 @@
(cleanup.sh (oln/o/29_cleanup.sh 1.6 700))
- (configure.ac (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.11 600))
+ (configure.ac (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.12 600))
(doc/demo/image.cc (oln/d/46_image.cc 1.8 600))
(doc/demo/Makefile.am (oln/d/44_Makefile.a 1.16.1.2 600))
@@ -1594,7 +1593,7 @@
- (olena/oln/lrde/ufmt/README (oln/x/22_README 1.7 644))
+ (olena/oln/lrde/ufmt/README (oln/x/22_README 1.8 644))
;; Files deleted by depopulate at Fri, 04 Aug 2006 18:41:16 +0200,
;; from version 10.245(w), by theo:
@@ -1613,7 +1612,7 @@
(olena/oln/lrde/ufmt/Makefile.am (oln/x/26_Makefile.a 1.6 644))
(olena/oln/lrde/ufmt/fiorio-1.hh (oln/x/27_fiorio-1.h 1.3 644))
(olena/oln/lrde/ufmt/fiorio-2.hh (oln/x/28_fiorio-2.h 1.3 644))
- (olena/oln/lrde/ufmt/bin/Makefile.am (oln/x/29_Makefile.a 1.5 644))
+ (olena/oln/lrde/ufmt/bin/Makefile.am (oln/x/29_Makefile.a 1.6 644))
(olena/oln/lrde/ufmt/bin/fiorio.cc (oln/x/30_fiorio.cc 1.3 644))
;; Files added by populate at Mon, 28 Aug 2006 10:51:36 +0200,
;; to version 10.249(w), by theo:
@@ -1660,9 +1659,9 @@
;; to version 10.255(w), by theo:
(olena/oln/lrde/efigi/pfm2pgm.cc (oln/x/49_pfm2pgm.cc 1.1 644))
- (olena/oln/lrde/efigi/misc.hh (oln/x/50_misc.hh 1.1 644))
+ (olena/oln/lrde/efigi/misc.hh (oln/x/50_misc.hh 1.2 644))
(olena/oln/lrde/efigi/io.hh (oln/x/51_io.hh 1.1 644))
- (olena/oln/lrde/efigi/req.hh (oln/y/0_req.hh 1.1 644))
+ (olena/oln/lrde/efigi/req.hh (oln/y/0_req.hh 1.2 644))
(olena/oln/lrde/efigi/wst.cc (oln/y/1_wst.cc 1.1 644))
(olena/oln/lrde/efigi/gaussian.cc (oln/y/2_gaussian.c 1.1 644))
(olena/oln/lrde/efigi/pgm2pfm.cc (oln/y/3_pgm2pfm.cc 1.1 644))
@@ -1676,9 +1675,9 @@
;; to version 10.268(w), by levill_r:
(olena/oln/lrde/efigi/pgm2pfm_wo_noise.cc (oln/y/5_pgm2pfm_wo 1.1 644))
- (olena/oln/lrde/efigi/Makefile.am (oln/y/6_Makefile.a 1.1 644))
+ (olena/oln/lrde/efigi/Makefile.am (oln/y/6_Makefile.a 1.2 644))
(olena/oln/lrde/ufmt/naive_generic_salembier.hh (oln/y/7_naive_gene 1.2 644))
- (olena/oln/lrde/ufmt/generic_salembier.hh (oln/y/8_generic_sa 1.2 644))
+ (olena/oln/lrde/ufmt/generic_salembier.hh (oln/y/8_generic_sa 1.3 644))
(olena/oln/lrde/ufmt/bin/generic_salembier_int_u8.cc (oln/y/9_generic_sa 1.1 644))
(olena/oln/lrde/ufmt/bin/generic_salembier_float.cc (oln/y/10_generic_sa 1.1 644))
@@ -1688,7 +1687,14 @@
(olena/oln/lrde/ufmt/bin/generic_salembier_float2.cc (oln/y/11_generic_sa 1.1 644))
(olena/oln/lrde/ufmt/bin/generic_simplified_salembier_float.cc (oln/y/12_generic_si 1.1
644))
(olena/oln/lrde/ufmt/bin/naive_generic_salembier_float.cc (oln/y/13_naive_gene 1.1
644))
- (olena/oln/lrde/ufmt/generic_simplified_salembier.hh (oln/y/14_generic_si 1.1 644))
+ (olena/oln/lrde/ufmt/generic_simplified_salembier.hh (oln/y/14_generic_si 1.2 644))
+
+;; Files added by populate at Thu, 08 Feb 2007 12:31:43 +0100,
+;; to version 10.270(w), by levill_r:
+
+ (olena/oln/lrde/efigi/pfm-crop.cc (oln/y/15_pfm-crop.c 1.1 644))
+ (olena/oln/lrde/ufmt/bin/basic_salembier_float_via_16b.cc (oln/y/16_basic_sale 1.1
644))
+ (olena/oln/lrde/ufmt/bin/generic_salembier_float_via_16b.cc (oln/y/17_generic_sa 1.1
644))
)
(Merge-Parents)
(New-Merge-Parents)
--- 10.270/ChangeLog Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/o/33_ChangeLog
1.37.1.16.1.17.1.19.1.30 600)
+++ 10.271/ChangeLog Thu, 08 Feb 2007 12:40:28 +0100 levill_r (oln/o/33_ChangeLog
1.37.1.16.1.17.1.19.1.31 600)
@@ -1,3 +1,7 @@
+2007-02-08 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * configure.ac: Typos.
+
2006-12-20 Roland Levillain <roland(a)lrde.epita.fr>
* configure.ac (olena/oln/lrde/efigi/Makefile): Configure it.