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
June 2009
- 9 participants
- 356 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-06-19 Etienne FOLIO <folio(a)lrde.epita.fr>
Update histo compute and project tests and algorithms.
* folio/mln/histo/compute_histo_3d.hh: Add headers.
* folio/mln/histo/project_histo_3d.hh: New projection algorithm.
* folio/test/histo/compute_histo_3d.cc: New test.
* folio/test/histo/project_histo_3d_add.cc: New test.
* folio/test/histo/project_histo_3d_mean.cc: New test.
---
mln/histo/compute_histo_3d.hh | 30 +++++++++++--
mln/histo/project_histo_3d.hh | 56 +++++++++++++++++++++++++
test/histo/compute_histo_3d.cc | 54 ++++++++++++++++++------
test/histo/project_histo_3d_add.cc | 75 +++++++++++++++++++++++++++++++++
test/histo/project_histo_3d_mean.cc | 80 ++++++++++++++++++++++++++++++++++++
5 files changed, 277 insertions(+), 18 deletions(-)
Index: trunk/milena/sandbox/folio/test/histo/project_histo_3d_mean.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/project_histo_3d_mean.cc (revision 0)
+++ trunk/milena/sandbox/folio/test/histo/project_histo_3d_mean.cc (revision 4173)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+
+#include <mln/accu/stat/mean.hh>
+#include <mln/literal/all.hh>
+#include <mln/value/rgb8.hh>
+
+#include "../../mln/histo/compute_histo_3d.hh"
+#include "../../mln/histo/project_histo_3d.hh"
+
+using namespace mln;
+using namespace value;
+
+
+inline
+void
+init_test_image(image2d<rgb8>& ima)
+{
+ rgb8 red = literal::red;
+ rgb8 green = literal::green;
+ rgb8 black = literal::black;
+
+ for (unsigned i = 1; i < 8; ++i)
+ for (unsigned j = 0; j < 8; ++j)
+ ima(point2d(j, i)) = black;
+
+ for (unsigned i = 0; i < 8; ++i)
+ ima(point2d(i, 0)) = red;
+
+ ima(point2d(4, 5)) = green;
+}
+
+
+int
+main(int argc, char* argv[])
+{
+ // build test image
+ image2d<rgb8> ima(8, 8);
+ init_test_image(ima);
+
+ // build histo
+ image3d<unsigned> histo = histo::compute_histo_3d(ima);
+
+ // project it
+ image2d<unsigned> proj =
+ histo::project_histo<accu::stat::mean<unsigned, unsigned>, 1>(histo);
+
+ // mln_fwd_piter_(image2d<unsigned>) p(proj.domain());
+ // for_all(p)
+ // if (proj(p) != 0)
+ // std::cout << p << " " << proj(p) << std::endl;
+
+ // verify...
+ mln_assertion(proj(point2d(255, 0)) == 8);
+ mln_assertion(proj(point2d(0, 0)) == 56);
+ mln_assertion(proj(point2d(0, 255)) == 0);
+}
Index: trunk/milena/sandbox/folio/test/histo/compute_histo_3d.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/compute_histo_3d.cc (revision 4172)
+++ trunk/milena/sandbox/folio/test/histo/compute_histo_3d.cc (revision 4173)
@@ -1,27 +1,45 @@
-/*!
- * \file compute_histo_rgb.cc<2>
- * \author etiennefolio <ornthalas(a)gmail.com>
- */
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
-#include <iostream>
#include <mln/literal/all.hh>
-#include <mln/value/rgb.hh>
#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
#include "../../mln/histo/compute_histo_3d.hh"
-int main()
-{
using namespace mln;
using namespace value;
- typedef rgb<3> rgb3;
- // build test image
- image2d<rgb3> ima(8, 8);
- rgb3 red = literal::red;
- rgb3 green = literal::green;
- rgb3 black = literal::black;
+void
+init_test_image(image2d<rgb8>& ima)
+{
+ rgb8 red = literal::red;
+ rgb8 green = literal::green;
+ rgb8 black = literal::black;
for (unsigned i = 1; i < 8; ++i)
for (unsigned j = 0; j < 8; ++j)
@@ -38,6 +56,14 @@
point2d p(4, 5);
ima(p) = green;
+}
+
+
+int main()
+{
+ // build test image
+ image2d<rgb8> ima(8, 8);
+ init_test_image(ima);
// build histo
image3d<unsigned> out = histo::compute_histo_3d(ima);
Index: trunk/milena/sandbox/folio/test/histo/project_histo_3d_add.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/project_histo_3d_add.cc (revision 0)
+++ trunk/milena/sandbox/folio/test/histo/project_histo_3d_add.cc (revision 4173)
@@ -0,0 +1,75 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+
+#include <mln/accu/math/sum.hh>
+#include <mln/literal/all.hh>
+#include <mln/value/rgb8.hh>
+
+#include "../../mln/histo/compute_histo_3d.hh"
+#include "../../mln/histo/project_histo_3d.hh"
+
+using namespace mln;
+using namespace value;
+
+
+inline
+void
+init_test_image(image2d<rgb8>& ima)
+{
+ rgb8 red = literal::red;
+ rgb8 green = literal::green;
+ rgb8 black = literal::black;
+
+ for (unsigned i = 1; i < 8; ++i)
+ for (unsigned j = 0; j < 8; ++j)
+ ima(point2d(j, i)) = black;
+
+ for (unsigned i = 0; i < 8; ++i)
+ ima(point2d(i, 0)) = red;
+
+ ima(point2d(4, 5)) = green;
+}
+
+
+int
+main(int argc, char* argv[])
+{
+ // build test image
+ image2d<rgb8> ima(8, 8);
+ init_test_image(ima);
+
+ // build histo
+ image3d<unsigned> histo = histo::compute_histo_3d(ima);
+
+ // project it
+ image2d<unsigned> proj =
+ histo::project_histo<accu::math::sum<unsigned, unsigned>, 1>(histo);
+
+ // verify...
+ mln_assertion(proj(point2d(255, 0)) == 8);
+ mln_assertion(proj(point2d(0, 0)) == 56);
+ mln_assertion(proj(point2d(0, 255)) == 0);
+}
Index: trunk/milena/sandbox/folio/mln/histo/project_histo_3d.hh
===================================================================
--- trunk/milena/sandbox/folio/mln/histo/project_histo_3d.hh (revision 0)
+++ trunk/milena/sandbox/folio/mln/histo/project_histo_3d.hh (revision 4173)
@@ -0,0 +1,56 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+
+#include <mln/accu/image/init.hh>
+#include <mln/accu/image/take.hh>
+#include <mln/accu/image/to_result.hh>
+#include <mln/core/image/dmorph/unproject_image.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/fun/v2v/projection.hh>
+
+
+namespace mln
+{
+ namespace histo
+ {
+
+ template <typename A, unsigned Direction, typename V>
+ image2d<mln_result(A)>
+ project_histo(const image3d<V>& h)
+ {
+ image2d<A> h_2d_a(h.nrows(), h.ncols());
+ accu::image::init(h_2d_a);
+
+ accu::image::take( unproject( h_2d_a,
+ h.domain(),
+ fun::v2v::projection<point3d, Direction>() ).rw(),
+ h );
+
+ return accu::image::to_result(h_2d_a);
+ }
+
+ }
+}
Index: trunk/milena/sandbox/folio/mln/histo/compute_histo_3d.hh
===================================================================
--- trunk/milena/sandbox/folio/mln/histo/compute_histo_3d.hh (revision 4172)
+++ trunk/milena/sandbox/folio/mln/histo/compute_histo_3d.hh (revision 4173)
@@ -1,12 +1,34 @@
-/*!
- * \file compute_histo_3d.cc
- * \author etiennefolio <ornthalas(a)gmail.com>
- */
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
#include <mln/core/image/image2d.hh>
#include <mln/core/image/image3d.hh>
#include <mln/trait/value/comp.hh>
+
namespace mln
{
namespace histo
1
0
r4172: Add mln/ and tests/ directory for testing before integration into Milena
by Fabien Freling 19 Jun '09
by Fabien Freling 19 Jun '09
19 Jun '09
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-06-19 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add mln/ and tests/ directory for testing before integration into Milena.
* fabien/bin/pnms2dump.cc: Small update.
* fabien/igr/Makefile: Add targets.
* fabien/igr/check_edges.sh: Small update.
* fabien/igr/clo_vol.cc: Small update.
* fabien/igr/crop.cc: Small update.
* fabien/igr/dist_edges.cc: Small update.
* fabien/igr/filter.cc: Small update.
* fabien/igr/grad.cc: Small update.
* fabien/igr/maj.cc: New filter for US images.
* fabien/igr/point_filtering/main.cc: Small update (demo for IGR).
* fabien/igr/wst.cc: Small update.
* fabien/igr/wst_edges.cc: Small update.
* fabien/mln/debug/int2rgb.hh: Convert int value into rgb value (useful
for visualization of int_u12 values).
* fabien/mln/display/display_region.hh: New visualization routine for
watershed regions.
* fabien/mln/world/inter_pixel/display_region.hh: Fix values filling.
* fabien/tests/display/Makefile: New target.
* fabien/tests/display/display_region.cc: New test for display_region()
routine.
* fabien/tests/world/inter_pixel/Makefile: New target.
* fabien/tests/world/inter_pixel/display_region.cc: New test for
display_region() routine in inter_pixel world.
---
bin/pnms2dump.cc | 1
igr/Makefile | 3 +
igr/check_edges.sh | 35 ++++++-----
igr/clo_vol.cc | 13 ++--
igr/crop.cc | 10 ++-
igr/dist_edges.cc | 4 +
igr/filter.cc | 82 ---------------------------
igr/grad.cc | 21 +++----
igr/maj.cc | 60 ++++++++++++++++++++
igr/point_filtering/main.cc | 12 ++--
igr/wst.cc | 19 +++---
igr/wst_edges.cc | 8 --
mln/debug/int2rgb.hh | 36 ++++++++++++
mln/display/display_region.hh | 90 ++++++++++++++++++++++++++++++
mln/world/inter_pixel/display_region.hh | 33 +++++++++--
tests/display/Makefile | 7 ++
tests/display/display_region.cc | 64 +++++++++++++++++++++
tests/world/inter_pixel/Makefile | 7 ++
tests/world/inter_pixel/display_region.cc | 59 +++++++++++++++++++
19 files changed, 420 insertions(+), 144 deletions(-)
Index: trunk/milena/sandbox/fabien/igr/clo_vol.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/clo_vol.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/clo_vol.cc (revision 4172)
@@ -35,8 +35,9 @@
using namespace mln;
using value::int_u8;
using value::int_u12;
+ typedef int_u8 input_type;
- if (argc != 4)
+ if (argc != 5)
{
std::cout << "Usage: " << argv[0] << " input.dump dim lambda output.dump"
<< std::endl;
@@ -53,20 +54,20 @@
if (dim == 2)
{
- image2d<int_u12> input;
+ image2d<input_type> input;
io::dump::load(input, argv[1]);
- image2d<int_u12> clo = morpho::closing::volume(input, c4(), closure_lambda);
- io::dump::save(clo, "clo_vol.dump");
+ image2d<input_type> clo = morpho::closing::volume(input, c4(), closure_lambda);
+ io::dump::save(clo, argv[4]);
}
else
{
- typedef image3d<int_u12> I;
+ typedef image3d<input_type> I;
I input;
io::dump::load(input, argv[1]);
I clo = morpho::closing::volume(input, c6(), closure_lambda);
- io::dump::save(clo, "clo_vol.dump");
+ io::dump::save(clo, argv[4]);
}
return 0;
Index: trunk/milena/sandbox/fabien/igr/crop.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/crop.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/crop.cc (revision 4172)
@@ -8,8 +8,9 @@
#include <mln/core/alias/window3d.hh>
#include <mln/io/dicom/load.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/io/dump/all.hh>
+#include <mln/value/int_u8.hh>
#include <mln/value/int_u12.hh>
@@ -33,12 +34,15 @@
int main(int argc, char* argv[])
{
using namespace mln;
+ using value::int_u8;
using value::int_u12;
+ typedef int_u12 input_type;
+
if (argc != 9)
usage(argv);
- image3d<int_u12> vol;
+ image3d<input_type> vol;
io::dicom::load(vol, argv[1]);
std::cout << "Input bbox: " << vol.bbox() << std::endl;
@@ -55,7 +59,7 @@
box3d b = make::box3d(s_min, r_min, c_min, s_max, r_max, c_max);
std::cout << "Output bbox: " << b << std::endl;
- image3d<int_u12> ima(b);
+ image3d<input_type> ima(b);
data::fill(ima, vol);
io::dump::save(ima, argv[8]);
}
Index: trunk/milena/sandbox/fabien/igr/check_edges.sh
===================================================================
--- trunk/milena/sandbox/fabien/igr/check_edges.sh (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/check_edges.sh (revision 4172)
@@ -3,17 +3,19 @@
process ()
{
- ./dist_edges $1 -1 $2 dist${2}.dump
+ echo "Distance ${2}"
+
+ ./dist_edges $1 -1 $2 ${4}_dist${2}.dump
if [ $? -gt 0 ]; then
echo "error: dist_edges failed"
exit
fi
- nbasins=`./wst_edges dist${2}.dump $3`
+ nbasins=`./wst_edges ${4}_dist${2}.dump $3`
if [ $? -gt 0 ]; then
echo "error: wst_edges failed"
exit
fi
- ./mean_median_label dist${2}.dump watershed.dump $nbasins
+ ./mean_median_label ${4}_dist${2}.dump watershed.dump $nbasins
if [ $? -gt 0 ]; then
echo "error: mean_median_label failed"
echo "nbasins: $nbasins"
@@ -26,13 +28,13 @@
#convert dist_mean.pgm dist_mean${2}.png
#convert dev.pgm dev${2}.png
- mv dist.pgm dist${2}.pgm
- mv watershed.ppm watershed${2}.pgm
- mv means.pgm means${2}.pgm
- mv dist_mean.pgm dist_mean${2}.pgm
- mv dev.pgm dev${2}.pgm
+ mv dist.pgm ${4}_dist${2}.pgm
+ mv watershed.ppm ${4}_watershed${2}.pgm
+ mv means.pgm ${4}_means${2}.pgm
+ mv dist_mean.pgm ${4}_dist_mean${2}.pgm
+ mv dev.pgm ${4}_dev${2}.pgm
- cp watershed.dump watershed${2}.dump
+ cp watershed.dump ${4}_watershed${2}.dump
# Cleanup.
#rm *.pgm *.ppm
@@ -40,11 +42,14 @@
batch_process ()
{
- process $1 1 $2
- process $1 2 $2
- process $1 3 $2
- process $1 4 $2
- process $1 5 $2
+ process $1 1 $2 $3
+ process $1 2 $2 $3
+ process $1 3 $2 $3
+ process $1 4 $2 $3
+ process $1 5 $2 $3
}
-batch_process $1 $2
+# $1 = input.dump
+# $2 = closing lambda
+# $3 = name
+batch_process $1 500 $3
Index: trunk/milena/sandbox/fabien/igr/wst.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/wst.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/wst.cc (revision 4172)
@@ -11,8 +11,8 @@
#include <mln/value/int_u8.hh>
#include <mln/value/int_u12.hh>
+#include <mln/value/label_8.hh>
#include <mln/value/label_16.hh>
-#include <mln/value/label_32.hh>
#include <mln/morpho/watershed/flooding.hh>
@@ -30,13 +30,14 @@
using namespace mln;
using value::int_u8;
using value::int_u12;
+ using value::label_8;
using value::label_16;
- using value::label_32;
- typedef label_16 L;
+ typedef label_8 L;
+ typedef int_u8 V;
- if (argc != 3)
+ if (argc != 4)
{
- std::cout << "Usage: " << argv[0] << " <ima.dcm> <dimensions>"
+ std::cout << "Usage: " << argv[0] << " input.dump dim output.dump"
<< std::endl;
return 1;
}
@@ -52,17 +53,17 @@
if (dim == 2)
{
- image2d<int_u12> input;
+ image2d<V> input;
io::dump::load(input, argv[1]);
image2d<L> wshed = morpho::watershed::flooding(input, c4(), nbasins);
- io::dump::save(wshed, "wst.dump");
+ io::dump::save(wshed, argv[3]);
}
else
{
- image3d<int_u12> input;
+ image3d<V> input;
io::dump::load(input, argv[1]);
image3d<L> wshed = morpho::watershed::flooding(input, c6(), nbasins);
- io::dump::save(wshed, "wst.dump");
+ io::dump::save(wshed, argv[3]);
}
std::cout << nbasins << std::endl;
Index: trunk/milena/sandbox/fabien/igr/wst_edges.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4172)
@@ -40,7 +40,7 @@
#include <mln/math/diff_abs.hh>
#include <mln/morpho/dilation.hh>
#include <mln/morpho/erosion.hh>
-#include <mln/morpho/closing/sum.hh>
+#include <mln/morpho/closing/volume.hh>
#include <mln/morpho/watershed/flooding.hh>
#include <mln/pw/all.hh>
#include <mln/util/array.hh>
@@ -110,7 +110,6 @@
unsigned lambda = atoi(argv[2]);
-
// Initialization.
typedef int_u12 input_type;
image2d<input_type> input;
@@ -118,7 +117,7 @@
// Closing.
- mln_VAR(d_clo, morpho::closing::sum(input | world::inter_pixel::is_separator(), world::inter_pixel::e2e(), lambda));
+ mln_VAR(d_clo, morpho::closing::volume(input | world::inter_pixel::is_separator(), world::inter_pixel::e2e(), lambda));
io_save_edges_int_u12(d_clo, 0, "d_clo.pgm");
@@ -142,8 +141,5 @@
io::dump::save(w_all, "watershed.dump");
io::ppm::save(debug::int2rgb(w_all), "watershed.ppm");
- io::ppm::save(world::inter_pixel::display_region(data::stretch(int_u8(), input), w_all, literal::red), "regions.ppm");
-
-
return 0;
}
Index: trunk/milena/sandbox/fabien/igr/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/igr/Makefile (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/Makefile (revision 4172)
@@ -24,6 +24,9 @@
wst: wst.cc
${CXX} -I../../../ ${CXXFLAGS} $^ -o wst
+maj: maj.cc
+ ${CXX} -I../../../ ${CXXFLAGS} $^ -o maj
+
graph: graph.cc
${CXX} -I../../../ ${DICOM} ${CXXFLAGS} $^ -o graph
Index: trunk/milena/sandbox/fabien/igr/maj.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/maj.cc (revision 0)
+++ trunk/milena/sandbox/fabien/igr/maj.cc (revision 4172)
@@ -0,0 +1,60 @@
+#include <iostream>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/image3d.hh>
+
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/alias/window2d.hh>
+#include <mln/core/alias/neighb3d.hh>
+#include <mln/core/alias/window3d.hh>
+
+#include <mln/io/dump/all.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u12.hh>
+#include <mln/value/label_8.hh>
+#include <mln/value/label_16.hh>
+
+#include <mln/morpho/watershed/flooding.hh>
+
+#include <mln/accu/transform.hh>
+#include <mln/accu/maj_h.hh>
+
+#include <mln/win/sphere3d.hh>
+
+
+
+///////////////////
+// //
+// Main Function //
+// //
+///////////////////
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::int_u12;
+ using value::label_8;
+ using value::label_16;
+ typedef label_8 L;
+ typedef int_u8 V;
+
+ if (argc != 3)
+ {
+ std::cout << "Usage: " << argv[0] << " wst.dump output.dump"
+ << std::endl;
+ return 1;
+ }
+
+ L nbasins;
+
+ image3d<L> wst;
+ io::dump::load(wst, argv[1]);
+ accu::maj_h<L> maj;
+ image3d<L> output = accu::transform(wst, maj, win::sphere3d(7));
+
+ io::dump::save(output, argv[2]);
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/igr/point_filtering/main.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/point_filtering/main.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/point_filtering/main.cc (revision 4172)
@@ -41,8 +41,8 @@
win::segment1d seg15(15);
win::segment1d seg21(21);
- image1d<float> opening_ima = morpho::opening::structural(ima, seg21);
- image1d<float> closing_ima = morpho::closing::structural(ima, seg21);
+ image1d<float> opening_ima = morpho::opening::structural(ima, seg15);
+ image1d<float> closing_ima = morpho::closing::structural(ima, seg15);
image1d<accu::stat::mean<float> > result;
@@ -55,8 +55,8 @@
io::plot::save(ima_morpho, "morpho.plot");
// Morpho (again).
- opening_ima = morpho::opening::structural(ima_morpho, seg13);
- closing_ima = morpho::closing::structural(ima_morpho, seg13);
+ opening_ima = morpho::opening::structural(ima_morpho, seg11);
+ closing_ima = morpho::closing::structural(ima_morpho, seg11);
initialize(result, ima_morpho);
@@ -67,8 +67,8 @@
io::plot::save(ima_morpho2, "morpho2.plot");
// Morpho (the return of the revenge).
- opening_ima = morpho::opening::structural(ima_morpho2, seg5);
- closing_ima = morpho::closing::structural(ima_morpho2, seg5);
+ opening_ima = morpho::opening::structural(ima_morpho2, seg7);
+ closing_ima = morpho::closing::structural(ima_morpho2, seg7);
initialize(result, ima_morpho2);
Index: trunk/milena/sandbox/fabien/igr/dist_edges.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/dist_edges.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/dist_edges.cc (revision 4172)
@@ -203,8 +203,10 @@
res += (double) math::diff_abs(v1[i], v2[i]);
res = res / v1.nelements();
+ if (res > 0.5)
+ return 4095u;
//res = 1 - res;
- res = (res * 4095) + 0.49;
+ res = (1.999999 * res * 4095) + 0.49;
return (int) res;
}
Index: trunk/milena/sandbox/fabien/igr/grad.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/grad.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/grad.cc (revision 4172)
@@ -10,7 +10,7 @@
//#include <mln/io/dicom/load.hh>
#include <mln/io/dump/all.hh>
-//#include <mln/value/int_u8.hh>
+#include <mln/value/int_u8.hh>
#include <mln/value/int_u12.hh>
#include <mln/morpho/elementary/gradient.hh>
@@ -27,12 +27,13 @@
int main(int argc, char *argv[])
{
using namespace mln;
- //using value::int_u8;
+ using value::int_u8;
using value::int_u12;
+ typedef int_u8 input_type;
- if (argc != 3)
+ if (argc != 4)
{
- std::cout << "Usage: " << argv[0] << " <ima.dcm> <dimensions>"
+ std::cout << "Usage: " << argv[0] << " ima.dcm dim output.dump"
<< std::endl;
return 1;
}
@@ -46,17 +47,17 @@
if (dim == 2)
{
- image2d<int_u12> dcm2;
+ image2d<input_type> dcm2;
io::dump::load(dcm2, argv[1]);
- image2d<int_u12> grad2 = morpho::elementary::gradient(dcm2, c4());
- io::dump::save(grad2, "grad.dump");
+ image2d<input_type> grad2 = morpho::elementary::gradient(dcm2, c4());
+ io::dump::save(grad2, argv[3]);
}
else
{
- image3d<int_u12> dcm3;
+ image3d<input_type> dcm3;
io::dump::load(dcm3, argv[1]);
- image3d<int_u12> grad3 = morpho::elementary::gradient(dcm3, c6());
- io::dump::save(grad3, "grad.dump");
+ image3d<input_type> grad3 = morpho::elementary::gradient(dcm3, c6());
+ io::dump::save(grad3, argv[3]);
}
return 0;
Index: trunk/milena/sandbox/fabien/igr/filter.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/filter.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/igr/filter.cc (revision 4172)
@@ -93,88 +93,6 @@
-// Distance function.
-//-------------------
-
-struct dist_t : Function_vv2v<dist_t>
-{
- typedef int_u12 result;
-
- template <typename V>
- int_u12 operator()(util::array<V> v1, util::array<V> v2) const
- {
- float res = 0.f;
-
- for (unsigned i = 0; i < v1.nelements(); ++i)
- res += std::min(v1[i], v2[i]);
-
- image1d<V> tmp_ima;
- image1d<V> tmp_ima2;
- accu::math::sum<V> accu_sum;
-
- convert::from_to(v1, tmp_ima);
- float sum_v1 = data::compute(accu_sum, tmp_ima);
-
- convert::from_to(v2, tmp_ima2);
- float sum_v2 = data::compute(accu_sum, tmp_ima2);
-
- if (sum_v1 == 0 && sum_v2 == 0)
- return 1;
-
- res /= std::max(sum_v1, sum_v2);
- res = 1 - res;
- res = res * 4095;
- if (res > 4095)
- return 4095;
-
- return (int) res;
- }
-} dist;
-
-
-struct dist_morpho_t : Function_vv2v<dist_morpho_t>
-{
- typedef int_u12 result;
-
- template <typename V>
- int_u12 operator()(util::array<V> v1, util::array<V> v2) const
- {
- float res = 0.f;
-
- accu::math::sum<V> accu_sum;
-
- image1d<V> tmp_ima;
- convert::from_to(v1, tmp_ima);
- image1d<float> morpho_ima = mean_image(tmp_ima, 15);
- morpho_ima = mean_image(morpho_ima, 11);
- morpho_ima = mean_image(morpho_ima, 7);
- float sum_v1 = data::compute(accu_sum, morpho_ima);
-
- image1d<V> tmp_ima2;
- convert::from_to(v2, tmp_ima2);
- image1d<float> morpho_ima2 = mean_image(tmp_ima2, 15);
- morpho_ima2 = mean_image(tmp_ima2, 11);
- morpho_ima2 = mean_image(tmp_ima2, 7);
- float sum_v2 = data::compute(accu_sum, morpho_ima2);
-
- mln_piter(image1d<float>) p(morpho_ima.domain());
- for_all(p)
- res += std::min(morpho_ima(p), morpho_ima2(p));
-
- if (sum_v1 == 0 && sum_v2 == 0)
- return 1;
-
- res /= std::max(sum_v1, sum_v2);
- res = 1 - res;
- res = res * 4095;
- if (res > 4095)
- return 4095;
-
- return res;
- }
-} dist_morpho;
-
-
Index: trunk/milena/sandbox/fabien/tests/display/display_region.cc
===================================================================
--- trunk/milena/sandbox/fabien/tests/display/display_region.cc (revision 0)
+++ trunk/milena/sandbox/fabien/tests/display/display_region.cc (revision 4172)
@@ -0,0 +1,64 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/image/image3d.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+#include <mln/core/image/dmorph/slice_image.hh>
+#include <mln/core/routine/duplicate.hh>
+
+#include <mln/io/dump/all.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u12.hh>
+#include <mln/value/label_8.hh>
+#include <mln/value/label_16.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/convert/from_to.hh>
+#include <mln/data/fill.hh>
+#include <mln/data/paste.hh>
+#include <mln/data/stretch.hh>
+#include <mln/pw/all.hh>
+#include <mln/literal/colors.hh>
+
+
+using namespace mln;
+using value::int_u8;
+using value::int_u12;
+using value::label_8;
+using value::label_16;
+using value::rgb8;
+
+
+
+int usage(const char* bin)
+{
+ std::cout << "Usage: " << bin << " input.dump wst.dump output.dump" << std::endl;
+ return 1;
+}
+
+int main(int argc, char* argv[])
+{
+ if (argc != 4)
+ return usage(argv[0]);
+
+
+ // Initialization.
+ typedef int_u8 V;
+ typedef label_8 L;
+ image3d<V> input;
+ io::dump::load(input, argv[1]);
+ image3d<L> wst;
+ io::dump::load(wst, argv[2]);
+ image3d<rgb8> output;
+ initialize(output, input);
+
+ mln_piter_(image3d<V>) p(input.domain());
+ for_all(p)
+ convert::from_to(input(p), output(p));
+ data::fill((output | pw::value(wst) == pw::cst(0)).rw(), literal::red);
+
+ io::dump::save(output, argv[3]);
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/tests/display/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/tests/display/Makefile (revision 0)
+++ trunk/milena/sandbox/fabien/tests/display/Makefile (revision 4172)
@@ -0,0 +1,7 @@
+include ../../igr/Makefile.rules
+
+display_region: display_region.cc
+ ${CXX} -I../../ -I../../../../ ${CXXFLAGS} display_region.cc -o display_region
+
+clean:
+ rm -rf *.dump *.p?m *.plot *.log *.csv *.dSYM
Index: trunk/milena/sandbox/fabien/tests/world/inter_pixel/display_region.cc
===================================================================
--- trunk/milena/sandbox/fabien/tests/world/inter_pixel/display_region.cc (revision 0)
+++ trunk/milena/sandbox/fabien/tests/world/inter_pixel/display_region.cc (revision 4172)
@@ -0,0 +1,59 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/image/image3d.hh>
+#include <mln/core/image/dmorph/slice_image.hh>
+#include <mln/core/routine/duplicate.hh>
+
+#include <mln/io/dump/all.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u12.hh>
+#include <mln/value/label_8.hh>
+#include <mln/value/label_16.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/data/stretch.hh>
+#include <mln/literal/colors.hh>
+
+#include <mln/world/inter_pixel/display_region.hh>
+
+
+using namespace mln;
+using value::int_u8;
+using value::int_u12;
+using value::label_8;
+using value::label_16;
+using value::rgb8;
+
+
+
+
+
+int usage(const char* bin)
+{
+ std::cout << "Usage: " << bin << " input.dump wst.dump" << std::endl;
+ return 1;
+}
+
+int main(int argc, char* argv[])
+{
+ if (argc != 3)
+ return usage(argv[0]);
+
+
+ // Initialization.
+ typedef int_u12 V;
+ typedef label_16 L;
+ image3d<V> input;
+ io::dump::load(input, argv[1]);
+ image2d<L> wst;
+ io::dump::load(wst, argv[2]);
+
+ image2d<V> source = duplicate(slice(input, 10));
+
+ io::ppm::save(world::inter_pixel::display_region(data::stretch(int_u8(), source), wst, literal::red), "regions.ppm");
+
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/tests/world/inter_pixel/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/tests/world/inter_pixel/Makefile (revision 0)
+++ trunk/milena/sandbox/fabien/tests/world/inter_pixel/Makefile (revision 4172)
@@ -0,0 +1,7 @@
+include ../../../igr/Makefile.rules
+
+display_region: display_region.cc
+ ${CXX} -I../../../ -I../../../../../ ${CXXFLAGS} display_region.cc -o display_region
+
+clean:
+ rm -rf *.dump *.p?m *.plot *.log *.csv *.dSYM
Index: trunk/milena/sandbox/fabien/mln/display/display_region.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/display/display_region.hh (revision 0)
+++ trunk/milena/sandbox/fabien/mln/display/display_region.hh (revision 4172)
@@ -0,0 +1,90 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_DISPLAY_DISPLAY_REGION_HH
+# define MLN_DISPLAY_DISPLAY_REGION_HH
+
+/// \file
+///
+/// FIXME
+
+#include <mln/core/concept/image.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+
+#include <mln/value/rgb8.hh>
+
+#include <mln/convert/from_to.hh>
+#include <mln/data/fill.hh>
+#include <mln/data/paste.hh>
+#include <mln/pw/all.hh>
+
+
+namespace mln
+{
+
+ namespace display
+ {
+
+ /// \brief FIXME
+ ///
+ template<typename I, typename L>
+ inline
+ mln_ch_value(I, value::rgb8)
+ display_region(const Image<I>& ima, const Image<L>& wst, const value::rgb8 color);
+
+
+#ifndef MLN_INCLUDE_ONLY
+
+ template<typename I, typename L>
+ inline
+ mln_ch_value(I, value::rgb8)
+ display_region(const Image<I>& ima_, const Image<L>& wst_, const value::rgb8 color)
+ {
+ trace::entering("display::display_region");
+ // TODO: We should check that wst.bbox() == input.bbox()
+
+ const I& ima = exact(ima_);
+ const L& wst = exact(wst_);
+
+ mln_ch_value(I, value::rgb8) output;
+ initialize(output, ima);
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ convert::from_to(ima(p), output(p));
+ data::fill((output | pw::value(wst) == pw::cst(0)).rw(), color);
+
+ trace::exiting("display::display_region");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::display
+
+} // end of namespace mln
+
+#endif // ! MLN_DISPLAY_DISPLAY_REGION_HH
Index: trunk/milena/sandbox/fabien/mln/debug/int2rgb.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/debug/int2rgb.hh (revision 0)
+++ trunk/milena/sandbox/fabien/mln/debug/int2rgb.hh (revision 4172)
@@ -0,0 +1,36 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/value/rgb8.hh>
+
+
+namespace mln
+{
+
+ namespace debug
+ {
+
+ using value::rgb8;
+
+ template <typename V>
+ image2d<rgb8>
+ int2rgb(const image2d<V>& input)
+ {
+ image2d<rgb8> output;
+ initialize(output, input);
+
+ mln_piter(image2d<V>) p(input.domain());
+ for_all(p)
+ {
+ unsigned value = input(p);
+ output(p).blue() = value % 256;
+ value /= 256;
+ output(p).green() = value % 256;
+ value /= 256;
+ output(p).red() = value % 256;
+ }
+
+ return output;
+ }
+
+} // end of namespace mln::debug
+
+} // end of namespace mln
Index: trunk/milena/sandbox/fabien/mln/world/inter_pixel/display_region.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/world/inter_pixel/display_region.hh (revision 4171)
+++ trunk/milena/sandbox/fabien/mln/world/inter_pixel/display_region.hh (revision 4172)
@@ -33,16 +33,18 @@
# include <mln/core/concept/image.hh>
# include <mln/core/image/image2d.hh>
+# include <mln/core/alias/neighb2d.hh>
# include <mln/core/image/dmorph/image_if.hh>
# include <mln/core/routine/extend.hh>
# include <mln/convert/from_to.hh>
# include <mln/data/paste.hh>
# include <mln/world/inter_pixel/is_pixel.hh>
# include <mln/world/inter_pixel/is_separator.hh>
+# include <mln/world/inter_pixel/is_zero_face.hh>
# include <mln/opt/at.hh>
# include <mln/value/rgb8.hh>
-# include <mln/world/inter_pixel/is_zero_face.hh>
+#include <mln/literal/colors.hh> //DEBUG
namespace mln
@@ -54,12 +56,14 @@
namespace inter_pixel
{
- /// \brief FIXME
+ /// \brief Create an image which is a copy of the input image (but
+ /// twice the size) with highlighted watershed lines.
///
/// \param[in] input The input image providing pixels values.
/// \param[in] wst The labeling image providing the watershed lines.
/// \param[in] edge_color The color (in rgb8) for the watershed line.
- /// \return FIXME
+ /// \return A copy of the input image (but twice the size) with
+ /// highlighted watershed lines.
///
/// \pre \p input has to be an 8 bits image.
/// \pre \p wst has to be an unmorphed image.
@@ -78,6 +82,7 @@
mln_ch_value(I, value::rgb8)
display_region(const Image<I>& input_, const Image<L>& wst_, value::rgb8 edge_color)
{
+ trace::entering("world::inter_pixel::display_region");
// TODO: We should check that wst.bbox () == 2 * input.bbox() - 1.
// TODO: We must check that dim(I) == dim(L).
//mln_precondition((2 * input.bbox()) == wst.bbox());
@@ -114,8 +119,21 @@
typedef image_if<output_t, is_zero_face> zero_face_t;
zero_face_t zero = output | is_zero_face();
mln_piter(zero_face_t) q(zero.domain());
+ mln_niter(neighb2d) n(c4(), q);
for_all(q)
{
+ bool has_wst = false;
+ for_all(n)
+ {
+ if (!has_wst && wst(n) == 0)
+ {
+ has_wst = true;
+ output(q) = edge_color;
+ }
+ }
+
+ if (!has_wst)
+ {
unsigned row = q.row();
unsigned col = q.col();
output(q) = (opt::at(output, row + 1, col) +
@@ -123,16 +141,19 @@
opt::at(output, row - 1, col) +
opt::at(output, row, col - 1)) / 4;
}
+ }
// Watershed lines.
- data::fill((output | pw::value(wst) == pw::cst(0)).rw(), edge_color);
- //FIXME: Fill intersections.
+ for_all(p)
+ if (wst(p) == 0)
+ output(p) = edge_color;
+ trace::exiting("world::inter_pixel::display_region");
return output;
+ }
# endif // ! MLN_INCLUDE_ONLY
- }
} // end of namespace mln::world::inter_pixel
Index: trunk/milena/sandbox/fabien/bin/pnms2dump.cc
===================================================================
--- trunk/milena/sandbox/fabien/bin/pnms2dump.cc (revision 4171)
+++ trunk/milena/sandbox/fabien/bin/pnms2dump.cc (revision 4172)
@@ -54,6 +54,7 @@
io::pgm::load(ima, argv[i]);
arr.append(ima);
}
+ std::cout << "nbr elements: " << arr.nelements() << std::endl;
image3d<int_u8> vol = make::image3d(arr);
io::dump::save(vol, argv[1]);
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-06-19 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add a demo for inter_pixel algorithms.
* demos/inter_pixel/Makefile: New target.
* demos/inter_pixel/inter_pixel.cc: New demo for inter_pixel watershed.
Generate a watershed image and an inter_pixel watershed image.
---
Makefile | 4 +++
inter_pixel.cc | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+)
Index: trunk/milena/demos/inter_pixel/inter_pixel.cc
===================================================================
--- trunk/milena/demos/inter_pixel/inter_pixel.cc (revision 0)
+++ trunk/milena/demos/inter_pixel/inter_pixel.cc (revision 4171)
@@ -0,0 +1,76 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/var.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/label_16.hh>
+
+#include <mln/io/pgm/all.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/debug/int2rgb.hh>
+#include <mln/display/display_region.hh>
+#include <mln/literal/colors.hh>
+#include <mln/math/diff_abs.hh>
+#include <mln/morpho/elementary/gradient.hh>
+#include <mln/morpho/watershed/flooding.hh>
+#include <mln/world/inter_pixel/compute.hh>
+#include <mln/world/inter_pixel/display_region.hh>
+#include <mln/world/inter_pixel/immerse.hh>
+#include <mln/world/inter_pixel/is_pixel.hh>
+#include <mln/world/inter_pixel/is_separator.hh>
+#include <mln/world/inter_pixel/neighb2d.hh>
+
+
+using namespace mln;
+using value::int_u8;
+using value::label_16;
+
+
+struct dist_t : Function_vv2v<dist_t>
+{
+ typedef int_u8 result;
+
+ template <typename V>
+ int_u8 operator()(const V v1, const V v2) const
+ {
+ return math::diff_abs(v1, v2);
+ }
+} dist;
+
+
+
+int main(int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ std::cout << "Usage: " << argv[0] << " input.pgm" << std::endl;
+ return 1;
+ }
+
+ image2d<int_u8> input;
+ io::pgm::load(input, argv[1]);
+
+ // Gradient.
+ image2d<int_u8> grad = morpho::elementary::gradient(input, c4());
+
+ label_16 nbasins;
+
+ // Normal watershed.
+ image2d<label_16> normal_wst = morpho::watershed::flooding(input, c4(), nbasins);
+ io::ppm::save(display::display_region(input, normal_wst, literal::red), "normal.ppm");
+
+
+
+ // Distance on edges.
+ typedef image_if<image2d<int_u8>, world::inter_pixel::is_pixel> Ix;
+ Ix imax = world::inter_pixel::immerse(input);
+ image_if<image2d<int_u8>, world::inter_pixel::is_separator> edges;
+ edges = world::inter_pixel::compute(imax, dist);
+
+ // On edges watershed.
+ mln_VAR(edge_wst, morpho::watershed::flooding(edges, world::inter_pixel::e2e(), nbasins));
+ io::ppm::save(world::inter_pixel::display_region(input, edge_wst.unmorph_(), literal::red), "edges.ppm");
+
+ return 0;
+}
Index: trunk/milena/demos/inter_pixel/Makefile
===================================================================
--- trunk/milena/demos/inter_pixel/Makefile (revision 0)
+++ trunk/milena/demos/inter_pixel/Makefile (revision 4171)
@@ -0,0 +1,4 @@
+all: inter_pixel
+
+inter_pixel: inter_pixel.cc
+ g++ -I../../ -I../../sandbox/fabien/ -DNDEBUG -O1 $^ -o inter_pixel
1
0
* Makefile.am: make use of scripts located in build-aux.
* generate_dist_headers.sh: remove since useless.
* headers.mk: regen.
* nodist-headers: list of not distributed headers.
* tests/unit_test/build_unit_test.sh: add output path as argument.
* tests/unit_test/Makefile.am: update call to build_unit_test.sh.
---
scribo/ChangeLog | 16 ++++++++++++++++
scribo/Makefile.am | 16 ++++++++++++----
scribo/generate_dist_headers.sh | 21 ---------------------
scribo/headers.mk | 4 ++--
scribo/tests/unit_test/Makefile.am | 4 ++--
scribo/tests/unit_test/build_unit_test.sh | 4 ++--
6 files changed, 34 insertions(+), 31 deletions(-)
delete mode 100755 scribo/generate_dist_headers.sh
create mode 100644 scribo/nodist-headers
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f2751f0..306a272 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,19 @@
+2009-06-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Use scripts located in build-aux in Scribo.
+
+ * Makefile.am: make use of scripts located in build-aux.
+
+ * generate_dist_headers.sh: remove since useless.
+
+ * headers.mk: regen.
+
+ * nodist-headers: list of not distributed headers.
+
+ * tests/unit_test/build_unit_test.sh: add output path as argument.
+
+ * tests/unit_test/Makefile.am: update call to build_unit_test.sh.
+
2009-06-16 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Fix compilation issues with gcc-3.3 in Scribo.
diff --git a/scribo/Makefile.am b/scribo/Makefile.am
index 11aadf8..dede79f 100644
--- a/scribo/Makefile.am
+++ b/scribo/Makefile.am
@@ -27,15 +27,23 @@ bin:
include $(top_srcdir)/build-aux/regen-recursive.mk
REGEN_SUBDIRS += tests
+# FIXME: the generation should be done from scribo's directory.
regen-am:
- cd $(srcdir) && ./generate_dist_headers.sh
+ cd $(srcdir) && \
+ $(top_srcdir)/build-aux/generate_dist_headers.sh\
+ . \
+ ./headers.mk \
+ ./nodist-headers
-EXTRA_DIST = generate_dist_headers.sh
# FIXME: Change generate_dist_headers.sh so that the action looks like this:
#
# $< $@.tmp && mv -f $@.tmp $@ && chmod -w $@
#
-$(srcdir)/headers.mk: $(srcdir)/generate_dist_headers.sh
- cd $(srcdir) && ./generate_dist_headers.sh
+$(srcdir)/headers.mk: $(top_srcdir)/build-aux/generate_dist_headers.sh
+ cd $(srcdir) && \
+ $(top_srcdir)/build-aux/generate_dist_headers.sh\
+ . \
+ ./headers.mk \
+ ./nodist-headers
include $(srcdir)/headers.mk
diff --git a/scribo/generate_dist_headers.sh b/scribo/generate_dist_headers.sh
deleted file mode 100755
index a6dd8d5..0000000
--- a/scribo/generate_dist_headers.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-
-# Generate scribo/headers.mk
-# ------------------------------
-# List all the headers in order to make them part of distribution.
-
-# Use the C locale to have a deterministic sort.
-export LC_ALL=C
-
-echo "## Generated by ./generate_dist_headers, do not modify ##" > headers.mk
-echo "" >> headers.mk
-echo "noinst_HEADERS = \\" >> headers.mk
-echo "generating headers.mk"
-
-find . -type f -name '*.hh'| grep -v "\.svn" | sed -e 's/$/ \\/g' | sort >> headers.mk
-find . -type f -name '*.hxx'| grep -v "\.svn" | sed -e 's/$/ \\/g'| sort >> headers.mk
-
-last_line=`tail -n 1 headers.mk | sed -e 's/\\\//g'` # remove '\' in last line
-sed '$d' < headers.mk > headers.mk.tmp # remove last line
-mv headers.mk.tmp headers.mk
-echo $last_line >> headers.mk # put the cleaned last line back.
diff --git a/scribo/headers.mk b/scribo/headers.mk
index eceb426..4846d70 100644
--- a/scribo/headers.mk
+++ b/scribo/headers.mk
@@ -1,6 +1,6 @@
-## Generated by ./generate_dist_headers, do not modify ##
+## Generated by `generate_dist_headers.sh', do not edit by hand.
-noinst_HEADERS = \
+nobase_include_HEADERS = \
./all.hh \
./binarization/simple.hh \
./core/all.hh \
diff --git a/scribo/nodist-headers b/scribo/nodist-headers
new file mode 100644
index 0000000..e69de29
diff --git a/scribo/tests/unit_test/Makefile.am b/scribo/tests/unit_test/Makefile.am
index ef9b282..79b3830 100644
--- a/scribo/tests/unit_test/Makefile.am
+++ b/scribo/tests/unit_test/Makefile.am
@@ -23,7 +23,7 @@ include $(top_srcdir)/scribo/scribo.mk
include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am:
cd $(srcdir) \
- && ./build_unit_test.sh $(abs_top_srcdir)/scribo
+ && ./build_unit_test.sh $(abs_top_srcdir)/scribo .
# FIXME: Change build_unit_test.sh so that the action looks like this:
#
@@ -33,7 +33,7 @@ regen-am:
# at the beginning og the action.
$(srcdir)/unit-tests.mk: $(srcdir)/build_unit_test.sh
cd $(srcdir) \
- && ./build_unit_test.sh $(abs_top_srcdir)/scribo
+ && ./build_unit_test.sh $(abs_top_srcdir)/scribo .
include $(srcdir)/unit-tests.mk
diff --git a/scribo/tests/unit_test/build_unit_test.sh b/scribo/tests/unit_test/build_unit_test.sh
index e722204..d4af384 100755
--- a/scribo/tests/unit_test/build_unit_test.sh
+++ b/scribo/tests/unit_test/build_unit_test.sh
@@ -11,7 +11,7 @@ ECHO_N=printf
# Use the C locale to have a deterministic sort.
export LC_ALL=C
-test $# -eq 1 || { echo "Usage: $0 <scribo path>" && exit 1; }
+test $# -eq 2 || { echo "Usage: $0 <scribo path> <output path>" && exit 1; }
## FIXME: Ouch! Using `find' properly can probably save us some pipes,
## forks and characters here.
@@ -23,7 +23,7 @@ HEADERS=`find $1 -name "*.hh" \
| sed -e 's/.*\/scribo\/\(.*\)/scribo\/\1/g' \
| sed 's/\.\.\/\.\.\///g'`
-output=unit-tests.mk
+output=$2/unit-tests.mk
rm -f "$output"
rm -f scribo_*.cc
--
1.5.6.5
1
0
* tests/unit_test/build_unit_test.sh,
* generate_dist_headers.sh: remove since moved to build-aux.
* Makefile.am,
* tests/unit_test/Makefile.am: make use of the new scripts in
build-aux.
* tests/unit_test/disabled_tests: add a list of disabled unit tests.
* headers.mk,
* tests/unit_test/unit-tests.mk: regen.
---
milena/ChangeLog | 16 +++++
milena/Makefile.am | 8 +-
milena/generate_dist_headers.sh | 33 ----------
milena/headers.mk | 5 +-
milena/tests/unit_test/Makefile.am | 17 +++--
milena/tests/unit_test/build_unit_test.sh | 96 -----------------------------
milena/tests/unit_test/disabled_tests | 43 +++++++++++++
milena/tests/unit_test/unit-tests.mk | 4 +-
8 files changed, 78 insertions(+), 144 deletions(-)
delete mode 100755 milena/generate_dist_headers.sh
delete mode 100755 milena/tests/unit_test/build_unit_test.sh
create mode 100644 milena/tests/unit_test/disabled_tests
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6a2f751..62025ee 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,19 @@
+2009-06-19 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
+ Use new scripts located in build-aux.
+
+ * tests/unit_test/build_unit_test.sh,
+ * generate_dist_headers.sh: remove since moved to build-aux.
+
+ * Makefile.am,
+ * tests/unit_test/Makefile.am: make use of the new scripts in
+ build-aux.
+
+ * tests/unit_test/disabled_tests: add a list of disabled unit tests.
+
+ * headers.mk,
+ * tests/unit_test/unit-tests.mk: regen.
+
2009-06-18 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Augment demo on neighborhood genericity.
diff --git a/milena/Makefile.am b/milena/Makefile.am
index c498a7a..5e06f1b 100644
--- a/milena/Makefile.am
+++ b/milena/Makefile.am
@@ -70,15 +70,15 @@ REGEN_SUBDIRS += doc tests
#
# Hence the redundant action. There may be a better solution
regen-am:
- cd $(srcdir) && ./generate_dist_headers.sh
+ cd $(srcdir) && $(top_srcdir)/build-aux/generate_dist_headers.sh mln ./headers.mk ./nodist-headers
-EXTRA_DIST = generate_dist_headers.sh nodist-headers
+EXTRA_DIST = nodist-headers
# FIXME: Change generate_dist_headers.sh so that the action looks like this:
#
# $< $@.tmp && mv -f $@.tmp $@ && chmod -w $@
#
-$(srcdir)/headers.mk: $(srcdir)/generate_dist_headers.sh nodist-headers
- cd $(srcdir) && ./generate_dist_headers.sh
+$(srcdir)/headers.mk: $(top_srcdir)/build-aux/generate_dist_headers.sh nodist-headers
+ cd $(srcdir) && $(top_srcdir)/build-aux/generate_dist_headers.sh mln ./headers.mk ./nodist-headers
include $(srcdir)/headers.mk
diff --git a/milena/generate_dist_headers.sh b/milena/generate_dist_headers.sh
deleted file mode 100755
index 18ee545..0000000
--- a/milena/generate_dist_headers.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#! /bin/sh
-
-# Generate headers.mk.
-# --------------------
-# List all the headers in order to make them part of distribution.
-
-# Use the C locale to have a deterministic sort.
-export LC_ALL=C
-
-me=`basename $0`
-# FIXME: OUTPUT and NODIST_HEADERS should be arguments of the script.
-output=headers.mk
-nodist_headers=nodist-headers
-test -f "$nodist_headers" \
- || { echo "$me: Cannot find \`$nodist_headers' in `pwd`."; exit 1; }
-
-echo "Generating $output..." >&2
-rm -f "$output"
-cat <<EOF >"$output"
-## Generated by \`$me', do not edit by hand.
-
-nobase_include_HEADERS = \\
-EOF
-
-find mln -type f -a \( -name '*.hh' -o -name '*.hxx' \) \
- | sort \
- | comm -23 - "$nodist_headers" \
- | sed -e 's/$/ \\/g' >> headers.mk
-
-last_line=`tail -n 1 headers.mk | sed -e 's/\\\//g'` # remove '\' in last line
-sed '$d' < headers.mk > headers.mk.tmp # remove last line
-mv headers.mk.tmp headers.mk
-echo $last_line >> headers.mk # put the cleaned last line back.
diff --git a/milena/headers.mk b/milena/headers.mk
index 709363a..6fa4c1c 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -7,6 +7,7 @@ mln/accu/compute.hh \
mln/accu/convolve.hh \
mln/accu/count_adjacent_vertices.hh \
mln/accu/count_labels.hh \
+mln/accu/count_value.hh \
mln/accu/essential.hh \
mln/accu/histo.hh \
mln/accu/image/all.hh \
@@ -31,9 +32,7 @@ mln/accu/maj_h.hh \
mln/accu/math/all.hh \
mln/accu/math/count.hh \
mln/accu/math/essential.hh \
-mln/accu/math/inf.hh \
mln/accu/math/sum.hh \
-mln/accu/math/sup.hh \
mln/accu/max_site.hh \
mln/accu/nil.hh \
mln/accu/p.hh \
@@ -503,9 +502,7 @@ mln/fun/internal/selector.hh \
mln/fun/internal/x2x_linear_impl.hh \
mln/fun/math/abs.hh \
mln/fun/math/cos.hh \
-mln/fun/math/inf.hh \
mln/fun/math/norm.hh \
-mln/fun/math/sup.hh \
mln/fun/meta/impl.hh \
mln/fun/ops.hh \
mln/fun/p2b/all.hh \
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 3ea19b7..5b9ef8f 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -22,19 +22,24 @@ include $(top_srcdir)/milena/tests/tests.mk
# Regen files.
include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am:
- cd $(srcdir) \
- && ./build_unit_test.sh $(abs_top_srcdir)/milena/mln
+ cd $(top_srcdir) \
+ && ./build-aux/build_unit_test.sh \
+ milena/mln \
+ milena/tests/unit_test \
+ milena/tests/unit_test/disabled_tests
-EXTRA_DIST = build_unit_test.sh
# FIXME: Change build_unit_test.sh so that the action looks like this:
#
# $< $@.tmp && mv -f $@.tmp $@ && chmod -w $@
#
# `$(abs_top_srcdir)' is required because of the change of directory
# at the beginning og the action.
-$(srcdir)/unit-tests.mk: $(srcdir)/build_unit_test.sh
- cd $(srcdir) \
- && ./build_unit_test.sh $(abs_top_srcdir)/milena/mln
+$(srcdir)/unit-tests.mk: $(top_srcdir)/build-aux/build_unit_test.sh
+ cd $(top_srcdir) \
+ && ./build-aux/build_unit_test.sh \
+ milena/mln \
+ milena/tests/unit_test \
+ milena/tests/unit_test/disabled_tests
include $(srcdir)/unit-tests.mk
diff --git a/milena/tests/unit_test/build_unit_test.sh b/milena/tests/unit_test/build_unit_test.sh
deleted file mode 100755
index ae31679..0000000
--- a/milena/tests/unit_test/build_unit_test.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#! /bin/sh
-
-# Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
-# (LRDE)
-#
-# This file is part of Olena.
-#
-# Olena is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, version 2 of the License.
-#
-# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
-
-## FIXME: Don't use `echo -n', as echo's options are not portable.
-##
-## http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtiā¦
-##
-## As an ugly workaround, use `printf' instead. The right approach
-## would be to only emit lines ended with newlines.
-ECHO_N=printf
-
-# Use the C locale to have a deterministic sort.
-export LC_ALL=C
-
-test $# -eq 1 || { echo "Usage: $0 <mln path>" && exit 1; }
-
-## FIXME: Ouch! Using `find' properly can probably save us some pipes,
-## forks and characters here.
-##
-## FIXME: We do not include these directories
-##
-## mln/io/dicom
-## mln/io/fits
-## mln/io/magick
-## mln/io/tiff
-##
-## because they contain files depending on optional (external)
-## libraries. We should test them conditionally.
-HEADERS=$(find $1 -name "*.hh" \
- | grep -vE "*.spe.hh" \
- | grep -v "mln/core/concept/doc" \
- | grep -v "mln/io/dicom" \
- | grep -v "mln/io/fits" \
- | grep -v "mln/io/magick" \
- | grep -v "mln/io/tiff" \
- | sort \
- | sed -e 's/.*\/mln\/\(.*\)/mln\/\1/g' | sed 's/\.\.\/\.\.\///g')
-
-output=unit-tests.mk
-
-rm -f "$output"
-rm -f mln_*.cc
-
-# Build unit-tests.mk.
-echo "## Generated by $0, do not modify." >"$output"
-echo >>"$output"
-$ECHO_N "check_PROGRAMS = " >>"$output"
-
-for i in $HEADERS; do
- FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
-
- # Build .cc.
- cat > $FILE_CC << EOF
-// Unit test for $i.
-// Generated by $0, do not modify.
-
-// Include the file twice, so we detect missing inclusion guards.
-#include <$i>
-#include <$i>
-
-int main()
-{
- // Nothing.
-}
-EOF
-
- # Build unit-tests.mk.
- TARGET=`echo "${FILE_CC}" | sed 's/\.cc//'`
- echo " \\" >>"$output"
- $ECHO_N "${TARGET}" >>"$output"
-done
-
-# Build "$output".
-echo "" >>"$output"
-echo "" >>"$output"
-for i in $HEADERS; do
- FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
- NAME=`echo $FILE_CC | sed 's/\.cc//g'`
- echo "${NAME}_SOURCES = $FILE_CC" >>"$output"
-done
diff --git a/milena/tests/unit_test/disabled_tests b/milena/tests/unit_test/disabled_tests
new file mode 100644
index 0000000..3943e70
--- /dev/null
+++ b/milena/tests/unit_test/disabled_tests
@@ -0,0 +1,43 @@
+mln/arith/div.spe.hh
+mln/arith/min.spe.hh
+mln/arith/revert.spe.hh
+mln/arith/times.spe.hh
+mln/core/concept/doc/accumulator.hh
+mln/core/concept/doc/box.hh
+mln/core/concept/doc/dpoint.hh
+mln/core/concept/doc/generalized_pixel.hh
+mln/core/concept/doc/image.hh
+mln/core/concept/doc/image_fastest.hh
+mln/core/concept/doc/iterator.hh
+mln/core/concept/doc/neighborhood.hh
+mln/core/concept/doc/object.hh
+mln/core/concept/doc/pixel_iterator.hh
+mln/core/concept/doc/point_iterator.hh
+mln/core/concept/doc/point_site.hh
+mln/core/concept/doc/site_set.hh
+mln/core/concept/doc/value_iterator.hh
+mln/core/concept/doc/value_set.hh
+mln/core/concept/doc/weighted_window.hh
+mln/core/concept/doc/window.hh
+mln/data/apply.spe.hh
+mln/data/fill_with_image.spe.hh
+mln/data/fill_with_value.spe.hh
+mln/data/paste.spe.hh
+mln/data/transform.spe.hh
+mln/debug/iota.spe.hh
+mln/debug/println.spe.hh
+mln/debug/println_with_border.spe.hh
+mln/histo/compute.spe.hh
+mln/io/dicom/all.hh
+mln/io/dicom/load.hh
+mln/io/fits/all.hh
+mln/io/fits/load.hh
+mln/io/magick/all.hh
+mln/io/magick/load.hh
+mln/io/magick/save.hh
+mln/io/tiff/all.hh
+mln/io/tiff/load.hh
+mln/io/tiff/save.hh
+mln/labeling/value.spe.hh
+mln/logical/not.spe.hh
+mln/morpho/general.spe.hh
diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk
index ad78d35..5dccbe2 100644
--- a/milena/tests/unit_test/unit-tests.mk
+++ b/milena/tests/unit_test/unit-tests.mk
@@ -1,4 +1,4 @@
-## Generated by ./build_unit_test.sh, do not modify.
+## Generated by ./build-aux/build_unit_test.sh, do not modify.
check_PROGRAMS = \
mln_accu_all \
@@ -7,6 +7,7 @@ mln_accu_compute \
mln_accu_convolve \
mln_accu_count_adjacent_vertices \
mln_accu_count_labels \
+mln_accu_count_value \
mln_accu_essential \
mln_accu_histo \
mln_accu_image_all \
@@ -1267,6 +1268,7 @@ mln_accu_compute_SOURCES = mln_accu_compute.cc
mln_accu_convolve_SOURCES = mln_accu_convolve.cc
mln_accu_count_adjacent_vertices_SOURCES = mln_accu_count_adjacent_vertices.cc
mln_accu_count_labels_SOURCES = mln_accu_count_labels.cc
+mln_accu_count_value_SOURCES = mln_accu_count_value.cc
mln_accu_essential_SOURCES = mln_accu_essential.cc
mln_accu_histo_SOURCES = mln_accu_histo.cc
mln_accu_image_all_SOURCES = mln_accu_image_all.cc
--
1.5.6.5
1
0
4168: Add build_unit_test.sh and generate_dist_headers.sh to build-aux.
by Guillaume Lazzara 19 Jun '09
by Guillaume Lazzara 19 Jun '09
19 Jun '09
* build-aux/build_unit_test.sh,
* build-aux/generate_dist_headers.sh: copy scripts from milena/ and
milena/tests/unit_test.
* build-aux/Makefile.am: add the previous scripts to EXTRA_DIST.
* bootstrap,
* Makefile.am: update the use of these scripts.
---
ChangeLog | 13 +++++
Makefile.am | 4 ++
bootstrap | 8 ++--
build-aux/Makefile.am | 1 +
build-aux/build_unit_test.sh | 92 ++++++++++++++++++++++++++++++++++++
build-aux/generate_dist_headers.sh | 39 +++++++++++++++
6 files changed, 153 insertions(+), 4 deletions(-)
create mode 100755 build-aux/build_unit_test.sh
create mode 100755 build-aux/generate_dist_headers.sh
diff --git a/ChangeLog b/ChangeLog
index ac210a6..3fbe99f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-06-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Add build_unit_test.sh and generate_dist_headers.sh to build-aux.
+
+ * build-aux/build_unit_test.sh,
+ * build-aux/generate_dist_headers.sh: copy scripts from milena/ and
+ milena/tests/unit_test.
+
+ * build-aux/Makefile.am: add the previous scripts to EXTRA_DIST.
+
+ * bootstrap,
+ * Makefile.am: update the use of these scripts.
+
2009-06-18 Roland Levillain <roland(a)lrde.epita.fr>
* m4/with-swilena.m4 (_OLN_WITH_SWIG): Require Python 2.5.
diff --git a/Makefile.am b/Makefile.am
index 000fd42..3657461 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,6 +97,10 @@ dist-hook:
$(top_srcdir)/build-aux/strip-lrde $$f; \
done; \
rm -rf $(LRDE_NODIST_FILES) && \
+ $(top_srcdir)/build-aux/build_unit_test.sh \
+ $(distdir)/milena/mln \
+ $(distdir)/milena/tests/unit_test \
+ $(top_srcdir)/milena/tests/unit_test/disabled_tests && \
( \
cd $(distdir); \
set -evx; \
diff --git a/bootstrap b/bootstrap
index 9827b9c..7273e79 100755
--- a/bootstrap
+++ b/bootstrap
@@ -129,20 +129,20 @@ require $libtoolize 1.5.22
set -x
# Generate milena/headers.mk
-run milena ./generate_dist_headers.sh
+run milena `pwd`/build-aux/generate_dist_headers.sh mln ./headers.mk ./nodist-headers
# Generate scribo/headers.mk
-run scribo ./generate_dist_headers.sh
+run . `pwd`/build-aux/generate_dist_headers.sh scribo scribo/headers.mk scribo/nodist-headers
# Generate lists of files to be part of the distribution
# for the tutorial.
run milena/doc ./generate_dist_files.sh
# Generate unit test files.
-run milena/tests/unit_test ./build_unit_test.sh `pwd`/milena/mln
+run . ./build-aux/build_unit_test.sh `pwd`/milena/mln milena/tests/unit_test milena/tests/unit_test/disabled_tests
# Generate unit test files for Scribo.
-run scribo/tests/unit_test ./build_unit_test.sh `pwd`/scribo
+run scribo/tests/unit_test ./build_unit_test.sh `pwd`/scribo .
# Install the GNU Build System.
autoreconf -f -v -i
diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am
index 7a2901f..1185eaf 100644
--- a/build-aux/Makefile.am
+++ b/build-aux/Makefile.am
@@ -16,3 +16,4 @@
#
## Process this file through Automake to produce Makefile.in.
+EXTRA_DIST = generate_dist_headers.sh build_unit_test.sh
diff --git a/build-aux/build_unit_test.sh b/build-aux/build_unit_test.sh
new file mode 100755
index 0000000..8080ef2
--- /dev/null
+++ b/build-aux/build_unit_test.sh
@@ -0,0 +1,92 @@
+#! /bin/sh
+
+# Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+# (LRDE)
+#
+# This file is part of Olena.
+#
+# Olena is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, version 2 of the License.
+#
+# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+
+## FIXME: Don't use `echo -n', as echo's options are not portable.
+##
+## http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtiā¦
+##
+## As an ugly workaround, use `printf' instead. The right approach
+## would be to only emit lines ended with newlines.
+ECHO_N=printf
+
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
+
+test $# -eq 3 || { echo "Usage: $0 <scanned dir> <output_dir> <disabled_tests>" && exit 1; }
+
+scanned_dir=$1
+output_dir=$2
+disabled_tests=$3
+
+## FIXME: We do not include these directories
+##
+## mln/io/dicom
+## mln/io/fits
+## mln/io/magick
+## mln/io/tiff
+##
+## because they contain files depending on optional (external)
+## libraries. We should test them conditionally.
+HEADERS=$(find $scanned_dir -type f -name "*.hh" \
+ | sort \
+ | sed -e 's/.*\/mln\/\(.*\)/mln\/\1/g' | sed 's/\.\.\/\.\.\///g' \
+ | comm -23 - "$disabled_tests")
+
+output="$output_dir/unit-tests.mk"
+
+rm -f "$output"
+rm -f mln_*.cc
+
+# Build unit-tests.mk.
+echo "## Generated by $0, do not modify." >"$output"
+echo >>"$output"
+$ECHO_N "check_PROGRAMS = " >>"$output"
+
+for i in $HEADERS; do
+ FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
+
+ # Build .cc.
+ cat > $output_dir/$FILE_CC << EOF
+// Unit test for $i.
+// Generated by $0, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <$i>
+#include <$i>
+
+int main()
+{
+ // Nothing.
+}
+EOF
+
+ # Build unit-tests.mk.
+ TARGET=`echo "${FILE_CC}" | sed 's/\.cc//'`
+ echo " \\" >>"$output"
+ $ECHO_N "${TARGET}" >>"$output"
+done
+
+# Build "$output".
+echo "" >>"$output"
+echo "" >>"$output"
+for i in $HEADERS; do
+ FILE_CC=`echo $i | sed 's/[/.]/_/g' | sed 's/_hh/\.cc/g'`
+ NAME=`echo $FILE_CC | sed 's/\.cc//g'`
+ echo "${NAME}_SOURCES = $FILE_CC" >>"$output"
+done
diff --git a/build-aux/generate_dist_headers.sh b/build-aux/generate_dist_headers.sh
new file mode 100755
index 0000000..60aa946
--- /dev/null
+++ b/build-aux/generate_dist_headers.sh
@@ -0,0 +1,39 @@
+#! /bin/sh
+
+# Generate a list of distributed files w.r.t. a list of file which must
+# be excluded.
+# --------------------
+# List all the headers in order to make them part of distribution.
+
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
+
+if [ $# -ne 3 ]; then
+ echo "$0 <scanned_dir> <output> <nodist-headers>"
+ exit 1
+fi
+
+me=`basename $0`
+scanned_dir=$1
+output=$2
+nodist_headers=$3
+test -f "$nodist_headers" \
+ || { echo "$me: Cannot find \`$nodist_headers' in `pwd`."; exit 1; }
+
+echo "Generating $output..." >&2
+rm -f "$output"
+cat <<EOF >"$output"
+## Generated by \`$me', do not edit by hand.
+
+nobase_include_HEADERS = \\
+EOF
+
+find $scanned_dir -type f -a \( -name '*.hh' -o -name '*.hxx' \) \
+ | sort \
+ | comm -23 - "$nodist_headers" \
+ | sed -e 's/$/ \\/g' >> $output
+
+last_line=`tail -n 1 $output | sed -e 's/\\\//g'` # remove '\' in last line
+sed '$d' < $output > $output.tmp # remove last line
+mv $output.tmp $output
+echo $last_line >> $output # put the cleaned last line back.
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Augment demo on neighborhood genericity.
* mln/core/image/dmorph/transformed_image.hh
(operator()): Fix precondition.
Layout.
* mln/make/neighb2d.hh: New.
* mln/make/all.hh: Update.
* demos/genericity/neighborhood: New directory.
* demos/genericity/neighborhood.cc: Move...
* demos/genericity/neighborhood/neighborhood.cc: ...here.
Revamp.
* demos/genericity/neighborhood/duality.cc: New.
* demos/genericity/neighborhood/world.pbm: New.
* demos/genericity/neighborhood/drawing.pbm: New.
* demos/genericity/neighborhood/permissive.cc: New.
demos/genericity/neighborhood/duality.cc | 66 +++++++++++++++
demos/genericity/neighborhood/neighborhood.cc | 110 ++++++++++++++------------
demos/genericity/neighborhood/permissive.cc | 70 ++++++++++++++++
mln/core/image/dmorph/transformed_image.hh | 18 ++--
mln/make/all.hh | 4
mln/make/neighb2d.hh | 70 ++++++++++++++++
6 files changed, 280 insertions(+), 58 deletions(-)
Index: mln/core/image/dmorph/transformed_image.hh
--- mln/core/image/dmorph/transformed_image.hh (revision 4166)
+++ mln/core/image/dmorph/transformed_image.hh (working copy)
@@ -139,10 +139,6 @@
- template <typename I, typename F, typename J>
- void init_(tag::image_t, transformed_image<I,F>& target, const J& model);
-
-
# ifndef MLN_INCLUDE_ONLY
@@ -153,12 +149,18 @@
void init_(tag::image_t, transformed_image<I,F>& target, const J& model)
{
I ima;
- init_(tag::image, ima, model);
+ init_(tag::image, ima, exact(model));
F f;
- init_(tag::function, f, model);
+ init_(tag::function, f, exact(model));
target.init_(ima, f);
}
+ template <typename I, typename F>
+ void init_(tag::function_t, F& f, const transformed_image<I,F>& model)
+ {
+ f = model.domain().function();
+ }
+
// internal::data< transformed_image<I,F> >
@@ -216,7 +218,7 @@
{
mln_precondition(this->delegatee_() != 0);
mln_precondition(exact(this)->has(p));
- mln_precondition(this->delegatee_()->has(p));
+ mln_precondition(this->delegatee_()->has(this->data_->f_(p)));
return this->delegatee_()->operator()(this->data_->f_(p));
}
@@ -227,7 +229,7 @@
{
mln_precondition(this->delegatee_() != 0);
mln_precondition(exact(this)->has(p));
- mln_precondition(this->delegatee_()->has(p));
+ mln_precondition(this->delegatee_()->has(this->data_->f_(p)));
return this->delegatee_()->operator()(this->data_->f_(p));
}
Index: mln/make/neighb2d.hh
--- mln/make/neighb2d.hh (revision 0)
+++ mln/make/neighb2d.hh (revision 0)
@@ -0,0 +1,70 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_MAKE_NEIGHB2D_HH
+# define MLN_MAKE_NEIGHB2D_HH
+
+/// \file
+///
+/// \brief Routine to create a double neighborhood.
+///
+/// \todo Add overload with 'when_*' being Neighborhood<N>...
+
+# include <mln/core/alias/neighb2d.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ template <unsigned S>
+ mln::neighb2d
+ neighb2d(bool const (&vals) [S]);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned S>
+ inline
+ mln::neighb2d
+ neighb2d(bool const (&vals) [S])
+ {
+ enum { h = mlc_sqrt_int(S) / 2 };
+ mlc_bool((2 * h + 1) * (2 * h + 1) == S)::check();
+ mln::neighb2d nbh;
+ convert::from_to(vals, nbh);
+ return nbh;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_NEIGHB2D_HH
Index: mln/make/all.hh
--- mln/make/all.hh (revision 4166)
+++ mln/make/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -49,6 +50,7 @@
# include <mln/make/image2d.hh>
# include <mln/make/image3d.hh>
# include <mln/make/mat.hh>
+# include <mln/make/neighb2d.hh>
# include <mln/make/pix.hh>
# include <mln/make/pixel.hh>
# include <mln/make/point2d_h.hh>
Index: demos/genericity/neighborhood/duality.cc
--- demos/genericity/neighborhood/duality.cc (revision 0)
+++ demos/genericity/neighborhood/duality.cc (revision 0)
@@ -0,0 +1,66 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+/// \file demos/genericity/neighborhood/duality.cc
+///
+/// Demo on dual neighborhoods.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/labeling/flat_zones.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/make/dual_neighb.hh>
+
+
+
+template <typename N>
+void labelize(const mln::image2d<bool>& pic,
+ const N& nbh,
+ const std::string& filename)
+{
+ using namespace mln;
+ using value::rgb8;
+ unsigned n;
+ image2d<unsigned> lab = labeling::flat_zones(pic, nbh, n);
+ image2d<rgb8> out = labeling::colorize(rgb8(), lab, n);
+ io::ppm::save(out, filename);
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<bool> pic = io::pbm::load("drawing.pbm");
+
+ labelize(pic, make::dual_neighb(pic, c4(), c8()), "c4_c8.ppm");
+ labelize(pic, make::dual_neighb(pic, c8(), c4()), "c8_c4.ppm");
+ labelize(pic, c6_2d(), "c6_c6.ppm");
+}
Index: demos/genericity/neighborhood/world.pbm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: demos/genericity/neighborhood/world.pbm
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: demos/genericity/neighborhood/drawing.pbm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: demos/genericity/neighborhood/drawing.pbm
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: demos/genericity/neighborhood/permissive.cc
--- demos/genericity/neighborhood/permissive.cc (revision 0)
+++ demos/genericity/neighborhood/permissive.cc (revision 0)
@@ -0,0 +1,70 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+/// \file demos/genericity/neighborhood/permissive.cc
+///
+/// Demo on user-defined simple neighborhood.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/load.hh>
+
+#include <mln/make/neighb2d.hh>
+#include <mln/labeling/blobs.hh>
+
+#include <mln/io/ppm/save.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/fun/p2p/fold.hh>
+#include <mln/core/image/dmorph/transformed_image.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<bool> world = io::pbm::load("world.pbm");
+
+ bool large[] = { 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 0, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1 };
+ neighb2d nbh = make::neighb2d(large);
+
+ unsigned n;
+ image2d<unsigned> labeled = labeling::blobs(world, nbh, n);
+
+ io::ppm::save(labeling::colorize(value::rgb8(), labeled, n),
+ "world.ppm");
+
+
+ fun::p2p::fold<point2d,0,1> f(world.domain());
+ labeled = labeling::blobs(transform_domain(world, f), nbh, n).unmorph_();
+
+ io::ppm::save(labeling::colorize(value::rgb8(), labeled, n),
+ "world_bis.ppm");
+}
Index: demos/genericity/neighborhood/neighborhood.cc
--- demos/genericity/neighborhood/neighborhood.cc (revision 0)
+++ demos/genericity/neighborhood/neighborhood.cc (working copy)
@@ -1,52 +1,46 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
-// This file is part of the Milena 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 file is part of Olena.
//
-// This library is distributed in the hope that it will be useful,
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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.
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
+// software project 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.
+// 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.
-/// \file demos/genericity/neighborhood.cc
+/// \file demos/genericity/neighborhood/neighborhood.cc
///
-/// Test on mln::labeling::blobs.
+/// Demo on using or defining neighborhoods.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
#include <mln/labeling/blobs.hh>
#include <mln/labeling/colorize.hh>
-#include <mln/labeling/flat_zones.hh>
#include <mln/value/rgb8.hh>
#include <mln/io/ppm/save.hh>
-#include <mln/core/alias/neighb2d.hh>
-#include <mln/make/dual_neighb.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/make/neighb2d.hh>
#include <mln/make/double_neighb2d.hh>
-#include <mln/debug/println.hh>
-#include "../../tests/data.hh"
template <typename N>
-void run(const mln::image2d<bool>& pic,
+void labelize(const mln::image2d<bool>& pic,
const N& nbh,
const std::string& filename)
{
@@ -59,41 +53,59 @@
}
+bool chess(const mln::point2d& p)
+{
+ return (p.row() + p.col()) % 2 == 0;
+}
+
+bool top_right(const mln::point2d& p)
+{
+ return p.col() >= p.row();
+}
+
+
int main()
{
using namespace mln;
- image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/small.pbm");
+ image2d<bool> pic = io::pbm::load("drawing.pbm");
- run(pic, c4(), "c4.ppm");
- run(pic, c8(), "c8.ppm");
- run(pic, c6_2d(), "c6.ppm");
+ // Classical 2D neighborhoods.
- {
- bool vert[] = { 0, 1, 0,
- 0, 0, 0,
- 0, 1, 0 };
+ labelize(pic, c4(), "c4.ppm");
+ labelize(pic, c8(), "c8.ppm");
- bool hori[] = { 0, 0, 0,
+
+ // A user-defined simple neighborhood.
+
+ bool horiz[] = { 0, 0, 0,
1, 0, 1,
0, 0, 0 };
- run(pic,
- make::double_neighb2d(fun::p2b::chess(), vert, hori),
- "cmy.ppm");
- }
+ labelize(pic, make::neighb2d(horiz), "c2.ppm");
- {
- using value::rgb8;
- unsigned n;
- image2d<unsigned> lab;
- lab = labeling::flat_zones(pic,
- make::dual_neighb(pic,
- c4(), // object
- c8()), // background
- n);
- image2d<rgb8> out = labeling::colorize(rgb8(), lab, n);
- io::ppm::save(out, "cdual48.ppm");
- }
+ // Another user-defined simple neighborhood.
+
+ bool tilt[] = { 1, 1, 0,
+ 0, 0, 0,
+ 0, 1, 1 };
+ labelize(pic, make::neighb2d(tilt), "cZ.ppm");
+
+
+ // A user-defined double-neighborhood.
+
+ bool nbh1[] = { 1, 1, 0,
+ 1, 0, 1,
+ 0, 1, 1 };
+
+ bool nbh2[] = { 0, 1, 1,
+ 1, 0, 1,
+ 1, 1, 0 };
+ labelize(pic, make::double_neighb2d(chess, nbh1, nbh2), "c6.ppm");
+
+
+ // Another user-defined double-neighborhood.
+
+ labelize(pic, make::double_neighb2d(top_right, nbh1, nbh2), "cX.ppm");
}
Property changes on: demos/genericity/neighborhood/neighborhood.cc
___________________________________________________________________
Added: svn:mergeinfo
1
0
18 Jun '09
---
milena/ChangeLog | 4 ++++
milena/nodist-headers | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 83199cc..b13613a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-06-18 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+ * nodist-headers: remove few files from distribution.
+
+2009-06-18 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
* doc/Makefile.am: fix doxyfile generation.
2009-06-18 Roland Levillain <roland(a)lrde.epita.fr>
diff --git a/milena/nodist-headers b/milena/nodist-headers
index 51d0641..12a0c5e 100644
--- a/milena/nodist-headers
+++ b/milena/nodist-headers
@@ -1,3 +1,5 @@
+mln/accu/math/inf.hh
+mln/accu/math/sup.hh
mln/core/image/vmorph/thru_image.hh
mln/core/image/vmorph/thrubin_image.hh
mln/data/was.median.hh
@@ -15,6 +17,8 @@ mln/fun/component/comp.hh
mln/fun/compose.hh
mln/fun/composition.hh
mln/fun/from_accu.hh
+mln/fun/math/inf.hh
+mln/fun/math/sup.hh
mln/fun/meta/all.hh
mln/fun/meta/blue.hh
mln/fun/meta/essential.hh
--
1.5.6.5
1
0
---
milena/ChangeLog | 4 ++++
milena/doc/Makefile.am | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7e126d1..83199cc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-18 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
+ * doc/Makefile.am: fix doxyfile generation.
+
2009-06-18 Roland Levillain <roland(a)lrde.epita.fr>
* headers.mk, tests/unit_test/unit-tests.mk: Regen.
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index dd7ed1b..cf7b3e3 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -218,7 +218,7 @@ Doxyfile_user_pdf: Doxyfile_user
$(edit_pdf) $< >$@
Doxyfile_devel: $(srcdir)/Doxyfile.in
- Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog | sed -e 's/\$//g'`; \
+ Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog | sed -e 's/\$$//g'`; \
$(edit) $< >$@
Doxyfile_devel_pdf: $Doxyfile_devel
--
1.5.6.5
1
0
---
milena/ChangeLog | 4 ++++
milena/headers.mk | 12 ++++++------
milena/tests/unit_test/unit-tests.mk | 24 ++++++++++++------------
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1b9145f..7e126d1 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-06-18 Roland Levillain <roland(a)lrde.epita.fr>
+ * headers.mk, tests/unit_test/unit-tests.mk: Regen.
+
+2009-06-18 Roland Levillain <roland(a)lrde.epita.fr>
+
Break dependencies of the documentation on ChangeLog.
* doc/Makefile.am
diff --git a/milena/headers.mk b/milena/headers.mk
index 3300d71..709363a 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -18,7 +18,6 @@ mln/accu/image/take_as_init.hh \
mln/accu/image/take_n_times.hh \
mln/accu/image/to_result.hh \
mln/accu/image/untake.hh \
-mln/accu/inf.hh \
mln/accu/internal/base.hh \
mln/accu/internal/couple.hh \
mln/accu/label_used.hh \
@@ -32,14 +31,13 @@ mln/accu/maj_h.hh \
mln/accu/math/all.hh \
mln/accu/math/count.hh \
mln/accu/math/essential.hh \
+mln/accu/math/inf.hh \
mln/accu/math/sum.hh \
+mln/accu/math/sup.hh \
mln/accu/max_site.hh \
mln/accu/nil.hh \
mln/accu/p.hh \
mln/accu/pair.hh \
-mln/accu/rank.hh \
-mln/accu/rank_bool.hh \
-mln/accu/rank_high_quant.hh \
mln/accu/rms.hh \
mln/accu/shape/all.hh \
mln/accu/shape/bbox.hh \
@@ -60,9 +58,11 @@ mln/accu/stat/median_h.hh \
mln/accu/stat/min.hh \
mln/accu/stat/min_h.hh \
mln/accu/stat/min_max.hh \
+mln/accu/stat/rank.hh \
+mln/accu/stat/rank_bool.hh \
+mln/accu/stat/rank_high_quant.hh \
mln/accu/stat/var.hh \
mln/accu/stat/variance.hh \
-mln/accu/sup.hh \
mln/accu/take.hh \
mln/accu/transform.hh \
mln/accu/transform_diagonal.hh \
@@ -223,7 +223,6 @@ mln/core/concept/iterator.hh \
mln/core/concept/literal.hh \
mln/core/concept/mesh.hh \
mln/core/concept/meta_accumulator.hh \
-mln/core/concept/meta_fun.hh \
mln/core/concept/meta_function.hh \
mln/core/concept/neighborhood.hh \
mln/core/concept/object.hh \
@@ -507,6 +506,7 @@ mln/fun/math/cos.hh \
mln/fun/math/inf.hh \
mln/fun/math/norm.hh \
mln/fun/math/sup.hh \
+mln/fun/meta/impl.hh \
mln/fun/ops.hh \
mln/fun/p2b/all.hh \
mln/fun/p2b/antilogy.hh \
diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk
index 0f4fa00..ad78d35 100644
--- a/milena/tests/unit_test/unit-tests.mk
+++ b/milena/tests/unit_test/unit-tests.mk
@@ -18,7 +18,6 @@ mln_accu_image_take_as_init \
mln_accu_image_take_n_times \
mln_accu_image_to_result \
mln_accu_image_untake \
-mln_accu_inf \
mln_accu_internal_base \
mln_accu_internal_couple \
mln_accu_label_used \
@@ -32,14 +31,13 @@ mln_accu_maj_h \
mln_accu_math_all \
mln_accu_math_count \
mln_accu_math_essential \
+mln_accu_math_inf \
mln_accu_math_sum \
+mln_accu_math_sup \
mln_accu_max_site \
mln_accu_nil \
mln_accu_p \
mln_accu_pair \
-mln_accu_rank \
-mln_accu_rank_bool \
-mln_accu_rank_high_quant \
mln_accu_rms \
mln_accu_shape_all \
mln_accu_shape_bbox \
@@ -60,9 +58,11 @@ mln_accu_stat_median_h \
mln_accu_stat_min \
mln_accu_stat_min_h \
mln_accu_stat_min_max \
+mln_accu_stat_rank \
+mln_accu_stat_rank_bool \
+mln_accu_stat_rank_high_quant \
mln_accu_stat_var \
mln_accu_stat_variance \
-mln_accu_sup \
mln_accu_take \
mln_accu_transform \
mln_accu_transform_diagonal \
@@ -201,7 +201,6 @@ mln_core_concept_iterator \
mln_core_concept_literal \
mln_core_concept_mesh \
mln_core_concept_meta_accumulator \
-mln_core_concept_meta_fun \
mln_core_concept_meta_function \
mln_core_concept_neighborhood \
mln_core_concept_object \
@@ -498,6 +497,7 @@ mln_fun_meta_essential \
mln_fun_meta_first \
mln_fun_meta_green \
mln_fun_meta_hue \
+mln_fun_meta_impl \
mln_fun_meta_inty \
mln_fun_meta_lum \
mln_fun_meta_red \
@@ -1278,7 +1278,6 @@ mln_accu_image_take_as_init_SOURCES = mln_accu_image_take_as_init.cc
mln_accu_image_take_n_times_SOURCES = mln_accu_image_take_n_times.cc
mln_accu_image_to_result_SOURCES = mln_accu_image_to_result.cc
mln_accu_image_untake_SOURCES = mln_accu_image_untake.cc
-mln_accu_inf_SOURCES = mln_accu_inf.cc
mln_accu_internal_base_SOURCES = mln_accu_internal_base.cc
mln_accu_internal_couple_SOURCES = mln_accu_internal_couple.cc
mln_accu_label_used_SOURCES = mln_accu_label_used.cc
@@ -1292,14 +1291,13 @@ mln_accu_maj_h_SOURCES = mln_accu_maj_h.cc
mln_accu_math_all_SOURCES = mln_accu_math_all.cc
mln_accu_math_count_SOURCES = mln_accu_math_count.cc
mln_accu_math_essential_SOURCES = mln_accu_math_essential.cc
+mln_accu_math_inf_SOURCES = mln_accu_math_inf.cc
mln_accu_math_sum_SOURCES = mln_accu_math_sum.cc
+mln_accu_math_sup_SOURCES = mln_accu_math_sup.cc
mln_accu_max_site_SOURCES = mln_accu_max_site.cc
mln_accu_nil_SOURCES = mln_accu_nil.cc
mln_accu_p_SOURCES = mln_accu_p.cc
mln_accu_pair_SOURCES = mln_accu_pair.cc
-mln_accu_rank_SOURCES = mln_accu_rank.cc
-mln_accu_rank_bool_SOURCES = mln_accu_rank_bool.cc
-mln_accu_rank_high_quant_SOURCES = mln_accu_rank_high_quant.cc
mln_accu_rms_SOURCES = mln_accu_rms.cc
mln_accu_shape_all_SOURCES = mln_accu_shape_all.cc
mln_accu_shape_bbox_SOURCES = mln_accu_shape_bbox.cc
@@ -1320,9 +1318,11 @@ mln_accu_stat_median_h_SOURCES = mln_accu_stat_median_h.cc
mln_accu_stat_min_SOURCES = mln_accu_stat_min.cc
mln_accu_stat_min_h_SOURCES = mln_accu_stat_min_h.cc
mln_accu_stat_min_max_SOURCES = mln_accu_stat_min_max.cc
+mln_accu_stat_rank_SOURCES = mln_accu_stat_rank.cc
+mln_accu_stat_rank_bool_SOURCES = mln_accu_stat_rank_bool.cc
+mln_accu_stat_rank_high_quant_SOURCES = mln_accu_stat_rank_high_quant.cc
mln_accu_stat_var_SOURCES = mln_accu_stat_var.cc
mln_accu_stat_variance_SOURCES = mln_accu_stat_variance.cc
-mln_accu_sup_SOURCES = mln_accu_sup.cc
mln_accu_take_SOURCES = mln_accu_take.cc
mln_accu_transform_SOURCES = mln_accu_transform.cc
mln_accu_transform_diagonal_SOURCES = mln_accu_transform_diagonal.cc
@@ -1461,7 +1461,6 @@ mln_core_concept_iterator_SOURCES = mln_core_concept_iterator.cc
mln_core_concept_literal_SOURCES = mln_core_concept_literal.cc
mln_core_concept_mesh_SOURCES = mln_core_concept_mesh.cc
mln_core_concept_meta_accumulator_SOURCES = mln_core_concept_meta_accumulator.cc
-mln_core_concept_meta_fun_SOURCES = mln_core_concept_meta_fun.cc
mln_core_concept_meta_function_SOURCES = mln_core_concept_meta_function.cc
mln_core_concept_neighborhood_SOURCES = mln_core_concept_neighborhood.cc
mln_core_concept_object_SOURCES = mln_core_concept_object.cc
@@ -1758,6 +1757,7 @@ mln_fun_meta_essential_SOURCES = mln_fun_meta_essential.cc
mln_fun_meta_first_SOURCES = mln_fun_meta_first.cc
mln_fun_meta_green_SOURCES = mln_fun_meta_green.cc
mln_fun_meta_hue_SOURCES = mln_fun_meta_hue.cc
+mln_fun_meta_impl_SOURCES = mln_fun_meta_impl.cc
mln_fun_meta_inty_SOURCES = mln_fun_meta_inty.cc
mln_fun_meta_lum_SOURCES = mln_fun_meta_lum.cc
mln_fun_meta_red_SOURCES = mln_fun_meta_red.cc
--
1.6.1.2
1
0