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: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* config/oln.m4: Fix.
+2004-04-13 Damien Thivolle <damien(a)lrde.epita.fr>
+
* configure.ac: Check for doxygen version.
* config/oln.m4: Add macro to check for doxygen version.
Index: tools/swilena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* swilena/expand.sh: Add `DOC_CPPFLAGS' to the compilation flags.
+2004-04-13 Damien Thivolle <damien(a)lrde.epita.fr>
+
* tools/swilena/ruby/Makefile.am: Remove `ruby_DATA' variable.
2004-04-12 Niels Van Vliet <niels(a)lrde.epita.fr>
Index: config/oln.m4
--- config/oln.m4 Tue, 13 Apr 2004 17:38:53 +0200 thivol_d (oln/j/15_oln.m4 1.38.1.3 600)
+++ config/oln.m4 Tue, 13 Apr 2004 17:48:16 +0200 thivol_d (oln/j/15_oln.m4 1.38.1.3 600)
@@ -393,6 +393,7 @@
DOC_CPPFLAGS="$DOC_CPPFLAGS -DNEED_$2"
elif test "x$[]oln_cv_$1_flags" = xisodef; then
CPPFLAGS="$CPPFLAGS -D_ISOC99_SOURCE=1"
+ DOC_CPPFLAGS="$DOC_CPPFLAGS -D_ISOC99_SOURCE=1"
fi
AC_LANG_POP([C++])
])
Index: tools/swilena/expand.sh
--- tools/swilena/expand.sh Mon, 12 Apr 2004 19:37:26 +0200 thivol_d (oln/s/25_expand.sh 1.15 700)
+++ tools/swilena/expand.sh Tue, 13 Apr 2004 19:47:34 +0200 thivol_d (oln/s/25_expand.sh 1.15 700)
@@ -78,7 +78,7 @@
INCLUDES = \$(PYTHON_CPPFLAGS) -I\$(srcdir)/../src
AM_CPPFLAGS = -DOLN_EXCEPTIONS
-AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE)
+AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE) \$(DOC_CPPFLAGS)
AM_LDFLAGS = -shared -lswigpy \$(ZLIB_LDFLAGS)
EOF
@@ -143,7 +143,7 @@
INCLUDES = \$(RUBY_CPPFLAGS) -I\$(srcdir)/../src
AM_CPPFLAGS = -DOLN_EXCEPTIONS
-AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE)
+AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE) \$(DOC_CPPFLAGS)
AM_LDFLAGS = -shared -lswigrb \$(ZLIB_LDFLAGS)
EOF
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
1
0
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* tests/convol/tests/nagao: Disable test.
+2004-04-13 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* tests/convol/tests/md5_convol_fast_gaussian_hh3: Correct the
test to make it success on mac.
Index: olena/tests/convol/tests/nagao
--- olena/tests/convol/tests/nagao Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n (oln/m/19_nagao 1.1 600)
+++ olena/tests/convol/tests/nagao Tue, 13 Apr 2004 15:12:13 +0200 palma_g (oln/m/19_nagao 1.1 600)
@@ -6,6 +6,10 @@
#include <oln/utils/md5.hh>
#include "data.hh"
#include "check.hh"
+
+// There is a problem with the way of testing this algorithm. Md5
+// will not return the same result since nagao result may differ a
+// little bit depending on the machine used (float).
int main()
{
bool fail (false);
@@ -27,7 +31,10 @@
fail = fail | (oln::utils::md5(ng) != oln::utils::key(data_key_g));
if (!fail)
+ {
std::cout << "OK" << std::endl;
+ return true; // XFAIL
+ }
else
{
std::cout << "FAIL" << std::endl;
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/core/abstract/image.hh: Fix macro oln_concrete_type.
* olena/tests/morpho/tests/gradient: New.
+2004-04-12 Niels Van Vliet <niels(a)lrde.epita.fr>
+
* olena/oln/morpho/laplacian.inc: Add a FIXME.
* olena/oln/morpho/watershed.hh: Add a FIXME.
Index: tools/swilena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* tools/swilena/generate_morpho_instantiations.py: Remove
maxima_killer minima_killer from swilena_morpho1d_* and
swilena_morpho3d_*.
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Sun, 04 Apr 2004 16:48:06 +0200
odou_s (oln/t/25_image.hh 1.30 600)
+++ olena/oln/core/abstract/image.hh Mon, 12 Apr 2004 12:19:23 +0200
van-vl_n (oln/t/25_image.hh 1.30 600)
@@ -341,7 +341,7 @@
mlc_exact_type_(ImgType)::value_type
# define oln_concrete_type(ImgType) \
-typename mute<ImgType>::ret
+typename oln::mute<ImgType>::ret
# define oln_exact_type(ImgType) \
mlc_exact_type(ImgType)
Index: tools/swilena/generate_morpho_instantiations.py
--- tools/swilena/generate_morpho_instantiations.py Mon, 12 Apr 2004
01:09:38 +0200 van-vl_n (oln/v/24_generate_m 1.7 700)
+++ tools/swilena/generate_morpho_instantiations.py Mon, 12 Apr 2004
11:32:41 +0200 van-vl_n (oln/v/24_generate_m 1.7 700)
@@ -146,6 +146,7 @@
instantiate(idx, "hybrid_regional_minima",
bin_img_type, img_type, neighb_type)
# Extrema killers
+ if dim == 2:
instantiate(idx, "fast_maxima_killer", img_type,
neighb_type)
instantiate(idx, "fast_minima_killer", img_type,
neighb_type)
# FIXME: This should work with other types.
Index: olena/tests/morpho/tests/gradient
--- olena/tests/morpho/tests/gradient Mon, 12 Apr 2004 12:55:46 +0200
van-vl_n ()
+++ olena/tests/morpho/tests/gradient Mon, 12 Apr 2004 12:55:35 +0200
van-vl_n (oln/r/1_gradient 644)
@@ -0,0 +1,39 @@
+// -*- c++ -*-
+
+#include <oln/basics2d.hh>
+#include <oln/morpho/gradient.hh>
+#include <oln/level/compare.hh>
+#include <ntg/all.hh>
+#include "check.hh"
+#include "data.hh"
+
+
+#define OK_OR_FAIL \
+ std::cout << "OK" << std::endl; \
+ else \
+ { \
+ std::cout << "FAIL" << std::endl; \
+ fail = true; \
+ }
+
+template<class I>
+bool are_not_eq(const oln::abstract::non_vectorial_image_with_dim<2, I>
&im)
+{
+ return
+ !oln::level::is_equal(oln::morpho::fast::beucher_gradient(im,
+ oln::win_c8p()),
+ oln::morpho::beucher_gradient(im, oln::win_c8p()));
+}
+
+
+bool
+check()
+{
+ bool fail = false;
+
+ oln::image2d<ntg::int_u8> im8(oln::load(rdata("lena256.pgm")));
+ if (are_not_eq(im8) == false)
+ OK_OR_FAIL;
+
+ return fail;
+}
1
1
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/morpho/laplacian.inc: Add a FIXME.
* olena/oln/morpho/watershed.hh: Add a FIXME.
Index: tools/swilena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* tools/swilena/generate_morpho_instantiations.py: Fix and add
some algorithms.
Index: olena/oln/morpho/laplacian.inc
--- olena/oln/morpho/laplacian.inc Fri, 02 Apr 2004 17:50:27 +0200
van-vl_n (oln/41_laplacian. 1.16 600)
+++ olena/oln/morpho/laplacian.inc Sun, 11 Apr 2004 23:50:47 +0200
van-vl_n (oln/41_laplacian. 1.16 600)
@@ -110,7 +110,10 @@
** \image latex lena256_pgm.png
** =>
** \image html oln_morpho_fast_laplacian_overload.png
-** \image latex oln_morpho_fast_laplacian_overload.png
+** \image latex oln_morpho_fast_laplacian_overload.pn
+**
+** \todo FIXME: Not instantiated in swilena (see
+** tools/swilena/generate_morpho_instantiations.py)
*/
template<class DestValue, class I, class E>
typename mute<I, DestValue>::ret
Index: olena/oln/morpho/watershed.hh
--- olena/oln/morpho/watershed.hh Fri, 02 Apr 2004 17:50:27 +0200
van-vl_n (oln/48_watershed. 1.14 600)
+++ olena/oln/morpho/watershed.hh Sun, 11 Apr 2004 23:48:41 +0200
van-vl_n (oln/48_watershed. 1.14 600)
@@ -216,6 +216,9 @@
** \arg D Input image.
** \arg M Image of labels.
** \arg Ng Neighborhood to consider.
+ **
+ ** \todo FIXME: Not instantiated in swilena (see
+ ** tools/swilena/generate_morpho_instantiations.py)
*/
template<class I1, class I2, class N>
oln_concrete_type(I2)&
Index: tools/swilena/generate_morpho_instantiations.py
--- tools/swilena/generate_morpho_instantiations.py Sun, 11 Apr 2004
22:22:47 +0200 van-vl_n (oln/v/24_generate_m 1.6 700)
+++ tools/swilena/generate_morpho_instantiations.py Mon, 12 Apr 2004
01:00:19 +0200 van-vl_n (oln/v/24_generate_m 1.6 700)
@@ -110,7 +110,7 @@
instantiate(idx, "hit_or_miss_closing_bg", img_type, img_type,
win_type, win_type)
instantiate(idx, "fast_hit_or_miss_closing_bg", img_type, img_type,
win_type, win_type)
- # FIXME: these algorithms do not work with float
neither binary types
+ # FIXME: This should work with other types.
if type != "ntg_bin":
instantiate(idx, "beucher_gradient", img_type,
img_type, win_type)
instantiate(idx, "fast_beucher_gradient",
img_type, img_type, win_type)
@@ -132,36 +132,31 @@
instantiate(idx, "top_hat_contrast_op", img_type,
img_type, win_type)
instantiate(idx, "fast_top_hat_contrast_op",
img_type, img_type, win_type)
-
- # FIXME: fix this when available
- #if type == "ntg_int_u8":
# Watershed
- #img_ret_type = "::oln::image%(dim)sd< ntg_int_u32 >" % vars()
- #instantiate(dim, "watershed_seg", img_ret_type, img_type, neighb_type)
- #instantiate(dim, "watershed_con", img_ret_type, img_type, neighb_type)
- #instantiate(dim, "watershed_seg_or", img_type, img_type,
img_ret_type, neighb_type)
-
- # FIXME: this is broken
- # instantiate(dim, "laplacian", img_type, img_type, win_type)
- # instantiate(dim, "fast_laplacian", img_type, img_type, win_type)
-
- # FIXME: this is broken
- # bin_img_type = "::oln::image%(dim)sd< ntg_bin >" % vars()
- # instantiate(dim, "sure_minima_imposition", img_type, img_type,
bin_img_type, neighb_type)
- # instantiate(dim, "sequential_minima_imposition", img_type,
img_type, bin_img_type, neighb_type)
- # instantiate(dim, "hybrid_minima_imposition", img_type, img_type,
bin_img_type, neighb_type)
-
- # FIXME: this is broken
- # instantiate(dim, "sure_regional_minima", bin_img_type, img_type,
neighb_type)
- # instantiate(dim, "sequential_regional_minima", bin_img_type,
img_type, neighb_type)
- # instantiate(dim, "hybrid_regional_minima", bin_img_type,
img_type, neighb_type)
+ img_ret_type = "::oln::image%(dim)sd< ntg_int_u32
>" % vars()
+ instantiate(idx, "watershed_seg", img_ret_type,
img_type, neighb_type)
+ instantiate(idx, "watershed_con", img_ret_type,
img_type, neighb_type)
+ bin_img_type = "::oln::image%(dim)sd< ntg_bin >" %
vars()
+ instantiate(idx, "sure_minima_imposition",
img_type, img_type, bin_img_type, neighb_type)
+ instantiate(idx, "sequential_minima_imposition",
img_type, img_type, bin_img_type, neighb_type)
+ instantiate(idx, "hybrid_minima_imposition",
img_type, img_type, bin_img_type, neighb_type)
+
+ instantiate(idx, "sure_regional_minima",
bin_img_type, img_type, neighb_type)
+ instantiate(idx, "sequential_regional_minima",
bin_img_type, img_type, neighb_type)
+ instantiate(idx, "hybrid_regional_minima",
bin_img_type, img_type, neighb_type)
# Extrema killers
- # FIXME: extrema killers work only with ntg::int_u8 data type
- # instantiate(dim, "sure_maxima_killer", img_type, neighb_type)
- # instantiate(dim, "fast_maxima_killer", img_type, neighb_type)
- # instantiate(dim, "sure_minima_killer", img_type, neighb_type)
- # instantiate(dim, "fast_minima_killer", img_type, neighb_type)
+ instantiate(idx, "fast_maxima_killer", img_type,
neighb_type)
+ instantiate(idx, "fast_minima_killer", img_type,
neighb_type)
+ # FIXME: This should work with other types.
+ if type == "ntg_int_u8":
+ instantiate(idx, "sure_maxima_killer",
img_type, neighb_type)
+ instantiate(idx, "sure_minima_killer",
img_type, neighb_type)
+
+ #FIXME: Does not work due to the return type:
+ #instantiate(idx, "watershed_seg_or", img_type,
img_type, img_ret_type, neighb_type)
+ #instantiate(idx, "laplacian", img_type, img_type,
win_type)
+ #instantiate(idx, "fast_laplacian", img_type, img_type, win_type)
def main():
if len(sys.argv) != 2:
1
0
Index: doc/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* ref/out/exdoc.config.in: Add include directory.
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Sat, 03 Apr 2004 23:17:34 +0200 thivol_d (oln/k/7_exdoc.conf 1.4 600)
+++ doc/ref/out/exdoc.config.in Fri, 09 Apr 2004 10:54:55 +0200 palma_g (oln/k/7_exdoc.conf 1.4 600)
@@ -4,7 +4,7 @@
TAG_CLOSE = endcode
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
- OPTIONS = @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
1
Je sais, j'ai fait des trucs super moches, mais bon c'est provisoire,
des que j'aurai maitrise les autotools, je corrigerai tout ca :)
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* config/oln.m4: Fix compiler detection.
Index: doc/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* doc/ref/Makefile.am: Add `CLEANFILES' variable to delete all the
created files.
+2004-04-03 Damien Thivolle <damien(a)lrde.epita.fr>
+
* doc/ref/out/exdoc.config.in: Remove -DNEED_ROUND -DNEED_ROUNDF flags.
2004-04-03 Damien Thivolle <damien(a)lrde.epita.fr>
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/Makefile.am: Add forgotten files to the distribution.
Index: doc/ref/Makefile.am
--- doc/ref/Makefile.am Sat, 03 Apr 2004 23:02:21 +0200 thivol_d (oln/d/51_Makefile.a 1.27.1.16 600)
+++ doc/ref/Makefile.am Wed, 07 Apr 2004 11:39:33 +0200 thivol_d (oln/d/51_Makefile.a 1.27.1.17 600)
@@ -7,7 +7,14 @@
EXDOC = $(srcdir)/exdoc.pl
OUT_DIR = "out"
IMG_CONV = $(srcdir)/img_conv.pl
-
+CLEANFILES = -r -- html.tar.gz \
+ oln-ref.pdf \
+ ./$(OUT_DIR)/out* \
+ ./html \
+ ./latex \
+ ./img \
+ ./$(OUT_DIR)/makefile \
+ ./$(OUT_DIR)/all.mk
doc: html.tar.gz oln-ref.pdf
@@ -30,7 +37,7 @@
dist_noinst_DATA = oln-ref.pdf html.tar.gz $(srcdir)/exdoc.pl $(srcdir)/img_conv.pl
dist-local:
- rm -rf img/* out/*
+ rm -rf img/*
MAINTAINERCLEANFILES = $(dist_noinst_DATA) \
./html/* ./img/* ./$(OUT_DIR)/*
Index: config/oln.m4
--- config/oln.m4 Sat, 03 Apr 2004 23:02:21 +0200 thivol_d (oln/j/15_oln.m4 1.37 600)
+++ config/oln.m4 Sun, 04 Apr 2004 22:36:14 +0200 thivol_d (oln/j/15_oln.m4 1.38 600)
@@ -435,7 +435,7 @@
[ac_cv_cxx_style],
[ac_cv_cxx_style=unknown
if test "x$ac_compiler_gnu" != xno; then
- if $CXX --version | grep ' 3\.[34]' >/dev/null ; then
+ if $CXX --version | grep " 3\.\(3\|4\)" >/dev/null ; then
ac_cv_cxx_style=GNU
else
ac_cv_cxx_style=weakGNU
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Sun, 04 Apr 2004 16:48:06 +0200 odou_s (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.6 600)
+++ olena/oln/Makefile.am Sun, 04 Apr 2004 18:34:45 +0200 thivol_d (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.7 600)
@@ -38,6 +38,8 @@
convol/fast_gaussian.hh \
convol/fast_gaussian.hxx \
convol/fast_gaussian_coefficient.hh \
+ convol/nagao.hh \
+ convol/nagao.hxx \
core/abstract/binary_image.hh \
core/abstract/behavior.hh \
core/abstract/dpoint.hh \
@@ -221,6 +223,8 @@
utils/buffer.hh \
utils/buffer.hxx \
utils/histogram.hh \
+ utils/se_stat.hh \
+ utils/se_stat.hxx \
utils/stat.hh \
utils/special_points.hh \
utils/timer.hh
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
2
2
Pour que ca compile correctement, j'ai fait quelques modifs que je ne trouve
pas du tout elegante, si quelqu'un a mieux a proposer, je suis preneur.
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* config/oln.m4: Remove `-Werror' flag for g++-3.2.
Index: doc/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* doc/ref/Makefile.am: Replace `make' by $(MAKE).
* doc/ref/out/exdoc.config.in: Add -DNEED_ROUND -DNEED_ROUNDF flags
to examples compilation.
+2004-04-03 Damien Thivolle <damien(a)lrde.epita.fr>
+
* ref/Makefile.am: Correct install-data-hook rule.
2004-03-25 Giovanni Palma <giovanni(a)lrde.epita.fr>
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/Makefile.am: Add files.
* olena/oln/morpher/generic_morpher.hh: Repair unmorph().
* olena/oln/morpher/color_morpher.hh: Correct comments.
* olena/tests/morpher/tests/color_morph: Readd a test.
+2004-04-03 Damien Thivolle <damien(a)lrde.epita.fr>
+
* olena/oln/morpher/generic_morpher.hh: Inherit directly from oln::image.
* olena/oln/morpher/subq_morpher.hh: Change inheritance system.
* olena/oln/morpher/color_morpher.hh: Likewise.
Index: doc/ref/Makefile.am
--- doc/ref/Makefile.am Sat, 03 Apr 2004 14:42:26 +0200 thivol_d (oln/d/51_Makefile.a 1.27.1.15 600)
+++ doc/ref/Makefile.am Sat, 03 Apr 2004 22:55:16 +0200 thivol_d (oln/d/51_Makefile.a 1.27.1.15 600)
@@ -15,7 +15,7 @@
doxy:
$(EXDOC) --config=$(OUT_DIR)/exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir)
mkdir -p img
- cd $(OUT_DIR) && make -f makefile
+ cd $(OUT_DIR) && $(MAKE) -f makefile
$(IMG_CONV) $(top_srcdir)/olena/img img preserve
$(IMG_CONV) img img nopreserve
$(DOXYGEN) doxygen.config
@@ -30,7 +30,7 @@
dist_noinst_DATA = oln-ref.pdf html.tar.gz $(srcdir)/exdoc.pl $(srcdir)/img_conv.pl
dist-local:
- rm -f img/*
+ rm -rf img/* out/*
MAINTAINERCLEANFILES = $(dist_noinst_DATA) \
./html/* ./img/* ./$(OUT_DIR)/*
Index: config/oln.m4
--- config/oln.m4 Fri, 08 Aug 2003 13:24:29 +0200 burrus_n (oln/j/15_oln.m4 1.36 600)
+++ config/oln.m4 Sat, 03 Apr 2004 22:53:47 +0200 thivol_d (oln/j/15_oln.m4 1.36 600)
@@ -435,10 +435,10 @@
[ac_cv_cxx_style],
[ac_cv_cxx_style=unknown
if test "x$ac_compiler_gnu" != xno; then
- if $CXX --version | grep '^2\.' >/dev/null ; then
- ac_cv_cxx_style=weakGNU
- else
+ if $CXX --version | grep ' 3\.[34]' >/dev/null ; then
ac_cv_cxx_style=GNU
+ else
+ ac_cv_cxx_style=weakGNU
fi
elif $CXX -V 2>&1 | grep -i "WorkShop">/dev/null 2>&1; then
ac_cv_cxx_style=Sun
@@ -468,7 +468,7 @@
_CXXFLAGS_DEBUG="-g"
_CXXFLAGS_OPTIMIZE="-O2 -felide-constructors -funroll-loops"
_CXXFLAGS_STRICT="-Wall -pedantic"
- _CXXFLAGS_STRICT_ERRORS="-Wall -pedantic -Werror"
+ _CXXFLAGS_STRICT_ERRORS="-Wall -pedantic"
;;
Sun)
_CXXFLAGS_DEBUG="-g"
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Tue, 30 Mar 2004 22:10:11 +0200 thivol_d (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.4 600)
+++ olena/oln/Makefile.am Sat, 03 Apr 2004 22:42:17 +0200 thivol_d (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.4 600)
@@ -157,6 +157,7 @@
morpho/closing.hh \
morpho/closing.inc \
morpho/dilation.hh \
+ morpho/environments.hh \
morpho/erosion.hh \
morpho/extrema.hh \
morpho/extrema.hxx \
@@ -203,6 +204,8 @@
topo/inter-pixel/internal/dir-iter.hh \
topo/inter-pixel/internal/dir.hh \
topo/tarjan/flat-zone.hh \
+ topo/tarjan/tarjan.hh \
+ topo/tarjan/tarjan_with_attr.hh \
topo/tarjan/union.hh \
transforms/fft.hh \
transforms/dwt.hh \
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Wed, 10 Mar 2004 16:20:23 +0100 palma_g (oln/k/7_exdoc.conf 1.2 600)
+++ doc/ref/out/exdoc.config.in Sat, 03 Apr 2004 22:55:44 +0200 thivol_d (oln/k/7_exdoc.conf 1.2 600)
@@ -4,7 +4,7 @@
TAG_CLOSE = endcode
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
- OPTIONS = @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = -DNEED_ROUND -DNEED_ROUNDF @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
Index: olena/oln/morpher/generic_morpher.hh
--- olena/oln/morpher/generic_morpher.hh Sat, 03 Apr 2004 14:42:26 +0200 thivol_d (oln/m/18_generic_mo 1.5 600)
+++ olena/oln/morpher/generic_morpher.hh Sat, 03 Apr 2004 22:44:20 +0200 thivol_d (oln/m/18_generic_mo 1.5 600)
@@ -65,6 +65,32 @@
namespace abstract {
+ template <unsigned Dim, class T>
+ struct dest_type;
+
+ template <class T>
+ struct dest_type<1, T>
+ {
+ typedef image1d<T> ret;
+ };
+
+
+ template <class T>
+ struct dest_type<2, T>
+ {
+ typedef image2d<T> ret;
+ };
+
+
+ template <class T>
+ struct dest_type<3, T>
+ {
+ typedef image3d<T> ret;
+ };
+
+
+
+
/*! The Abstract morpher class.
**
** Define a default implementation for all the
@@ -80,7 +106,7 @@
template <class SrcType, class Exact>
class generic_morpher :
public oln::abstract::image_with_impl<typename image_id<Exact>::impl_type,
- typename image_id<Exact>::exact_type>
+ Exact>
{
protected:
@@ -119,10 +145,7 @@
/// The morpher underlying implementation.
typedef typename image_traits<exact_type>::impl_type impl_type;
- typedef oln::image<image_traits<exact_type>::dim,
- value_type,
- impl_type,
- mlc::final> DestType;
+ typedef typename dest_type<image_traits<exact_type>::dim, value_type>::ret DestType;
/// Type of the decorated image.
typedef SrcType src_self_type;
@@ -159,6 +182,19 @@
return ima_;
}
+ /// Instantiate and return the image that the morpher is simulating.
+ DestType
+ unmorph() const
+ {
+ DestType res(to_exact(*this).size());
+ oln_iter_type(DestType) it(res);
+
+ for_all(it)
+ res[it] = (*this)[it];
+ return res;
+ }
+
+
/*! Default implementation of at.
**
** Return the value stored at \a p in the decorated image.
@@ -169,7 +205,7 @@
const src_value_type
at(const src_point_type& p) const
{
- return to_exact(ima_).at(p);
+ return ima_[p];
}
/*! Default implementation of at.
@@ -182,31 +218,31 @@
src_value_type&
at(const src_point_type& p)
{
- return to_exact(ima_).at(p);
+ return ima_[p];
}
/// Default implementation of impl.
const src_impl_type*
impl() const
{
- return to_exact(ima_).impl();
+ return ima_.impl();
}
/// Default implementation of impl.
src_impl_type*
impl()
{
- return to_exact(ima_).impl();
+ return ima_.impl();
}
/*! Default implementation of clone_.
**
** Return a copy of the decorated image.
*/
- src_self_type
+ src_exact_type
clone_() const
{
- return to_exact(ima_).clone_();
+ return to_exact(ima_).clone();
}
/*! Default implementation of npoints_.
@@ -216,7 +252,7 @@
size_t
npoints_()
{
- return to_exact(ima_).npoints_();
+ return to_exact(ima_).npoints();
}
/*! Default implementation of assign.
Index: olena/oln/morpher/color_morpher.hh
--- olena/oln/morpher/color_morpher.hh Sat, 03 Apr 2004 14:42:26 +0200 thivol_d (oln/m/26_color_morp 1.3 600)
+++ olena/oln/morpher/color_morpher.hh Sat, 03 Apr 2004 19:25:42 +0200 thivol_d (oln/m/26_color_morp 1.3 600)
@@ -72,7 +72,7 @@
/*! \brief Specialized version for color_morpher.
**
- ** \param I The type of the decorated image.
+ ** \param SrcType The type of the decorated image.
**
** \param Exact The exact type of the object.
*/
@@ -89,8 +89,6 @@
/*! \brief Abstract color_morpher class used for
** code factorization.
**
- ** \param DestType Output type of the morpher.
- **
** \param SrcType Input type decorated.
**
** \param Exact Exact type
Index: olena/tests/morpher/tests/color_morph
--- olena/tests/morpher/tests/color_morph Sat, 03 Apr 2004 14:42:26 +0200 thivol_d (oln/m/45_color_morp 1.2 600)
+++ olena/tests/morpher/tests/color_morph Sat, 03 Apr 2004 22:39:14 +0200 thivol_d (oln/m/45_color_morp 1.2 600)
@@ -37,8 +37,7 @@
fail = fail | (oln::utils::md5(oln::morpher::bmorph(imc)) != oln::utils::key(data_key_c_b));
fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc_const)) != oln::utils::key(data_key_c_r));
fail = fail | (oln::utils::md5(mimd) != oln::utils::md5(mimc));
-// remove comments when it works ...
-// fail = fail | (oln::utils::md5(*(oln::morpher::rmorph(imc).unmorph())) != oln::utils::key(data_key_c_r));
+ fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc).unmorph()) != oln::utils::key(data_key_c_r));
if (!fail)
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
2
Désolé pour ce mini checkin, mais je ne sais pas trop comment résoudre ce
problème. Si la machine est équipée des fonctions round() et roundf(),
alors `-DNEED_ROUND'et `-DNEED_ROUNDF' posent problème car les 2 fonctions
sont définies 2 fois; si la machine n'est pas équipée des fonctions
round() et roundf(), alors si `-DNEED_ROUNDF' et `-DNEED_ROUND' ne sont pas
présentes, ca ne compile pas non plus.
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Sat, 03 Apr 2004 23:02:21 +0200 thivol_d (oln/k/7_exdoc.conf 1.3 600)
+++ doc/ref/out/exdoc.config.in Sat, 03 Apr 2004 23:15:51 +0200 thivol_d (oln/k/7_exdoc.conf 1.3 600)
@@ -4,7 +4,7 @@
TAG_CLOSE = endcode
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
- OPTIONS = -DNEED_ROUND -DNEED_ROUNDF @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
4
3
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/core/image1d.hh: Add informations to image_id.
* oln/core/image2d.hh: Likewise
* oln/core/image3d.hh: Likewise
* oln/core/impl/image_array1d.hh: Add empty constructor for
any_with_diamond.
* oln/core/impl/image_array.hh: Likewise.
* oln/core/impl/image_array2d.hh: Likewise.
* oln/core/impl/image_array3d.hh: Likewise.
* oln/core/impl/image_impl.hh: Likewise.
* oln/core/abstract/image_size.hh: Likewise.
* oln/core/image1d_size.hh: Likewise.
* oln/core/image2d_size.hh: Likewise.
* oln/core/image3d_size.hh: Likewise.
* tests/morpher/tests/piece: New.
* tests/morpher/tests/iter: New.
* tests/morpher/tests/slicing: New.
* oln/core/abstract/image.hh: Size() returns const inside of
const &.
* oln/morpher/piece_morpher.hh: Adapt to new version of generic
morpher.
Respect 80 columns.
* oln/morpher/slicing_morpher.hh: Likewise.
* oln/morpher/iter_morpher.hh: Likewise.
Better example for documentation.
* oln/Makefile.am: Add files.
* oln/morpher/generic_morpher.hh: Fix a bug.
Index: olena/oln/core/image1d.hh
--- olena/oln/core/image1d.hh Fri, 02 Apr 2004 16:00:03 +0200 van-vl_n (oln/c/47_image1d.hh 1.28.1.3 600)
+++ olena/oln/core/image1d.hh Sun, 04 Apr 2004 16:26:06 +0200 odou_s (oln/c/47_image1d.hh 1.28.1.4 600)
@@ -57,6 +57,8 @@
typedef T value_type;
typedef typename mlc::exact_vt<image1d<T, Exact>, Exact>::ret exact_type;
typedef impl::image_array1d<T> impl_type;
+ typedef point1d point_type;
+ typedef image1d_size size_type;
};
/*! \class image_traits<image1d<T, Exact> >
Index: olena/oln/core/image1d_size.hh
--- olena/oln/core/image1d_size.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/46_image1d_si 1.11 600)
+++ olena/oln/core/image1d_size.hh Sun, 04 Apr 2004 16:26:13 +0200 odou_s (oln/c/46_image1d_si 1.12 600)
@@ -70,6 +70,9 @@
border_ = border;
}
+ image1d_size()
+ {}
+
/// Return the number of columns in the image.
coord
Index: olena/oln/core/image2d.hh
--- olena/oln/core/image2d.hh Fri, 02 Apr 2004 16:00:03 +0200 van-vl_n (oln/c/45_image2d.hh 1.30.1.3 600)
+++ olena/oln/core/image2d.hh Sun, 04 Apr 2004 16:26:21 +0200 odou_s (oln/c/45_image2d.hh 1.30.1.4 600)
@@ -57,6 +57,8 @@
typedef T value_type;
typedef typename mlc::exact_vt<image2d<T, Exact>, Exact>::ret exact_type;
typedef impl::image_array2d<T> impl_type;
+ typedef point2d point_type;
+ typedef image2d_size size_type;
};
/*! \class image_traits<image2d<T, Exact> >
Index: olena/oln/core/image2d_size.hh
--- olena/oln/core/image2d_size.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/44_image2d_si 1.11 600)
+++ olena/oln/core/image2d_size.hh Sun, 04 Apr 2004 16:26:36 +0200 odou_s (oln/c/44_image2d_si 1.12 600)
@@ -74,6 +74,9 @@
border_ = border;
}
+ image2d_size()
+ {}
+
/// Return the number of rows in the image.
coord
Index: olena/oln/core/image3d.hh
--- olena/oln/core/image3d.hh Fri, 02 Apr 2004 16:00:03 +0200 van-vl_n (oln/c/43_image3d.hh 1.27.1.3 600)
+++ olena/oln/core/image3d.hh Sun, 04 Apr 2004 16:26:27 +0200 odou_s (oln/c/43_image3d.hh 1.27.1.4 600)
@@ -57,6 +57,8 @@
typedef T value_type;
typedef typename mlc::exact_vt<image3d<T, Exact>, Exact>::ret exact_type;
typedef impl::image_array3d<T> impl_type;
+ typedef point3d point_type;
+ typedef image3d_size size_type;
};
/*! \class image_traits<image3d<T, Exact> >
Index: olena/oln/core/image3d_size.hh
--- olena/oln/core/image3d_size.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/42_image3d_si 1.11 600)
+++ olena/oln/core/image3d_size.hh Sun, 04 Apr 2004 16:26:31 +0200 odou_s (oln/c/42_image3d_si 1.12 600)
@@ -80,6 +80,9 @@
border_ = border;
}
+ image3d_size()
+ {}
+
/// Return the number of slices in the image.
coord
Index: olena/oln/core/abstract/image_size.hh
--- olena/oln/core/abstract/image_size.hh Thu, 11 Mar 2004 17:12:19 +0100 thivol_d (oln/c/41_image_size 1.11 600)
+++ olena/oln/core/abstract/image_size.hh Sun, 04 Apr 2004 16:26:57 +0200 odou_s (oln/c/41_image_size 1.12 600)
@@ -158,12 +158,11 @@
Exact::name() + ">";
}
- protected:
-
-
image_size()
{}
+ protected:
+
/*! border_ represents the width of the image border
** such a mecanism allow algorithm to perform operation
** on the points at the edge of the image as if they were
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Sat, 03 Apr 2004 23:02:21 +0200 thivol_d (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.5 600)
+++ olena/oln/Makefile.am Sun, 04 Apr 2004 16:27:17 +0200 odou_s (oln/q/47_Makefile.a 1.3.1.1.1.6.1.7.1.6 600)
@@ -148,6 +148,9 @@
math/macros.hh \
morpher/color_morpher.hh \
morpher/generic_morpher.hh \
+ morpher/iter_morpher.hh \
+ morpher/piece_morpher.hh \
+ morpher/slicing_morpher.hh \
morpher/subq_morpher.hh \
morpho/attribute_closing_opening.hh \
morpho/attribute_closing_opening_map.hxx \
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Fri, 26 Mar 2004 12:53:24 +0100 thivol_d (oln/t/25_image.hh 1.29 600)
+++ olena/oln/core/abstract/image.hh Sun, 04 Apr 2004 16:27:23 +0200 odou_s (oln/t/25_image.hh 1.30 600)
@@ -178,11 +178,11 @@
/// Return a reference to the image size.
- const size_type&
+ const size_type
size() const
{
assertion(has_impl());
- return this->exact().impl()->size();
+ return this->exact().size();
}
/// Return the value of the border width.
Index: olena/oln/core/impl/image_impl.hh
--- olena/oln/core/impl/image_impl.hh Sun, 14 Mar 2004 19:03:34 +0100 van-vl_n (oln/t/29_image_impl 1.18 600)
+++ olena/oln/core/impl/image_impl.hh Sun, 04 Apr 2004 16:28:17 +0200 odou_s (oln/t/29_image_impl 1.19 600)
@@ -81,6 +81,7 @@
image_impl(const size_type s): refcount_(0), size_(s) {}
+ image_impl() {}
/// Notice that there is a new reference to the object.
Index: olena/oln/core/impl/image_array.hh
--- olena/oln/core/impl/image_array.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/t/30_image_arra 1.16 600)
+++ olena/oln/core/impl/image_array.hh Sun, 04 Apr 2004 16:28:29 +0200 odou_s (oln/t/30_image_arra 1.17 600)
@@ -121,6 +121,9 @@
allocate_data_(buffer_, len(s));
}
+ image_array() : buffer_(0)
+ {}
+
image_array(const self_type&); // cpy ctor w/o impl
void
@@ -169,6 +172,7 @@
~image_array()
{
+ if (buffer_)
desallocate_data_(buffer_);
}
Index: olena/oln/core/impl/image_array3d.hh
--- olena/oln/core/impl/image_array3d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/t/32_image_arra 1.11 600)
+++ olena/oln/core/impl/image_array3d.hh Sun, 04 Apr 2004 16:28:41 +0200 odou_s (oln/t/32_image_arra 1.12 600)
@@ -134,8 +134,11 @@
pretreat_3d_data_(this->buffer_, array2_, array_, s);
}
+ image_array3d() : array_(0) {}
+
~image_array3d()
{
+ if (array_)
desallocate_3d_data_(array2_, array_, this->size_);
}
Index: olena/oln/core/impl/image_array2d.hh
--- olena/oln/core/impl/image_array2d.hh Mon, 29 Mar 2004 15:45:23 +0200 palma_g (oln/t/33_image_arra 1.13 600)
+++ olena/oln/core/impl/image_array2d.hh Sun, 04 Apr 2004 16:28:38 +0200 odou_s (oln/t/33_image_arra 1.14 600)
@@ -122,8 +122,11 @@
pretreat_2d_data_(this->buffer_, array_, s);
}
+ image_array2d() : array_(0) {}
+
~image_array2d()
{
+ if (array_)
desallocate_2d_data_(array_, this->size_);
}
Index: olena/oln/core/impl/image_array1d.hh
--- olena/oln/core/impl/image_array1d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/t/34_image_arra 1.13 600)
+++ olena/oln/core/impl/image_array1d.hh Sun, 04 Apr 2004 16:28:34 +0200 odou_s (oln/t/34_image_arra 1.14 600)
@@ -99,6 +99,8 @@
pretreat_1d_data_(this->buffer_, buffer__, s);
}
+ image_array1d() {}
+
~image_array1d() {}
protected:
Index: olena/oln/morpher/piece_morpher.hh
--- olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/m/40_piece_morp 1.1 600)
+++ olena/oln/morpher/piece_morpher.hh Sun, 04 Apr 2004 16:29:01 +0200 odou_s (oln/m/40_piece_morp 1.2 600)
@@ -36,31 +36,51 @@
template <class I, class Exact = mlc::final>
struct piece_morpher;
+ template <class I, class Exact = mlc::final>
+ struct super_piece_morpher;
} // end of namespace morpher
- /// Inherits identification's informations about the piece morpher.
- template <class I, class Exact>
- struct image_id< morpher::piece_morpher<I, Exact> > : public image_id<I>
- {};
+ /// Informations about the super piece morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::super_piece_morpher<SrcType, Exact> >
+ {
+ typedef typename mlc::exact_vt<
+ morpher::super_piece_morpher<SrcType, Exact>,
+ Exact>::ret
+ exact_type;
+ ///< Retrieve the exact type of the image.
+ };
- /// Inherits identification's informations about the const piece morpher.
- template <class I, class Exact>
- struct image_id< morpher::piece_morpher<const I, Exact> > : public image_id<I>
- {};
+ /// Informations about the piece morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::piece_morpher<SrcType, Exact> >
+ {
+ enum {dim = SrcType::dim}; ///< The Image dimension.
+ typedef oln_impl_type(SrcType) impl_type;
+ ///< Underlying implementation.
+ typedef oln_value_type(SrcType) value_type;
+ ///< The value type of the decorated image.
+ typedef typename mlc::exact_vt<morpher::piece_morpher<SrcType, Exact>,
+ Exact>::ret exact_type;
+ ///< Retrieve the exact type of the image.
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_iter_type(SrcType) iter_type;
+ };
/// Traits for piece morpher.
- template <class I>
- struct image_traits < morpher::piece_morpher<I> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(I),
- morpher::piece_morpher<I> > >
- {};
-
- /// Traits for const piece morpher.
- template <class I>
- struct image_traits < morpher::piece_morpher<const I> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(I),
- morpher::piece_morpher<const I> > >
+ template <class SrcType, class Exact>
+ struct image_traits < morpher::piece_morpher<SrcType, Exact> >
+ : public
+ image_traits<
+ morpher::abstract::generic_morpher<
+ SrcType,
+ typename image_id<morpher::piece_morpher<SrcType,
+ Exact> >::exact_type
+ >
+ >
{};
@@ -68,13 +88,18 @@
/// Abstract piece morpher class used for code factorization.
template <class SrcType, class Exact>
- class super_piece_morpher : public abstract::generic_morpher<SrcType, SrcType, Exact>
+ class super_piece_morpher
+ : public abstract::generic_morpher<SrcType, Exact>
{
+
public:
- typedef abstract::generic_morpher<SrcType, SrcType, Exact> super_type;
- typedef oln_dpoint_type(SrcType) dpoint_type;
- typedef oln_size_type(SrcType) size_type;
+ typedef super_piece_morpher<SrcType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef abstract::generic_morpher<SrcType, Exact> super_type;
+
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
protected:
@@ -93,31 +118,36 @@
{}
const size_type size_; ///< The size of the piece of picture.
- const dpoint_type p_; ///< The reference point of the piece of picture.
+ const dpoint_type p_;
+ ///< The reference point of the piece of picture.
/*!
** \brief Empty constructor.
**
** Needed by mlc_hierarchy::any_with_diamond.
*/
- super_piece_morpher() : size_(size_) {}
+ super_piece_morpher()
+ {}
public:
/// Return the size (different from the original picture).
- const size_type size() const
+ const size_type
+ size() const
{
return size_;
}
/// Return the reference point.
- const dpoint_type ref_point() const
+ const dpoint_type
+ ref_point() const
{
return p_;
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "super_piece_morpher<" + super_type::name() + ">";
}
@@ -134,17 +164,19 @@
*/
template <class SrcType, class Exact>
struct piece_morpher
- : public super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> >
+ : public super_piece_morpher<
+ SrcType,
+ typename image_id<piece_morpher<SrcType, Exact> >::exact_type
+ >
{
- /// The type of the object instantiated. piece morpher can be derived.
- typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
typedef piece_morpher<SrcType, Exact> self_type;
- typedef super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> > super_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_piece_morpher<SrcType, exact_type> super_type;
- typedef oln_point_type(SrcType) point_type;
- typedef oln_dpoint_type(SrcType) dpoint_type;
- typedef oln_size_type(SrcType) size_type;
- typedef oln_value_type(SrcType) value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
+ typedef typename image_id<exact_type>::value_type value_type;
/// Construct the piece morpher with an image \a ima.
piece_morpher(const SrcType &ima, const dpoint_type p,
@@ -170,9 +202,11 @@
** \arg p The point.
** \return The stored value.
*/
- value_type& at(const point_type& p)
+ value_type&
+ at(const point_type& p)
{
- return const_cast<value_type &>(this->ima_)[p + p_];
+ return const_cast<value_type &>
+ ( const_cast<SrcType &>(this->ima_)[p + p_] );
}
/*!
@@ -180,7 +214,8 @@
** \arg p The point.
** \return The stored value.
*/
- const value_type at(const point_type& p) const
+ const value_type
+ at(const point_type& p) const
{
return this->ima_[p + p_];
}
@@ -209,27 +244,31 @@
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "piece_morpher<" + super_type::name() + ">";
}
};
- /// The specialized version for `const' declared images.
+ /// The specialized version for `const' images.
template <class SrcType, class Exact>
struct piece_morpher<const SrcType, Exact>
- : public super_piece_morpher< SrcType, piece_morpher<const SrcType, Exact> >
+ : public super_piece_morpher<
+ const SrcType,
+ typename image_id<piece_morpher<const SrcType,
+ Exact> >::exact_type
+ >
{
- /// The type of the object instantiated. piece morpher can be derived.
- typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
typedef piece_morpher<const SrcType, Exact> self_type;
- typedef super_piece_morpher<SrcType, piece_morpher<const SrcType, Exact> > super_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_piece_morpher<const SrcType, exact_type> super_type;
- typedef oln_point_type(SrcType) point_type;
- typedef oln_dpoint_type(SrcType) dpoint_type;
- typedef oln_size_type(SrcType) size_type;
- typedef oln_value_type(SrcType) value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
+ typedef typename image_id<exact_type>::value_type value_type;
/*!
** \brief Construct a piece morpher.
@@ -259,13 +298,15 @@
** \arg p The point.
** \return The stored value.
*/
- const value_type at(const point_type &p) const
+ const value_type
+ at(const point_type &p) const
{
return this->ima_[p + p_];
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "piece_morpher<" + super_type::name() + ">";
}
@@ -290,7 +331,8 @@
** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
** oln::save(oln::morpher::piece_morph(imc,
** oln::dpoint2d(246, 244),
- ** oln::image2d_size(30, 60, imc.border())),
+ ** oln::image2d_size(30, 60,
+ ** imc.border())),
** IMG_OUT "oln_morpher_piece_morpher.pgm");
** }
** \endcode
@@ -301,7 +343,8 @@
** \image latex oln_morpher_piece_morpher.png
*/
template <class I, class PointType, class SizeType>
- const piece_morpher<I> piece_morph(I &ima, const PointType p, const SizeType s)
+ const piece_morpher<I>
+ piece_morph(I &ima, const PointType p, const SizeType s)
{
return piece_morpher<I>(ima, p, s);
}
Index: olena/oln/morpher/iter_morpher.hh
--- olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 09:31:34 +0200 odou_s (oln/m/41_iter_morph 1.1 600)
+++ olena/oln/morpher/iter_morpher.hh Sun, 04 Apr 2004 16:29:10 +0200 odou_s (oln/m/41_iter_morph 1.2 600)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef ITER_MORPHER_HH
-# define ITER_MORPHER_HH
+#ifndef OLN_MORPHER_ITER_MORPHER_HH
+# define OLN_MORPHER_ITER_MORPHER_HH
# include <oln/morpher/generic_morpher.hh>
@@ -39,30 +39,38 @@
} // end of namespace morpher
- /// Inherits identification's informations about the iter morpher.
+ /// Informations about the iter morpher.
template <class SrcType, class IterType, class Exact>
- struct image_id< morpher::iter_morpher<SrcType, IterType, Exact> > : public image_id<SrcType>
- {};
-
- /// Inherits identification's informations about the const iter morpher.
- template <class SrcType, class IterType, class Exact>
- struct image_id< morpher::iter_morpher<const SrcType, IterType, Exact> > : public image_id<SrcType>
- {};
-
- /// Traits for iter morpher.
- template <class SrcType, class IterType>
- struct image_traits < morpher::iter_morpher<SrcType, IterType> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
- morpher::iter_morpher<SrcType, IterType> > >
+ struct image_id< morpher::iter_morpher<SrcType, IterType, Exact> >
{
+ enum {dim = SrcType::dim}; ///< The Image dimension.
+ typedef oln_impl_type(SrcType) impl_type;
+ ///< Underlying implementation.
+ typedef oln_value_type(SrcType) value_type;
+ ///< The value type of the decorated image.
+ typedef typename mlc::exact_vt<
+ morpher::iter_morpher<SrcType, IterType, Exact>,
+ Exact
+ >::ret exact_type;
+ ///< Retrieve the exact type of the image.
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
typedef IterType iter_type;
};
- /// Traits for const iter morpher.
- template <class SrcType, class IterType>
- struct image_traits < morpher::iter_morpher<const SrcType, IterType> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
- morpher::iter_morpher<const SrcType, IterType> > >
+ /// Traits for iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_traits < morpher::iter_morpher<SrcType, IterType, Exact> >
+ : public
+ image_traits<
+ morpher::abstract::generic_morpher<
+ SrcType,
+ typename image_id<morpher::iter_morpher<SrcType,
+ IterType,
+ Exact> >::exact_type
+ >
+ >
{
typedef IterType iter_type;
};
@@ -71,13 +79,20 @@
template <class SrcType, class IterType, class Exact>
struct iter_morpher
- : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> >
+ : public abstract::generic_morpher<
+ SrcType,
+ typename image_id<iter_morpher<SrcType,
+ IterType,
+ Exact> >::exact_type
+ >
{
- /// The type of the object instantiated. iter morpher can be derived.
- typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
typedef iter_morpher<SrcType, IterType, Exact> self_type;
- typedef IterType iter_type;
- typedef abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> > super_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef abstract::generic_morpher<SrcType, exact_type> super_type;
+
+ typedef typename image_id<exact_type>::iter_type iter_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
/// Construct the iter morpher with an image \a ima.
iter_morpher(const SrcType &ima)
@@ -110,8 +125,32 @@
return this->exact();
}
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ value_type&
+ at(const point_type& p)
+ {
+ return const_cast<value_type &>
+ ( const_cast<SrcType &>(this->ima_)[p] );
+ }
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type
+ at(const point_type& p) const
+ {
+ return this->ima_[p];
+ }
+
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "iter_morpher<" + super_type::name() + ">";
}
@@ -121,13 +160,22 @@
/// The specialized version for `const' declared images.
template <class SrcType, class IterType, class Exact>
struct iter_morpher<const SrcType, IterType, Exact>
- : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> >
+ : public
+ abstract::generic_morpher<
+ const SrcType,
+ typename image_id<iter_morpher<const SrcType,
+ IterType,
+ Exact> >::exact_type
+ >
{
- /// The type of the object instantiated. iter morpher can be derived.
- typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
typedef iter_morpher<const SrcType, IterType, Exact> self_type;
- typedef IterType iter_type;
- typedef abstract::generic_morpher<SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> > super_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef abstract::generic_morpher<const SrcType, exact_type>
+ super_type;
+
+ typedef typename image_id<exact_type>::iter_type iter_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
/// Construct the iter morpher with an image \a ima.
iter_morpher(const SrcType &ima)
@@ -135,19 +183,45 @@
{}
/// Construct the iter morpher with another iter morpher.
- iter_morpher(const iter_morpher<const SrcType, IterType>& r)
- : super_type(r.get_ima()) {}
+ iter_morpher(const self_type& r)
+ : super_type(r.get_ima())
+ {}
/*!
** \brief Empty constructor.
**
** Needed by mlc_hierarchy::any_with_diamond.
*/
- iter_morpher()
- {}
+ iter_morpher() {}
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type
+ at(const point_type& p) const
+ {
+ return this->ima_[p];
+ }
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "iter_morpher<" + super_type::name() + ">";
}
@@ -158,33 +232,45 @@
** \brief Instantiate a temporary read-only iter morpher.
**
** The image will be viewed according to its iterator type.
- ** For example, the foo function will print the size of the picture
- ** (the bkd_iter_type is used transparently).
+ ** So the resulting image will be reversed.
**
** \code
** #include <oln/morpher/iter_morpher.hh>
** #include <oln/basics2d.hh>
** #include <ntg/all.hh>
- ** template <class E>
- ** void foo(const oln::abstract::image<E>& img)
+ ** template <class E, class F>
+ ** void foo(const oln::abstract::image<E>& src,
+ ** oln::abstract::image<F>& dst)
** {
- ** oln_iter_type(oln::abstract::image<E>) it(img);
- ** for_all(it)
+ ** oln_iter_type(oln::abstract::image<E>) it_src(src);
+ ** oln_iter_type(oln::abstract::image<F>) it_dst(dst);
+ **
+ ** it_dst = mlc::begin;
+ ** for_all(it_src)
** {
- ** std::cout << it.row() << " " << it.col() << std::endl;
- ** break;
+ ** dst[it_dst] = src[it_src];
+ ** ++it_dst;
** }
** }
** int main()
** {
- ** const oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
- ** assert(imc.has_impl());
- ** foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(imc));
+ ** const oln::image2d<ntg::rgb_8> im = oln::load(IMG_IN "lena.ppm");
+ ** oln::image2d<ntg::rgb_8> im_out(im.size());
+ **
+ ** foo(oln::morpher::iter_morph<
+ ** oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(im), im_out);
+ ** oln::save(im_out, IMG_OUT "oln_morpher_iter.pgm");
** }
** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_iter.png
+ ** \image latex oln_morpher_iter.png
*/
template <class IterType, class I>
- const iter_morpher<I, IterType> iter_morph(I &ima)
+ const iter_morpher<I, IterType>
+ iter_morph(I &ima)
{
return iter_morpher<I, IterType>(ima);
}
Index: olena/oln/morpher/slicing_morpher.hh
--- olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 11:23:59 +0200 odou_s (oln/m/42_slicing_mo 1.2 600)
+++ olena/oln/morpher/slicing_morpher.hh Sun, 04 Apr 2004 16:29:15 +0200 odou_s (oln/m/42_slicing_mo 1.3 600)
@@ -36,107 +36,160 @@
template <class I, class Exact = mlc::final>
struct slicing_morpher;
+ template <class I, class Exact = mlc::final>
+ struct super_slicing_morpher;
} // end of namespace morpher
-
- template <class Image>
- struct DecDimensionImage
- {};
- template <class Type>
- struct DecDimensionImage< oln::image2d<Type> >
+ /// Informations about the super slicing morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::super_slicing_morpher<SrcType, Exact> >
{
- typedef oln::image1d<Type> ret;
+ typedef typename mlc::exact_vt<
+ morpher::super_slicing_morpher<SrcType, Exact>,
+ Exact>::ret
+ exact_type;
+ ///< Retrieve the exact type of the image.
+ enum {dim = SrcType::dim - 1};
+ typedef typename dim_traits<dim,
+ typename image_id<SrcType>::value_type,
+ exact_type
+ >::img_type img_type;
+ typedef typename image_traits<img_type>::size_type size_type;
+ typedef typename image_traits<img_type>::impl_type impl_type;
};
- template <class Type>
- struct DecDimensionImage< oln::image3d<Type> >
+
+ /// Informations about the const super slicing morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::super_slicing_morpher<const SrcType, Exact> >
{
- typedef oln::image2d<Type> ret;
+ typedef typename mlc::exact_vt<
+ morpher::super_slicing_morpher<SrcType, Exact>,
+ Exact>::ret
+ exact_type;
+ ///< Retrieve the exact type of the image.
+ enum {dim = SrcType::dim - 1};
+ typedef typename dim_traits<dim,
+ typename image_id<SrcType>::value_type,
+ exact_type
+ >::img_type img_type;
+ typedef typename image_traits<img_type>::size_type size_type;
+ typedef typename image_traits<img_type>::impl_type impl_type;
};
- /// Inherits identification's informations about the slicing morpher.
- template <class I, class Exact>
- struct image_id< morpher::slicing_morpher<I, Exact> >
- : public image_id<typename DecDimensionImage<I>::ret>
- {};
-
- /// Inherits identification's informations about the const slicing morpher.
- template <class I, class Exact>
- struct image_id< morpher::slicing_morpher<const I, Exact> >
- : public image_id<typename DecDimensionImage<I>::ret>
- {};
+ /// Informations about the slicing morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::slicing_morpher<SrcType, Exact> >
+ {
+ typedef typename mlc::exact_vt<morpher::slicing_morpher<SrcType, Exact>,
+ Exact>::ret exact_type;
+ ///< Retrieve the exact type of the image.
+ enum {dim = SrcType::dim - 1};
+ typedef typename dim_traits<dim,
+ typename image_id<SrcType>::value_type,
+ exact_type
+ >::img_type img_type;
+ typedef typename image_id<img_type>::value_type value_type;
+ typedef typename image_id<img_type>::point_type point_type;
+ typedef typename image_id<img_type>::size_type size_type;
+ typedef typename image_id<img_type>::impl_type impl_type;
+ };
- /// Specialized version for slicing morpher.
- template <class I>
- struct image_traits< morpher::slicing_morpher<I> > :
- public image_traits<abstract::image_with_impl<typename DecDimensionImage<I>::ret::impl_type,
- morpher::slicing_morpher<I> > >
- {};
+ /// Informations about the const slicing morpher.
+ template <class SrcType, class Exact>
+ struct image_id< morpher::slicing_morpher<const SrcType, Exact> >
+ {
+ typedef typename mlc::exact_vt<morpher::slicing_morpher<SrcType, Exact>,
+ Exact>::ret exact_type;
+ ///< Retrieve the exact type of the image.
+ enum {dim = SrcType::dim - 1};
+ typedef typename dim_traits<dim,
+ typename image_id<SrcType>::value_type,
+ exact_type
+ >::img_type img_type;
+ typedef typename image_id<img_type>::value_type value_type;
+ typedef typename image_traits<img_type>::point_type point_type;
+ typedef typename image_traits<img_type>::size_type size_type;
+ typedef typename image_traits<img_type>::impl_type impl_type;
+ };
- /// Specialized version for slicing morpher.
- template <class I>
- struct image_traits< morpher::slicing_morpher<const I> > :
- public image_traits<abstract::image_with_impl<typename DecDimensionImage<I>::ret::impl_type,
- morpher::slicing_morpher<const I> > >
+ /// Traits for slicing morpher.
+ template <class SrcType, class Exact>
+ struct image_traits< morpher::slicing_morpher<SrcType, Exact> >
+ : public
+ image_traits<
+ morpher::abstract::generic_morpher<
+ SrcType,
+ typename image_id<morpher::slicing_morpher<SrcType,
+ Exact> >::exact_type
+ >
+ >
{};
namespace morpher {
/// Return a size of N-1 dimension.
- oln::image1d_size* image_size_dec(const oln::image2d_size& image_size)
+ oln::image1d_size
+ image_size_dec(const oln::image2d_size& image_size)
{
- // We can't use typedef here because image2d_size and image3d_size don't have
- // the same number of arguments.
- return new oln::image1d_size(image_size.ncols(), image_size.border());
+ return oln::image1d_size(image_size.ncols(), image_size.border());
}
/// Return a size of N-1 dimension.
- oln::image2d_size* image_size_dec(const oln::image3d_size& image_size)
+ oln::image2d_size
+ image_size_dec(const oln::image3d_size& image_size)
{
- // We can't use typedef here because image2d_size and image3d_size don't have
- // the same number of arguments.
- return new oln::image2d_size(image_size.nrows(), image_size.ncols(), image_size.border());
+ return oln::image2d_size(image_size.nrows(),
+ image_size.ncols(),
+ image_size.border());
}
- /// Abstract piece morpher class used for code factorization.
- template <class DestType, class SrcType, class Exact>
- class super_slicing_morpher : public abstract::generic_morpher<DestType, SrcType, Exact>
+ /// Abstract slicing morpher class used for code factorization.
+ template <class SrcType, class Exact>
+ class super_slicing_morpher
+ : public abstract::generic_morpher<SrcType, Exact>
{
+
public:
- typedef oln_size_type(DestType) size_type;
- typedef oln_impl_type(DestType) impl_type;
- typedef abstract::generic_morpher<DestType, SrcType, Exact> super_type;
+ typedef super_slicing_morpher<SrcType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef abstract::generic_morpher<SrcType, Exact> super_type;
+
+ typedef typename image_id<exact_type>::size_type size_type;
+ typedef typename image_id<exact_type>::impl_type impl_type;
/// Override the size method.
const size_type&
size() const
{
- return *size_;
+ return size_;
}
/// Override the impl method.
const impl_type*
impl() const
{
- return impl_;
+ return &impl_;
}
/// Override the impl method.
impl_type*
impl()
{
- return impl_;
+ return &impl_;
}
- ///< Return the last coordinate' value.
- coord get_slice() const
+ /// Return the last coordinate' value.
+ coord
+ get_slice() const
{
return slice_;
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "super_slicing_morpher<" + super_type::name() + ">";
}
@@ -152,62 +205,56 @@
** since it is protected.
*/
super_slicing_morpher(const SrcType &ima, const coord slice)
- : super_type(ima), impl_(0), size_(0), slice_(slice)
- {
- size_ = image_size_dec(ima_.size());
- impl_ = new impl_type(*size_);
- }
-
- /// Destructor
- ~super_slicing_morpher()
- {
- delete size_;
- delete impl_;
- }
+ : super_type(ima), slice_(slice), size_(image_size_dec(ima_.size())), impl_(size_)
+ {}
/*!
** \brief Empty constructor.
**
** Needed by mlc_hierarchy::any_with_diamond.
+ ** \todo create empty constructors for impl_, ...
*/
- super_slicing_morpher() : impl_(0), size_(0), slice_(0)
+ super_slicing_morpher()
{}
- impl_type *impl_;
- size_type *size_; ///< The size of the N-1 dimension image.
coord slice_; ///< The last coordinate.
+ const size_type size_; ///< The size of the N-1 dimension image.
+ impl_type impl_;
};
/*!
- ** \brief The default piece morpher class.
+ ** \brief The default slicing morpher class.
**
- ** Using this class, a piece of picture is a picture.
+ ** Using this class, a slicing of picture is a picture.
**
** \see oln::morpher::abstract::generic_morpher
- ** \see oln::morpher::piece_morph
+ ** \see oln::morpher::slicing_morph
*/
template <class SrcType, class Exact>
struct slicing_morpher
- : public super_slicing_morpher< typename DecDimensionImage<SrcType>::ret, SrcType, slicing_morpher<SrcType, Exact> >
+ : public super_slicing_morpher<
+ SrcType,
+ typename image_id<slicing_morpher<SrcType, Exact> >::exact_type
+ >
{
- typedef typename image_id< slicing_morpher<SrcType, Exact> >::exact_type exact_type;
typedef slicing_morpher<SrcType, Exact> self_type;
- typedef typename DecDimensionImage<SrcType>::ret DestType;
- typedef super_slicing_morpher<DestType, SrcType, slicing_morpher<SrcType, Exact> > super_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_slicing_morpher<SrcType, exact_type> super_type;
- typedef oln_value_type(DestType) value_type;
- typedef oln_point_type(DestType) point_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::img_type img_type;
+ typedef typename image_id<exact_type>::value_type value_type;
/*!
- ** \brief Construct a piece morpher.
+ ** \brief Construct a slicing morpher.
** \arg ima The image.
** \arg slice The slice value.
*/
slicing_morpher(const SrcType &ima, coord slice)
: super_type(ima, slice) {}
- /// Construct a piece morpher from another one.
+ /// Construct a slicing morpher from another one.
slicing_morpher(const self_type& r)
: super_type(r.get_ima(), r.get_slice()) {}
@@ -223,7 +270,8 @@
** \arg p The point.
** \return The stored value.
*/
- value_type& at(const point_type &p)
+ value_type&
+ at(const point_type &p)
{
typename SrcType::point_type tmp_p(p, slice_);
return const_cast<value_type &>(this->ima_)[tmp_p];
@@ -254,35 +302,39 @@
** \brief This operator= assigns rhs to the current image.
*/
self_type&
- operator=(DestType& rhs)
+ operator=(self_type& rhs)
{
return this->exact().assign(rhs);
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "slicing_morpher<" + super_type::name() + ">";
}
};
- /// The specialized version for `const' declared images.
+ /// The specialized version for `const' images.
template <class SrcType, class Exact>
struct slicing_morpher<const SrcType, Exact>
- : public super_slicing_morpher<typename DecDimensionImage<SrcType>::ret, SrcType, slicing_morpher<const SrcType, Exact> >
+ : public super_slicing_morpher<
+ const SrcType,
+ typename image_id<slicing_morpher<const SrcType, Exact> >::exact_type
+ >
{
- /// The type of the object instantiated. piece morpher can be derived.
- typedef typename image_id<slicing_morpher<const SrcType, Exact> >::exact_type exact_type;
- typedef slicing_morpher<SrcType, Exact> self_type;
- typedef typename DecDimensionImage<SrcType>::ret DestType;
- typedef super_slicing_morpher<DestType, SrcType, slicing_morpher<const SrcType, Exact> > super_type;
- typedef oln_value_type(DestType) value_type;
- typedef oln_point_type(DestType) point_type;
+ typedef slicing_morpher<const SrcType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_slicing_morpher<const SrcType, exact_type> super_type;
+
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+
/*!
- ** \brief Construct a piece morpher.
+ ** \brief Construct a slicing morpher.
** \arg ima The image.
** \arg slice The slice value.
*/
@@ -290,7 +342,7 @@
: super_type(ima, slice)
{}
- /// Construct a piece morpher from another one.
+ /// Construct a slicing morpher from another one.
slicing_morpher(const self_type& r)
: super_type(r.get_ima(), r.get_slice())
{}
@@ -308,14 +360,16 @@
** \arg p The point.
** \return The stored value.
*/
- const value_type at(const point_type &p) const
+ const value_type
+ at(const point_type &p) const
{
typename SrcType::point_type tmp_p(p, slice_);
return this->ima_[tmp_p];
}
/// Useful to debug.
- static std::string name()
+ static std::string
+ name()
{
return "slicing_morpher<" + super_type::name() + ">";
}
@@ -347,7 +401,8 @@
** \image latex oln_morpher_slicing_morpher.png
*/
template <class I>
- const slicing_morpher<I> slicing_morph(I &ima, coord slice)
+ const slicing_morpher<I>
+ slicing_morph(I &ima, coord slice)
{
return slicing_morpher<I>(ima, slice);
}
Index: olena/tests/morpher/tests/iter
--- olena/tests/morpher/tests/iter Sun, 04 Apr 2004 16:50:04 +0200 odou_s ()
+++ olena/tests/morpher/tests/iter Sun, 04 Apr 2004 16:29:52 +0200 odou_s (oln/q/3_iter 1.1 600)
@@ -0,0 +1,71 @@
+// -*- c++ -*-
+#include <oln/morpher/iter_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+// Try to read from the morpher.
+template <class E, class F>
+void foo(const oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it_src(src);
+ oln_iter_type(oln::abstract::image<F>) it_dst(dst);
+
+ it_dst = mlc::begin;
+ for_all(it_src)
+ {
+ dst[it_dst] = src[it_src];
+ ++it_dst;
+ }
+}
+
+// Try to write inside the morpher.
+template <class E, class F>
+void foo(oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it_src(src);
+ oln_iter_type(oln::abstract::image<F>) it_dst(dst);
+
+ it_dst = mlc::begin;
+ for_all(it_src)
+ {
+ src[it_src] = dst[it_dst];
+ ++it_dst;
+ }
+}
+
+int main()
+{
+ bool fail (false);
+
+ oln::utils::key::value_type data_key_inv[16]
+ = {0xd4, 0x2a, 0xe0, 0xc7, 0xc4, 0xea, 0xbc, 0xe4,
+ 0x10, 0x6, 0x52, 0x12, 0xba, 0x8d, 0xa4, 0x4c};
+
+ oln::image2d<ntg::rgb_8> im = oln::load(rdata("lena.ppm"));
+ oln::image2d<ntg::rgb_8> im_out(im.size());
+
+ const oln::image2d<ntg::rgb_8> im_const = oln::load(rdata("lena.ppm"));
+ oln::image2d<ntg::rgb_8> im_const_out(im_const.size());
+
+ oln::morpher::iter_morpher< oln::image2d<ntg::rgb_8>,
+ oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>) > it_nonconst(im);
+
+ foo(it_nonconst, im);
+ foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(im), im_out);
+ foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(im_const), im_const_out);
+
+ fail = fail | (oln::utils::md5(im_out) != oln::utils::md5(it_nonconst));
+ fail = fail | (oln::utils::md5(im_const_out) != oln::utils::key(data_key_inv));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
Index: olena/tests/morpher/tests/piece
--- olena/tests/morpher/tests/piece Sun, 04 Apr 2004 16:50:04 +0200 odou_s ()
+++ olena/tests/morpher/tests/piece Sun, 04 Apr 2004 16:29:58 +0200 odou_s (oln/q/43_piece 1.1 600)
@@ -0,0 +1,66 @@
+// -*- c++ -*-
+#include <oln/morpher/piece_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+// Try to read from the morpher.
+template <class E, class F>
+void foo(const oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it(src);
+ for_all(it)
+ dst[it] = src[it];
+}
+
+// Try to write inside the morpher.
+template <class E, class F>
+void foo(oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it_src(src);
+
+ for_all(it_src)
+ src[it_src] = dst[it_src];
+}
+
+int main()
+{
+ bool fail (false);
+
+ oln::utils::key::value_type data_key[16]
+ = {0x2b, 0x8b, 0x3c, 0x8e, 0x92, 0x90, 0xc8, 0x9,
+ 0xba, 0xfd, 0xc5, 0x52, 0x7c, 0xde, 0xa5, 0x6c};
+
+ oln::image2d<ntg::rgb_8> im = oln::load(rdata("lena.ppm"));
+ const oln::image2d<ntg::rgb_8> im_const = oln::load(rdata("lena.ppm"));
+ oln::image2d<ntg::rgb_8> im_out(oln::image2d_size(30, 60, im.border()));
+ oln::image2d<ntg::rgb_8> im_const_out(oln::image2d_size(30, 60, im.border()));
+
+ oln::morpher::piece_morpher< oln::image2d<ntg::rgb_8> > im_nonconst_out(im,
+ oln::dpoint2d(246, 244),
+ oln::image2d_size(30, 60, im.border()));
+
+ foo(im_nonconst_out, im);
+ foo(oln::morpher::piece_morph(im,
+ oln::dpoint2d(246, 244),
+ oln::image2d_size(30, 60, im.border())),
+ im_out);
+ foo(oln::morpher::piece_morph(im_const,
+ oln::dpoint2d(246, 244),
+ oln::image2d_size(30, 60, im.border())),
+ im_const_out);
+
+ fail = fail | (oln::utils::md5(im_out) != oln::utils::md5(im_nonconst_out));
+ fail = fail | (oln::utils::md5(im_const_out) != oln::utils::key(data_key));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
Index: olena/tests/morpher/tests/slicing
--- olena/tests/morpher/tests/slicing Sun, 04 Apr 2004 16:50:04 +0200 odou_s ()
+++ olena/tests/morpher/tests/slicing Sun, 04 Apr 2004 16:29:47 +0200 odou_s (oln/q/44_slicing 1.1 600)
@@ -0,0 +1,46 @@
+#include <oln/morpher/slicing_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+// Try to read from the morpher.
+template <class E, class F>
+void foo(const oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it(src);
+ for_all(it)
+ dst[it] = src[it];
+}
+
+
+int main(int argc, char *argv[])
+{
+ bool fail (false);
+
+ oln::utils::key::value_type data_key[16]
+ = {0xc1, 0x3a, 0x47, 0xb, 0x6f, 0xff, 0xac, 0x97,
+ 0xab, 0xa0, 0xf, 0x6c, 0x2a, 0x4a, 0xcb, 0x1};
+
+ oln::image2d<ntg::rgb_8> im = oln::load(rdata("lena.ppm"));
+ const oln::image2d<ntg::rgb_8> im_const = oln::load(rdata("lena.ppm"));
+ oln::image1d<ntg::rgb_8> im_out(im.ncols());
+ oln::image1d<ntg::rgb_8> im_const_out(im_const.ncols());
+
+ foo(oln::morpher::slicing_morph(im, 5), im_out);
+ foo(oln::morpher::slicing_morph(im_const, 5), im_const_out);
+
+ std::cout << oln::utils::md5(im_const_out) << std::endl;
+ fail = fail | (oln::utils::md5(im_out) != oln::utils::md5(im_const_out));
+ fail = fail | (oln::utils::md5(im_const_out) != oln::utils::key(data_key));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
--
Simon Odou
simon(a)lrde.epita.fr
4
3
Il manque un peu de doc, ca sera fait plus tard :)
Index: doc/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* ref/Makefile.am: Correct install-data-hook rule.
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/morpher/generic_morpher.hh: Inherit directly from oln::image.
* olena/oln/morpher/subq_morpher.hh: Change inheritance system.
* olena/oln/morpher/color_morpher.hh: Likewise.
* olena/tests/morpher/tests/color_morph: Remove a test.
Index: doc/ref/Makefile.am
--- doc/ref/Makefile.am Mon, 15 Mar 2004 16:47:03 +0100 palma_g (oln/d/51_Makefile.a 1.27.1.14 640)
+++ doc/ref/Makefile.am Fri, 02 Apr 2004 12:14:54 +0200 thivol_d (oln/d/51_Makefile.a 1.27.1.14 640)
@@ -33,7 +33,7 @@
rm -f img/*
MAINTAINERCLEANFILES = $(dist_noinst_DATA) \
- ./html/* ./img/* $(OUT_DIR)/*
+ ./html/* ./img/* ./$(OUT_DIR)/*
# ###
# ### What gets installed.
@@ -44,10 +44,11 @@
install-data-hook:
$(mkinstalldirs) $(DESTDIR)$(docdir)
@ for p in $(dist_noinst_DATA); do \
+ p1=`basename "$$p"`; \
if test -f $$p; then d=.; else d=$(srcdir); fi; \
if test -f $$d/$$p; then \
echo " $(INSTALL_DATA) $$d/$$p $(DESTDIR)$(docdir)/$$p"; \
- $(INSTALL_DATA) $$d/$$p $(DESTDIR)$(docdir)/$$p; \
+ $(INSTALL_DATA) $$d/$$p $(DESTDIR)$(docdir)/$$p1; \
else : ; fi; \
done
Index: olena/oln/morpher/generic_morpher.hh
--- olena/oln/morpher/generic_morpher.hh Tue, 30 Mar 2004 22:10:11 +0200 thivol_d (oln/m/18_generic_mo 1.4 600)
+++ olena/oln/morpher/generic_morpher.hh Sat, 03 Apr 2004 14:17:24 +0200 thivol_d (oln/m/18_generic_mo 1.4 600)
@@ -36,6 +36,7 @@
# include <oln/basics2d.hh>
# include <oln/basics3d.hh>
+
namespace oln {
/// Contain all the morpher relative declarations and functions.
@@ -46,37 +47,24 @@
namespace abstract {
- /*! Traits for conditionnal inheritance used by the \a generic_morpher
- **
- ** It changes the exact type of the image in the input (the exact
- ** type becomes the concrete morpher).
- **
- ** \see oln::morpher::generic_morpher
- */
- template <class T, class Exact>
- struct gm_inherit;
+ template <class SrcType, class Exact>
+ class generic_morpher;
- /// Return \a image1d with an \a exact_type of \a Exact.
- template <class T, class Exact>
- struct gm_inherit<oln::image1d<T>, Exact >
- {
- typedef oln::image1d<T, Exact> ret;
- };
+ }
+ }
- /// Return \a image2d with an \a exact_type of \a Exact.
- template <class T, class Exact>
- struct gm_inherit<oln::image2d<T>, Exact >
+ template <class Exact, class SrcType>
+ struct image_traits<morpher::abstract::generic_morpher<SrcType, Exact> >:
+ public image_traits<abstract::image_with_impl<typename image_id<Exact>::impl_type,
+ typename image_id<Exact>::exact_type> >
{
- typedef oln::image2d<T, Exact> ret;
- };
- /// Return \a image3d with an \a exact_type of \a Exact.
- template <class T, class Exact>
- struct gm_inherit<oln::image3d<T>, Exact >
- {
- typedef oln::image3d<T, Exact> ret;
};
+ namespace morpher {
+
+ namespace abstract {
+
/*! The Abstract morpher class.
**
** Define a default implementation for all the
@@ -89,10 +77,10 @@
** \param Exact Exact type
*/
- template <class DestType, class SrcType, class Exact>
- class generic_morpher : public gm_inherit<
- DestType,
- Exact>::ret
+ template <class SrcType, class Exact>
+ class generic_morpher :
+ public oln::abstract::image_with_impl<typename image_id<Exact>::impl_type,
+ typename image_id<Exact>::exact_type>
{
protected:
@@ -110,27 +98,31 @@
public:
/// The self type.
- typedef generic_morpher<DestType, SrcType, Exact> self_type;
+ typedef generic_morpher<SrcType, Exact> self_type;
/// The exact type of the morpher.
typedef Exact exact_type;
/// The morpher point type.
- typedef oln_point_type(DestType) point_type;
+ typedef typename image_traits<exact_type>::point_type point_type;
/// The morpher dpoint type.
- typedef oln_dpoint_type(DestType) dpoint_type;
+ typedef typename image_traits<exact_type>::dpoint_type dpoint_type;
/// The morpher iterator type.
- typedef oln_iter_type(DestType) iter_type;
+ typedef typename image_traits<exact_type>::iter_type iter_type;
/// The morpher forward iterator type.
- typedef oln_fwd_iter_type(DestType) fwd_iter_type;
+ typedef typename image_traits<exact_type>::fwd_iter_type fwd_iter_type;
/// The morpher backward iterator type.
- typedef oln_bkd_iter_type(DestType) bkd_iter_type;
+ typedef typename image_traits<exact_type>::bkd_iter_type bkd_iter_type;
/// The morpher value type.
- typedef oln_value_type(DestType) value_type;
+ typedef typename image_traits<exact_type>::value_type value_type;
/// The morpher size type.
- typedef oln_size_type(DestType) size_type;
+ typedef typename image_traits<exact_type>::size_type size_type;
/// The morpher underlying implementation.
- typedef oln_impl_type(DestType) impl_type;
+ typedef typename image_traits<exact_type>::impl_type impl_type;
+ typedef oln::image<image_traits<exact_type>::dim,
+ value_type,
+ impl_type,
+ mlc::final> DestType;
/// Type of the decorated image.
typedef SrcType src_self_type;
@@ -155,7 +147,10 @@
typedef oln_exact_type(SrcType) src_exact_type;
/// The upper class.
- typedef typename gm_inherit<DestType, Exact>::ret super_type;
+ typedef oln::abstract::image_with_impl<impl_type,
+ exact_type>
+ super_type;
+
/// Return the decorated image.
const SrcType&
@@ -164,18 +159,6 @@
return ima_;
}
- /// Instantiate and return the image that the morpher simulates.
- DestType*
- unmorph() const
- {
- DestType* im = new DestType(to_exact(*this).size());
- oln_iter_type(DestType) it(*im);
-
- for_all(it)
- (*im)[it] = to_exact(*this).operator[](it);
- return im;
- }
-
/*! Default implementation of at.
**
** Return the value stored at \a p in the decorated image.
Index: olena/oln/morpher/subq_morpher.hh
--- olena/oln/morpher/subq_morpher.hh Tue, 30 Mar 2004 22:10:11 +0200 thivol_d (oln/m/25_subq_morph 1.2 600)
+++ olena/oln/morpher/subq_morpher.hh Fri, 02 Apr 2004 19:27:22 +0200 thivol_d (oln/m/25_subq_morph 1.2 600)
@@ -38,6 +38,40 @@
template <class SrcType, unsigned N, class Exact = mlc::final>
struct subq_morpher;
+
+
+ /*! Change the color depth of \a T.
+ **
+ ** For Example, calling color_mute with
+ ** color<3, 8, rgb_traits>, 5 will give
+ ** the type : color<3, 5, rgb_traits>.
+ **
+ ** \param T The data type of the image.
+ **
+ ** \param N The new number of bits by component.
+ **
+ */
+
+ template <class T, unsigned N>
+ struct color_mute
+ {
+ };
+
+ /// Specialized version for ntg::color.
+ template <unsigned nbcomps_,
+ unsigned nbits_,
+ template <unsigned> class color_system,
+ unsigned N>
+ struct color_mute<ntg::color<nbcomps_, nbits_, color_system>, N>
+ {
+ typedef ntg::color<nbcomps_, N, color_system> ret;
+ /*! <The new value type.*/
+ enum { nbcomps = nbcomps_ };
+ /*! <The number of components */
+ };
+
+
+
} // end of namespace morpher
/*! Retrieve types and dimension of the subq_morpher.
@@ -55,10 +89,12 @@
/*! <The image dimension. */
typedef oln_impl_type(SrcType) impl_type;
/*! <The underlying implementation.*/
- typedef typename ntg::color<3, N, ntg::rgb_traits> value_type;
+ typedef typename oln::morpher::color_mute<oln_value_type(SrcType), N>::ret value_type;
/*! <The modified value type.*/
typedef typename mlc::exact_vt<oln::morpher::subq_morpher<SrcType, N, Exact>,
Exact>::ret exact_type;
+
+ typedef oln_point_type(SrcType) point_type;
};
/*! Specialized version for subq_morpher.
@@ -71,45 +107,14 @@
*/
template <class SrcType, unsigned N, class Exact>
struct image_traits <oln::morpher::subq_morpher<SrcType, N, Exact> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
- oln::morpher::subq_morpher<SrcType, N, Exact> > >
+ public image_traits<oln::morpher::abstract::generic_morpher<SrcType,
+ typename image_id<oln::morpher::subq_morpher<SrcType, N, Exact> >::exact_type> >
{
};
namespace morpher {
- /*! Change the color depth of \a T.
- **
- ** For Example, calling color_mute with
- ** color<3, 8, rgb_traits>, 5 will give
- ** the type : color<3, 5, rgb_traits>.
- **
- ** \param T The data type of the image.
- **
- ** \param N The new number of bits by component.
- **
- */
-
- template <class T, unsigned N>
- struct color_mute
- {
- };
-
- /// Specialized version for ntg::color.
- template <unsigned nbcomps_,
- unsigned nbits_,
- template <unsigned> class color_system,
- unsigned N>
- struct color_mute<ntg::color<nbcomps_, nbits_, color_system>, N>
- {
- typedef ntg::color<nbcomps_, N, color_system> ret;
- /*! <The new value type.*/
- enum { nbcomps = nbcomps_ };
- /*! <The number of components */
- };
-
-
/*! \brief Sub quantify an image.
**
@@ -126,36 +131,22 @@
*/
template <class SrcType, unsigned N, class Exact>
struct subq_morpher:
- public abstract::generic_morpher<
- typename oln::mute<SrcType,
- typename color_mute<oln_value_type(SrcType),
- N>::ret>::ret ,
- SrcType,
+ public abstract::generic_morpher<SrcType,
typename oln::image_id<subq_morpher<SrcType, N, Exact> >::exact_type>
{
- /// The upper class.
- typedef abstract::generic_morpher<
- typename oln::mute<SrcType,
- typename color_mute<oln_value_type(SrcType),
- N>::ret>::ret,
- SrcType,
- typename oln::image_id<subq_morpher<SrcType, N, Exact> >::exact_type> super_type;
-
/// The exact type of \a this. This class can be derived.
typedef typename oln::image_id<subq_morpher<SrcType, N, Exact> >::exact_type exact_type;
- /// The type of the resulting image.
- typedef typename oln::mute<SrcType,
- typename color_mute<oln_value_type(SrcType),
- N>::ret>::ret DestType;
- typedef subq_morpher<SrcType, N, Exact> self_type;
+ /// The upper class.
+ typedef abstract::generic_morpher<SrcType,
+ exact_type> super_type;
/// The value point of the resulting image.
- typedef typename color_mute<oln_value_type(SrcType), N>::ret value_type;
- typedef oln_point_type(SrcType) point_type;
- typedef oln_impl_type(SrcType) impl_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::impl_type impl_type;
enum { nbcomps = color_mute<oln_value_type(SrcType), N>::nbcomps };
/// Construct the morpher with an image.
Index: olena/oln/morpher/color_morpher.hh
--- olena/oln/morpher/color_morpher.hh Tue, 30 Mar 2004 22:10:11 +0200 thivol_d (oln/m/26_color_morp 1.2 600)
+++ olena/oln/morpher/color_morpher.hh Fri, 02 Apr 2004 21:08:14 +0200 thivol_d (oln/m/26_color_morp 1.2 600)
@@ -64,19 +64,24 @@
/*! <Retrieve the exact type of the image. It depends on
** the value of Exact.
*/
+
+ typedef oln_point_type(I) point_type;
+ typedef oln_iter_type(I) iter_type;
};
+
/*! \brief Specialized version for color_morpher.
**
** \param I The type of the decorated image.
**
** \param Exact The exact type of the object.
*/
- template <class I, class Exact>
- struct image_traits <morpher::color_morpher<I, Exact> > :
- public image_traits<abstract::image_with_impl<oln_impl_type(I),
- morpher::color_morpher<I, Exact> > >
+ template <class SrcType, class Exact>
+ struct image_traits <morpher::color_morpher<SrcType, Exact> > :
+ public image_traits<morpher::abstract::generic_morpher<SrcType,
+ typename image_id<morpher::color_morpher<SrcType, Exact> >::exact_type> >
{
+
};
namespace morpher {
@@ -90,8 +95,9 @@
**
** \param Exact Exact type
*/
- template <class DestType, class SrcType, class Exact>
- class super_color_morpher : public abstract::generic_morpher<DestType, SrcType, Exact>
+ template <class SrcType, class Exact>
+ class super_color_morpher :
+ public abstract::generic_morpher<SrcType, Exact>
{
protected:
@@ -123,8 +129,8 @@
{}
public:
- typedef abstract::generic_morpher<DestType, SrcType, Exact> super_type;
- typedef oln_impl_type(SrcType) impl_type;
+ typedef abstract::generic_morpher<SrcType, Exact> super_type;
+ typedef typename image_id<Exact>::impl_type impl_type;
/// Return the number of the image component to retrieve.
unsigned
@@ -147,6 +153,8 @@
return ima_.impl();
}
+
+
static std::string
name()
{
@@ -169,29 +177,21 @@
*/
template <class SrcType, class Exact>
struct color_morpher :
- public super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
- ntg_comp_type(oln_value_type(SrcType))>::ret,
- SrcType,
+ public super_color_morpher<SrcType,
typename image_id<color_morpher<SrcType, Exact> >::exact_type >
{
/// The type of the object instantiated. color_morpher can be derived.
typedef typename image_id<color_morpher<SrcType, Exact> >::exact_type exact_type;
- /// The image will be viewed as a Destype image.
- typedef typename oln::mute<oln_exact_type(SrcType),
- ntg_comp_type(oln_value_type(SrcType))>::ret DestType;
typedef color_morpher<SrcType, Exact> self_type;
- typedef oln_iter_type(SrcType) iter_type;
+ typedef typename image_id<exact_type>::iter_type iter_type;
/*! <Type of the class iterator.*/
- typedef oln_point_type(SrcType) point_type;
+ typedef typename image_id<exact_type>::point_type point_type;
/*! <Type of the class point.*/
- typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
+ typedef typename image_id<exact_type>::value_type value_type;
/*! <The value type of the decorated image.*/
- typedef super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
- ntg_comp_type(oln_value_type(SrcType))>::ret,
- SrcType,
- typename image_id<color_morpher<SrcType, Exact> >::exact_type > super_type;
+ typedef super_color_morpher<SrcType, exact_type> super_type;
/*! <The upper class. */
/// Construct the color_morpher with an image \a ima and a component \a n.
@@ -264,25 +264,21 @@
*/
template <class SrcType, class Exact>
struct color_morpher<const SrcType, Exact> :
- public super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
- ntg_comp_type(oln_value_type(SrcType))>::ret,
- SrcType,
- typename image_id<color_morpher<const SrcType, Exact> >::exact_type>
+ public super_color_morpher<const SrcType,
+ typename image_id<color_morpher<const SrcType,
+ Exact> >::exact_type>
{
/// The type of the object instantiated. color_morpher can be derived.
- typedef typename image_id<color_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef typename image_id<color_morpher<const SrcType, Exact> >::exact_type exact_type;
- typedef oln_point_type(SrcType) point_type;
+ typedef typename image_id<exact_type>::point_type point_type;
/*! <The type of the class point.*/
- typedef oln_iter_type(SrcType) iter_type;
+ typedef typename image_id<exact_type>::iter_type iter_type;
/*! <The type of the class iterator.*/
- typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
+ typedef typename image_id<exact_type>::value_type value_type;
/*! <The value of the decorated image.*/
- typedef super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
- ntg_comp_type(oln_value_type(SrcType))>::ret,
- SrcType,
- typename image_id<color_morpher<const SrcType, Exact> >::exact_type> super_type;
+ typedef super_color_morpher<const SrcType, exact_type> super_type;
/*! <The upper class.*/
/// Construct the color_morpher with an image \a ima and a component \a n.
Index: olena/tests/morpher/tests/color_morph
--- olena/tests/morpher/tests/color_morph Tue, 30 Mar 2004 22:10:11 +0200 thivol_d (oln/m/45_color_morp 1.1 600)
+++ olena/tests/morpher/tests/color_morph Sat, 03 Apr 2004 14:21:59 +0200 thivol_d (oln/m/45_color_morp 1.1 600)
@@ -36,7 +36,9 @@
fail = fail | (oln::utils::md5(oln::morpher::gmorph(imc)) != oln::utils::key(data_key_c_g));
fail = fail | (oln::utils::md5(oln::morpher::bmorph(imc)) != oln::utils::key(data_key_c_b));
fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc_const)) != oln::utils::key(data_key_c_r));
- fail = fail | (oln::utils::md5(*(oln::morpher::rmorph(imc).unmorph())) != oln::utils::key(data_key_c_r));
+ fail = fail | (oln::utils::md5(mimd) != oln::utils::md5(mimc));
+// remove comments when it works ...
+// fail = fail | (oln::utils::md5(*(oln::morpher::rmorph(imc).unmorph())) != oln::utils::key(data_key_c_r));
if (!fail)
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
3