Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* tests/convol/tests/md5_convol_fast_gaussian_hh0: Add file.
* tests/convol/tests/md5_convol_fast_gaussian_hh1: Add file.
* tests/convol/tests/md5_convol_fast_gaussian_hh2: Add file.
* tests/convol/tests/md5_convol_fast_gaussian_hh3: Add file.
* tests/convol/tests/md5_convol_fast_gaussian_hh4: Add file.
* tests/convol/tests/md5_convol_fast_gaussian_hh5: Add file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh0: Remove file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh1: Remove file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh2: Remove file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh3: Remove file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh4: Remove file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh5: Remove file.
+2004-03-23 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* tests/core/tests/md5_apply: Add file.
2004-03-23 Giovanni Palma <giovanni(a)lrde.epita.fr>
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh5
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh5 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh5 Tue, 23 Mar 2004 13:46:52 +0100 palma_g (oln/k/23_md5_convol 644)
@@ -0,0 +1,31 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+ oln::utils::key::value_type data_key[16] = {0x70, 0x53, 0xa8, 0x84, 0x81,
+ 0x4, 0xbc, 0x30, 0x71, 0x23,
+ 0x78, 0xba, 0xed, 0x6, 0xc6,
+ 0x9e};
+
+ oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh4
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh4 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh4 Tue, 23 Mar 2004 12:07:13 +0100 palma_g (oln/k/24_md5_convol 644)
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
+
+oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::
+int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh3
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh3 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh3 Tue, 23 Mar 2004 12:07:03 +0100 palma_g (oln/k/25_md5_convol 644)
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
+
+oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::
+int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh2
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh2 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh2 Tue, 23 Mar 2004 12:06:52 +0100 palma_g (oln/k/26_md5_convol 644)
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+
+oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::
+int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh1
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh1 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh1 Tue, 23 Mar 2004 12:06:42 +0100 palma_g (oln/k/27_md5_convol 644)
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+
+oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::
+int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh0
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh0 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh0 Tue, 23 Mar 2004 12:06:31 +0100 palma_g (oln/k/28_md5_convol 644)
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/convol/fast_gaussian.hh>
+#include <oln/core/behavior.hh>
+#include <ntg/all.hh>
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+
+oln::utils::key key(data_key);
+
+ typedef oln::image2d<ntg::
+int_u8> im_type;
+ im_type im1(oln::load(rdata("lena256.pgm")));
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ return 0;
+ }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh5
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh5 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/16_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh5 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,31 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
- oln::utils::key::value_type data_key[16] = {0x70, 0x53, 0xa8, 0x84, 0x81,
- 0x4, 0xbc, 0x30, 0x71, 0x23,
- 0x78, 0xba, 0xed, 0x6, 0xc6,
- 0x9e};
-
- oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
-
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh4
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh4 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/17_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh4 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
-oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
-
-oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::
-int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
- std::cout << "OK" << std::endl;
-else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh3
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh3 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/18_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh3 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
-oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
-
-oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::
-int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
- std::cout << "OK" << std::endl;
-else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh2
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh2 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/19_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh2 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
-
-oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::
-int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
- std::cout << "OK" << std::endl;
-else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh1
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh1 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/20_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh1 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
-
-oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::
-int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
- std::cout << "OK" << std::endl;
-else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
Index:
olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh0
--- olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh0 Tue, 23 Mar 2004 13:54:45 +0100 palma_g (oln/k/21_out_olena_ 1.1 644)
+++ olena/tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh0 Tue, 23 Mar 2004 14:26:51 +0100 palma_g ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include "check.hh"
-#include <oln/basics2d.hh>
-#include <oln/convol/fast_gaussian.hh>
-#include <oln/core/behavior.hh>
-#include <ntg/all.hh>
-
-int main()
-{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
-
-oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::
-int_u8> im_type;
- im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
- std::cout << "OK" << std::endl;
-else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
- return 0;
- }
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* tests/core/tests/md5_apply: Add file.
+2004-03-23 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh0: Add file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh1: Add file.
* tests/convol/tests/out_olena_oln_convol_fast_gaussian_hh2: Add file.
Index: olena/tests/core/tests/md5_apply
--- olena/tests/core/tests/md5_apply Tue, 23 Mar 2004 14:12:19 +0100 palma_g ()
+++ olena/tests/core/tests/md5_apply Tue, 23 Mar 2004 12:08:01 +0100 palma_g (oln/k/22_md5_apply 644)
@@ -0,0 +1,33 @@
+// -*- c++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include "check.hh"
+#include <oln/basics2d.hh>
+#include <oln/level/threshold.hh>
+#include <ntg/all.hh>
+using namespace ntg;
+
+
+int main()
+{
+oln::utils::key::value_type data_key[16] = {0x98, 0xf0, 0x2f, 0x75, 0x92, 0x22, 0xbe, 0x3f, 0x36, 0x10, 0x44, 0x1e, 0x53, 0xf3, 0xb9, 0xce};
+
+oln::utils::key key(data_key);
+
+ oln::image2d<
+int_u8> in = oln::load(rdata("lena256.pgm"));
+
+int_u8 th = 127;
+ rgb_8 low = rgb_8(100, 0, 0);
+ rgb_8 height = rgb_8(0, 200, 255);
+ oln::image2d<rgb_8> out = apply(oln::level::threshold<
+int_u8, rgb_8 >(th, low, height), in);
+ if (oln::utils::md5(out) == key)
+ std::cout << "OK" << std::endl;
+else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ }
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/level/cc.hh (frontp_connected_component): Change image to
binary_image.
* olena/oln/level/connected.hh (connected_component): Change image to
binary_image_with_dim.
* olena/oln/morpho/extrema_killer.hh (internal_kill_cc_area): Change
non_vectorial_image to binary_image_with_dim
* olena/oln/morpho/attribute_closing_opening_map.hh (f_tarjan_map):
Change image to non_vectorial_image.
Index: olena/oln/level/cc.hh
--- olena/oln/level/cc.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n
(oln/e/20_cc.hh 1.11.1.14 600)
+++ olena/oln/level/cc.hh Fri, 19 Mar 2004 17:57:54 +0100 van-vl_n
(oln/e/20_cc.hh 1.11.1.14 600)
@@ -42,8 +42,6 @@
# include <oln/level/compare.hh>
# include <set>
-# include <list>
-# include <vector>
# include <ntg/core/macros.hh>
# include <mlc/is_a.hh>
@@ -102,12 +100,10 @@
template <class DestType, class I, class E>
typename mute<I, DestType>::ret
- frontp_connected_component(const abstract::image<I>& input,
+ frontp_connected_component(const abstract::binary_image<I>& input,
const abstract::neighborhood<E>& se,
unsigned& nb_label)
{
- ntg_is_a(oln_value_type(I), ntg::binary)::ensure();
-
typename mute<I, DestType>::ret output(input.size());
level::fill(output, 0);
Index: olena/oln/level/connected.hh
--- olena/oln/level/connected.hh Mon, 15 Mar 2004 15:32:27 +0100
van-vl_n (oln/30_connected. 1.9.1.13 600)
+++ olena/oln/level/connected.hh Fri, 19 Mar 2004 17:56:36 +0100
van-vl_n (oln/30_connected. 1.9.1.13 600)
@@ -40,7 +40,7 @@
/* \brief Processing connected_component extract the connected
components.
**
- ** \arg: input image
+ ** \arg: input a 2d image of binary.
** \arg: Ng neighborhood
**
** \return Returns a labeled image
@@ -52,18 +52,15 @@
** d'images, filtrages et segmentations p.62.
**
** \see level::frontp_connected_component
- ** \todo FIXME: The type of input shoud be a binary 2d image.
*/
// Number the connected components i.e label true. background(i.e
// label false) has the label 0; This algorithm works only for 2D
images.
template <class DestType, class I, class N>
typename mute<I, DestType>::ret
- connected_component(const abstract::image<I>& input,
+ connected_component(const abstract::binary_image_with_dim<2, I>& input,
const abstract::neighborhood<N>& Ng)
{
- // FIXME: ensure the oln_value_type(I) is bin.
mlc::eq<I::dim, N::dim>::ensure();
- mlc::eq<I::dim, 2>::ensure();
typename mute<I, DestType>::ret output(input.size());
level::hlut< DestType, DestType > T;
DestType k = 1;
Index: olena/oln/morpho/extrema_killer.hh
--- olena/oln/morpho/extrema_killer.hh Thu, 18 Mar 2004 18:24:14 +0100
van-vl_n (oln/e/19_extrema_ki 1.7.1.4.1.14 600)
+++ olena/oln/morpho/extrema_killer.hh Tue, 23 Mar 2004 13:12:27 +0100
van-vl_n (oln/e/19_extrema_ki 1.7.1.4.1.14 600)
@@ -60,7 +60,7 @@
*/
template<class I, class N>
typename mute<I, ntg::bin>::ret
- internal_kill_cc_area(const abstract::non_vectorial_image<I>& input,
+ internal_kill_cc_area(const abstract::binary_image_with_dim<2, I>&
input,
const unsigned int area,
const abstract::neighborhood<N>& Ng)
{
Index: olena/oln/morpho/attribute_closing_opening_map.hh
--- olena/oln/morpho/attribute_closing_opening_map.hh Thu, 18 Mar 2004
18:24:14 +0100 van-vl_n (oln/j/49_attribute_ 1.9 600)
+++ olena/oln/morpho/attribute_closing_opening_map.hh Tue, 23 Mar 2004
13:34:03 +0100 van-vl_n (oln/j/49_attribute_ 1.9 600)
@@ -65,14 +65,25 @@
struct f_tarjan_map
{
public:
- typedef abstract::image<I> input_type; ///< Image type (abstract).
- typedef oln_concrete_type(I) img_type; ///< Image type (concrete).
+ typedef abstract::non_vectorial_image<I> input_type;
+ ///< Image type (abstract).
- typedef oln_point_type(input_type) point_type; ///< Associated point
type.
- typedef oln_value_type(input_type) value_type; ///< Value type fo the
image.
- typedef typename mute<input_type, point_type>::ret parent_type; ///<
Image of points.
- typedef typename mute<input_type, bool>::ret is_proc_type; ///< Image
of bool.
- typedef attr_lambda_type(D) lambda_type; ///< dTthreshold type.
+ typedef oln_concrete_type(I) img_type;
+ ///< Image type (concrete).
+
+ typedef oln_point_type(input_type) point_type;
+ ///< Associated point type.
+
+ typedef oln_value_type(input_type) value_type;
+ ///< Value type fo the image.
+
+ typedef typename mute<input_type, point_type>::ret parent_type;
+ ///< Image of points.
+
+ typedef typename mute<input_type, bool>::ret is_proc_type;
+ ///< Image of bool.
+ typedef attr_lambda_type(D) lambda_type;
+ ///< Threshold type.
// e.g.,
// when I is image2d<int_u8> and D is area_type, we've got:
@@ -164,9 +175,11 @@
const input_type& input; ///< Input image.
lambda_type lambda; ///< Trheshold.
parent_type parent; ///< Give a parent of a point.
- is_proc_type is_proc; ///< Tell if a point has already been preceded
- img_type output; ///< Image to store the result
- std::map<point_type, D, oln::internal::default_less<point_type> >
auxdata; ///< Map to store attributes.
+ is_proc_type is_proc;///< Tell if a point has already been preceded.
+ img_type output; ///< Image to store the result.
+ std::map<point_type, D,
+ oln::internal::default_less<point_type> > auxdata;
+ ///< Map to store attributes.
Env env; ///< The envronment.
};
@@ -180,7 +193,7 @@
template <class D, class I, class N>
oln_concrete_type(I)
tarjan_map(bool is_closing,
- const abstract::image<I>& input,
+ const abstract::non_vectorial_image<I>& input,
const abstract::neighborhood<N>& ng,
const attr_lambda_type(D)& lambda,
const attr_env_type(D)& env/* = Env()*/)
@@ -198,7 +211,7 @@
# define xxx_opening_map_decl(T) \
template <class I, class N> \
oln_concrete_type(I) \
-T##_opening(const abstract::image<I>& input, \
+T##_opening(const abstract::non_vectorial_image<I>& input, \
const abstract::neighborhood<N>& ng, \
const attr_lambda_type(T##_type<>)& lambda) \
{ \
@@ -210,7 +223,7 @@
# define xxx_opening_im_map_decl(T) \
template <class I, class N> \
oln_concrete_type(I) \
-T##_opening(const abstract::image<I>& input, \
+T##_opening(const abstract::non_vectorial_image<I>& input, \
const abstract::neighborhood<N>& ng, \
const attr_lambda_type(T##_type<I>)& lambda) \
{ \
@@ -219,26 +232,29 @@
}
//return input;
- // return tarjan_map<T##_type, I, N>(false, input, ng,
lambda, attr_env_type(T##_type<>)());
+ // return tarjan_map<T##_type, I, N>(false, input, ng, lambda,
+ // attr_env_type(T##_type<>)());
# define xxx_closing_map_decl(T) \
template <class I, class N> \
oln_concrete_type(I) \
-T##_closing(const abstract::image<I>& input, \
+T##_closing(const abstract::non_vectorial_image<I>& input, \
const abstract::neighborhood<N>& ng, \
const attr_lambda_type(T##_type<>)& lambda) \
{ \
- return tarjan_map<T##_type<>, I, N>(true, input, ng, lambda,
attr_env_type(T##_type<>)()); \
+ return tarjan_map<T##_type<>, I, N>(true, input, ng, lambda, \
+ attr_env_type(T##_type<>)()); \
}
// same but attribute take care of the image type
# define xxx_closing_im_map_decl(T) \
template <class I, class N> \
oln_concrete_type(I) \
-T##_closing(const abstract::image<I>& input, \
+T##_closing(const abstract::non_vectorial_image<I>& input, \
const abstract::neighborhood<N>& ng, \
const attr_lambda_type(T##_type<I>)& lambda) \
{ \
- return tarjan_map<T##_type<I>, I, N>(true, input, ng, lambda,
attr_env_type(T##_type<I>)()); \
+ return tarjan_map<T##_type<I>, I, N>(true, input, ng, lambda, \
+ attr_env_type(T##_type<I>)());\
}
/*!
@@ -306,7 +322,8 @@
** typedef oln::image2d<ntg::int_u8> im_type;
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
- ** im1 = oln::morpho::slow::integral_closing(im1,
oln::neighb_c4(), 200);
+ ** im1 = oln::morpho::slow::integral_closing(im1, oln::neighb_c4(),
+ ** 200);
** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_closing.ppm");
** }
** \endcode
@@ -332,7 +349,8 @@
** typedef oln::image2d<ntg::int_u8> im_type;
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
- ** im1 = oln::morpho::slow::integral_opening(im1,
oln::neighb_c4(), 200);
+ ** im1 = oln::morpho::slow::integral_opening(im1, oln::neighb_c4(),
+ ** 200);
** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_opening.ppm");
** }
** \endcode
1
0
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* tests/utils/tests/md5: Add file
* oln/utils/key.hxx: Add constructor.
* oln/utils/key.hh: Likewise.
* oln/utils/buffer.hxx: Correct code.
* oln/Makefile.am: Add md5 files reference.
+2004-03-19 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* oln/utils/md5.hh: Add function for md5 calls.
* oln/utils/md5.hxx: Likewise.
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Mon, 08 Mar 2004 08:12:15 +0100 palma_g (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.2 640)
+++ olena/oln/Makefile.am Fri, 19 Mar 2004 17:24:16 +0100 palma_g (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.2 640)
@@ -205,6 +205,12 @@
transforms/dwt.hh \
transforms/wavelet_coeffs.hh \
utils/copy.hh \
+ utils/key.hh \
+ utils/key.hxx \
+ utils/md5.hh \
+ utils/md5.hxx \
+ utils/buffer.hh \
+ utils/buffer.hxx \
utils/histogram.hh \
utils/stat.hh \
utils/special_points.hh \
Index: olena/oln/utils/buffer.hxx
--- olena/oln/utils/buffer.hxx Fri, 19 Mar 2004 15:52:57 +0100 palma_g (oln/k/9_buffer.hxx 1.1 644)
+++ olena/oln/utils/buffer.hxx Fri, 19 Mar 2004 16:58:18 +0100 palma_g (oln/k/9_buffer.hxx 1.1 644)
@@ -129,10 +129,6 @@
add(reorder(len2_), false);
add(reorder(len1_), false);
- std::cout << len2_ << len1_<< std::endl;
- std::cout << (*this)[data_.size()-2] << (*this)[data_.size()-1] << std::endl;
- std::cout << data_.size() - 1<< std::endl;
- std::cout << (*this)[14]<< std::endl;
length_appended_ = true;
};
Index: olena/oln/utils/key.hxx
--- olena/oln/utils/key.hxx Fri, 19 Mar 2004 15:52:57 +0100 palma_g (oln/k/11_key.hxx 1.1 644)
+++ olena/oln/utils/key.hxx Fri, 19 Mar 2004 17:05:24 +0100 palma_g (oln/k/11_key.hxx 1.1 644)
@@ -36,6 +36,14 @@
data_[i] = data[i];
}
+// Ctor implementation.
+inline
+key::key(const value_type *data)
+{
+ for (unsigned i = 0; i < 16; ++i)
+ data_[i] = data[i];
+}
+
// [] operator implementation
inline
key::value_type &key::operator[](unsigned i)
Index: olena/oln/utils/key.hh
--- olena/oln/utils/key.hh Fri, 19 Mar 2004 15:52:57 +0100 palma_g (oln/k/12_key.hh 1.1 644)
+++ olena/oln/utils/key.hh Fri, 19 Mar 2004 17:11:43 +0100 palma_g (oln/k/12_key.hh 1.1 644)
@@ -52,6 +52,14 @@
explicit key(const std::vector<value_type> &data);
/*!
+ ** \brief Constructor used to initialize the key.
+ **
+ ** \pre There must at least 16 elements in data.
+ ** \arg data Inuput data.
+ */
+ explicit key(const value_type *data);
+
+ /*!
** \brief [] operator.
**
** \return the ith byte of the key.
@@ -95,8 +103,10 @@
*/
friend std::ostream &operator<<(std::ostream &stream, const key &k)
{
- for (unsigned i = 0; i < 16; ++i)
- stream << std::hex << k[i];
+ stream << "{";
+ for (unsigned i = 0; i < 15; ++i)
+ stream << "0x" << std::hex << k[i] << ", ";
+ stream << "0x" << std::hex << k[15] << "}";
return stream;
}
Index: olena/tests/utils/tests/md5
--- olena/tests/utils/tests/md5 Fri, 19 Mar 2004 17:28:06 +0100 palma_g ()
+++ olena/tests/utils/tests/md5 Fri, 19 Mar 2004 17:23:10 +0100 palma_g (oln/k/15_md5 644)
@@ -0,0 +1,51 @@
+// -*- c++ -*-
+
+#include <ntg/int.hh>
+#include <oln/basics2d.hh>
+#include <oln/utils/md5.hh>
+
+#include <iostream>
+
+#include "check.hh"
+#include "data.hh"
+
+using namespace oln;
+using namespace ntg;
+using namespace utils;
+
+#define OK_OR_FAIL \
+ std::cout << "OK" << std::endl; \
+ else \
+ { \
+ std::cout << "FAIL" << std::endl; \
+ fail = true; \
+ }
+
+bool
+check()
+{
+ bool fail = false;
+ oln::utils::key::value_type data_ppm[16] = {0x47, 0xa5, 0xb6, 0xa2, 0xc8,
+ 0xf1, 0x4d, 0xb8, 0x90, 0x67,
+ 0xaa, 0x19, 0x3d, 0x43, 0xb6,
+ 0xe0};
+ key lena_ppm(data_ppm);
+ oln::utils::key::value_type data_pgm[16] = {0xc7, 0xe4, 0x4, 0x4c, 0x32,
+ 0x1d, 0x2e, 0x3e, 0x5c, 0xbf,
+ 0x89, 0x8d, 0x3f, 0x94, 0x16,
+ 0xd5};
+ key lena_pgm(data_pgm);
+
+ image2d<rgb_8> src = load(rdata("lena.ppm"));
+ image2d<int_u8> src2 = load(rdata("lena.pgm"));
+
+
+ std::cout << "MD5 on vectorial images: ";
+ if (lena_ppm == md5(src))
+ OK_OR_FAIL;
+ std::cout << "MD5 on non vectorial images: ";
+ if (lena_pgm == md5(src2))
+ OK_OR_FAIL;
+
+ return fail;
+}
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/utils/md5.hh: Add function for md5 calls.
* oln/utils/md5.hxx: Likewise.
+2004-03-19 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* oln/utils/buffer.hxx: Add file.
* oln/utils/buffer.hh: Likewise.
* oln/utils/key.hh: Likewise.
Index: olena/oln/utils/md5.hxx
--- olena/oln/utils/md5.hxx Fri, 19 Mar 2004 15:52:57 +0100 palma_g (oln/k/13_md5.hxx 1.1 644)
+++ olena/oln/utils/md5.hxx Fri, 19 Mar 2004 16:49:29 +0100 palma_g (oln/k/13_md5.hxx 1.1 644)
@@ -281,4 +281,44 @@
step();
return gen_key();
}
+
+
+// md5 implementation.
+template <class I>
+inline
+key md5(const abstract::non_vectorial_image<I> &im)
+{
+ oln_iter_type(I) p(im);
+ buffer b;
+
+ for_all(p)
+ b.add(im[p]);
+ b.append_padding();
+ b.append_length();
+
+ oln::utils::MD5 md5(b);
+ return md5.execute();
+}
+
+// md5 implementation.
+template <class I>
+inline
+key md5(const abstract::vectorial_image<I> &im)
+{
+ oln_iter_type(I) p(im);
+ buffer b;
+ // unsigned nb =
+
+ for_all(p)
+ {
+ for (unsigned i = 0; i < ntg_nb_comp(oln_value_type(I)); ++i)
+ b.add(im[p][i]);
+ }
+ b.append_padding();
+ b.append_length();
+
+ oln::utils::MD5 md5(b);
+ return md5.execute();
+}
+
#endif // !OLENA_OLN_UTILS_MD5_HXX
Index: olena/oln/utils/md5.hh
--- olena/oln/utils/md5.hh Fri, 19 Mar 2004 15:52:57 +0100 palma_g (oln/k/14_md5.hh 1.1 644)
+++ olena/oln/utils/md5.hh Fri, 19 Mar 2004 16:38:39 +0100 palma_g (oln/k/14_md5.hh 1.1 644)
@@ -31,6 +31,8 @@
# include <ntg/all.hh>
# include <vector>
+# include <oln/core/abstract/image_with_type_with_dim.hh>
+
# include <oln/utils/key.hh>
# include <oln/utils/buffer.hh>
@@ -199,6 +201,30 @@
#include <oln/utils/md5.hxx>
+ /*!
+ ** \brief Compute The Md5 value of an image.
+ **
+ ** \param I Exact type of the image.
+ **
+ ** \arg im Image to process.
+ **
+ ** Non vectorial image version.
+ */
+ template <class I>
+ key md5(const abstract::non_vectorial_image<I> &im);
+
+ /*!
+ ** \brief Compute The Md5 value of an image.
+ **
+ ** \param I Exact type of the image.
+ **
+ ** \arg im Image to process.
+ **
+ ** Vectorial image version.
+ */
+ template <class I>
+ key md5(const abstract::vectorial_image<I> &im);
+
} // !utils
} // !oln
#endif // !OLENA_OLN_UTILS_MD5_HH
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Index: integre/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* integre/ntg/core/pred_succ.hh: Add file.
* integre/ntg/Makefile.am: Add file references.
+2004-03-18 Niels Van Vliet <niels(a)lrde.epita.fr>
+
+ * integre/ntg/real/behavior.hh: Change the unsafe::get<T>::check().
+ * integre/ntg/utils/cast.hh: Change cast::force().
+
2004-02-09 Giovanni Palma <giovanni(a)lrde.epita.fr>
* ntg/vect/vec.hh: Add sup() function to vec traits.
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/utils/histogram.hh: Fix doc.
* olena/oln/convert/value_to_point.hh: Likewise.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Thu, 18 Mar 2004 18:24:14 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.10 640)
+++ olena/oln/utils/histogram.hh Fri, 19 Mar 2004 11:49:17 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.10 640)
@@ -178,11 +178,11 @@
** number of occurrences an image3d (because rgb_8 has 3 components).
**
** \todo FIXME: An image is inside the histogram. This is incorrect
- ** because it is not exactly an image (we do not need any border).
+ ** because it is not exactly an image (no border needed).
**
** \param T Type of the image.
- ** \param CPT Type use to count the occurrences (unsinged).
- ** \param V2P Concersion class to convert a value T to a point.
+ ** \param CPT Type used to count the occurrences (unsigned).
+ ** \param V2P Conversion class to convert a value T to a point.
** \param Exact Exact type of the histogram.
**
** \see oln::abstract::histogram
@@ -227,7 +227,7 @@
/*! \brief Empty histogram.
**
- ** \note The function Init(image) should be used after this
+ ** \note The function init(image) should be used after this
** constructor.
*/
histogram(const value_to_point_type & c2p = value_to_point_type()):
@@ -292,10 +292,10 @@
/*! Minimum value of an histogram.
**
- ** It return the smaller value within the image used to build the
+ ** Return the smaller value within the image used to build the
** histogram.
**
- ** \note It can be slow when the histogram is sparse because it iterate
+ ** \note It can be slow when the histogram is sparse because it
iterates
** over a large range of 0. Use \a histogram_min or \a
histogram_minmax
** instead.
** \see histogram_min
@@ -317,11 +317,11 @@
}
/*! Maximum value of an histogram.
**
- ** It return the higher value within the image used to build the
+ ** Return the higher value within the image used to build the
** histogram.
**
** \note It can be slow when the histogram is sparse because it
- ** iterate over a large range of 0. Use histogram_max or
+ ** iterates over a large range of 0. Use histogram_max or
** histogram_minmax instead.
** \see histogram_max
*/
@@ -357,12 +357,12 @@
/*! Build the histogram and has quick min and max functions.
**
** The idea behind the min- and max-specialized histogram is to
- ** maintain worst min and max bounds while updating histogram. We
- ** don't maintain _exact_ min and max bounds, because this would
+ ** maintain worst min and max bounds while updating histogram. It
+ ** does not maintain _exact_ min and max bounds, because this would
** involve some costly computation when removing values from the
** histogram and maybe this time will be lost if the removed value is
** reinserted before max() or min() is called.\n
- ** So we update the _worst_ min and max bounds whenever the histogram
+ ** So it updates the _worst_ min and max bounds whenever the histogram
** value are accessed, and delay the _real_ min and max computation
** until min() or max() is called.
** \see histogram
@@ -687,10 +687,10 @@
// calculate the histogram of the image
utils::histogram<val> histo(im);
- // initialize the array of pointer to the point in the result
- // with the histogram we can know the number of each color and
- // then calculate an array of pointer for quick access to each
- // value of the image
+ // Initialize the array of pointer to the point in the result.
+ // With the histogram the number of each color can be deduced and
+ // then it calculates an array of pointer for quick access to each
+ // value of the image.
const ntg_cumul_type(val) card = ntg_max_val(val)
- ntg_min_val(val) + 1;
std::vector<oln_point_type(I)* > ptr(card);
@@ -741,7 +741,7 @@
*(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
}
- /*! Select staticly the good distrib_sort.
+ /*! Select statically the good distrib_sort.
**
** \param reverse If the sort should be reverted or not.
*/
Index: integre/ntg/Makefile.am
--- integre/ntg/Makefile.am Thu, 27 Nov 2003 11:26:27 +0100 burrus_n
(oln/q/36_Makefile.a 1.8.1.1 640)
+++ integre/ntg/Makefile.am Fri, 19 Mar 2004 11:22:50 +0100 van-vl_n
(oln/q/36_Makefile.a 1.8.1.1 640)
@@ -27,6 +27,7 @@
core/internal/traits.hh \
core/interval.hh \
core/macros.hh \
+ core/pred_succ.hh \
core/predecls.hh \
core/type.hh \
core/type_traits.hh \
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Thu, 18 Mar 2004 18:24:14 +0100
van-vl_n (oln/j/43_value_to_p 1.4 644)
+++ olena/oln/convert/value_to_point.hh Fri, 19 Mar 2004 11:38:53 +0100
van-vl_n (oln/j/43_value_to_p 1.4 644)
@@ -37,7 +37,8 @@
namespace convert {
/*! Convert a value of pixel to a point.
**
- ** For example it transforms an RGB color to a 3D point (ntg::rgb_8
=> oln::point3d).
+ ** For example, transform an RGB color to a 3D point
+ ** (ntg::rgb_8 => oln::point3d).
** This function is useful to build the histogram. \n
** Example:
** \verbatim
@@ -57,14 +58,15 @@
Exact>::ret>
{
private:
- /// By default a scalar is expected. If the type is a vector, a
specialization should be written.
+ /// By default a scalar is expected. If the type is a vector, a
+ /// specialization should be written.
typedef typename ntg_is_a(Argument_type,
ntg::non_vectorial)::ensure_type ensure_type;
public:
- /// By default it return a point1d.
+ /// By default return a point1d.
typedef point1d result_type;
typedef Argument_type argument_type;
- /// This class has bee made because of the lake of operator-- in
ntg::bin
+ /// Convert a binary to a point.
template <typename O, typename I>
struct doit_binary
{
@@ -75,7 +77,7 @@
return input ? O(1) : O(0);
}
};
- /// This class has bee made because of the lake of operator-- in
ntg::bin
+ /// Convert a non vectorial to a point.
template <typename O, typename I>
struct doit_not_binary
{
@@ -99,7 +101,7 @@
/*! Specialization for color of three dimension.
**
- ** \todo It could be generalized to n dimensions if there were a
trait that
+ ** \todo Could be generalized to n dimensions if there were a trait
that
** give a pointkd for a given dimension k.
*/
template <unsigned Qbits, template <unsigned> class S, class Exact>
Index: integre/ntg/core/pred_succ.hh
--- integre/ntg/core/pred_succ.hh Fri, 19 Mar 2004 11:51:05 +0100
van-vl_n ()
+++ integre/ntg/core/pred_succ.hh Fri, 19 Mar 2004 11:15:51 +0100
van-vl_n (oln/k/8_pred_succ. 644)
@@ -0,0 +1,75 @@
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef NTG_CORE_PRED_SUCC_HH
+# define NTG_CORE_PRED_SUCC_HH
+
+#include <ntg/all.hh>
+#include <mlc/is_a.hh>
+
+namespace ntg {
+
+ namespace internal {
+ //! Return a type which supports inc and dec.
+ template <typename T>
+ struct with_arith
+ {
+ typedef typename ntg_is_a(T, non_vectorial)::ensure_type non_v;
+
+ typedef int_u<1> bool_with_arith;
+ typedef T non_vectorial_with_arith;
+
+ typedef typename mlc::if_<ntg_is_a(T, ntg::binary)::ret,
+ id_<bool_with_arith>,
+ id_<non_vectorial_with_arith> >::ret::ret ret;
+ };
+ }
+
+ /*! Return the successor of \a t.
+ **
+ ** \note The goal is to iterate on types such as ntg::bin.
+ */
+ template <typename T>
+ T
+ succ(const T &t)
+ {
+ return T(internal::with_arith<T>::ret(t) + 1);
+ }
+
+ /*! Return the predecessor of \a t.
+ **
+ ** \note The goal is to iterate on types such as ntg::bin.
+ */
+ template <typename T>
+ T
+ pred(const T&t)
+ {
+ return T(internal::with_arith<T>::ret(t) - 1);
+ }
+}
+
+#endif
2
2
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/convol/fast_gaussian.hh: Correct comments.
* oln/io/se_window.hh: Likewise.
* oln/transforms/dwt.hh: Likewise.
* oln/transforms/fft.hh: Likewise.
Index: olena/oln/convol/fast_gaussian.hh
--- olena/oln/convol/fast_gaussian.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/26_fast_gauss 1.6.1.6.1.6 640)
+++ olena/oln/convol/fast_gaussian.hh Wed, 17 Mar 2004 11:35:39 +0100 palma_g (oln/26_fast_gauss 1.6.1.6.1.6 640)
@@ -32,11 +32,12 @@
# include <oln/convert/basics.hh>
# include <ntg/float.hh>
# include <oln/core/behavior.hh>
-//
-// Gaussian filter implementation from
-// "Recursively implementing the gaussian and its derivatives"
-// Deriche 93 INRIA REPORT
-//
+/*!
+** \file olena/oln/convol/fast_gaussian.hh
+** Gaussian filter implementation from
+** "Recursively implementing the gaussian and its derivatives"
+** Deriche 93 INRIA REPORT.
+*/
namespace oln {
namespace convol {
@@ -122,7 +123,7 @@
/* Same functions, with a default conversion. */
- /*
+ /*!
** \brief Gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
Index: olena/oln/io/se_window.hh
--- olena/oln/io/se_window.hh Mon, 15 Mar 2004 19:40:09 +0100 odou_s (oln/i/46_se_window. 1.15 640)
+++ olena/oln/io/se_window.hh Tue, 16 Mar 2004 12:38:47 +0100 palma_g (oln/i/46_se_window. 1.15 640)
@@ -46,7 +46,7 @@
namespace internal {
- ///< \todo FIXME: this code should be factorized.
+ /// \todo FIXME: this code should be factorized.
/*!
** \brief Read a window (1 dimension) from a file.
Index: olena/oln/transforms/dwt.hh
--- olena/oln/transforms/dwt.hh Tue, 16 Mar 2004 12:11:53 +0100 palma_g (oln/i/35_dwt.hh 1.2.1.4.1.11 640)
+++ olena/oln/transforms/dwt.hh Tue, 16 Mar 2004 15:24:31 +0100 palma_g (oln/i/35_dwt.hh 1.2.1.4.1.11 640)
@@ -95,15 +95,15 @@
public:
// accessors
- /// \brief Accessor to ith element of g.
+ /// Accessor to ith element of g.
const value_t getG(unsigned i) const { return g[i]; }
- /// \brief Accessor to ith element of ig.
+ /// Accessor to ith element of ig.
const value_t getInvG(unsigned i) const { return ig[i]; }
- /// \brief Accessor to ith element of h.
+ /// Accessor to ith element of h.
const value_t getH(unsigned i) const { return h[i]; }
- /// \brief Accessor to ith element of ih.
+ /// Accessor to ith element of ih.
const value_t getInvH(unsigned i) const { return ih[i]; }
- /// \brief Give the size of the arrays.
+ /// Give the size of the arrays.
const unsigned size() const { return size_; }
protected:
@@ -139,14 +139,14 @@
mlc::is_false<N % 2>::ensure();
}
- mlc::array1d< mlc::array1d_info<N>, value_t> h; /// \brief array of value_t.
- mlc::internal::array1d_start_<value_t> wc_start; /// \brief First coefficient.
+ mlc::array1d< mlc::array1d_info<N>, value_t> h; ///< array of value_t.
+ mlc::internal::array1d_start_<value_t> wc_start; ///< First coefficient.
private:
- value_t g[N]; /// \brief array of value_t.
- value_t ih[N]; /// \brief array of value_t.
- value_t ig[N]; /// \brief array of value_t.
+ value_t g[N]; ///< Array of value_t.
+ value_t ih[N]; ///< Array of value_t.
+ value_t ig[N]; /// Array of value_t.
enum {
size_ = N
};
@@ -474,10 +474,10 @@
{
public:
- typedef I original_im_t; ///< \brief Exact of the image.
- typedef oln_value_type(I) original_im_value_t; ///< \brief Original data type of the image.
- typedef typename mute<I, ntg::float_d>::ret trans_im_t; ///< \brief Type of the transformed image.
- typedef typename K::self_t coeffs_t; ///< \brief Data type of coefficients.
+ typedef I original_im_t; ///< Exact of the image.
+ typedef oln_value_type(I) original_im_value_t; ///< Original data type of the image.
+ typedef typename mute<I, ntg::float_d>::ret trans_im_t; ///< Type of the transformed image.
+ typedef typename K::self_t coeffs_t; ///< Data type of coefficients.
/*!
** \brief Constructor from an image.
Index: olena/oln/transforms/fft.hh
--- olena/oln/transforms/fft.hh Tue, 16 Mar 2004 12:11:53 +0100 palma_g (oln/i/36_fft.hh 1.4.1.9 640)
+++ olena/oln/transforms/fft.hh Tue, 16 Mar 2004 15:25:00 +0100 palma_g (oln/i/36_fft.hh 1.4.1.9 640)
@@ -46,7 +46,7 @@
namespace internal {
- /// \brief dispatch traits for fftw
+ /// Dispatch traits for fftw
enum fft_dispatch { fft_cplx, fft_real };
/*!
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
1
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* olena/oln/io/base.hh: Add comments.
* olena/oln/io/readable.hh: Likewise.
* olena/oln/io/se_neighborhood.hh: Likewise.
* olena/oln/io/se_window.hh: Likewise.
* olena/oln/io/image_base.hh: Likewise.
* olena/oln/io/image_write.hh: Likewise.
* olena/oln/io/stream_wrapper.hh: Likewise.
* olena/oln/io/utils.hh: Likewise.
* olena/oln/io/image_read.hh: Likewise.
* olena/oln/core/abstract/image.hh: Likewise.
* olena/oln/core/bkd_iter1d.hh: Correct comments.
* olena/oln/core/bkd_iter2d.hh: Likewise.
* olena/oln/core/bkd_iter3d.hh: Likewise.
* olena/oln/core/fwd_iter1d.hh: Likewise.
* olena/oln/core/fwd_iter2d.hh: Likewise.
* olena/oln/core/fwd_iter3d.hh: Likewise.
* olena/oln/core/abstract/iter1d.hh: Likewise.
* olena/oln/core/abstract/iter2d.hh: Likewise.
* olena/oln/core/abstract/iter3d.hh: Likewise.
* olena/oln/core/abstract/iter.hh: Likewise.
* olena/oln/core/neighborhood1d.hh: Likewise.
* olena/oln/core/neighborhood2d.hh: Likewise.
* olena/oln/core/neighborhood3d.hh: Likewise.
* olena/oln/core/abstract/neighborhood.hh: Likewise.
* olena/oln/core/abstract/struct_elt.hh: Likewise.
* olena/oln/core/window1d.hh: Likewise.
* olena/oln/core/window2d.hh: Likewise.
* olena/oln/core/window3d.hh: Likewise.
* olena/oln/core/abstract/window.hh: Likewise.
* olena/oln/core/w_window1d.hh: Likewise.
* olena/oln/core/w_window2d.hh: Likewise.
* olena/oln/core/w_window3d.hh: Likewise.
* olena/oln/core/abstract/w_window.hh: Likewise.
* olena/oln/core/abstract/window_base.hh: Likewise.
* olena/oln/core/abstract/windownd.hh: Likewise.
* olena/oln/core/abstract/w_windownd.hh: Likewise.
* olena/oln/core/abstract/neighborhoodnd.hh: Likewise.
Index: olena/oln/core/bkd_iter1d.hh
--- olena/oln/core/bkd_iter1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/38_bkd_iter1d 1.17 640)
+++ olena/oln/core/bkd_iter1d.hh Mon, 15 Mar 2004 18:25:32 +0100 odou_s (oln/d/38_bkd_iter1d 1.17 640)
@@ -100,7 +100,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/bkd_iter2d.hh
--- olena/oln/core/bkd_iter2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/37_bkd_iter2d 1.17 640)
+++ olena/oln/core/bkd_iter2d.hh Mon, 15 Mar 2004 18:25:31 +0100 odou_s (oln/d/37_bkd_iter2d 1.17 640)
@@ -99,7 +99,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/bkd_iter3d.hh
--- olena/oln/core/bkd_iter3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/36_bkd_iter3d 1.17 640)
+++ olena/oln/core/bkd_iter3d.hh Mon, 15 Mar 2004 18:25:31 +0100 odou_s (oln/d/36_bkd_iter3d 1.17 640)
@@ -96,7 +96,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter1d.hh
--- olena/oln/core/fwd_iter1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/21_fwd_iter1d 1.14 640)
+++ olena/oln/core/fwd_iter1d.hh Mon, 15 Mar 2004 18:25:30 +0100 odou_s (oln/d/21_fwd_iter1d 1.14 640)
@@ -98,7 +98,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter2d.hh
--- olena/oln/core/fwd_iter2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/20_fwd_iter2d 1.14 640)
+++ olena/oln/core/fwd_iter2d.hh Mon, 15 Mar 2004 18:25:30 +0100 odou_s (oln/d/20_fwd_iter2d 1.14 640)
@@ -100,7 +100,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter3d.hh
--- olena/oln/core/fwd_iter3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/19_fwd_iter3d 1.14 640)
+++ olena/oln/core/fwd_iter3d.hh Mon, 15 Mar 2004 18:25:29 +0100 odou_s (oln/d/19_fwd_iter3d 1.14 640)
@@ -97,7 +97,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/iter1d.hh
--- olena/oln/core/abstract/iter1d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/10_iter1d.hh 1.18 640)
+++ olena/oln/core/abstract/iter1d.hh Mon, 15 Mar 2004 18:38:07 +0100 odou_s (oln/d/10_iter1d.hh 1.18 640)
@@ -89,7 +89,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -101,7 +101,7 @@
protected:
- const coord ncols_; ///< The number of column of the image you are iterating
+ const coord ncols_; ///< The number of columns of the image you are iterating
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter2d.hh
--- olena/oln/core/abstract/iter2d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/9_iter2d.hh 1.18 640)
+++ olena/oln/core/abstract/iter2d.hh Mon, 15 Mar 2004 18:38:07 +0100 odou_s (oln/d/9_iter2d.hh 1.18 640)
@@ -102,7 +102,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -115,7 +115,7 @@
protected:
const coord nrows_; ///< The number of rows of the image you are iterating.
- const coord ncols_; ///< The number of column of the image you are iterating.
+ const coord ncols_; ///< The number of columns of the image you are iterating.
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter3d.hh
--- olena/oln/core/abstract/iter3d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/8_iter3d.hh 1.18 640)
+++ olena/oln/core/abstract/iter3d.hh Mon, 15 Mar 2004 18:38:06 +0100 odou_s (oln/d/8_iter3d.hh 1.18 640)
@@ -115,7 +115,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -127,9 +127,9 @@
protected:
- const coord nslices_; ///< The number of slice of the image you are iterating.
+ const coord nslices_; ///< The number of slices of the image you are iterating.
const coord nrows_; ///< The number of rows of the image you are iterating.
- const coord ncols_; ///< The number of column of the image you are iterating.
+ const coord ncols_; ///< The number of columns of the image you are iterating.
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter.hh
--- olena/oln/core/abstract/iter.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/c/40_iter.hh 1.20 640)
+++ olena/oln/core/abstract/iter.hh Mon, 15 Mar 2004 18:25:38 +0100 odou_s (oln/c/40_iter.hh 1.20 640)
@@ -359,7 +359,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood1d.hh
--- olena/oln/core/neighborhood1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/37_neighborho 1.16 640)
+++ olena/oln/core/neighborhood1d.hh Mon, 15 Mar 2004 18:32:04 +0100 odou_s (oln/c/37_neighborho 1.16 640)
@@ -57,7 +57,7 @@
** \brief Neighborhood 1 dimension.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 1 dimensions.
**
*/
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood2d.hh
--- olena/oln/core/neighborhood2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/36_neighborho 1.17 640)
+++ olena/oln/core/neighborhood2d.hh Mon, 15 Mar 2004 18:32:04 +0100 odou_s (oln/c/36_neighborho 1.17 640)
@@ -58,7 +58,7 @@
** \brief Neighborhood 2 dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 2 dimensions.
**
*/
@@ -160,7 +160,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood3d.hh
--- olena/oln/core/neighborhood3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/35_neighborho 1.16 640)
+++ olena/oln/core/neighborhood3d.hh Mon, 15 Mar 2004 18:32:02 +0100 odou_s (oln/c/35_neighborho 1.16 640)
@@ -57,7 +57,7 @@
** \brief Neighborhood 3 dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 3 dimensions.
**
*/
@@ -141,7 +141,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/neighborhood.hh
--- olena/oln/core/abstract/neighborhood.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/38_neighborho 1.20 640)
+++ olena/oln/core/abstract/neighborhood.hh Mon, 15 Mar 2004 18:37:35 +0100 odou_s (oln/c/38_neighborho 1.20 640)
@@ -56,17 +56,17 @@
** \brief Neighborhood.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite (cf mathematical
+ ** you add an element, you add its opposite (cf mathematical
** definition to know more about).
** This abstract class defines several virtual methods for his
- ** subclasses. His aim is to deal with a set of deplacement points.
+ ** subclasses. Its goal is to deal with a set of deplacement points.
**
*/
template<class Exact>
struct neighborhood : public mlc_hierarchy::any<Exact>
{
typedef Exact exact_type; ///< Set the exact type.
- typedef neighborhood<Exact> self_type; ///< Set his type.
+ typedef neighborhood<Exact> self_type; ///< Set its type.
/*!
** \brief The associate image's type of iterator.
@@ -94,7 +94,7 @@
///< Set the dim of the points of the neighborhood.
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -117,8 +117,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card() const
@@ -210,7 +210,7 @@
/*!
** \brief Set neighborhood to opposite.
**
- ** Each point of neighborhood is assigned to his opposite.
+ ** Each point of neighborhood is assigned to its opposite.
**
*/
void
Index: olena/oln/core/abstract/struct_elt.hh
--- olena/oln/core/abstract/struct_elt.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/25_structelt. 1.21 640)
+++ olena/oln/core/abstract/struct_elt.hh Mon, 15 Mar 2004 18:39:45 +0100 odou_s (oln/c/25_structelt. 1.21 640)
@@ -58,8 +58,8 @@
/*!
** Structuring elements (set of points).
**
- ** This abstract class defines several virtual methods for his
- ** subclasses. His aim is to deal with a set of deplacement points.
+ ** This abstract class defines several virtual methods for its
+ ** subclasses. Its goal is to deal with a set of 'move' points.
*/
template<class Exact>
struct struct_elt : public mlc_hierarchy::any< Exact >
@@ -73,7 +73,7 @@
///< Set the abstract type of hisself.
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -102,8 +102,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card() const
@@ -185,7 +185,7 @@
/*!
** \brief Set structuring elements to opposite.
**
- ** Each point of structuring elements is assigned to his opposite.
+ ** Each point of structuring elements is assigned to its opposite.
*/
exact_type
operator-() const
@@ -200,7 +200,7 @@
/*!
** \brief Set structuring elements to opposite.
**
- ** Each point of structuring elements is assigned to his opposite.
+ ** Each point of structuring elements is assigned to its opposite.
*/
void
sym()
Index: olena/oln/core/window1d.hh
--- olena/oln/core/window1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/15_window1d.h 1.16 640)
+++ olena/oln/core/window1d.hh Mon, 15 Mar 2004 18:25:28 +0100 odou_s (oln/c/15_window1d.h 1.16 640)
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/window2d.hh
--- olena/oln/core/window2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/14_window2d.h 1.18 640)
+++ olena/oln/core/window2d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/14_window2d.h 1.18 640)
@@ -161,7 +161,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/window3d.hh
--- olena/oln/core/window3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/13_window3d.h 1.17 640)
+++ olena/oln/core/window3d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/13_window3d.h 1.17 640)
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/window.hh
--- olena/oln/core/abstract/window.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/16_window.hh 1.18 640)
+++ olena/oln/core/abstract/window.hh Mon, 15 Mar 2004 18:25:36 +0100 odou_s (oln/c/16_window.hh 1.18 640)
@@ -74,7 +74,7 @@
friend class struct_elt<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window1d.hh
--- olena/oln/core/w_window1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/19_w_window1d 1.17 640)
+++ olena/oln/core/w_window1d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/19_w_window1d 1.17 640)
@@ -164,7 +164,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window2d.hh
--- olena/oln/core/w_window2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/18_w_window2d 1.6.1.12 640)
+++ olena/oln/core/w_window2d.hh Mon, 15 Mar 2004 18:25:26 +0100 odou_s (oln/c/18_w_window2d 1.6.1.12 640)
@@ -183,7 +183,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window3d.hh
--- olena/oln/core/w_window3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/17_w_window3d 1.17 640)
+++ olena/oln/core/w_window3d.hh Mon, 15 Mar 2004 18:25:26 +0100 odou_s (oln/c/17_w_window3d 1.17 640)
@@ -170,7 +170,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/w_window.hh
--- olena/oln/core/abstract/w_window.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/20_w_window.h 1.15 640)
+++ olena/oln/core/abstract/w_window.hh Mon, 15 Mar 2004 18:25:36 +0100 odou_s (oln/c/20_w_window.h 1.15 640)
@@ -76,7 +76,7 @@
friend class struct_elt<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/io/base.hh
--- olena/oln/io/base.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/b/20_base.hh 1.8 640)
+++ olena/oln/io/base.hh Mon, 15 Mar 2004 16:27:40 +0100 odou_s (oln/b/20_base.hh 1.8 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -36,10 +36,21 @@
namespace oln {
+ /*! \namespace io
+ ** \brief io namespace.
+ */
namespace io {
+ /*! \namespace internal
+ ** \brief abstract internal.
+ */
namespace internal {
+ /*!
+ ** \brief Read anything from a file.
+ **
+ ** The "good" read function is called by template specialization.
+ */
template<typename T>
bool
read_any(T& output, const std::string& name)
@@ -47,6 +58,11 @@
return read(output, name);
}
+ /*!
+ ** \brief Write anything to a file.
+ **
+ ** The "good" write function is called by template specialization.
+ */
template<typename T>
bool
write_any(const T& input, const std::string& name)
@@ -58,6 +74,16 @@
// aliases
+ /*
+ ** \brief Load object from a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg name The name of the file.
+ ** \return The new object.
+ **
+ ** Here is the external interface.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
inline
internal::anything
load(const std::string& name)
@@ -65,6 +91,15 @@
return internal::anything(name);
}
+ /*
+ ** \brief Load object from a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg output The object to write to a file.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ **
+ ** Here is the external interface. Depending of T, work is dispatched.
+ */
template<class T>
bool
load(T& output, std::string name)
@@ -72,6 +107,17 @@
return internal::read_any(output, name);
}
+ /*
+ ** \brief Writing object to a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg input The object to read.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ **
+ ** Here is the external interface. Depending of T, work is dispatched.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
template< typename T >
bool
save(const T& input, const std::string& name)
Index: olena/oln/io/readable.hh
--- olena/oln/io/readable.hh Thu, 09 Oct 2003 16:21:55 +0200 burrus_n (oln/b/13_readable.h 1.12 640)
+++ olena/oln/io/readable.hh Mon, 15 Mar 2004 16:24:00 +0100 odou_s (oln/b/13_readable.h 1.12 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,30 +41,56 @@
template<typename T>
bool
- read_any(T& output, const std::string& name);
+ read_any(T& output, const std::string& name); //forward declaration
+ /*!
+ ** \brief Anything.
+ **
+ ** This class is called by oln::load and just keep the filename to load.
+ ** As soon as you will use the operator = on it, assign will be called
+ ** and it will read the file.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
class anything
{
public:
- // FIXME: these constructors are required by swig
+ /*!
+ ** \brief Constructor
+ ** \todo FIXME: these constructors are required by swig
+ */
anything() : str_() {}
+
+ /*!
+ ** \brief Constructor
+ */
anything(const anything& rhs) : str_(rhs.str_) {}
+ /*!
+ ** \brief Constructor
+ */
anything(const std::string& str) : str_(str) {}
+ /*!
+ ** \brief Constructor
+ */
anything(const char* c) : str_(c) {}
+ /*!
+ ** \brief This function will be called when applied to an operator =
+ ** and load the file (str_ is the filename).
+ */
template< typename T >
T&
assign(T& output) const
{
read_any(output, str_);
- // FIXME: call output.clear()?
+ ///< \todo FIXME: call output.clear()?
return output;
}
private:
- std::string str_;
+ std::string str_; ///< The filename to load.
};
} // end of namespace internal
Index: olena/oln/io/se_neighborhood.hh
--- olena/oln/io/se_neighborhood.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/i/47_se_neighbo 1.13 640)
+++ olena/oln/io/se_neighborhood.hh Mon, 15 Mar 2004 15:40:37 +0100 odou_s (oln/i/47_se_neighbo 1.13 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -39,6 +39,12 @@
namespace internal {
+ /*!
+ ** \brief Read a neighborhood from a file.
+ ** \arg output The new neighborhood.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(neighborhood2d& output, const std::string& name)
{
@@ -81,6 +87,12 @@
return true;
}
+ /*!
+ ** \brief Write a neighborhood to a file.
+ ** \arg input The neighborhood to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const neighborhood2d& input, const std::string& name)
{
Index: olena/oln/io/se_window.hh
--- olena/oln/io/se_window.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/i/46_se_window. 1.14 640)
+++ olena/oln/io/se_window.hh Mon, 15 Mar 2004 15:45:24 +0100 odou_s (oln/i/46_se_window. 1.14 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -46,13 +46,14 @@
namespace internal {
- // FIXME: this code should be factorized.
+ ///< \todo FIXME: this code should be factorized.
- /*----------------.
- | read (window1d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (1 dimension) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window1d& output, const std::string& name)
{
@@ -70,11 +71,12 @@
return true;
}
- /*----------------.
- | read (window2d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (2 dimensions) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window2d& output, const std::string& name)
{
@@ -97,11 +99,12 @@
return true;
}
- /*----------------.
- | read (window3d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (3 dimensions) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window3d& output, const std::string& name)
{
@@ -121,11 +124,12 @@
return true;
}
- /*-----------------.
- | write (window1d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (1 dimension) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window1d& input, const std::string& name)
{
@@ -139,11 +143,12 @@
return true;
}
- /*-----------------.
- | write (window2d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (2 dimensions) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window2d& input, const std::string& name)
{
@@ -157,11 +162,12 @@
return true;
}
- /*-----------------.
- | write (window3d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (3 dimensions) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window3d& input, const std::string& name)
{
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/t/25_image.hh 1.26 600)
+++ olena/oln/core/abstract/image.hh Mon, 15 Mar 2004 19:34:49 +0100 odou_s (oln/t/25_image.hh 1.26 600)
@@ -34,9 +34,14 @@
# include <oln/core/abstract/point.hh>
# include <oln/core/abstract/iter.hh>
-
+/*! \namespace oln
+** \brief oln namespace.
+*/
namespace oln {
+ /*! \namespace oln::abstract
+ ** \brief oln::abstract namespace.
+ */
namespace abstract {
// fwd_decl
Index: olena/oln/io/image_base.hh
--- olena/oln/io/image_base.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/41_image_base 1.4 600)
+++ olena/oln/io/image_base.hh Mon, 15 Mar 2004 17:55:14 +0100 odou_s (oln/t/41_image_base 1.4 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -39,21 +39,30 @@
namespace internal {
- /*---------------------.
- | image default reader |
- `---------------------*/
-
+ /*!
+ ** \brief Reader identifiers.
+ **
+ ** They are used recursively: each time a ReadId fails, then
+ ** try with ReadId - 1.
+ */
enum reader_id { ReadNone = 0,
ReadPnmPlain = 1,
ReadPnmRaw = 2,
ReadAny = 2 };
- // Default reader
-
+ /*!
+ ** \brief Read an image of type reader_id.
+ ** \param F The reader identifier.
+ **
+ ** In fact, do nothing because of the type of reader.
+ ** Used when an errors occurs on others types of reader.
+ ** \see reader_id
+ */
template<reader_id F, class I>
struct image_reader
{
+ ///< Do nothing because of the type of reader.
static const std::string&
name()
{
@@ -61,12 +70,14 @@
return name_;
}
+ ///< Do nothing because of the type of reader.
static bool
knows_ext(const std::string&)
{
return false;
}
+ ///< Do nothing because of the type of reader.
static bool
read(std::istream&, I&)
{
@@ -74,21 +85,32 @@
}
};
- /*---------------------.
- | image default writer |
- `---------------------*/
+ /*!
+ ** \brief Writer identifiers.
+ **
+ ** They are used recursively: each time a WriteId fails, then
+ ** try with WriteId - 1.
+ */
enum writer_id { WriteNone = 0,
WritePnmPlain = 1,
WritePnmRaw = 2,
WriteAny = 2 };
- // Default writer
+ /*!
+ ** \brief Write an image of type writer_id.
+ ** \param F The writer identifier.
+ **
+ ** In fact, do nothing because of the type of writer.
+ ** Used when an errors occurs on others types of writer.
+ ** \see writer_id
+ */
template<writer_id F, class I>
struct image_writer
{
+ ///< Do nothing because of the type of writer.
static const std::string&
name()
{
@@ -96,12 +118,14 @@
return name_;
}
+ ///< Do nothing because of the type of writer.
static bool
knows_ext(const std::string&)
{
return false;
}
+ ///< Do nothing because of the type of writer.
static bool
write(std::ostream&, const I&)
{
Index: olena/oln/io/image_write.hh
--- olena/oln/io/image_write.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/42_image_writ 1.9 600)
+++ olena/oln/io/image_write.hh Mon, 15 Mar 2004 18:10:40 +0100 odou_s (oln/t/42_image_writ 1.9 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -50,16 +50,20 @@
namespace internal {
- /*------------.
- | try_writers |
- `------------*/
-
- // Try writers recursively
-
+ /*!
+ ** \brief Image's writer.
+ ** \param W Type of writer.
+ */
template< writer_id W, typename T >
struct try_writers
{
- // Try to deduce the file format from the extension
+ /*!
+ ** \brief Write object on the stream.
+ ** Try do deduce the image format from the extension.
+ ** \arg input The object to read.
+ ** \arg out The stream.
+ ** \arg ext The extension's filename.
+ */
static bool
by_extension(const T& input, std::ostream& out, const std::string& ext)
{
@@ -70,7 +74,11 @@
::by_extension(input, out, ext);
}
- // Try to match the file format referring to the data only
+ /*!
+ ** \brief Try to match the file format referring to the data only.
+ ** \arg input The object to read.
+ ** \arg out The stream.
+ */
static bool
by_data(const T& input, std::ostream& out, const std::string& ext)
{
@@ -86,17 +94,30 @@
}
};
- // End of try_writers loop
+ /*!
+ ** \brief Reader for image of type None.
+ **
+ ** In fact, do nothing because of the type of writer.
+ ** Used when an errors occurs on others types of writer.
+ */
template< typename T >
struct try_writers<WriteNone, T>
{
+ /*!
+ ** \brief Write object on the stream.
+ ** Try do deduce the image format from the extension.
+ */
static bool
by_extension(const T&, std::ostream&, const std::string&)
{
return false;
}
+ /*!
+ ** \brief Write object on the stream.
+ ** Try to match the file format referring to the data only.
+ */
static bool
by_data(const T&, std::ostream&, const std::string&)
{
@@ -104,14 +125,19 @@
}
};
- /*----------------------.
- | write(image, filename) |
- `----------------------*/
-
- // Writers trier functor, helper for stream_wrappers
-
+ /*!
+ ** \brief Writers trier functor, helper for stream_wrappers.
+ */
struct writers_trier
{
+ /*!
+ ** \brief Writers trier functor, helper for stream_wrappers.
+ ** \arg output The new object.
+ ** \arg in The stream to read from.
+ ** \arg ext The extension.
+ **
+ ** First try to write by extension, then by data.
+ */
template <class T>
static bool
doit(const T& input, std::ostream& out, const std::string ext)
@@ -123,8 +149,13 @@
}
};
- // Write images
+ /*!
+ ** \brief Write an image (2 dimensions) to a file.
+ ** \arg input The image to write to file.
+ ** \arg name The filename.
+ ** \return True if successful.
+ */
template <class E, unsigned N>
inline bool
write(const abstract::image_with_dim<N, E>& input,
@@ -143,9 +174,17 @@
return false;
}
- // Mono-dimensional images is a special case of bi-dimensional
- // images.
-
+ /*!
+ ** \brief Write an image (1 dimension) to a file.
+ ** \arg input The image to write to file.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** In fact, real work is not done here : this function calls 'write' for
+ ** images of 2 dimensions:
+ ** Mono-dimensional images is a special case of bi-dimensional
+ ** images.
+ */
template <class E>
inline bool
write(const abstract::image_with_dim<1, E>& input,
Index: olena/oln/io/stream_wrapper.hh
--- olena/oln/io/stream_wrapper.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/43_stream_wra 1.3.1.1 600)
+++ olena/oln/io/stream_wrapper.hh Mon, 15 Mar 2004 18:12:30 +0100 odou_s (oln/t/43_stream_wra 1.3.1.1 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,8 +41,12 @@
namespace internal {
- // stream wrappers
-
+ /*!
+ ** \brief Stream identifiers.
+ **
+ ** They are used recursively: each time a StreamId fails, then
+ ** try with StreamId - 1.
+ */
enum stream_id { StreamNone = 0,
StreamFile = 1,
StreamGz = 2,
@@ -81,15 +85,16 @@
{}
};
- /*---------------------------.
- | stream_wrappers_find_files |
- `---------------------------*/
-
- // Find files compatible with the given root, extension free filename
-
+ /*!
+ ** \brief Find files compatible with the given root, extension free
+ ** filename
+ */
template <stream_id W>
struct stream_wrappers_find_files
{
+ /*!
+ ** \brief Just a functor.
+ */
static void
doit(std::list<std::string>& names, const std::string& name)
{
@@ -99,8 +104,9 @@
}
};
- // End of the loop
-
+ /*!
+ ** \brief Do nothing because of the type of stream.
+ */
template <>
struct stream_wrappers_find_files<StreamNone>
{
@@ -109,16 +115,20 @@
{}
};
- /*-----------------------.
- | try_stream_wrappers_in |
- `-----------------------*/
-
- // Try stream wrappers recursively
- // On each potential stream format, try to read using Reader
+ /*!
+ ** \brief Read a stream.
+ ** \param W The type of stream
+ ** \param Reader The real reader of this stream.
+ */
template<stream_id W, typename T, class Reader>
struct try_stream_wrappers_in
{
+
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" reader.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ */
static bool
by_extension(T& output, const std::string& name, const std::string& ext)
{
@@ -138,8 +148,15 @@
::by_extension(output, name, ext);
}
- // FIXME: it sounds strange to read wrapped file without
- // matching its extension.
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" reader.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ ** \arg output The new object.
+ ** \arg name The filename.
+ **
+ ** \todo FIXME: it sounds strange to read wrapped file without
+ ** matching its extension.
+ */
static bool
by_data(T& output, const std::string& name)
{
@@ -157,17 +174,23 @@
}
};
- // End of loop
-
+ /*!
+ ** \brief Read a stream of type None.
+ **
+ ** In fact, do nothing because of the type of stream.
+ ** Used when an errors occurs on others types of stream.
+ */
template< typename T, class Reader >
struct try_stream_wrappers_in<StreamNone, T, Reader>
{
+ ///< Read s stream of type None by extension.
static bool
by_extension(T&, const std::string&, const std::string&)
{
return false;
}
+ ///< Read a stream of type None by data.
static bool
by_data(T&, const std::string&)
{
@@ -175,16 +198,20 @@
}
};
- /*------------------------.
- | try_stream_wrappers_out |
- `------------------------*/
-
- // Try stream wrappers recursively
- // On each potential stream format, try to write using the given Writer
+ /*!
+ ** \brief Write a stream.
+ ** \param W The type of stream
+ ** \param Writer The "real" writer of this stream.
+ */
template<stream_id W, typename T, class Writer>
struct try_stream_wrappers_out
{
+
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" writer.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ */
static bool
by_extension(const T& input,
const std::string& name,
@@ -208,11 +235,16 @@
}
};
- // End of loop
-
+ /*!
+ ** \brief Write a stream of type None.
+ **
+ ** In fact, do nothing because of the type of stream.
+ ** Used when an errors occurs on others types of stream.
+ */
template< typename T, class Reader >
struct try_stream_wrappers_out<StreamNone, T, Reader>
{
+ ///< Do nothing because of the type of stream.
static bool
by_extension(const T&, const std::string&, const std::string&)
{
Index: olena/oln/io/utils.hh
--- olena/oln/io/utils.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/44_utils.hh 1.3 600)
+++ olena/oln/io/utils.hh Mon, 15 Mar 2004 16:00:47 +0100 odou_s (oln/t/44_utils.hh 1.3 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -38,8 +38,17 @@
namespace internal {
+ /*!
+ ** \brief Utils for io (get extension of a file).
+ */
struct utils
{
+
+ /*!
+ ** \brief Return the extension of a filename.
+ ** \arg name The filename.
+ ** \return The extension (lower case).
+ */
static std::string
extension(const std::string& name)
{
@@ -53,6 +62,7 @@
}
return ext;
}
+
};
} // end of namespace internal
Index: olena/oln/io/image_read.hh
--- olena/oln/io/image_read.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/45_image_read 1.9 600)
+++ olena/oln/io/image_read.hh Mon, 15 Mar 2004 18:10:52 +0100 odou_s (oln/t/45_image_read 1.9 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -50,16 +50,20 @@
namespace internal {
- /*------------.
- | try_readers |
- `------------*/
-
- // Try readers recursively
-
+ /*!
+ ** \brief Image's reader.
+ ** \param R Type of reader.
+ */
template< reader_id R, typename T >
struct try_readers
{
- // Try to deduce the file format from the extension
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try do deduce the image format from the extension.
+ ** \arg output The new object to write.
+ ** \arg in The stream.
+ ** \arg ext The extension's filename.
+ */
static bool
by_extension(T& output, std::istream& in, const std::string& ext)
{
@@ -71,7 +75,12 @@
::by_extension(output, in, ext);
}
- // Try to match the file format referring to the data only
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try to match the file format referring to the data only.
+ ** \arg output The new object to write.
+ ** \arg in The stream.
+ */
static bool
by_data(T& output, std::istream& in)
{
@@ -82,17 +91,29 @@
}
};
- // End of try_readers loop
-
+ /*!
+ ** \brief Reader for image of type None.
+ **
+ ** In fact, do nothing because of the type of reader.
+ ** Used when an errors occurs on others types of reader.
+ */
template< typename T >
struct try_readers<ReadNone, T>
{
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try do deduce the image format from the extension.
+ */
static bool
by_extension(T&, std::istream&, const std::string&)
{
return false;
}
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try to match the file format referring to the data only.
+ */
static bool
by_data(T&, std::istream&)
{
@@ -100,14 +121,19 @@
}
};
- /*----------------------.
- | read(image, filename) |
- `----------------------*/
-
- // Readers trier functor, helper for stream_wrappers
-
+ /*!
+ ** \brief Readers trier functor, helper for stream_wrappers.
+ */
struct readers_trier
{
+ /*!
+ ** \brief Readers trier functor, helper for stream_wrappers.
+ ** \arg output The new object.
+ ** \arg in The stream to read from.
+ ** \arg ext The extension.
+ **
+ ** First try to read by extension, then by data.
+ */
template <class T>
static bool
doit(T& output, std::istream& in, const std::string ext)
@@ -119,16 +145,23 @@
}
};
- // Read images
-
+ /*!
+ ** \brief Read an image (2 dimensions) from a file.
+ ** \arg output Where to write the new image.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** Try to read first by extension and then by data.
+ ** If you want to know more about, see
+ ** oln::io::internal::try_stream_wrappers_in
+ */
template <unsigned N, class E>
inline bool
read(abstract::image_with_dim<N,E>& output, const std::string& name)
{
mlc::is_true<N == 2 || N == 3>::ensure();
- // FIXME: E or abstract::image_with_dim<N,E> ?
- // E is convenient.
+ ///< \todo FIXME: E or abstract::image_with_dim<N,E> ? E is convenient.
typedef try_stream_wrappers_in<StreamAny, E, readers_trier>
stream_trier;
@@ -170,6 +203,17 @@
return false;
}
+ /*!
+ ** \brief Read an image (1 dimension) from a file.
+ ** \arg output Where to write the new image.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** In fact, real work is not done here : this function calls 'read' for
+ ** images of 2 dimensions:
+ ** Mono-dimensional images is a special case of bi-dimensional
+ ** images.
+ */
template <class E>
inline bool
read(abstract::image_with_dim<1, E>& output, const std::string& name)
Index: olena/oln/core/abstract/window_base.hh
--- olena/oln/core/abstract/window_base.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/3_window_bas 1.10 640)
+++ olena/oln/core/abstract/window_base.hh Mon, 15 Mar 2004 18:41:40 +0100 odou_s (oln/u/3_window_bas 1.10 640)
@@ -135,7 +135,7 @@
// friend class window_base_friend_traits<Sup>::ret;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -160,8 +160,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card_() const
@@ -226,7 +226,7 @@
/*!
** \brief Set a set of point to opposite.
**
- ** Each point of the set of point is assigned to his opposite.
+ ** Each point of the set of point is assigned to its opposite.
*/
void
sym_()
@@ -262,7 +262,7 @@
** \brief Used only by sub-classes
** \arg size The number of point.
**
- ** Set the number of point this object will get.
+ ** Set the number of points this object will get.
** Used only by sub-classes
*/
window_base(unsigned size) : super_type(), dp_(), delta_(0)
Index: olena/oln/core/abstract/windownd.hh
--- olena/oln/core/abstract/windownd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/4_windownd.h 1.8 640)
+++ olena/oln/core/abstract/windownd.hh Mon, 15 Mar 2004 18:43:03 +0100 odou_s (oln/u/4_windownd.h 1.8 640)
@@ -73,7 +73,7 @@
friend class window<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -111,7 +111,7 @@
/*!
** \brief Construct a w_window of 'size' elements.
- ** \arg size The number of element to reserve for the window.
+ ** \arg size The number of elements to reserve for the window.
*/
windownd(unsigned size) : super_type(size)
{}
Index: olena/oln/core/abstract/w_windownd.hh
--- olena/oln/core/abstract/w_windownd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/5_w_windownd 1.7 640)
+++ olena/oln/core/abstract/w_windownd.hh Mon, 15 Mar 2004 18:43:21 +0100 odou_s (oln/u/5_w_windownd 1.7 640)
@@ -75,7 +75,7 @@
friend class w_window<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -154,7 +154,7 @@
/*!
** \brief Construct a w_window of 'size' elements.
- ** \arg size The number of element to reserve for the window.
+ ** \arg size The number of elements to reserve for the window.
*/
w_windownd(unsigned size) : super_type(size)
{
Index: olena/oln/core/abstract/neighborhoodnd.hh
--- olena/oln/core/abstract/neighborhoodnd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/6_neighborho 1.7 640)
+++ olena/oln/core/abstract/neighborhoodnd.hh Mon, 15 Mar 2004 18:35:11 +0100 odou_s (oln/u/6_neighborho 1.7 640)
@@ -50,10 +50,10 @@
namespace abstract {
/*!
- ** \brief Neighborhoodnd.
+ ** \brief Neighborhood N dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have N dimensions.
**
*/
@@ -75,7 +75,7 @@
friend class neighborhood<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -107,14 +107,14 @@
}
/*!
- ** \brief Construct a neighborhoodnd.
+ ** \brief Construct a neighborhood N dimensions.
*/
neighborhoodnd() : super_type()
{}
/*!
** \brief Construct a neighborhood of 'size' elements.
- ** \arg size The number of element to reserve for the neighborhood.
+ ** \arg size The number of elements to reserve for the neighborhood.
*/
neighborhoodnd(unsigned size) : super_type(size)
{}
--
Simon Odou
simon(a)lrde.epita.fr
2
2
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* integre/ntg/real/behavior.hh: Change the unsafe::get<T>::check().
* integre/ntg/utils/cast.hh: Change cast::force().
* olena/oln/convert/value_to_point.hh: Fix value_to_point<bin>.
* olena/oln/utils/histogram.hh: Fix hisogram<bin>.
* olena/oln/morpho/fast_morpho.hxx: Histogram to abstract histogram.
* olena/oln/morpho/hit_or_miss.inc: Enable code in the doc.
* olena/oln/morpho/top_hat.inc: Likewise.
* olena/oln/morpho/opening.inc: Likewise.
* olena/oln/morpho/dilation.hh: Likewise.
* olena/oln/morpho/erosion.hh: Likewise.
* olena/oln/morpho/dilation.hh: Likewise.
* olena/tests/morpho/tests/edoc: Add tests.
* olena/oln/morpho/attribute_closing_opening_map.hh: Rename images.
* olena/oln/morpho/extrema.hxx: Add doc.
* olena/oln/morpho/closing.inc: Remove fixme.
Index: olena/oln/morpho/closing.inc
--- olena/oln/morpho/closing.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/44_closing.in 1.17 640)
+++ olena/oln/morpho/closing.inc Thu, 18 Mar 2004 17:23:19 +0100
van-vl_n (oln/44_closing.in 1.17 640)
@@ -56,9 +56,6 @@
** \arg input Input image to close.
** \arg se Structuring element to use.
**
-** \warning This code is the same for morpho and morpho::fast
-** namespaces.
-**
** \code
** #include <oln/basics2d.hh>
** #include <oln/morpho/closing.hh>
@@ -69,7 +66,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
-** save(oln::morpho::closing(im1, oln::win_c8p()), IMG_OUT
"oln_morpho_closing.pbm");
+** save(oln::morpho::closing(im1, oln::win_c8p()),
+** IMG_OUT "oln_morpho_closing.pbm");
** return 0;
** }
** \endcode
Index: olena/oln/morpho/dilation.hh
--- olena/oln/morpho/dilation.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/b/5_dilation.h 1.18 640)
+++ olena/oln/morpho/dilation.hh Thu, 18 Mar 2004 17:23:08 +0100
van-vl_n (oln/b/5_dilation.h 1.18 640)
@@ -76,8 +76,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** save(oln::morpho::dilation(im1, oln::win_c8p()), IMG_OUT
"oln_morpho_dilation.pbm");
- ** return 0;
+ ** save(oln::morpho::dilation(im1, oln::win_c8p()),
+ ** IMG_OUT "oln_morpho_dilation.pbm");
** }
** \endcode
**
@@ -124,8 +124,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** save(oln::morpho::n_dilation(im1, oln::win_c8p(), 5), IMG_OUT
"oln_morpho_n_dilation.pbm");
- ** return 0;
+ ** save(oln::morpho::n_dilation(im1, oln::win_c8p(), 5),
+ ** IMG_OUT "oln_morpho_n_dilation.pbm");
** }
** \endcode
**
@@ -158,7 +158,8 @@
dilation(const abstract::non_vectorial_image<I>& input,
const abstract::struct_elt<E>& se)
{
- return fast_morpho<I, E, utils::histogram_max>(input, se);
+ return fast_morpho<I, E, utils::histogram_max<oln_value_type(I)> >
+ (input, se);
}
}
} // end of morpho
Index: olena/oln/morpho/erosion.hh
--- olena/oln/morpho/erosion.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/b/4_erosion.hh 1.20 640)
+++ olena/oln/morpho/erosion.hh Thu, 18 Mar 2004 17:22:50 +0100 van-vl_n
(oln/b/4_erosion.hh 1.20 640)
@@ -68,8 +68,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** save(oln::morpho::erosion(im1, oln::win_c8p()), IMG_OUT
"oln_morpho_erosion.pbm");
- ** return 0;
+ ** save(oln::morpho::erosion(im1, oln::win_c8p()),
+ ** IMG_OUT "oln_morpho_erosion.pbm");
** }
** \endcode
**
@@ -117,8 +117,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** save(oln::morpho::n_erosion(im1, oln::win_c8p(), 5), IMG_OUT
"oln_morpho_n_erosion.pbm");
- ** return 0;
+ ** save(oln::morpho::n_erosion(im1, oln::win_c8p(), 5),
+ ** IMG_OUT "oln_morpho_n_erosion.pbm");
** }
** \endcode
**
@@ -170,8 +170,8 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** save(oln::morpho::erosion(im1, oln::win_c8p()), IMG_OUT
"oln_morpho_fast_erosion.pbm");
- ** return 0;
+ ** save(oln::morpho::fast::erosion(im1, oln::win_c8p()),
+ ** IMG_OUT "oln_morpho_fast_erosion.pbm");
** }
** \endcode
**
@@ -180,16 +180,16 @@
** =>
** \image html oln_morpho_fast_erosion.png
** \image latex oln_morpho_fast_erosion.png
- ** \todo FIXME: Correct this function and make the example use it.
*/
template<class I, class E>
oln_concrete_type(I)
erosion(const abstract::non_vectorial_image<I>& input,
const abstract::struct_elt<E>& se)
{
- return fast_morpho<I, E, utils::histogram_min>(input, se);
- }
+ return fast_morpho<I, E, utils::histogram_min<oln_value_type(I)> >
+ (input, se);
}
+ } // end of fast
} // end of morpho
Index: olena/oln/morpho/extrema.hxx
--- olena/oln/morpho/extrema.hxx Mon, 15 Mar 2004 17:40:54 +0100
van-vl_n (oln/j/4_extrema.hx 1.16 640)
+++ olena/oln/morpho/extrema.hxx Thu, 18 Mar 2004 17:22:12 +0100
van-vl_n (oln/j/4_extrema.hx 1.16 640)
@@ -106,9 +106,10 @@
** im_type light(oln::load(IMG_IN "lena.pgm"));
** bin_im_type minima(oln::load(IMG_IN "map.pbm"));
**
-** oln::save(oln::morpho::sequential::minima_imposition(light,
minima, oln::neighb_c4()),
+** oln::save(oln::morpho::sequential::minima_imposition(light,
+** minima,
+** oln::neighb_c4()),
** IMG_OUT "oln_morpho_sequential_minima_imposition.pgm");
-** return 0;
** }
** \endcode
** \image html lena_pgm.png
@@ -164,7 +165,6 @@
**
** oln::save(oln::morpho::sequential::regional_minima(im,
oln::neighb_c4()),
** IMG_OUT "oln_morpho_sequential_regional_minima.pgm");
-** return 0;
** }
** \endcode
** \image html lena_pgm.png
Index: olena/oln/morpho/extrema_killer.hh
--- olena/oln/morpho/extrema_killer.hh Sun, 14 Mar 2004 18:21:09 +0100
palma_g (oln/e/19_extrema_ki 1.7.1.4.1.13 640)
+++ olena/oln/morpho/extrema_killer.hh Thu, 18 Mar 2004 16:53:10 +0100
van-vl_n (oln/e/19_extrema_ki 1.7.1.4.1.13 640)
@@ -321,6 +321,8 @@
** implementation is based on stak. Guichard and Morel, Image
** iterative smoothing and PDE's. Book in preparation. p 265.
**
+ ** \see oln::morpho::fast::card_closing
+ **
** \param I Image exact type.
** \param N Neighborhood exact type.
**
@@ -446,6 +448,8 @@
** implementation is based on stak. Guichard and Morel, Image
** iterative smoothing and PDE's. Book in preparation. p 265.
**
+ ** \see oln::morpho::fast::card_opening.
+ **
** \param I Image exact type.
** \param N Neighborhood exact type.
**
Index: olena/oln/morpho/fast_morpho.hxx
--- olena/oln/morpho/fast_morpho.hxx Mon, 15 Mar 2004 17:40:54 +0100
van-vl_n (oln/45_fast_morph 1.21 640)
+++ olena/oln/morpho/fast_morpho.hxx Thu, 18 Mar 2004 17:20:37 +0100
van-vl_n (oln/45_fast_morph 1.21 640)
@@ -117,7 +117,7 @@
template<class I, class E1, class E2, class H>
// inline
void
- hist_update(H& hist,
+ hist_update(utils::abstract::histogram<H>& hist,
const abstract::non_vectorial_image<I>& input,
const oln_point_type(I)& p,
const abstract::struct_elt<E1>& se_rem,
@@ -284,6 +284,8 @@
/*!
** \brief Fast morpho algorithm.
**
+ ** \todo FIXME: This algorithm should be moved to the
+ ** namespace oln::morpho::fast.
**
** \code
** #include <oln/basics2d.hh>
@@ -295,21 +297,21 @@
** typedef oln::image2d<ntg::bin> im_type;
**
** im_type im1(oln::load(IMG_IN "object.pbm"));
- ** //save(oln::morpho::fast_morpho<im_type, oln::win_c8p(),
utils::histogram_min>
- ** // (im1, oln::win_c8p()), IMG_OUT
"oln_morpho_fast_morpho.pbm");
- ** save(im1, IMG_OUT "oln_morpho_fast_morpho.pbm");
- ** return 0;
+ ** save(oln::morpho::fast_morpho<im_type, oln::window2d,
+ ** oln::utils::histogram_min<ntg::bin> >
+ ** (im1, oln::win_c8p()),
+ ** IMG_OUT "oln_morpho_fast_morpho.pbm");
** }
** \endcode
- **
** \image html object_pbm.png
** \image latex object_pbm.png
** =>
** \image html oln_morpho_fast_morpho.png
** \image latex oln_morpho_fast_morpho.png
- ** \todo FIXME: Correct this function and make the example use it.
+ **
+ ** \todo FIXME: add tests.
*/
- template<class I, class E, template<typename, typename> class H>
+ template<class I, class E, class H>
oln_concrete_type(I)
fast_morpho(const abstract::non_vectorial_image<I>& input,
const abstract::struct_elt<E>& se)
@@ -350,7 +352,7 @@
const typename I::size_type size = input.size();
// Initialize the histogram with the values around the first point.
- H<oln_value_type(I),unsigned> hist;
+ H hist;
oln_point_type(I) p;
// oln_iter_type(E) dp(se);
@@ -364,7 +366,7 @@
output[p] = hist.res(); // First point.
internal::fast_morpho_inner<1, E::dim, const I,
- const typename I::size_type, H<oln_value_type(I),unsigned>,
+ const typename I::size_type, H,
const E,oln_point_type(I),oln_concrete_type(I)>::doit(input.exact(),
size, hist,
se_add, se_rem,
se_add_back, se_rem_back,
Index: olena/oln/morpho/hit_or_miss.inc
--- olena/oln/morpho/hit_or_miss.inc Sun, 14 Mar 2004 18:21:09 +0100
palma_g (oln/42_hit_or_mis 1.22 640)
+++ olena/oln/morpho/hit_or_miss.inc Thu, 18 Mar 2004 17:18:51 +0100
van-vl_n (oln/42_hit_or_mis 1.22 640)
@@ -64,9 +64,9 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-**
oln::save(oln::morpho::hit_or_miss(oln::convert::bound<ntg::int_u8>(),
im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss
+** (oln::convert::bound<ntg::int_u8>(), im1, mywin, mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss.pbm");
-** return 0;
** }
** \endcode
**
@@ -76,7 +76,6 @@
** \image html oln_morpho_fast_hit_or_miss.png
** \image latex oln_morpho_fast_hit_or_miss.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class C, class B, class I, class E1, class E2>
typename mute<I, typename convoutput<C, B,oln_value_type(I)>::ret>::ret
@@ -128,9 +127,8 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-** oln::save(oln::morpho::hit_or_miss(im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss(im1, mywin, mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss_overload.pbm");
-** return 0;
** }
** \endcode
**
@@ -140,7 +138,6 @@
** \image html oln_morpho_fast_hit_or_miss_overload.png
** \image latex oln_morpho_fast_hit_or_miss_overload.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class I, class E1, class E2>
oln_concrete_type(I)
@@ -194,9 +191,8 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-** oln::save(oln::morpho::hit_or_miss_opening(im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss_opening(im1, mywin, mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss_opening.pbm");
-** return 0;
** }
** \endcode
**
@@ -206,7 +202,6 @@
** \image html oln_morpho_fast_hit_or_miss_opening.png
** \image latex oln_morpho_fast_hit_or_miss_opening.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class I, class E1, class E2>
oln_concrete_type(I)
@@ -256,9 +251,8 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-** oln::save(oln::morpho::hit_or_miss_opening_bg(im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss_opening_bg(im1, mywin,
mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss_opening_bg.pbm");
-** return 0;
** }
** \endcode
**
@@ -268,7 +262,6 @@
** \image html oln_morpho_fast_hit_or_miss_opening_bg.png
** \image latex oln_morpho_fast_hit_or_miss_opening_bg.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class I, class E1, class E2>
oln_concrete_type(I)
@@ -324,9 +317,8 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-** oln::save(oln::morpho::hit_or_miss_closing(im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss_closing(im1, mywin, mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss_closing.pbm");
-** return 0;
** }
** \endcode
**
@@ -336,7 +328,6 @@
** \image html oln_morpho_fast_hit_or_miss_closing.png
** \image latex oln_morpho_fast_hit_or_miss_closing.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class I, class E1, class E2>
oln_concrete_type(I)
@@ -389,9 +380,8 @@
** .add(-1,0);
** oln::window2d mywin2 = - mywin;
**
-** oln::save(oln::morpho::hit_or_miss_closing_bg(im1, mywin, mywin2),
+** oln::save(oln::morpho::fast::hit_or_miss_closing_bg(im1, mywin,
mywin2),
** IMG_OUT
"oln_morpho_fast_hit_or_miss_closing_bg.pbm");
-** return 0;
** }
** \endcode
**
@@ -401,7 +391,6 @@
** \image html oln_morpho_fast_hit_or_miss_closing_bg.png
** \image latex oln_morpho_fast_hit_or_miss_closing_bg.png
**
-** \todo FIXME: Histogram problems (fast version do not work).
*/
template<class I, class E1, class E2>
oln_concrete_type(I)
Index: olena/oln/morpho/opening.inc
--- olena/oln/morpho/opening.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/40_opening.in 1.15 640)
+++ olena/oln/morpho/opening.inc Thu, 18 Mar 2004 16:47:27 +0100
van-vl_n (oln/40_opening.in 1.15 640)
@@ -49,9 +49,8 @@
**
** im_type im(oln::load(IMG_IN "object.pbm"));
**
-** oln::save(oln::morpho::opening(im, oln::win_c8p()),
+** oln::save(oln::morpho::fast::opening(im, oln::win_c8p()),
** IMG_OUT
"oln_morpho_fast_opening.pbm");
-** return 0;
** }
** \endcode
**
@@ -61,7 +60,6 @@
** \image html oln_morpho_fast_opening.png
** \image latex oln_morpho_fast_opening.png
**
-** \todo FIXME: Histogram problems (fast version do not compile).
*/
template<class I, class E>
oln_concrete_type(I)
Index: olena/oln/morpho/top_hat.inc
--- olena/oln/morpho/top_hat.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/39_top_hat.in 1.15 640)
+++ olena/oln/morpho/top_hat.inc Thu, 18 Mar 2004 17:46:14 +0100
van-vl_n (oln/39_top_hat.in 1.15 640)
@@ -48,11 +48,11 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
-**
oln::save(oln::morpho::fast::white_top_hat(oln::convert::bound<ntg::int_u8>(),
+** oln::save(oln::morpho::fast::white_top_hat
+** (oln::convert::bound<ntg::int_u8>(),
** im1,
** oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_white_top_hat.pbm");
-** return 0;
** }
** \endcode
**
@@ -94,7 +94,6 @@
** oln::save(oln::morpho::fast::white_top_hat(im1,
** oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_white_top_hat_overload.pbm");
-** return 0;
** }
** \endcode
**
@@ -136,11 +135,11 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
-**
oln::save(oln::morpho::fast::black_top_hat(oln::convert::bound<ntg::int_u8>(),
+** oln::save(oln::morpho::fast::black_top_hat
+** (oln::convert::bound<ntg::int_u8>(),
** im1,
** oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_black_top_hat.pbm");
-** return 0;
** }
** \endcode
**
@@ -183,7 +182,6 @@
** oln::save(oln::morpho::fast::black_top_hat(im1,
** oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_black_top_hat_overload.pbm");
-** return 0;
** }
** \endcode
**
@@ -229,11 +227,11 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
-**
oln::save(oln::morpho::fast::self_complementary_top_hat(oln::convert::bound<ntg::int_u8>(),
+** oln::save(oln::morpho::fast::self_complementary_top_hat
+** (oln::convert::bound<ntg::int_u8>(),
** im1,
**
oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_self_complementary_top_hat.pbm");
-** return 0;
** }
** \endcode
**
@@ -274,7 +272,6 @@
** oln::save(oln::morpho::fast::self_complementary_top_hat(im1,
**
oln::win_c8p()),
** IMG_OUT
"oln_morpho_fast_self_complementary_top_hat_overload.pbm");
-** return 0;
** }
** \endcode
**
@@ -318,11 +315,11 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
-**
oln::save(oln::morpho::fast::top_hat_contrast_op(oln::convert::bound<ntg::int_u8>(),
+** oln::save(oln::morpho::fast::top_hat_contrast_op
+** (oln::convert::bound<ntg::int_u8>(),
** im1,
**
oln::win_c8p()),
** IMG_OUT "oln_morpho_fast_top_hat_contrast_op.pbm");
-** return 0;
** }
** \endcode
**
@@ -366,11 +363,9 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
-** //oln::save(oln::morpho::fast::top_hat_contrast_op(im1,
-** // oln::win_c8p()),
-** // IMG_OUT
"oln_morpho_fast_top_hat_contrast_op_overload.pbm");
-** oln::save(im1, IMG_OUT
"oln_morpho_fast_top_hat_contrast_op_overload.pbm");
-** return 0;
+** oln::save(oln::morpho::fast::top_hat_contrast_op(im1,
+** oln::win_c8p()),
+** IMG_OUT "oln_morpho_fast_top_hat_contrast_op_overload.pbm");
** }
** \endcode
**
Index: integre/ntg/real/behavior.hh
--- integre/ntg/real/behavior.hh Thu, 27 Nov 2003 11:26:27 +0100
burrus_n (oln/g/31_behaviour. 1.13.1.15.1.1 640)
+++ integre/ntg/real/behavior.hh Thu, 18 Mar 2004 16:08:00 +0100
van-vl_n (oln/g/31_behaviour. 1.13.1.15.1.1 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -107,7 +107,7 @@
template <class P>
static storage_type
check (const P& p)
- { return p; }
+ { return storage_type(p); }
};
static std::string
Index: integre/ntg/utils/cast.hh
--- integre/ntg/utils/cast.hh Wed, 28 Jan 2004 16:28:44 +0100 palma_g
(oln/i/26_cast.hh 1.3.1.12 640)
+++ integre/ntg/utils/cast.hh Thu, 18 Mar 2004 16:13:26 +0100 van-vl_n
(oln/i/26_cast.hh 1.3.1.12 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -77,7 +77,7 @@
const Tdest
force(const Tsrc& val)
{
- return (Tdest)val;
+ return ntg_unsafe_type(Tdest)(val);
}
/*------.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Mon, 15 Mar 2004 17:40:54 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.9 640)
+++ olena/oln/utils/histogram.hh Wed, 17 Mar 2004 18:24:55 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.9 640)
@@ -30,14 +30,22 @@
# include <oln/core/image1d.hh>
+
# include <oln/core/image3d.hh>
# include <oln/convert/value_to_point.hh>
# include <oln/core/abstract/image.hh>
+# include <ntg/core/pred_succ.hh>
+
# include <vector>
+/// Return the underlying counter type of \a H.
+# define oln_cpt_type(H) mlc_exact_type(H)::cpt_type
+/// Return the underlying counter type of \a H.
+# define oln_cpt_type_(H) mlc_exact_type_(H)::cpt_type
+
namespace oln {
/// \brief Utilities, such as statistics.
namespace utils {
@@ -49,7 +57,8 @@
struct img_max_size
{
private:
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type;
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
+ ensure_type;
public:
typedef image1d_size size_type;
typedef T comp_type;
@@ -83,22 +92,29 @@
};
} // end of namespace internal
+ /// Traits for oln::utils::abstract::histogram hierarchy.
+ template <class Exact>
+ struct hist_traits
+ {
+ };
+
+
/// \brief Abstract utilities.
namespace abstract
{
- /*! Abstract base class for historgram.
+ /*! Abstract base class for histogram.
**
** \see oln::histogram
*/
- template<class T,
- typename CPT,
- class Exact = mlc::final>
+ template<class Exact = mlc::final>
class histogram: public mlc_hierarchy::any<Exact>
{
public:
- typedef histogram<T, CPT, Exact> self_type;
- typedef Exact exact_type;
- typedef CPT cpt_type;
+ typedef typename mlc::exact_vt<histogram<Exact>,
+ Exact>::ret exact_type;
+ typedef typename hist_traits<exact_type>::cpt_type cpt_type;
+ typedef typename hist_traits<exact_type>::value_type value_type;
+
/// Put the number of occurrence of every value to zero.
void
clear()
@@ -106,14 +122,14 @@
this->exact().clear_impl();
}
/// Read the number of occurrence of \a v.
- const CPT&
- operator[](const T &v)const
+ const cpt_type&
+ operator[](const value_type &v)const
{
return this->exact().at(v);
}
/// Read or write the number of occurrence of \a v.
- CPT&
- operator[](const T &v)
+ cpt_type&
+ operator[](const value_type &v)
{
return this->exact().at(v);
}
@@ -130,6 +146,30 @@
};
} // end of namespace abstract
+ template<typename T,
+ typename CPT = unsigned,
+ class V2P = oln::convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram;
+
+ /// Traits for oln::utils::abstract::histogram hierarchy.
+ template <typename T,
+ typename CPT,
+ class V2P,
+ class Exact>
+ struct hist_traits<histogram<T, CPT, V2P, Exact> >
+ {
+ typedef CPT cpt_type; ///< Counter type
+ typedef T value_type; ///< Value of the input image
+ typedef V2P value_to_point_type; ///< Class that convert a value to
+ /// a point
+ typedef typename value_to_point_type::result_type point_type;
+ ///< Point type of the internal image.
+ enum {dim = point_type::dim}; ///< Dimension of the histogram.
+ typedef typename dim_traits<dim, CPT>::img_type img_type;
+ ///< Type of the internal image.
+ };
+
/*! Histogram.
**
** This histogram uses an image of unsigned to store the value.
@@ -168,26 +208,30 @@
** \endcode
*/
template<typename T,
- typename CPT = unsigned,
- class V2P = oln::convert::value_to_point<T>,
- class Exact = mlc::final>
+ typename CPT,
+ class V2P,
+ class Exact>
class histogram: public abstract::histogram
- <T, CPT, typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>,
Exact>::ret>
+ <typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>, Exact>::ret>
{
public:
- typedef histogram<T, CPT, V2P, Exact> self_type;
- typedef Exact exact_type;
- typedef T input_type;
- typedef V2P value_to_point_type;
- typedef CPT cpt_type;
- typedef typename value_to_point_type::result_type point_type;
- enum {dim = value_to_point_type::result_type::dim};
- typedef abstract::histogram<T, CPT, self_type> upper_type;
- typedef typename dim_traits<dim, CPT>::img_type img_type;
+ typedef typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>,
+ Exact>::ret exact_type;
+ typedef typename hist_traits<exact_type>::value_type value_type;
+ typedef typename hist_traits<exact_type>::cpt_type cpt_type;
+ typedef typename hist_traits<exact_type>::value_to_point_type
+ value_to_point_type;
+ typedef typename hist_traits<exact_type>::point_type point_type;
+ enum {dim = hist_traits<exact_type>::dim};
+ typedef typename hist_traits<exact_type>::img_type img_type;
- /// Empty histogram. The function Init(image) should be used
after this constructor.
+ /*! \brief Empty histogram.
+ **
+ ** \note The function Init(image) should be used after this
+ ** constructor.
+ */
histogram(const value_to_point_type & c2p = value_to_point_type()):
- v2p_(c2p), img_(internal::img_max_size<input_type>()())
+ v2p_(c2p), img_(internal::img_max_size<value_type>()())
{
clear();
}
@@ -196,7 +240,7 @@
template <class I>
histogram(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()):
- v2p_(v2p), img_(internal::img_max_size<input_type>()())
+ v2p_(v2p), img_(internal::img_max_size<value_type>()())
{
clear();
init(input);
@@ -208,18 +252,18 @@
{
typename img_type::iter_type it(img_ );
for_all(it)
- img_[it] = ntg_zero_val(CPT);
+ img_[it] = ntg_zero_val(cpt_type);
}
/// operator[] should be called.
- const CPT&
+ const cpt_type&
at(const T &v)const
{
return img_[v2p_(v)];
}
/// operator[] should be called.
- CPT&
- at(const T &v)
+ cpt_type&
+ at(const value_type &v)
{
return img_[v2p_(v)];
}
@@ -248,49 +292,68 @@
/*! Minimum value of an histogram.
**
- ** It return the smaller value within the image used to build the
histogram.
- **
- ** \warning If there is no min an assertion will fail at the end of
the loop.
+ ** It return the smaller value within the image used to build the
+ ** histogram.
**
- ** \note It can be slow when the histogram is sparse because it
iterate over a
- ** large range of 0. Use histogram_min or histogram_minmax instead.
+ ** \note It can be slow when the histogram is sparse because it iterate
+ ** over a large range of 0. Use \a histogram_min or \a histogram_minmax
+ ** instead.
** \see histogram_min
*/
- template< typename T, typename CPT, class Exact>
- inline T
- min(const abstract::histogram<T, CPT, Exact>& hist)
- {
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
-
- T i;
- for (i = ntg_min_val(T); i <= ntg_max_val(T); ++i)
- if (hist[i] > ntg_zero_val(CPT))
+ template<class T>
+ inline oln_value_type(T)
+ min(const abstract::histogram<T>& hist)
+ {
+ typedef typename ntg_is_a(oln_value_type(T),
+ ntg::non_vectorial)::ensure_type ensure_type;
+
+ oln_value_type(T) i;
+ for (i = ntg_min_val(oln_value_type(T));
+ i != ntg_max_val(oln_value_type(T));
+ i = ntg::succ(i))
+ if (hist[i] > ntg_zero_val(oln_cpt_type(T)))
break;
return i;
}
/*! Maximum value of an histogram.
**
- ** It return the higher value within the image used to build the
histogram.
+ ** It return the higher value within the image used to build the
+ ** histogram.
**
- ** \warning If there is no min an assertion will fail at the end of
the loop.
- **
- ** \note It can be slow when the histogram is sparse because it
iterate over a
- ** large range of 0. Use histogram_max or histogram_minmax instead.
+ ** \note It can be slow when the histogram is sparse because it
+ ** iterate over a large range of 0. Use histogram_max or
+ ** histogram_minmax instead.
** \see histogram_max
*/
- template< typename T, typename CPT, class Exact>
- inline T
- max(const abstract::histogram<T, CPT, Exact>& hist)
- {
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
-
- T i;
- for (i = ntg_max_val(T); i >= ntg_min_val(T); --i)
- if (hist[i] > ntg_zero_val(CPT))
+ template<class T>
+ inline oln_value_type(T)
+ max(const abstract::histogram<T>& hist)
+ {
+ typedef typename ntg_is_a(oln_value_type(T),
+ ntg::non_vectorial)::ensure_type ensure_type;
+
+ oln_value_type(T) i;
+ for (i = ntg_max_val(oln_value_type(T));
+ i != ntg_min_val(oln_value_type(T));
+ i = ntg::pred(i))
+ if (hist[i] > ntg_zero_val(oln_cpt_type(T)))
break;
return i;
}
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram_minmax;
+
+ template <typename T,
+ typename CPT,
+ class V2P,
+ class Exact>
+ struct hist_traits<histogram_minmax<T, CPT, V2P, Exact> >
+ : public hist_traits<histogram<T, CPT, V2P, Exact> >
+ {};
/*! Build the histogram and has quick min and max functions.
**
** The idea behind the min- and max-specialized histogram is to
@@ -307,217 +370,269 @@
** \see histogram_max
*/
template< typename T,
- typename CPT = unsigned,
- class V2P = convert::value_to_point<T>,
- class Exact = mlc::final>
+ typename CPT,
+ class V2P,
+ class Exact>
class histogram_minmax : public histogram
<T, CPT, V2P,
- typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>,
Exact>::ret>
+ typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>,
+ Exact>::ret>
{
private:
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
- protected:
- /// Maintain the worst min and max.
- void
- adjust(const T &idx)
- {
- if (idx > max_)
- max_ = idx;
- if (idx < min_)
- min_ = idx;
- }
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
+ ensure_type;
public:
- typedef histogram_minmax<T, CPT, V2P, Exact> self_type;
- typedef Exact exact_type;
- typedef histogram<T, CPT, V2P, histogram_minmax<T, CPT, V2P,
Exact> > upper_type;
- typedef V2P value_to_point_type;
+ typedef typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>,
+ Exact>::ret exact_type;
+ typedef typename hist_traits<exact_type>::value_type value_type;
+ typedef typename hist_traits<exact_type>::cpt_type cpt_type;
+ typedef typename hist_traits<exact_type>::value_to_point_type
+ value_to_point_type;
+ typedef typename hist_traits<exact_type>::point_type point_type;
+ enum {dim = hist_traits<exact_type>::dim};
+ typedef typename hist_traits<exact_type>::img_type img_type;
+ typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_minmax(const value_to_point_type & v2p =
value_to_point_type()) :
upper_type(v2p),
- min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
+ min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
template <class I>
histogram_minmax(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
upper_type(input, v2p),
- min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
+ min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const CPT&
- at(const T& i) const
+ const cpt_type&
+ at(const value_type& i) const
{
adjust(i);
return img_[v2p_(i)];
}
/// operator[] should be called.
- CPT&
- at(const T& i)
+ cpt_type&
+ at(const value_type& i)
{
adjust(i);
return img_[v2p_(i)];
}
/// Quick function min.
- T
+ value_type
min()
{
- for (; min_ <= ntg_max_val(T); ++min_)
- if (img_[v2p_(min_)] > ntg_zero_val(CPT))
+ for (; min_ != ntg_max_val(value_type); min_ = ntg::succ(min_))
+ if (img_[v2p_(min_)] > ntg_zero_val(cpt_type))
break;
return min_;
}
/// Quick function max.
- T
+ value_type
max()
{
- for (; max_ > 0; --max_)
- if (img_[v2p_(max_)] > ntg_zero_val(CPT))
+ for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_))
+ if (img_[v2p_(max_)] > ntg_zero_val(cpt_type))
break;
return max_;
}
protected:
- T min_, max_; ///< Indices of min and max elements.
+ /// Maintain the worst min and max.
+ void
+ adjust(const value_type &idx)
+ {
+ if (idx > max_)
+ max_ = idx;
+ if (idx < min_)
+ min_ = idx;
+ }
+ value_type min_, max_; ///< Indices of min and max elements.
};
+
+
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram_min;
+
+ template <typename T,
+ typename CPT,
+ class V2P,
+ class Exact>
+ struct hist_traits<histogram_min<T, CPT, V2P, Exact> >
+ : public hist_traits<histogram<T, CPT, V2P, Exact> >
+ {};
+
/*! Build the histogram and has quick min function.
**
** \see histogram_minmax
*/
template< typename T,
- typename CPT = unsigned,
- class V2P = convert::value_to_point<T>,
- class Exact = mlc::final>
+ typename CPT,
+ class V2P,
+ class Exact>
class histogram_min : public histogram<T, CPT, V2P,
typename mlc::exact_vt<histogram_min<T, CPT, V2P, Exact>,
Exact>::ret>
{
private:
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
- protected:
- /// Maintain the worst min.
- void
- adjust(const T& idx)
- {
- if (idx < min_)
- min_ = idx;
- }
- public:
- typedef histogram_min<T, CPT, V2P, Exact> self_type;
- typedef Exact exact_type;
- typedef V2P value_to_point_type;
- typedef histogram<T, CPT, V2P, histogram_min<T, CPT, V2P, Exact>
> upper_type;
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
+ ensure_type;
+ public:
+ typedef typename mlc::exact_vt<histogram_min<T, CPT, V2P, Exact>,
+ Exact>::ret exact_type;
+ typedef typename hist_traits<exact_type>::value_type value_type;
+ typedef typename hist_traits<exact_type>::cpt_type cpt_type;
+ typedef typename hist_traits<exact_type>::value_to_point_type
+ value_to_point_type;
+ typedef typename hist_traits<exact_type>::point_type point_type;
+ enum {dim = hist_traits<exact_type>::dim};
+ typedef typename hist_traits<exact_type>::img_type img_type;
+ typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_min(const value_to_point_type & v2p =
value_to_point_type()) :
- upper_type(v2p), min_(ntg_min_val(T)) {}
+ upper_type(v2p), min_(ntg_min_val(value_type)) {}
template <class I>
histogram_min(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
- upper_type(input, v2p), min_(ntg_min_val(T)) {}
+ upper_type(input, v2p), min_(ntg_min_val(value_type)) {}
/// operator[] should be called.
- const CPT&
- at(const T& i) const
+ const cpt_type&
+ at(const value_type& i) const
{
return img_[v2p_(i)];
}
/// operator[] should be called.
- CPT&
- at(const T& i)
+ cpt_type&
+ at(const value_type& i)
{
adjust(i);
return img_[v2p_(i)];
}
/// Quick function min.
- T
+ value_type
min()
{
- for (; min_ <= ntg_max_val(T); ++min_)
- if (img_[v2p_(min_)] > ntg_zero_val(CPT))
+ for (; min_ != ntg_max_val(value_type); min_ = succ(min_))
+ if (img_[v2p_(min_)] > ntg_zero_val(cpt_type))
break;
return min_;
}
/// Return the min.
- T
+ value_type
res()
{
return min();
}
protected:
- T min_; ///< Index of the worst min element.
+ /// Maintain the worst min.
+ void
+ adjust(const value_type& idx)
+ {
+ if (idx < min_)
+ min_ = idx;
+ }
+ value_type min_; ///< Index of the worst min element.
};
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram_max;
+
+ template <typename T,
+ typename CPT,
+ class V2P,
+ class Exact>
+ struct hist_traits<histogram_max<T, CPT, V2P, Exact> >
+ : public hist_traits<histogram<T, CPT, V2P, Exact> >
+ {};
+
/*! Build the histogram and has quick max function.
**
** \see histogram_minmax
*/
template< typename T,
- typename CPT = unsigned,
- class V2P = convert::value_to_point<T> ,
- class Exact = mlc::final>
+ typename CPT,
+ class V2P,
+ class Exact>
class histogram_max : public histogram<T, CPT, V2P,
typename mlc::exact_vt<histogram_max<T, CPT, V2P, Exact>,
Exact>::ret>
{
- protected:
- /// Maintain the worst max.
- void
- adjust(const T& idx)
- {
- if (idx > max_)
- max_ = idx;
- }
+ private:
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
+ ensure_type;
public:
- typedef histogram_max<T, CPT, V2P, Exact> self_type;
- typedef Exact exact_type;
- typedef V2P value_to_point_type;
- typedef histogram<T, CPT, V2P, histogram_max<T, CPT, V2P, Exact>
> upper_type;
+ typedef typename mlc::exact_vt<histogram_max<T, CPT, V2P, Exact>,
+ Exact>::ret exact_type;
+ typedef typename hist_traits<exact_type>::value_type value_type;
+ typedef typename hist_traits<exact_type>::cpt_type cpt_type;
+ typedef typename hist_traits<exact_type>::value_to_point_type
+ value_to_point_type;
+ typedef typename hist_traits<exact_type>::point_type point_type;
+ enum {dim = hist_traits<exact_type>::dim};
+ typedef typename hist_traits<exact_type>::img_type img_type;
+ typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_max(const value_to_point_type & v2p =
value_to_point_type()) :
- upper_type(v2p),max_(ntg_max_val(T)) {}
+ upper_type(v2p),max_(ntg_max_val(value_type)) {}
template <class I>
histogram_max(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
- upper_type(input, v2p),max_(ntg_max_val(T)) {}
+ upper_type(input, v2p),max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const CPT&
- at(const T& i) const
+ const cpt_type&
+ at(const value_type& i) const
{
return img_[v2p_(i)];
}
/// operator[] should be called.
- CPT&
- at(const T& i)
+ cpt_type&
+ at(const value_type& i)
{
adjust(i);
return img_[v2p_(i)];
}
/// Quick function max.
- T
+ value_type
max()
{
- for (; max_ > 0; --max_)
- if (img_[v2p_(max_)] > ntg_zero_val(CPT))
+ for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_))
+ if (img_[v2p_(max_)] > ntg_zero_val(cpt_type))
break;
return max_;
}
/// Return the max.
- T
+ value_type
res()
{
return max();
}
protected:
- T max_; ///< Index of the worst max element.
+
+ /// Maintain the worst max.
+ void
+ adjust(const value_type& idx)
+ {
+ if (idx > max_)
+ max_ = idx;
+ }
+ value_type max_; ///< Index of the worst max element.
};
/// Minimum non-zero value of an histogram.
@@ -563,7 +678,8 @@
{
typedef oln_value_type(I) val;
- typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type
ensure_type;
+ typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type
+ ensure_type;
// check the size
precondition(v.size() == im.npoints());
@@ -575,7 +691,8 @@
// with the histogram we can know the number of each color and
// then calculate an array of pointer for quick access to each
// value of the image
- const ntg_cumul_type(val) card = ntg_max_val(val) -
ntg_min_val(val) + 1;
+ const ntg_cumul_type(val) card = ntg_max_val(val)
+ - ntg_min_val(val) + 1;
std::vector<oln_point_type(I)* > ptr(card);
ptr[0] = &(v[0]);
for (ntg_cumul_type(val) i = 1; i < card; ++i)
@@ -588,7 +705,8 @@
*(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
}
- /*! Inverted sort of the values of an image, and store the result
in a vector
+ /*! Inverted sort of the values of an image, and store the result
+ ** in a vector
**
** This sort is efficient.
** \arg im Image non_vectorial.
@@ -603,13 +721,15 @@
{
typedef oln_value_type(I) val;
- typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type
ensure_type;
+ typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type
+ ensure_type;
precondition(v.size() == im.npoints());
utils::histogram<val> histo(im);
- const ntg_cumul_type(val) card = ntg_max_val(val) -
ntg_min_val(val) + 1;
+ const ntg_cumul_type(val) card = ntg_max_val(val)
+ - ntg_min_val(val) + 1;
std::vector<oln_point_type(I)* > ptr(card);
ptr[card - 1] = &(v[0]);
Index: olena/tests/morpho/tests/edoc
--- olena/tests/morpho/tests/edoc Sun, 03 Aug 2003 19:36:17 +0200
burrus_n (oln/f/13_edoc.cc 1.4.1.5 640)
+++ olena/tests/morpho/tests/edoc Thu, 18 Mar 2004 16:34:08 +0100
van-vl_n (oln/f/13_edoc.cc 1.4.1.5 640)
@@ -10,6 +10,8 @@
#include <oln/morpho/dilation.hh>
#include <oln/morpho/opening.hh>
#include <oln/morpho/closing.hh>
+#include <oln/morpho/hit_or_miss.hh>
+#include <oln/morpho/top_hat.hh>
#include <oln/level/compare.hh>
@@ -27,13 +29,12 @@
fail = true; \
}
+template <class I>
bool
-check()
+check_bin_or_int_u8(const oln::image2d<I> &lena)
{
bool fail = false;
- image2d<int_u8> lena(rdata("lena128.pgm"));
-
std::cout << "erosion ... " << std::flush;
if (level::is_equal(morpho::erosion(lena, win_c4p()),
morpho::fast::erosion(lena, win_c4p())))
@@ -52,5 +53,53 @@
morpho::fast::closing(lena, win_c4p())))
OK_OR_FAIL;
+ std::cout << "closing ... " << std::flush;
+ if (level::is_equal(morpho::closing(lena, win_c4p()),
+ morpho::fast::closing(lena, win_c4p())))
+ OK_OR_FAIL;
+
+ //FIXME: value are only tested indirectly (this function is tested by
+ // fast::erosion and fast::dilatation).
+ oln::morpho::fast_morpho<oln::image2d<I>, oln::window2d,
oln::utils::histogram_min<I> >
+ (lena, oln::win_c4p());
+
+ oln::window2d mywin;
+ mywin
+ .add(-3,-2).add(-3,-1).add(-3,0).add(-3,1).add(-3,2)
+ .add(-2,-1).add(-2,0).add(-2,1)
+ .add(-1,0);
+ oln::window2d mywin2 = - mywin;
+
+ std::cout << "hit_or_miss ... " << std::flush;
+ if
(level::is_equal(morpho::hit_or_miss(oln::convert::bound<ntg::int_u8>(),
+ lena, mywin, mywin2),
+ morpho::fast::hit_or_miss(oln::convert::bound<ntg::int_u8>(),
+ lena, mywin, mywin2)))
+ OK_OR_FAIL;
+
+ return fail;
+}
+
+bool
+check()
+{
+ bool fail = false;
+
+ image2d<int_u8> lena(rdata("lena128.pgm"));
+ std::cout << "int_u8..." << std::flush;
+
+ if (!check_bin_or_int_u8(lena))
+ OK_OR_FAIL;
+
+ std::cout << "top hat contrast ... " << std::flush;
+ if (level::is_equal(morpho::top_hat_contrast_op(lena, win_c4p()),
+ morpho::fast::top_hat_contrast_op(lena, win_c4p())))
+ OK_OR_FAIL;
+
+ image2d<bin> obj(rdata("object.pbm"));
+ std::cout << "bin..." << std::flush;
+ if (!check_bin_or_int_u8(obj))
+ OK_OR_FAIL;
+
return fail;
}
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Sat, 13 Mar 2004 17:45:05 +0100
van-vl_n (oln/j/43_value_to_p 1.3 644)
+++ olena/oln/convert/value_to_point.hh Mon, 15 Mar 2004 18:44:05 +0100
van-vl_n (oln/j/43_value_to_p 1.3 644)
@@ -64,12 +64,36 @@
typedef point1d result_type;
typedef Argument_type argument_type;
- template <class input_type>
+ /// This class has bee made because of the lake of operator-- in
ntg::bin
+ template <typename O, typename I>
+ struct doit_binary
+ {
+ static
+ O
+ doit(const I &input)
+ {
+ return input ? O(1) : O(0);
+ }
+ };
+ /// This class has bee made because of the lake of operator-- in
ntg::bin
+ template <typename O, typename I>
+ struct doit_not_binary
+ {
+ static
+ O
+ doit(const I &input)
+ {
+ return O(input - ntg_min_val(I));
+ }
+ };
+
result_type
- doit(const input_type &input) const
+ doit(const argument_type &input) const
{
- result_type r(input - ntg_min_val(input_type));
- return r;
+ typedef typename mlc::if_<ntg_is_a(argument_type, ntg::binary)::ret,
+ doit_binary<result_type, argument_type>,
+ doit_not_binary<result_type, argument_type> >::ret doit_type;
+ return doit_type::doit(input);
}
};
@@ -92,11 +116,11 @@
typedef typename ntg::color<3, Qbits, S> argument_type;
result_type
- operator()(const argument_type &input) const
+ doit(const argument_type &input) const
{
result_type r;
for (unsigned i = 0; i < 3; ++i)
- r.nth(i) = input[i];
+ r.nth(i) = oln::coord(input[i]);
return r;
}
};
Index: olena/oln/morpho/attribute_closing_opening_map.hh
--- olena/oln/morpho/attribute_closing_opening_map.hh Mon, 15 Mar 2004
17:40:54 +0100 van-vl_n (oln/j/49_attribute_ 1.8 600)
+++ olena/oln/morpho/attribute_closing_opening_map.hh Thu, 18 Mar 2004
17:24:51 +0100 van-vl_n (oln/j/49_attribute_ 1.8 600)
@@ -255,15 +255,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::card_closing(im1,
oln::neighb_c4(), 200);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_card_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_card_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_card_closing.png
- ** \image latex oln_morpho_fast_card_closing.png
+ ** \image html oln_morpho_slow_card_closing.png
+ ** \image latex oln_morpho_slow_card_closing.png
**
*/
xxx_closing_map_decl(card);
@@ -282,15 +281,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::card_opening(im1,
oln::neighb_c4(), 200);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_card_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_card_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_card_opening.png
- ** \image latex oln_morpho_fast_card_opening.png
+ ** \image html oln_morpho_slow_card_opening.png
+ ** \image latex oln_morpho_slow_card_opening.png
**
*/
xxx_opening_map_decl(card);
@@ -309,15 +307,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::integral_closing(im1,
oln::neighb_c4(), 200);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_integral_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_integral_closing.png
- ** \image latex oln_morpho_fast_integral_closing.png
+ ** \image html oln_morpho_slow_integral_closing.png
+ ** \image latex oln_morpho_slow_integral_closing.png
**
*/
xxx_closing_map_decl(integral);
@@ -336,15 +333,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::integral_opening(im1,
oln::neighb_c4(), 200);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_integral_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_integral_opening.png
- ** \image latex oln_morpho_fast_integral_opening.png
+ ** \image html oln_morpho_slow_integral_opening.png
+ ** \image latex oln_morpho_slow_integral_opening.png
**
*/
xxx_opening_map_decl(integral);
@@ -363,15 +359,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::height_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_height_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_height_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_height_opening.png
- ** \image latex oln_morpho_fast_height_opening.png
+ ** \image html oln_morpho_slow_height_opening.png
+ ** \image latex oln_morpho_slow_height_opening.png
**
*/
xxx_opening_map_decl(height);
@@ -391,15 +386,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::height_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_height_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_height_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_height_closing.png
- ** \image latex oln_morpho_fast_height_closing.png
+ ** \image html oln_morpho_slow_height_closing.png
+ ** \image latex oln_morpho_slow_height_closing.png
**
*/
xxx_closing_map_decl(height);
@@ -420,15 +414,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::maxvalue_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_maxvalue_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_maxvalue_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_maxvalue_closing.png
- ** \image latex oln_morpho_fast_maxvalue_closing.png
+ ** \image html oln_morpho_slow_maxvalue_closing.png
+ ** \image latex oln_morpho_slow_maxvalue_closing.png
**
*/
xxx_closing_map_decl(maxvalue);
@@ -448,15 +441,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::maxvalue_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_maxvalue_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_maxvalue_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_maxvalue_opening.png
- ** \image latex oln_morpho_fast_maxvalue_opening.png
+ ** \image html oln_morpho_slow_maxvalue_opening.png
+ ** \image latex oln_morpho_slow_maxvalue_opening.png
**
*/
xxx_opening_map_decl(maxvalue);
@@ -476,15 +468,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::minvalue_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_minvalue_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_minvalue_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_minvalue_opening.png
- ** \image latex oln_morpho_fast_minvalue_opening.png
+ ** \image html oln_morpho_slow_minvalue_opening.png
+ ** \image latex oln_morpho_slow_minvalue_opening.png
**
*/
xxx_opening_map_decl(minvalue);
@@ -504,15 +495,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::minvalue_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_minvalue_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_minvalue_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_minvalue_closing.png
- ** \image latex oln_morpho_fast_minvalue_closing.png
+ ** \image html oln_morpho_slow_minvalue_closing.png
+ ** \image latex oln_morpho_slow_minvalue_closing.png
**
*/
xxx_closing_map_decl(minvalue);
@@ -532,15 +522,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::ball_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_ball_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_ball_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_ball_opening.png
- ** \image latex oln_morpho_fast_ball_opening.png
+ ** \image html oln_morpho_slow_ball_opening.png
+ ** \image latex oln_morpho_slow_ball_opening.png
**
*/
xxx_opening_im_map_decl(ball);
@@ -560,15 +549,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::ball_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_ball_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_ball_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_ball_closing.png
- ** \image latex oln_morpho_fast_ball_closing.png
+ ** \image html oln_morpho_slow_ball_closing.png
+ ** \image latex oln_morpho_slow_ball_closing.png
**
*/
xxx_closing_im_map_decl(ball);
@@ -588,15 +576,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::dist_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_dist_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_dist_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_dist_opening.png
- ** \image latex oln_morpho_fast_dist_opening.png
+ ** \image html oln_morpho_slow_dist_opening.png
+ ** \image latex oln_morpho_slow_dist_opening.png
**
*/
xxx_opening_im_map_decl(dist);
@@ -616,15 +603,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::dist_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_dist_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_dist_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_dist_closing.png
- ** \image latex oln_morpho_fast_dist_closing.png
+ ** \image html oln_morpho_slow_dist_closing.png
+ ** \image latex oln_morpho_slow_dist_closing.png
**
*/
xxx_closing_im_map_decl(dist);
@@ -644,15 +630,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::cube_closing(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_cube_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_cube_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_cube_closing.png
- ** \image latex oln_morpho_fast_cube_closing.png
+ ** \image html oln_morpho_slow_cube_closing.png
+ ** \image latex oln_morpho_slow_cube_closing.png
**
*/
xxx_closing_im_map_decl(cube);
@@ -672,15 +657,14 @@
**
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::cube_opening(im1,
oln::neighb_c4(), 5);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_cube_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_cube_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_cube_opening.png
- ** \image latex oln_morpho_fast_cube_opening.png
+ ** \image html oln_morpho_slow_cube_opening.png
+ ** \image latex oln_morpho_slow_cube_opening.png
**
*/
xxx_opening_im_map_decl(cube);
@@ -701,15 +685,14 @@
** lambda[0] = lambda[1] = 50;
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::box_closing(im1, oln::neighb_c4(),
lambda);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_box_closing.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_box_closing.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_box_closing.png
- ** \image latex oln_morpho_fast_box_closing.png
+ ** \image html oln_morpho_slow_box_closing.png
+ ** \image latex oln_morpho_slow_box_closing.png
**
*/
xxx_closing_im_map_decl(box);
@@ -730,15 +713,14 @@
** lambda[0] = lambda[1] = 50;
** im_type im1(oln::load(IMG_IN "lena128.pgm"));
** im1 = oln::morpho::slow::box_opening(im1, oln::neighb_c4(),
lambda);
- ** oln::save(im1, IMG_OUT "oln_morpho_fast_box_opening.ppm");
- ** return 0;
+ ** oln::save(im1, IMG_OUT "oln_morpho_slow_box_opening.ppm");
** }
** \endcode
** \image html lena128_pgm.png
** \image latex lena128_pgm.png
** =>
- ** \image html oln_morpho_fast_box_opening.png
- ** \image latex oln_morpho_fast_box_opening.png
+ ** \image html oln_morpho_slow_box_opening.png
+ ** \image latex oln_morpho_slow_box_opening.png
**
*/
xxx_opening_im_map_decl(box);
2
1
La section de Tiger pour la documentation a du sens pour Vaucanson et
Olena.
http://www.lrde.epita.fr/~akim/compil/assignments.html#Documentation-Style
2004-03-18 Akim Demaille <akim(a)epita.fr>
* assignments.texi (T3 Goals): More.
(T5 Goals): Traits are now part of...
(T3 Goals): these.
(Documentation Style): More about useless words/comments.
--- /home/akim/www/compil/assignments.txt 2004-03-17 10:39:27.000000000 +0100
+++ assignments.txt 2004-03-18 11:44:38.000000000 +0100
@@ -5,7 +5,7 @@
The Tiger Compiler Project
**************************
- This document, last edited on March 17, 2004, details the various tasks
+ This document, last edited on March 18, 2004, details the various tasks
the "Compilation" students must complete. It is available under various
forms:
- Assignments in a single HTML file(1).
@@ -1617,10 +1617,51 @@
End comments with a period.
+ -- Rule: Be concise
For documentation as for any other kind of writing, the shorter, the
better: hunt useless words. *Note The Elements of Style::, for an
excellent set of writing guidelines.
+ Here are a few samples of things to avoid:
+ Documenting the definition instead of the object of the definition
+ Don't write:
+
+ /// Declaration of the Foo class.
+ class Foo
+ {
+ ...
+ };
+
+ Of course you're documentation the definition of the entities!
+ "Declaration of the" is totally useless, just use `/// Foo
+ class'. But read bellow.
+
+ Don't qualify obvious entity kinds.
+ Don't write:
+
+ /// Foo class.
+ class Foo
+ {
+ public:
+ /// Construct a Foo object.
+ Foo (Bar &bar)
+ ...
+ };
+
+ It is so obvious that you're documentation the class and the
+ constructor that you should not write it down. Instead of
+ documenting the _kind_ of an entity (class, function, namespace,
+ destructor...), document its _goal_.
+
+ /// Wrapper around Bar objects.
+ class Foo
+ {
+ public:
+ /// Bind to \a bar.
+ Foo (Bar &bar)
+ ...
+ };
+
-- Rule: Use the Imperative
Use the imperative when documenting, as if you were giving order to the
function or entity you are describing. When describing a function,
1
0