Olena
Threads by month
- ----- 2025 -----
- 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
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
February 2004
- 8 participants
- 10 discussions
Index: ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* NEWS: Describe new way to document.
* configure.ac: Add configuration files for doc.
Index: doc/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* ref/img_conv.pl: Add script for image conversion.
* ref/exdoc.mk.in: Add exdoc config file.
* ref/exdoc.config.in: Likewise.
* ref/doxygen.config.in: Add doxygen config file.
* ref/exdoc.pl: Add script to extract code from comments.
* ref/Makefile.am: Make Makefile use new doc tools.
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/morpho/attribute_closing_opening.hh: Add comments.
* oln/core/abstract/behavior.hh: Likewise.
* oln/core/behavior.hh: Likewise.
Index: configure.ac
--- configure.ac Sun, 21 Sep 2003 23:54:00 +0200 burrus_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.13 640)
+++ configure.ac Mon, 23 Feb 2004 16:59:35 +0100 palma_g (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.13 640)
@@ -231,6 +231,17 @@
### Stuff pertaining to the documentation
###
+### The reference manual uses Doxygen
+### FIXME: could be much better.
+
+AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
+## if test -z "$DOXYGEN"; then
+## AC_MSG_WARN([`doxygen' not found -- `doxygen' must be installed to generate the documentation])
+AC_CONFIG_FILES([doc/ref/doxygen.config
+ doc/ref/exdoc.config
+ doc/ref/exdoc.mk])
+## fi
+
### The documentation tree is both a component...
OLN_COMPONENT([doc],
Index: doc/ref/Makefile.am
--- doc/ref/Makefile.am Mon, 11 Aug 2003 15:35:58 +0200 burrus_n (oln/d/51_Makefile.a 1.27.1.8 640)
+++ doc/ref/Makefile.am Tue, 24 Feb 2004 15:44:53 +0100 palma_g (oln/d/51_Makefile.a 1.27.1.8 640)
@@ -1,106 +1,142 @@
-###
-### General definitions
-###
+# ###
+# ### General definitions
+# ###
-TEXI2PDF = $(TEXI2DVI) --pdf
-TEXI2PDF_FLAGS = --batch -I $(srcdir)/graphics
+# TEXI2PDF = $(TEXI2DVI) --pdf
+# TEXI2PDF_FLAGS = --batch -I $(srcdir)/graphics
-TEXI2DVI_FLAGS = --batch -I $(srcdir)/graphics
+# TEXI2DVI_FLAGS = --batch -I $(srcdir)/graphics
olnsrc = $(top_srcdir)/olena/oln
-include $(srcdir)/filelists.make
+# include $(srcdir)/filelists.make
-$(srcdir)/filelists.make: $(srcdir)/gen_filelists.sh
- $(SHELL) $@ $(olnsrc)
+# $(srcdir)/filelists.make: $(srcdir)/gen_filelists.sh
+# $(SHELL) $@ $(olnsrc)
-$(srcdir)/Makefile.in: $(srcdir)/filelists.make
+# $(srcdir)/Makefile.in: $(srcdir)/filelists.make
-###
-### Auto-generation of TeX files.
-###
-
-AM_LDFLAGS = $(LDFLAGS) $(ZLIB_LDFLAGS)
-AM_CXXFLAGS = $(CXXFLAGS) $(ZLIB_CXXFLAGS)
-
-INCLUDES = -I$(top_srcdir)/olena -I$(top_builddir)/olena
-COMMONGETDEFSFLAGS = --agarg=-DCXXCOMPILE="$(CXX) -I$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS)" \
- --agarg=-DEPSTOPDF="$(EPSTOPDF)" \
- --agarg=-DCONVERT="$(IMAGEMAGICK_CONVERT)" \
- --agarg=--templ-dirs=$(srcdir) \
- --agarg=-DIMGDIR=$(top_srcdir)/olena/img
-PROCESSINGGETDEFSFLAGS = \
- --subblock=tpl=type,name,doc \
- --subblock=arg=type,name,mode,doc \
- --listattr=exh \
- --listattr=ns \
- --template $(srcdir)/processing.tpl \
- --srcfile
-
-ref-morpho.tex: $(morpho_files) $(srcdir)/processing.tpl
- $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \
- $(GETDEFSFLAGS) --base-name=ref-morpho $(morpho_files)
-
-ref-level.tex: $(level_files) $(srcdir)/processing.tpl
- $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \
- $(GETDEFSFLAGS) --base-name=ref-level $(level_files)
-
-###
-### Rules to build the manuals.
-###
-
-tex_TEX = oln-ref.tex
-
-built_oln_ref_TEX = ref-morpho.tex ref-level.tex
-oln_ref_TEX = $(built_oln_ref_TEX) integre-ref.tex
-
-oln-ref.dvi: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
- $(TEXI2DVI) $(TEXI2DVI_FLAGS) \
- `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
-
-oln-ref.pdf: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
- $(TEXI2PDF) $(TEXI2PDF_FLAGS) \
- `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
-
-# This rule is not activated by default since the generated files cannot
-# be easily distributed (automake barks loudly when the filenames are
-# not known at the time Makefile.in is generated)
-
-# FIXME: uncomment when ready
-# cp $(srcdir)/graphics/*-html.png html/
-
-html.tar.gz: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
- $(HEVEA) -fix -o html/oln-ref.html -I $(srcdir) -I $(srcdir)/graphics `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
- cd html && $(HACHA) -tocbis -o index.html oln-ref.html; cd ..
- $(TAR) -czf $@ html
+# ###
+# ### Auto-generation of TeX files.
+# ###
+
+# AM_LDFLAGS = $(LDFLAGS) $(ZLIB_LDFLAGS)
+# AM_CXXFLAGS = $(CXXFLAGS) $(ZLIB_CXXFLAGS)
+
+# INCLUDES = -I$(top_srcdir)/olena -I$(top_builddir)/olena
+# COMMONGETDEFSFLAGS = --agarg=-DCXXCOMPILE="$(CXX) -I$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS)" \
+# --agarg=-DEPSTOPDF="$(EPSTOPDF)" \
+# --agarg=-DCONVERT="$(IMAGEMAGICK_CONVERT)" \
+# --agarg=--templ-dirs=$(srcdir) \
+# --agarg=-DIMGDIR=$(top_srcdir)/olena/img
+# PROCESSINGGETDEFSFLAGS = \
+# --subblock=tpl=type,name,doc \
+# --subblock=arg=type,name,mode,doc \
+# --listattr=exh \
+# --listattr=ns \
+# --template $(srcdir)/processing.tpl \
+# --srcfile
+
+# ref-morpho.tex: $(morpho_files) $(srcdir)/processing.tpl
+# $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \
+# $(GETDEFSFLAGS) --base-name=ref-morpho $(morpho_files)
+
+# ref-level.tex: $(level_files) $(srcdir)/processing.tpl
+# $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \
+# $(GETDEFSFLAGS) --base-name=ref-level $(level_files)
+
+# ###
+# ### Rules to build the manuals.
+# ###
+
+# tex_TEX = oln-ref.tex
+
+# built_oln_ref_TEX = ref-morpho.tex ref-level.tex
+# oln_ref_TEX = $(built_oln_ref_TEX) integre-ref.tex
+
+# oln-ref.dvi: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
+# $(TEXI2DVI) $(TEXI2DVI_FLAGS) \
+# `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
+
+DOXYGEN = doxygen
+EXDOC = $(srcdir)/exdoc.pl
+OUT_DIR = "out"
+IMG_CONV = $(srcdir)/img_conv.pl
+code:
+ $(EXDOC) --config=exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir)
+
+execute: code
+ mkdir -p img
+ cd $(OUT_DIR) && make -f makefile
+
+images: execute
+ $(IMG_CONV) $(top_srcdir)/olena/img img
+ $(IMG_CONV) img img
-###
-### What gets distributed.
-###
+doxygen: images
+ $(DOXYGEN) doxygen.config
-dist_noinst_DATA = oln-ref.pdf oln-ref.dvi bin.tar.gz html.tar.gz
+html: doxygen
-EXTRA_DIST = $(tex_TEX) $(oln_ref_TEX) \
- processing.tpl filelists.make gen_filelists.sh
-bin.tar.gz: oln-ref.pdf oln-ref.dvi
- $(TAR) -czf $@ `test -f bin/lena256.pdf || echo '$(srcdir)/'`bin
+doc: html pdf
-###
-### What gets cleaned.
-###
+
+oln-ref.pdf: doxygen
+ cd latex && make && cp refman.pdf ../$@
+
+
+# oln-ref.pdf: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
+# $(TEXI2PDF) $(TEXI2PDF_FLAGS) \
+# `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
+
+# # This rule is not activated by default since the generated files cannot
+# # be easily distributed (automake barks loudly when the filenames are
+# # not known at the time Makefile.in is generated)
+
+# # FIXME: uncomment when ready
+# # cp $(srcdir)/graphics/*-html.png html/
+
+# html.tar.gz: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA)
+# $(HEVEA) -fix -o html/oln-ref.html -I $(srcdir) -I $(srcdir)/graphics `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX)
+# cd html && $(HACHA) -tocbis -o index.html oln-ref.html; cd ..
+# $(TAR) -czf $@ html
+
+html.tar.gz: html
+ $(TAR) -czf $@ html
+
+# ###
+# ### What gets distributed.
+# ###
+
+dist_noinst_DATA = oln-ref.pdf html.tar.gz
+
+# EXTRA_DIST = $(tex_TEX) $(oln_ref_TEX) \
+# processing.tpl filelists.make gen_filelists.sh
+
+# bin.tar.gz: oln-ref.pdf oln-ref.dvi
+# $(TAR) -czf $@ `test -f bin/lena256.pdf || echo '$(srcdir)/'`bin
+
+# ###
+# ### What gets cleaned.
+# ###
+# dist-local:
+# rm -f bin/*a.out$(EXEEXT)
dist-local:
- rm -f bin/*a.out$(EXEEXT)
+ rm -f img/*
-MAINTAINERCLEANFILES = $(built_oln_ref_TEX) $(dist_noinst_DATA) \
- $(srcdir)/html/* $(srcdir)/bin/* \
- $(srcdir)/filelists.make
+# MAINTAINERCLEANFILES = $(built_oln_ref_TEX) $(dist_noinst_DATA) \
+# $(srcdir)/html/* $(srcdir)/bin/* \
+# $(srcdir)/filelists.make
-CLEANFILES = = *.tmp *.aux *.bbl *blg *.lot *.log *.out *.toc
+MAINTAINERCLEANFILES = $(dist_noinst_DATA) \
+ ./html/* ./img/* $(OUT_DIR)/*
-###
-### What gets installed.
-###
+# CLEANFILES = = *.tmp *.aux *.bbl *blg *.lot *.log *.out *.toc
+
+# ###
+# ### What gets installed.
+# ###
docdir = $(datadir)/doc/@PACKAGE_TARNAME@
@@ -120,3 +156,4 @@
echo " rm -f $(DESTDIR)$(docdir)/$$p1"; \
rm -f $(DESTDIR)$(docdir)/$$p1; \
done
+
Index: NEWS
--- NEWS Tue, 10 Feb 2004 17:32:17 +0100 palma_g (oln/0_NEWS 1.19 640)
+++ NEWS Tue, 24 Feb 2004 15:21:04 +0100 palma_g (oln/0_NEWS 1.19 640)
@@ -1,5 +1,22 @@
Olena 0.10 Not yet
+ * New documentaion system.
+ Now any comment should use doxygen style (i.e. /*! ... */).
+ You can also put some code in comments to make them
+ compile at documentation generation time. It is useful to
+ illustrate some algorithm with concrete input and output. To
+ use this feature the only thing to be done is to put the
+ code into \code and \endcode tags. If you produce an image,
+ you can include it in the comments with the \image command,
+ using the same name you used to produce it, but with the png
+ extension. To make sure your image will not overwrite
+ another existing one, you should name it with taking care of
+ the name of the file you are writing in: e.g. if you comment the
+ file oln/core/behavior.hh, an image should be named
+ oln_core_behavior_hh_whatever_you_want.ppm It can be added that
+ two macros are provided to make abstraction of input and
+ output direcectories, they are named IMG_IN and IMG_OUT.
+
* Border behavior can be controlled with the behavior hierarchy.
If an algorithm support it, you can choose the way the image
border will be seen. Three behaviors are available: mirror,
Index: olena/oln/morpho/attribute_closing_opening.hh
--- olena/oln/morpho/attribute_closing_opening.hh Mon, 16 Feb 2004 19:06:24 +0100 palma_g (oln/q/49_attribute_ 1.14 640)
+++ olena/oln/morpho/attribute_closing_opening.hh Tue, 24 Feb 2004 16:20:46 +0100 palma_g (oln/q/49_attribute_ 1.14 640)
@@ -30,13 +30,50 @@
#include <oln/morpho/attribute_union_find.hh>
+/*! \namespace oln
+** \brief oln namespace
+*/
namespace oln {
+ /*! \namespace oln::morpho
+ ** \brief oln::morpho namespace
+ */
namespace morpho {
+ /*! \namespace oln::morpho::fast
+ ** \brief oln::morpho::fast namespace
+ */
namespace fast {
+ /*! \namespace oln::morpho::fast::tarjan
+ ** \brief oln::morpho::fast::tarjan namespace
+ */
namespace tarjan {
+ /*! \namespace oln::morpho::fast::tarjan::internal
+ ** \brief oln::morpho::fast::tarjan::internal namespace
+ */
namespace internal {
- // attribute closing
+ /*!
+ ** \brief perform an attribute closing
+ **
+ ** FIXME: ONLY A TEST
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <oln/morpho/attribute_closing_opening.hh>
+ ** #include <oln/level/compare.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ ** int main()
+ ** {
+ ** typedef oln::image2d<ntg::int_u8> im_type;
+ **
+ ** im_type im1(oln::load(IMG_IN "lena256.pgm"));
+ ** im1 = oln::morpho::fast::area_closing(im1, oln::neighb_c4(), 200);
+ ** oln::save(im1, IMG_OUT "olena_attribute_closing_opening_hh_attr_clo.ppm");
+ ** return 0;
+ ** }
+ ** \endcode
+ ** \image html lena256.png \image latex lena256.png => \image html olena_attribute_closing_opening_hh_attr_clo.png \image latex olena_attribute_closing_opening_hh_attr_clo.png
+ **
+ */
template<class I, class N, class A>
oln_concrete_type(I)
attr_closing_(const abstract::non_vectorial_image<I>& input,
Index: olena/oln/core/abstract/behavior.hh
--- olena/oln/core/abstract/behavior.hh Tue, 10 Feb 2004 15:35:04 +0100 palma_g (oln/j/46_behavior.h 1.1 644)
+++ olena/oln/core/abstract/behavior.hh Mon, 23 Feb 2004 17:32:31 +0100 palma_g (oln/j/46_behavior.h 1.1 644)
@@ -31,24 +31,44 @@
# include <oln/core/abstract/image.hh>
# include <oln/core/coord.hh>
+/*! \namespace oln
+** \brief oln namespace
+*/
namespace oln {
+ /*! \namespace abstract
+ ** \brief abstract namespace
+ */
namespace abstract {
- // behavior hierarchy
- //the aim of this one is to describe how an algorithm should work
- //on borders
+
+ /*! \class behavior
+ ** behavior hierarchy
+ **
+ ** the aim of this one is to describe how an algorithm should work
+ ** on borders
+ */
template <class Exact>
class behavior: public mlc_hierarchy::any<Exact>
{
public:
- typedef behavior<Exact> self_type;
- typedef mlc_exact_vt_type(self_type, Exact) exact_type;
+ typedef behavior<Exact> self_type; /*!< the self type*/
+ typedef mlc_exact_vt_type(self_type, Exact) exact_type; /*!< the exact type*/
+ /*!
+ ** \brief Adapt the border of an image
+ **
+ ** Adapt the border of an image regarding the kind of behavior wanted.
+ */
template <class I>
void adapt_border(oln::abstract::image<I> &im, coord border_size) const
{
mlc_dispatch(adapt_border)(im, border_size);
};
protected:
+ /*!
+ ** \brief CTor
+ **
+ ** Do nothing, used only by sub-classes
+ */
behavior() {};
};
} // !abstract
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Tue, 10 Feb 2004 15:35:04 +0100 palma_g (oln/j/47_behavior.h 1.1 644)
+++ olena/oln/core/behavior.hh Tue, 24 Feb 2004 11:03:29 +0100 palma_g (oln/j/47_behavior.h 1.1 644)
@@ -31,6 +31,10 @@
# include <mlc/type.hh>
namespace oln {
+ /*! \class mirror_behavior
+ **
+ ** make the border be a mirror of the image
+ */
// mirror the image content into the border
template <class Exact = mlc::final>
class mirror_behavior:
Index: doc/ref/exdoc.pl
--- doc/ref/exdoc.pl Tue, 24 Feb 2004 16:30:39 +0100 palma_g ()
+++ doc/ref/exdoc.pl Mon, 23 Feb 2004 19:58:25 +0100 palma_g (oln/v/26_exdoc.pl 1.2 755)
@@ -0,0 +1,447 @@
+#! /usr/bin/perl -w
+# Extract all examples from the manual source.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA
+
+use strict;
+use IO::File;
+use Text::Wrap;
+use File::Basename;
+use Getopt::Long qw(GetOptions);
+use Pod::Usage qw(pod2usage);
+
+## WARNING SOME PIECE OF CODE WORKING ON TEXI FILES SHOULD BE REMOVED
+## BOFORE DOING THIS, MAKE SURE THE SAME JOB IS PERFORMED BY THE
+## CONFIGURATION DEPENDANT WAY
+
+my $me = basename ($0);
+
+# Array of hash tables holding the information from the config file
+my @config;
+
+# Print the usage method
+sub print_usage()
+{
+ print "Usage:\n";
+ print "$me --configfile=[cfg] --default-name=[default name] --srcdir=[dir to find includes file] --output-dir=[dir to put result]\n";
+ exit(1);
+}
+
+# &parse_config ($FILE)
+# ---------------------
+# Parse the config file.
+sub parse_config($)
+{
+ open (CONFIGFILE, $_[0]) or die "$me: Can't open $_[0]: $!";
+
+ # Number of entries
+ my $entries = -1;
+
+ while (<CONFIGFILE>)
+ {
+ if (/\[ENTRY\]/) { $entries++ }
+ else
+ {
+ SWITCH:
+ {
+ last SWITCH if (/^\s*(\#+.*)*$/);
+ $config[$entries]{"command_prefix"} = $1 and last SWITCH if (/\s*COMMAND_PREFIX\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"tag_open"} = $1 and last SWITCH if (/\s*TAG_OPEN\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"tag_close"} = $1 and last SWITCH if (/\s*TAG_CLOSE\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"captions"} = $1 and last SWITCH if (/\s*CAPTIONS\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"options"} = $1 and last SWITCH if (/\s*OPTIONS\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"out"} = $1 and last SWITCH if (/\s*OUT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"std_out"} = $1 and last SWITCH if (/\s*STD_OUT_EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"err_out"} = $1 and last SWITCH if (/\s*ERR_OUT_EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"ext"} = $1 and last SWITCH if (/\s*EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"$1"} = $2 and last SWITCH if (/\s*ALIAS\s*([^\s]*)\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"comment_style"} = $1 and last SWITCH if (/\s*COMMENT_STYLE\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ die "$0: Error: Unmatching entry: $_";
+ }
+ }
+ }
+ close CONFIGFILE;
+ die "$me: Invalid config file `$_[0]'" if ($entries == -1); # FIXME: not strict enough.
+
+ for (my $i = 0; $i < @config; $i++)
+ {
+ $config[$i]{"tag_open"} = $config[$i]{"command_prefix"} . $config[$i]{"tag_open"};
+ $config[$i]{"tag_close"} = $config[$i]{"command_prefix"} . $config[$i]{"tag_close"};
+ }
+
+ for my $i ( 0 .. $#config )
+ {
+ for my $role ( keys %{ $config[$i] } )
+ {
+ print "elt $i $role is $config[$i]{$role}\n";
+ }
+ }
+}
+
+# get the real value of a field
+# $i: the current entry number
+# $name: the alias name
+sub get_alias($ $)
+{
+ my ($i, $name) = @_;
+ while (defined($config[$i]{$name}))
+ {
+ $name = $config[$i]{$name};
+ }
+ return $name;
+}
+
+# create the cmd line to be executed
+# $i: the current entry number
+sub gen_cmd($ $)
+{
+ my ($i, $prog) = @_;
+ my $cmd = get_alias $i, $config[$i]{"captions"};
+ $cmd = "$cmd ".$config[$i]{"options"};
+ return $cmd." && ./$prog > $prog.".$config[$i]{"std_out"}." 2> $prog.".$config[$i]{"err_out"}."\nexit \$?\n";
+}
+
+# Dependencies of KEY as a simple string.
+my %dependency;
+# Set to 1 if KEY is not to keep as a dependency.
+my %ignore;
+
+# &DEPEND ($TARGET, @DEPENDENCY)
+# ------------------------------
+sub depend ($@)
+{
+ my ($target, @dependency) = @_;
+ @dependency = (grep { !exists $ignore{$_} } @dependency);
+ push @{$dependency{$target}}, @dependency
+ if @dependency;
+}
+
+# List of files already opened. $FILE{FILE} is where FILE was
+# first defined.
+my %file;
+
+# ®ister ($FILE)
+# -----------------
+# Make sure the $FILE name is used only once (as input or output), to
+# avoid clashes.
+sub register ($)
+{
+ my ($file2) = @_;
+ if (defined $file{$file2})
+ {
+ die "$file2 already in use\n";
+ }
+ $file{$file2} = $file2;
+}
+
+
+# example_to_verbatim(CODE)
+# -------------------------
+# content: txt
+# style: comment style
+sub example_to_verbatim ($ $)
+{
+ my ($contents, $style) = @_;
+
+ $contents =~ s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*$//gm;
+ # Remove the Texinfo tags.
+ $contents =~ s/^\@(error|result)\{\}//gsm;
+ $contents =~ s/\@([{@}])/$1/gsm;
+ $contents =~ s/^\(a)comment.*//gm;
+ # remove the comment style sequence
+ $contents =~ s/^\s*$style//gm;
+
+ return $contents;
+}
+
+
+# &REPORT (@MESSAGE)
+# ------------------
+# Report some @MESSAGE to the user.
+sub message (@)
+{
+ print STDERR "$me: ", @_, "\n";
+}
+
+
+# &STORE ($FILE, $CONTENTS)
+# -------------------------
+# Save the $CONTENTS in the $FILE, unless it already contains $WHAT.
+sub store ($$)
+{
+ my ($file, $contents) = @_;
+ if (-f $file)
+ {
+ local $/; # Turn on slurp-mode.
+ my $f = new IO::File "< $file"
+ or die "$me: cannot open $file for reading: $!\n";
+ my $old_contents = $f->getline;
+ if ($old_contents eq $contents)
+ {
+ message "$file: unchanged";
+ return ;
+ }
+ }
+ my $out = new IO::File (">$file")
+ or die "$me: cannot create $file: $!\n";
+ print $out $contents;
+ message "$file: new";
+}
+
+# The directory where to store the extracted results.
+# Parse our options, trying to retain backwards compatibility with pod2man but
+# allowing short forms as well. --lax is currently ignored.
+my %option;
+Getopt::Long::config ('bundling_override');
+
+my $odir = "extract";
+my $idir = ".";
+my $srcdir = ".";
+my $default_name;
+GetOptions (\%option,
+ 'configfile|c=s',
+# 'default-name|n=s' => \$default_name,
+ 'srcdir|s=s' => \$srcdir,
+ 'input-dir|I=s' => \$idir,
+ 'output-dir|O=s' => \$odir,
+ 'help|h') or exit 1;
+pod2usage (0) if $option{help};
+
+#print_usage() unless (defined($default_name));
+
+##my $default_name = $option{"default-name"}; ## | for auto generated file name
+my $current_file_no;
+
+
+if (! -d $odir)
+{
+ mkdir $odir or die "$me: cannot create $odir: $!\n";
+}
+my $makefile = new IO::File "> $odir/makefile"
+ or die "$me: cannot create $odir/makefile: $!\n";
+my $all_mk = new IO::File "> $odir/all.mk"
+ or die "$me: cannot create $odir/all.mk: $!\n";
+print $makefile "include $srcdir/../exdoc.mk\n";
+print $makefile ".PHONY: all dvi eps html pdf txt\n";
+# print $makefile "all: txt\n";
+my $example;
+my $last_file;
+
+parse_config ($option{"configfile"});
+print $all_mk "all:";
+print $makefile "include all.mk\n";
+for (my $i = 0; $i < @config; $i++)
+{
+ print $makefile ".";
+ print $makefile $config[$i]{"ext"};
+ print $makefile ":\n\t";
+ print $makefile "chmod 700 ./\$<.cmd ";
+ print $makefile "&& eval ./\$@.";
+ print $makefile $config[$i]{"ext"};
+ print $makefile ".cmd \$< \$@";
+ print $makefile "\n\n";
+}
+
+sub parse($)
+{
+ $current_file_no = 0;
+ open (FILE, $_[0]) or die "$me: Can't open $_[0]: $!";
+ while (<FILE>)
+ {
+ ## @dotcaption{ord, file}
+ ## ======================
+ if (/^\(a)dotcaption{([-.\w]+),\s*([^\}]+)}/)
+ {
+ my $ord = $1;
+ my $file = $2;
+ register $ord;
+ register $file;
+ store "$odir/$ord.file", "$file.dot";
+ depend "html", "$ord.jpg";
+ depend "pdf", "$ord.pdf";
+ depend "txt", "$ord.txt";
+ depend "dvi", "$ord.eps";
+ }
+
+ ## @example/@end example
+ ## =====================
+ ## Memoize the contents.
+ else
+ {
+ my $i = 0;
+
+ for ($i = 0; ($i < @config)
+ && not ((/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_open"}\s*$/ .. /^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_close"}\s*$/)); $i++)
+ {
+ }
+
+ if ($i < @config)
+ {
+ if (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_open"}\s*$/)
+ {
+ # Nothing.
+ undef $example;
+ }
+ elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_close"}\s*$/)
+ {
+ my $fname;
+ my $cmdname;
+ my $ext = $config[$i]{"ext"};
+
+ $ext = ".$ext";
+ if (not defined $last_file)
+ {
+ $last_file = "$default_name$current_file_no";
+ $current_file_no = $current_file_no + 1;
+ }
+ # Output as a verbatim file.
+ $fname = "$odir/$last_file$ext";
+ $cmdname = "$odir/$last_file$ext.cmd";
+ register $fname;
+ register $cmdname;
+ store $fname, example_to_verbatim ($example, $config[$i]{"comment_style"});
+ store $cmdname, gen_cmd ($i, $last_file);
+ depend $last_file, "$last_file$ext", "$last_file$ext.cmd";
+ print $all_mk "$last_file ";
+ undef $last_file;
+ }
+ ## @filecaption{ord, filename}
+ ## Outputting the previous @example as a file.
+ elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}filecaption{([-.\w]+),\s*([^\}]+)}/)
+ {
+ my ($ord, $file) = ($1, "$2");
+# register $file;
+ $last_file = $file;
+ }
+ else
+ {
+ $example = $example . $_;
+ }
+ }
+
+
+ ## @c extdoc-ignore: file
+ ## ## A file that we should not depend upon (e.g., it does not exist).
+ elsif (/^\@c extdoc-ignore: (.*)$/)
+ {
+ message "ignoring $1";
+ $ignore{$1} = 1;
+ }
+
+
+ ## @havmcaption{ord, args}
+ ## @mipsycaption{ord, args}
+ ## @tccaption{ord, args}
+ ## @sedcaption{ord, args}
+ ## ## Running `havm', `mipsy', `tc', or `sed' on the ARGS.
+ else
+ {
+ my $i = 0;
+ for ($i = 0; ($i < @config) &&
+ not (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/); $i++)
+ {}
+ if ($i < @config && /^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/)
+ {
+ my $prog;
+
+
+ if (defined $config[$i]{$1})
+ {
+ $prog = $config[$i]{$1};
+
+ print $prog;
+ }
+ else
+ {
+ $prog = $1;
+ }
+ my $ord = $2;
+ my $args = $3;
+ my $out = "$ord.$config[$i]{out}";
+# register $out;
+ store "$odir/$ord.cmd", "$prog $args";
+ depend "pdf", $out;
+ depend "html", $out;
+ depend "txt", $out;
+ depend "dvi", $out;
+
+ # Dependencies: args except options and output redirections.
+ depend $out, grep { !/^[->]/ } split (' ', $args);
+ }
+ }
+ }
+ }
+ close FILE;
+}
+# go through all rep and sub rep and make stuff on matching file
+sub scanDir
+{
+ my $file;
+ my ($d, $name) = @_;#$_[0];
+ opendir DIR, "$d" or print <STDERR>, "unable to open $d: skipping\n";
+ foreach $file(readdir DIR)
+ {
+ if ((-d "$d/$file") && ($file ne ".") && ($file ne ".."))
+ {
+ &scanDir("$d/$file", "$name"."_$file");
+ }
+ else
+ {
+ if ($file =~ /(.*)\.(h(h|xx)|cc|inc)$/)
+ {
+ $file = "$file";
+# compileAndExecute("$d/$file");
+ print "parsing $d/$file as ";
+ print "$name"."_$1_$2\n";
+ $default_name = "$name"."_$1_$2";
+
+ parse "$d/$file";
+ }
+ }
+ }
+ # closedir DIR or print("unable to close $d: skipping\n"); # to be fixed
+}
+
+scanDir $idir, "out";
+
+for my $target (sort keys %dependency)
+{
+ print $makefile "$target: ";
+ my @dep = @{$dependency{$target}};
+ for (my $k=0; $k != $#dep; $k++)
+ {
+ print $makefile " ".$dep[$k];
+ }
+ print $makefile "\n";
+}
+print $all_mk "\n";
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
+
Index: doc/ref/doxygen.config.in
--- doc/ref/doxygen.config.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g ()
+++ doc/ref/doxygen.config.in Tue, 24 Feb 2004 13:33:45 +0100 palma_g (oln/v/29_doxygen.co 1.1 644)
@@ -0,0 +1,214 @@
+# Doxyfile 1.3.2
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = @PACKAGE_NAME@
+PROJECT_NUMBER = @PACKAGE_VERSION@
+OUTPUT_DIRECTORY = .
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+SHORT_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES = pouetcaption=
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SHOW_USED_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = @top_srcdir@/
+FILE_PATTERNS = *.hh \
+ *.hxx \
+ *.cc
+RECURSIVE = YES
+EXCLUDE = @top_srcdir@/doc \
+ @top_srcdir@/olena/tests \
+ @top_srcdir@/integre/tests \
+ @top_srcdir@/metalic/tests
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH = @top_builddir@doc/ref/img/
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH = @top_srcdir@/olena/ \
+ @top_srcdir@/integre/ \
+ @top_srcdir@/metalic/
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = YES
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 0
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = YES
+CGI_NAME = search.cgi
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
+BIN_ABSPATH = /usr/local/bin/
+EXT_DOC_PATHS =
Index: doc/ref/exdoc.mk.in
--- doc/ref/exdoc.mk.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g ()
+++ doc/ref/exdoc.mk.in Mon, 29 Sep 2003 21:50:01 +0200 palma_g (oln/k/1_exdoc.mk.i 644)
@@ -0,0 +1,56 @@
+%.dot: %.file
+ cp $$(cat $<) $@
+
+%.texi: %.cmd
+## Eval the cmd to preserve embedded redirections.
+ eval $$(cat $<) >$*.out 2>$*.err; \
+ echo $$? >$*.sta
+ rm -f $@
+ echo '@example' >> $@
+ echo "$$ @kbd{$$(cat $<)}" >> $@
+ if test -s $*.err; then \
+ sed -n -e 's/\([{@}]\)/@\1/g' \
+ -e '/./s/.*/@error{}&/p' $*.err >> $@;\
+ fi
+ if test -s $*.out; then \
+ expand $*.out | \
+ sed -e 's/\([{@}]\)/@\1/g' \
+ -e "s/é/@'e/g" \
+ -e 's/è/@`e/g' \
+ -e 's/ê/@^e/g' \
+ -e 's/ë/@"e/g' \
+ -e 's/î/@^i/g' \
+ -e 's/ï/@"i/g' \
+ -e 's/ô/@^o/g' \
+ >>$@;\
+ fi
+## Display the exit status only if not 0, as it confuses the
+## students to see so many `=> 0'. But, if there is nothing output
+## at all, it is even more confusing, so output `=> 0' only when
+## needed.
+ if test ! -e $@ \
+ || test $$(cat $*.sta) -ne 0; then \
+ sed 's/.*/@result{}&/' $*.sta >> $@; \
+ fi
+ echo "@strong{Example $*}: @kbd{$$(cat $<)}" >> $@
+ echo '@end example' >> $@
+
+## Once for PDF.
+## ratio = 2 makes it wider.
+## size (in Inches) makes it fit into A4.
+%.eps: %.dot
+ dot -Gratio=2 -Gsize=8,8 -Tps2 $*.dot -o $*.ps
+ ps2epsi $*.ps $*.eps
+
+%.pdf: %.eps
+ epstopdf $*.eps -o $*.pdf
+
+## Another for HTML (JPG), using natural size.
+%.jpg: %.dot
+ dot -Tps2 $*.dot -o $*.j.ps
+ ps2epsi $*.j.ps $*.j.eps
+ convert $*.j.eps $*.jpg
+
+## And the text...
+%.txt: %.dot
+ cp $< $@
Index: doc/ref/exdoc.config.in
--- doc/ref/exdoc.config.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g ()
+++ doc/ref/exdoc.config.in Tue, 24 Feb 2004 15:01:50 +0100 palma_g (oln/k/2_exdoc.conf 644)
@@ -0,0 +1,12 @@
+[ENTRY]
+ COMMAND_PREFIX = \\ # In Doxygen, commands begin with a `\'
+ TAG_OPEN = code
+ 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@ -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
+ ERR_OUT_EXT = err # Extension of generated file error output
+ COMMENT_STYLE = \*\* # begining of comment line
Index: doc/ref/img_conv.pl
--- doc/ref/img_conv.pl Tue, 24 Feb 2004 16:30:39 +0100 palma_g ()
+++ doc/ref/img_conv.pl Tue, 24 Feb 2004 15:57:37 +0100 palma_g (oln/k/3_img_conv.p 644)
@@ -0,0 +1,47 @@
+#! /usr/bin/perl -w
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA
+
+
+use strict;
+use IO::File;
+use Text::Wrap;
+use File::Basename;
+use Getopt::Long qw(GetOptions);
+use Pod::Usage qw(pod2usage);
+
+
+sub conv($ $)
+{
+ my $file;
+ my $d = $_[0];
+ my $o = $_[1];
+ opendir DIR, "$d" or die "Unable to open $d.\n";
+ foreach $file(readdir DIR)
+ {
+ if ($file =~ /(.*)\.(pgm|ppm|ppgm|pppgm)$/)
+ {
+ print "convert $d/$file to $o/$1.png\n";
+ system "convert $d/$file $o/$1.png";
+ }
+ }
+ closedir DIR or die "unable to close $d.";
+}
+my $argc=@ARGV;
+if ($argc != 2)
+{
+ die "usage: img_conv.pl input-dir output-dir\n";
+}
+conv $ARGV[0], $ARGV[1];
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
2
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Save 70 percent on Viagra Save 70 percent on Viagra and
Increase Sex Drive. Most places charge $19.95, we charge only
URI:http://www.medz4cheap.com//via/?mrbig $2.95.
URI:http://www.medz4cheap.com//via/?mrbig What is ZENEGRA (Generic
Viagra)? ZENEGRA is a male impotence drug. It helps men obtain and
maintain an erection. Men that do not have impotence problems report
that ZENEGRA increases sexual pleasure and staying power, as well as
increasing the size and hardness of erections. 744114617
URI:http://www.medz4cheap.com//via/?mrbig Why should I buy ZENEGRA
(Generic Viagra)? We the cheapest source of generic Viagra on the
Internet. Viagra has helped over 25,000,000 American men regain their
sexual power. 242503 URI:http://www.medz4cheap.com//via/?mrbig Will you
ship ZENEGRA (Generic Viagra) to my country? Generic Viagra Online
ships worldwide including Canada, Japan, UK and Australia. We ship our
product in a discrete brown package that does not mention the contents
of the shipment. All orders are shipped from India and usually take
15-30 days to arive. 242503 URI:http://www.medz4cheap.com//via/?mrbig
How do i pay for ZENEGRA (Generic Viagra)? We accept major creditcards,
and checking accounts (US only). All data is transmitted directly to
the bank using 134bit encription, and processed instantly. We never
keep your information stored on our server. You are totally safe to
order online from us. Infact ordering online from us is safer than
using your card at a restaurant or store. 288708127
URI:http://www.medz4cheap.com//via/?mrbig Buy ZENEGRA Generic Viagra
and save over 70 percent! We have the worlds lowest prices GUARANTEED.
[...]
Content analysis details: (35.4 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
2.1 FROM_WEBMAIL_END_NUMS6 From webmail service and address ends in numbers
0.3 NO_REAL_NAME From: does not include a real name
0.9 FROM_ENDS_IN_NUMS From: ends in numbers
1.7 INVALID_DATE_TZ_ABSURD Invalid Date: header (timezone does not exist)
1.1 FROM_NUM_AT_WEBMAIL From address is webmail, but starts with a number
2.8 SUBJ_VIAGRA Subject includes "viagra"
0.7 ADDR_NUMS_AT_BIGSITE Uses an address with lots of numbers, at a big ISP
1.6 FROM_STARTS_WITH_NUMS From: starts with nums
4.2 IMPOTENCE BODY: Impotence cure
4.3 GENERIC_VIAGRA BODY: Mentions Generic Viagra
1.9 INCREASE_SEX BODY: Talks about a bigger drive for sex
1.1 VIAGRA_ONLINE BODY: Fast Viagra Delivery
0.5 HTML_40_50 BODY: Message is 40% to 50% HTML
0.0 HTML_MESSAGE BODY: HTML included in message
0.1 HTML_FONT_BIG BODY: HTML has a big font
0.1 HTML_FONTCOLOR_UNSAFE BODY: HTML font color not in safe 6x6x6 palette
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.4 HTML_FONT_INVISIBLE BODY: HTML font color is same as background
0.1 HTML_FONTCOLOR_RED BODY: HTML font color is red
0.6 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date
0.5 FORGED_YAHOO_RCVD 'From' yahoo.com does not match 'Received' headers
1.1 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=217.162.102.21>]
2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address
[217.162.102.21 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS
[217.162.102.21 listed in dnsbl.sorbs.net]
1.2 FROM_ALL_NUMS From an address that is all numbers (non-phone)
1.1 FORGED_MUA_IMS Forged mail pretending to be from IMS
4.3 FORGED_IMS_HTML IMS can't send HTML message only
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: OEM Software URI:http://www.valuedsoft.biz/?242418
Specials good thru 11/12/03. Please use discount code mail9221 to
receive these prices. Software: Windows XP Suites, Adobe software,
Clearance, Corel Draw/Corel Ventura, Games, 3D Studio Max, Operating
Systems, Utilities. [...]
Content analysis details: (14.7 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.3 NO_REAL_NAME From: does not include a real name
0.9 FROM_ENDS_IN_NUMS From: ends in numbers
0.7 ADDR_NUMS_AT_BIGSITE Uses an address with lots of numbers, at a big ISP
1.6 FROM_STARTS_WITH_NUMS From: starts with nums
0.1 HTML_FONTCOLOR_UNKNOWN BODY: HTML font color is unknown to us
0.1 HTML_TAG_BALANCE_A BODY: HTML has excess "a" close tags
0.0 HTML_MESSAGE BODY: HTML included in message
0.2 HTML_TAG_BALANCE_TABLE BODY: HTML is missing "table" close tags
0.1 HTML_FONT_BIG BODY: HTML has a big font
0.1 HTML_70_80 BODY: Message is 70% to 80% HTML
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.8 BIZ_TLD URI: Contains a URL in the BIZ top-level domain
2.0 DATE_IN_FUTURE_12_24 Date: is 12 to 24 hours after Received: date
1.1 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=67.87.229.145>]
0.5 RCVD_IN_NJABL_DIALUP RBL: NJABL: dialup sender did non-local SMTP
[67.87.229.145 listed in dnsbl.njabl.org]
2.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
[Blocked - see <http://www.spamcop.net/bl.shtml?67.87.229.145>]
2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address
[67.87.229.145 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_NJABL RBL: Received via a relay in dnsbl.njabl.org
[67.87.229.145 listed in dnsbl.njabl.org]
0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS
[67.87.229.145 listed in dnsbl.sorbs.net]
1.2 FROM_ALL_NUMS From an address that is all numbers (non-phone)
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Hello! My name is Victoria. I am an advertising manager
of the KARAVAN Co. In connection with expansion of our business to us
the agents in your country are required. If you is interesting this
information - ask to send us summary on [...]
Content analysis details: (25.6 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.3 NO_REAL_NAME From: does not include a real name
0.5 HTML_40_50 BODY: Message is 40% to 50% HTML
0.0 HTML_MESSAGE BODY: HTML included in message
0.4 HTML_TAG_BALANCE_HTML BODY: HTML has unbalanced "html" tags
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.3 HTML_EMBEDS BODY: HTML with embedded plugin object
3.1 USERPASS URI: URL contains username and (optional) password
2.4 HTTP_ESCAPED_HOST URI: Uses %-escapes inside a URL's hostname
2.4 URI_OFFERS URI: Message has link to company offers
1.9 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date
1.1 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=24.131.160.233>]
2.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
[Blocked - see <http://www.spamcop.net/bl.shtml?24.131.160.233>]
1.1 RCVD_IN_NJABL_PROXY RBL: NJABL: sender is an open proxy
[24.131.160.233 listed in dnsbl.njabl.org]
0.1 RCVD_IN_NJABL RBL: Received via a relay in dnsbl.njabl.org
[24.131.160.233 listed in dnsbl.njabl.org]
1.1 FORGED_MUA_IMS Forged mail pretending to be from IMS
4.3 FORGED_IMS_HTML IMS can't send HTML message only
4.3 FORGED_IMS_TAGS IMS mailers can't send HTML in this format
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0

13 Feb '04
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: OEM Software URI:http://www.valuedsoft.biz/?242279
Specials good thru 11/12/03. Please use discount code mail9221 to
receive these prices. Software: Windows XP Suites, Adobe software,
Clearance, Corel Draw/Corel Ventura, Games, 3D Studio Max, Operating
Systems, Utilities. [...]
Content analysis details: (12.9 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.3 NO_REAL_NAME From: does not include a real name
0.9 FROM_ENDS_IN_NUMS From: ends in numbers
0.7 ADDR_NUMS_AT_BIGSITE Uses an address with lots of numbers, at a big ISP
1.6 FROM_STARTS_WITH_NUMS From: starts with nums
0.1 HTML_FONTCOLOR_UNKNOWN BODY: HTML font color is unknown to us
0.1 HTML_TAG_BALANCE_A BODY: HTML has excess "a" close tags
0.0 HTML_MESSAGE BODY: HTML included in message
0.2 HTML_TAG_BALANCE_TABLE BODY: HTML is missing "table" close tags
0.1 HTML_FONT_BIG BODY: HTML has a big font
0.1 HTML_70_80 BODY: Message is 70% to 80% HTML
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.8 BIZ_TLD URI: Contains a URL in the BIZ top-level domain
0.6 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date
0.2 SUBJ_HAS_UNIQ_ID Subject contains a unique ID
1.1 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=68.63.77.61>]
2.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
[Blocked - see <http://www.spamcop.net/bl.shtml?68.63.77.61>]
2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address
[68.63.77.61 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS
[68.63.77.61 listed in dnsbl.sorbs.net]
1.2 FROM_ALL_NUMS From an address that is all numbers (non-phone)
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/morpho/attributes.hh: Add file. Add new atributes.
* oln/morpho/attribute_union_find.hh: Correct genericity errors.
* oln/morpho/attribute_closing_opening.hh: Add some prototypes for
attribute opening/closing.
* oln/utils/histogram.hh: Add comments.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Fri, 06 Feb 2004 15:26:24 +0100 van-vl_n (oln/10_histogram. 1.6.1.14.1.3 644)
+++ olena/oln/utils/histogram.hh Fri, 06 Feb 2004 15:55:50 +0100 palma_g (oln/10_histogram. 1.6.1.14.1.3 644)
@@ -80,7 +80,7 @@
return s;
}
};
- }
+ } // end of namespace internal
namespace abstract
{
@@ -119,7 +119,7 @@
return this->exact().init_impl(img.exact());
}
};
- }
+ } // end of namespace abstract
template<typename T,
typename CPT = unsigned,
Index: olena/oln/morpho/attribute_closing_opening.hh
--- olena/oln/morpho/attribute_closing_opening.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/q/49_attribute_ 1.10 644)
+++ olena/oln/morpho/attribute_closing_opening.hh Fri, 06 Feb 2004 14:56:42 +0100 palma_g (oln/q/49_attribute_ 1.10 640)
@@ -34,6 +34,76 @@
namespace morpho {
namespace tarjan {
+ namespace internal {
+
+ // attribute closing
+ template<class I, class N, class A>
+ oln_concrete_type(I)
+ attr_closing_(const abstract::non_vectorial_image<I>& input,
+ const abstract::neighborhood<N>& Ng,
+ const attr_lambda_type(A) lambda)
+ {
+ typedef tarjan::tarjan_set<oln_concrete_type(I), A > tarjan_set_type;
+ tarjan_set_type area_closing(input.exact(), attr_env_type(A)());
+ return area_closing.get_comptute(lambda, Ng, true);
+ }
+
+ // attribute opening
+ template<class I, class N, class A>
+ oln_concrete_type(I)
+ attr_opening_(const abstract::non_vectorial_image<I>& input,
+ const abstract::neighborhood<N>& Ng,
+ const attr_lambda_type(A) lambda)
+ {
+ typedef tarjan::tarjan_set<oln_concrete_type(I), A > tarjan_set_type;
+ tarjan_set_type area_opening(input.exact(), attr_env_type(A)());
+ return area_opening.get_comptute(lambda , Ng, false);
+ }
+
+ } // !internal
+
+// macro for some attribute opening/closing declarations
+# define xxx_opening_decl(T) \
+ template<class I, class N> \
+ oln_concrete_type(I) \
+ T##_opening(const abstract::non_vectorial_image<I>& input, \
+ const abstract::neighborhood<N>& Ng, \
+ const attr_lambda_type(T##_type<unsigned>) lambda) \
+ { \
+ return internal::attr_opening_<I, N, T##_type<unsigned> >(input, Ng, lambda); \
+ }
+
+# define xxx_closing_decl(T) \
+ template<class I, class N> \
+ oln_concrete_type(I) \
+ T##_closing(const abstract::non_vectorial_image<I>& input, \
+ const abstract::neighborhood<N>& Ng, \
+ const attr_lambda_type(T##_type<unsigned>) lambda) \
+ { \
+ return internal::attr_closing_<I, N, T##_type<unsigned> >(input, Ng, lambda); \
+ }
+
+
+ // same as previous, but for attribute based on image types
+# define xxx_opening_im_decl(T) \
+ template<class I, class N> \
+ oln_concrete_type(I) \
+ T##_opening(const abstract::non_vectorial_image<I>& input, \
+ const abstract::neighborhood<N>& Ng, \
+ const attr_lambda_type(T##_type<I>) lambda) \
+ { \
+ return internal::attr_opening_<I, N, T##_type<I> >(input, Ng, lambda); \
+ }
+
+# define xxx_closing_im_decl(T) \
+ template<class I, class N> \
+ oln_concrete_type(I) \
+ T##_closing(const abstract::non_vectorial_image<I>& input, \
+ const abstract::neighborhood<N>& Ng, \
+ const attr_lambda_type(T##_type<I>) lambda) \
+ { \
+ return internal::attr_closing_<I, N, T##_type<I> >(input, Ng, lambda); \
+ }
/*=processing area_closing
* ns: morpho
@@ -53,19 +123,7 @@
* exi: lena256.pgm
* exo: out.pgm
=*/
- template<class I, class N>
- oln_concrete_type(I)
- area_closing(const abstract::non_vectorial_image<I>& input,
- const abstract::neighborhood<N>& Ng,
- const unsigned int area)
- {
- typedef T_attribute<unsigned int> area_type;
-
- typedef tarjan::tarjan_set<oln_concrete_type(I), area_type > tarjan_set_type;
- tarjan_set_type area_closing(input.exact());
- return area_closing.get_comptute(area_type(area) , Ng, true);
- }
-
+ xxx_closing_decl(area)
/*=processing area_opening
* ns: morpho
@@ -85,19 +143,22 @@
* exi: lena256.pgm
* exo: out.pgm
=*/
- template<class I, class N>
- oln_concrete_type(I)
- area_opening(const abstract::non_vectorial_image<I>& input,
- const abstract::neighborhood<N>& Ng,
- const unsigned int area)
- {
- typedef T_attribute<unsigned int> area_type;
-
- typedef tarjan::tarjan_set<oln_concrete_type(I), T_attribute<unsigned int> > tarjan_set_type;
- tarjan_set_type area_closing(input.exact());
- return area_closing.get_comptute(area_type(area) , Ng, false);
- }
+ xxx_opening_decl(area)
+ xxx_opening_decl(volume)
+ xxx_closing_decl(volume)
+ xxx_opening_decl(height)
+ xxx_closing_decl(height)
+ xxx_opening_decl(maxvalue)
+ xxx_closing_decl(maxvalue)
+ xxx_opening_decl(minvalue)
+ xxx_closing_decl(minvalue)
+ xxx_opening_im_decl(disk)
+ xxx_closing_im_decl(disk)
+ xxx_opening_im_decl(dist)
+ xxx_closing_im_decl(dist)
+ xxx_closing_im_decl(square)
+ xxx_opening_im_decl(square)
}
}
}
Index: olena/oln/morpho/attribute_union_find.hh
--- olena/oln/morpho/attribute_union_find.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/q/50_attribute_ 1.8 644)
+++ olena/oln/morpho/attribute_union_find.hh Fri, 06 Feb 2004 15:54:51 +0100 palma_g (oln/q/50_attribute_ 1.8 640)
@@ -33,49 +33,8 @@
#include <ntg/bin.hh>
#include <vector>
-
-namespace oln {
- namespace morpho {
- namespace tarjan {
- namespace internal_tarjan_ {
-
- template <class P, class V>
- bool
- vec_sort_max(const std::pair<P, V>& l,
- const std::pair<P, V>& r)
- {
- if (r.second != l.second)
- return r.second < l.second;
-
- const unsigned dim = 2;
- for (unsigned i = 0; i< dim; ++i)
- if (l.first.nth(i) != r.first.nth(i))
- return l.first.nth(i) < r.first.nth(i);
- // it means l == r
- return true;
- }
-
-
- template <class P, class V>
- bool
- vec_sort_min(const std::pair<P, V>& l,
- const std::pair<P, V>& r)
- {
- if (r.second != l.second)
- return r.second > l.second;
-
- const unsigned dim = P::dim;
- for (unsigned i = 0; i< dim; ++i)
- if (l.first.nth(i) != r.first.nth(i))
- return l.first.nth(i) < r.first.nth(i);
- // it means l == r
- return true;
- }
-
- }
- }
- }
-}
+#include <oln/utils/histogram.hh>
+#include <oln/morpho/attributes.hh>
namespace oln {
namespace morpho {
@@ -114,13 +73,14 @@
};
- template<class T, class ATTRIBUTE>
+ template<class T, class ATTRIBUTE, class Env = NullEnv>
struct tarjan_set
{
typedef oln_point_type(T) point_type;
typedef oln_value_type(T) data_type;
typedef oln_concrete_type(T) image_type;
-
+ typedef typename ATTRIBUTE::lambda_type lambda_type;
+ typedef Env env_type;
// ACTIVE and INACTIVE are defined with a hook to be static
// and initialized ionly once.
@@ -157,9 +117,10 @@
return tmp.elt;
}
- tarjan_set(const image_type& ima) : input_(ima),
+ tarjan_set(const image_type& ima, const env_type &env) : input_(ima),
parent_(ima.size()),
- aux_data_(ima.size())
+ aux_data_(ima.size()),
+ env_(env)
{
level::fill(parent_, INACTIVE());
}
@@ -169,7 +130,7 @@
{
precondition(parent_[x] == INACTIVE());
parent_[x] = ACTIVE();
- aux_data_[x] = 1;
+ aux_data_[x] = ATTRIBUTE(input_, x, env_);
}
point_type
@@ -199,7 +160,7 @@
if (r != p)
if (criterion(r,p))
{
- aux_data_[p] = aux_data_[p] + aux_data_[r];
+ aux_data_[p] += aux_data_[r];
parent_[r] = p;
}
else
@@ -212,39 +173,30 @@
// an opening otherwise.
template<class N>
image_type
- get_comptute(const ATTRIBUTE & lambda,
+ get_comptute(const lambda_type & lambda,
const abstract::neighborhood<N>& Ng,
const bool closing)
{
- typedef std::pair<point_type, data_type> pixel_type;
lambda_ = lambda;
- std::vector<pixel_type> I;
- I.reserve(input_.npoints());
+ std::vector<point_type> I(input_.npoints());
- {
- // sort pixels with respect to their level and scanning order
- oln_iter_type(T) p(input_);
- for_all(p)
- I.push_back(pixel_type(p.cur(), input_[p]));
if (closing)
- sort(I.begin(), I.end(), internal_tarjan_::vec_sort_min<point_type, data_type> );
+ oln::utils::distrib_sort(input_, I);
else
- sort(I.begin(), I.end(), internal_tarjan_::vec_sort_max<point_type, data_type> );
- }
+ oln::utils::distrib_sort_inv(input_, I);
- // Image to know which pixels have been processed
- typename mute<T, ntg::bin>::ret is_proc(input_.size());
- level::fill(is_proc, false);
+ level::fill(aux_data_, ntg_sup_val(lambda_type));
+ aux_data_.border_adapt_assign(Ng.delta(), ntg_sup_val(lambda_type));
// We are ready to perform stuff
for (unsigned int p = 0; p < I.size(); ++p)
{
- point_type p_p = I[p].first;
+ point_type p_p = I[p];
make_set(p_p);
- is_proc[p_p] = true;
oln_neighb_type(N) Q_prime(Ng, p_p);
- for_all (Q_prime) if (input_.hold(Q_prime)) if (is_proc[Q_prime] == true)
+ for_all (Q_prime)
+ if (is_proc(Q_prime))
uni(Q_prime.cur(), p_p);
}
@@ -252,9 +204,9 @@
image_type output(input_.size());
for (int p = I.size() - 1; p >= 0; --p)
{
- point_type p_p = I[p].first;
+ point_type p_p = I[p];
if ((parent_[p_p] == ACTIVE()) || (parent_[p_p] == INACTIVE()))
- output[p_p] = I[p].second;
+ output[p_p] = input_[p_p];
else
output[p_p] = output[parent_[p_p]];
// this code is equivalent to
@@ -264,11 +216,24 @@
return output;
}
+ protected:
+ // tells if a point has been proceded
+ bool is_proc(const point_type &p) const
+ {
+ //FIXME: odd way to call !=, but it is to help the compiler
+ //to find the good one when ATTRIBUTE is templeted by types
+ //in other namepaces.
+
+ // return aux_data_[p] != ntg_max_val(lambda_type);
+ return aux_data_[p].operator!=(ntg_sup_val(lambda_type));
+ };
+
+
const image_type & input_;
typename mute<T, point_type>::ret parent_;
typename mute<T, ATTRIBUTE>::ret aux_data_;
- ATTRIBUTE lambda_;
-
+ lambda_type lambda_;
+ const env_type env_;
};
}
}
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Fri, 06 Feb 2004 16:01:51 +0100 palma_g ()
+++ olena/oln/morpho/attributes.hh Fri, 06 Feb 2004 16:01:43 +0100 palma_g (oln/j/45_attributes 644)
@@ -0,0 +1,847 @@
+// Copyright (C) 2001, 2002, 2003 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 ATTRIBUTES_HH
+# define ATTRIBUTES_HH
+// some usefull macros
+
+// those macros should be moved into mlc
+# define oln_exact_vt_type(T, Exact) typename mlc::exact_vt<T, Exact>::ret
+# define oln_2_exact_vt_type(self, T, Exact) typename mlc::exact_vt<self<T, Exact>, Exact>::ret
+# define dispatch(Fun) return exact().Fun##_impl
+
+// attribute dedicated macros
+# define attr_lambda_type(T) typename attr_traits<T>::lambda_type
+# define attr_env_type(T) typename attr_traits<T>::env_type
+# define attr_value_type(T) typename attr_traits<T>::value_type
+
+# define attr_type_decl(slef_type) \
+ typedef oln_exact_vt_type(self_type, Exact) exact_type; \
+ typedef attr_value_type(exact_type) value_type; \
+ typedef attr_env_type(exact_type) env_type; \
+ typedef attr_lambda_type(exact_type) lambda_type
+
+
+
+// misc
+namespace my {
+
+ int diffabs(int v1, int v2)
+ {
+ return v1 > v2 ? v1 - v2 : v2 - v1;
+ }
+
+ template <class T>
+ T max(T v1, T v2)
+ {
+ return v1 > v2 ? v1 : v2;
+ }
+
+ template <class T>
+ T min(T v1, T v2)
+ {
+ return v1 < v2 ? v1 : v2;
+ }
+
+} // end of namespace my
+
+namespace oln {
+ namespace morpho {
+ namespace tarjan {
+ // environment herarchy
+ // not used yet
+ template <class Exact>
+ struct env: public mlc_hierarchy::any<Exact>
+ {
+ };
+
+ // this env is an empty one
+ struct NullEnv: public env<NullEnv>
+ {
+ };
+
+
+ // the traits fwd declaration
+ template <class T>
+ struct attr_traits;
+
+
+ // the attributes hierarchy
+
+ /*------------*
+ | attribute |
+ *-----------*/
+ template <class Exact>
+ class attribute: public mlc_hierarchy::any<Exact>
+ {
+ public:
+ typedef attribute<Exact> self_type;
+ attr_type_decl(self_type);
+
+ void operator+=(const exact_type& rhs)
+ {
+ dispatch(pe)(rhs);
+ };
+
+ void operator=(lambda_type lambda)
+ {
+ dispatch(equal)(lambda);
+ };
+
+ bool operator<(const lambda_type& lambda) const
+ {
+ dispatch(less)(lambda);
+ };
+
+ bool operator!=(const lambda_type& lambda) const
+ {
+ dispatch(ne)(lambda);
+ };
+
+ protected:
+ attribute() {};
+
+ };
+
+ /*-----------*
+ | area |
+ *-----------*/
+
+ template <class T, class Exact = mlc::final>
+ class area_type:
+ public attribute<oln_2_exact_vt_type(area_type, T, Exact)>
+ {
+ public:
+ typedef area_type<T, Exact> self_type;
+ attr_type_decl(self_type);
+
+ area_type()
+ {
+ };
+
+ area_type(const lambda_type &lambda): value_(lambda)
+ {
+ };
+
+ template <class I>
+ area_type(const abstract::image<I>&,
+ const oln_point_type(I)&,
+ const env_type&):
+ value_(1)
+ {
+ };
+
+ void pe_impl(const area_type& rhs)
+ {
+ value_ += rhs.value_;
+ };
+
+ void equal_impl(lambda_type lambda)
+ {
+ value_ = lambda;
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type value_;
+ // const client_data_type& client_data;
+ // FIXME: client_data is usefull when attribute is computed from other data
+ };
+
+
+ /*-----------*
+ | volume |
+ *-----------*/
+
+ template <class T, class Exact = mlc::final>
+ class volume_type:
+ public attribute<oln_2_exact_vt_type(volume_type, T, Exact)>
+ {
+ public:
+ typedef volume_type<T, Exact> self_type;
+ attr_type_decl(self_type);
+
+ // Ctors
+ volume_type()
+ {
+ };
+
+
+ volume_type(const lambda_type &lambda): value_(lambda)
+ {
+ };
+
+ template <class I>
+ volume_type(const abstract::image<I>& input,
+ const oln_point_type(I)& p,
+ const env_type &) :
+ reflevel_(input[p]),
+ area_(1),
+ value_(1)
+ {
+ };
+ // interface part
+ const value_type &getValue() const
+ {
+ dispatch(getValue)();
+ };
+
+ const value_type &getReflevel() const
+ {
+ dispatch(getReflevel)();
+ };
+
+ const value_type &getArea() const
+ {
+ dispatch(getArea)();
+ };
+
+ // impl part
+ const value_type &getValue_impl() const
+ {
+ return value_;
+ };
+
+ const value_type &getReflevel_impl() const
+ {
+ return reflevel_;
+ };
+
+ const value_type &getArea_impl() const
+ {
+ return area_;
+ };
+
+ void equal_impl(lambda_type lambda)
+ {
+ value_ = lambda;
+ };
+
+ void pe_impl(const volume_type& rhs)
+ {
+ value_ += rhs.getValue() + area_ * my::diffabs(reflevel_, rhs.getReflevel());
+ area_ += rhs.getArea();
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type reflevel_;
+ value_type area_;
+ value_type value_;
+ };
+
+ /*-----------*
+ | height |
+ *-----------*/
+
+ template <class T, class Exact = mlc::final>
+ class height_type:
+ public attribute<oln_2_exact_vt_type(height_type, T, Exact)>
+ {
+ public:
+ typedef height_type<T, Exact> self_type;
+ attr_type_decl(self_type);
+
+ height_type()
+ {
+ };
+
+ height_type(const lambda_type &lambda): value_(lambda)
+ {
+ };
+
+ template <class I>
+ height_type(const abstract::image<I>& input,
+ const oln_point_type(I)& p,
+ const env_type&):
+ reflevel_(input[p]),
+ value_(0)
+ {
+ };
+
+ const value_type &getReflevel() const
+ {
+ dispatch(getReflevel)();
+ };
+
+ // impl part
+ const value_type &getReflevel_impl() const
+ {
+ return reflevel_;
+ };
+
+ void equal_impl(lambda_type lambda)
+ {
+ value_ = lambda;
+ };
+
+ void pe_impl(const height_type& rhs)
+ {
+ value_ = my::diffabs(reflevel_, rhs.getReflevel());
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type reflevel_;
+ value_type value_;
+ };
+
+
+ /*-----------*
+ | maxvalue |
+ *-----------*/
+
+ template <class T, class Exact = mlc::final>
+ class maxvalue_type:
+ public attribute<oln_2_exact_vt_type(maxvalue_type, T, Exact)>
+ {
+ public:
+ typedef maxvalue_type<T, Exact> self_type;
+ attr_type_decl(self_type);
+
+ maxvalue_type()
+ {
+ };
+
+ maxvalue_type(const lambda_type &lambda): value_(lambda)
+ {
+ };
+
+ template <class I>
+ maxvalue_type(const abstract::image<I>& input,
+ const oln_point_type(I)& p,
+ const env_type &):
+ value_(input[p])
+ {
+ };
+
+ const value_type &getValue() const
+ {
+ dispatch(getValue)();
+ };
+
+ const value_type &getValue_impl() const
+ {
+ return value_;
+ };
+
+ void pe_impl(const maxvalue_type& rhs)
+ {
+ value_ = my::max(value_, rhs.getValue());
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type value_;
+ };
+
+
+ /*-----------*
+ | minvalue |
+ *-----------*/
+
+ template <class T, class Exact = mlc::final>
+ class minvalue_type:
+ public attribute<oln_2_exact_vt_type(minvalue_type, T, Exact)>
+ {
+ public:
+ typedef minvalue_type<T, Exact> self_type;
+ attr_type_decl(self_type);
+
+ minvalue_type()
+ {
+ };
+
+ minvalue_type(const lambda_type &lambda): value_(lambda)
+ {
+ };
+
+ template <class I>
+ minvalue_type(const abstract::image<I>& input,
+ const oln_point_type(I)& p,
+ const env_type &) :
+ value_(input[p])
+ {
+ };
+
+ const value_type &getValue() const
+ {
+ dispatch(getValue)();
+ };
+
+ const value_type &getValue_impl() const
+ {
+ return value_;
+ };
+
+ void pe_impl(const minvalue_type& rhs)
+ {
+ value_ = my::min(value_, rhs.getValue());
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type value_;
+ };
+
+
+ /*-----------*
+ | disk |
+ *-----------*/
+
+ template <class I, class Exact = mlc::final>
+ class disk_type:
+ public attribute<oln_2_exact_vt_type(disk_type, I, Exact)>
+ {
+ public:
+ typedef disk_type<I, Exact> self_type;
+ attr_type_decl(self_type);
+ typedef abstract::image<mlc_exact_type(I)> im_type;
+ typedef oln_point_type(im_type) point_type;
+ typedef oln_dpoint_type(im_type) dpoint_type;
+ typedef std::vector<point_type> pts_type;
+ typedef typename pts_type::const_iterator cst_iter_type;
+
+ disk_type()
+ {
+ };
+
+ disk_type(const lambda_type &lambda): value_(lambda), pts_()
+ {
+ };
+
+ disk_type(const im_type&, const point_type& p, const env_type &) :
+ value_(1), pts_()
+ {
+ pts_.push_back(p);
+ };
+
+ const pts_type &getPts() const
+ {
+ dispatch(getPts)();
+ };
+
+ // impl
+
+ const pts_type &getPts_impl() const
+ {
+ return pts_;
+ };
+
+ void pe_impl(const disk_type& rhs)
+ {
+ std::copy(rhs.getPts().begin(), rhs.getPts().end(), std::back_inserter(pts_));
+ value_ = 0;
+ for (cst_iter_type p1 = pts_.begin(); p1 != pts_.end(); ++p1)
+ for (cst_iter_type p2 = pts_.begin(); p2 != pts_.end(); ++p2)
+ {
+ unsigned d = 0;
+ dpoint_type p = *p1 - *p2;
+ for (int i = 0; i < point_traits<point_type>::dim; ++i)
+ d += p.nth(i) * p.nth(i);
+ if (d > value_)
+ value_ = d;
+ }
+ value_ /= 2;
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type& lambda) const
+ {
+ return lambda != value_;
+ };
+
+ protected:
+ value_type value_;
+ pts_type pts_;
+ };
+
+
+
+ /*-----------*
+ | dist |
+ *-----------*/
+
+ template <class I, class Exact = mlc::final>
+ class dist_type:
+ public attribute<oln_2_exact_vt_type(dist_type, I, Exact)>
+ {
+ public:
+ typedef dist_type<I, Exact> self_type;
+ attr_type_decl(self_type);
+ typedef abstract::image<mlc_exact_type(I)> im_type;
+ typedef oln_point_type(im_type) point_type;
+ typedef oln_dpoint_type(im_type) dpoint_type;
+
+// typedef float value_type;
+// typedef value_type lambda_type;
+
+ dist_type()
+ {
+ };
+
+ dist_type(const im_type&,
+ const point_type& p,
+ const env_type &) :
+ value_(0),
+ center_(p)
+ {
+ };
+
+ dist_type(const lambda_type lambda): value_(lambda)
+ {
+ };
+
+ const point_type &getCenter() const
+ {
+ dispatch(getCenter)();
+ };
+
+ // impl
+ const point_type &getCenter_impl() const
+ {
+ return center_;
+ };
+
+ void pe_impl(const dist_type& rhs)
+ {
+ dpoint_type p = center_ - rhs.getCenter();
+
+ value_ = 0;
+ for (int i = 0; i < point_traits<point_type>::dim; ++i)
+ value_ += p.nth(i) * p.nth(i);
+ value_ = sqrt(value_);
+ };
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ };
+
+ bool ne_impl(const lambda_type &lambda) const
+ {
+ return value_ != lambda;
+ };
+
+ protected:
+ value_type value_;
+ point_type center_;
+
+ };
+
+
+
+ /*-----------*
+ | square |
+ *-----------*/
+
+ template <class I, class Exact = mlc::final>
+ class square_type:
+ public attribute<oln_2_exact_vt_type(square_type, I, Exact)>
+ {
+ public:
+ typedef square_type<I, Exact> self_type;
+ attr_type_decl(self_type);
+ typedef abstract::image<mlc_exact_type(I)> im_type;
+ typedef oln_point_type(im_type) point_type;
+ typedef oln_dpoint_type(im_type) dpoint_type;
+
+// typedef unsigned value_type;
+// typedef value_type lambda_type;
+
+ square_type()
+ {
+ }
+
+ square_type(const lambda_type &lambda) : value_(lambda)
+ {
+ };
+
+ square_type(const im_type&,
+ const point_type& p,
+ const env_type &) :
+ value_(0)
+ {
+ min_row_ = max_row_ = p.row();
+ min_col_ = max_col_ = p.col();
+ }
+
+ int getMinRow() const
+ {
+ dispatch(getMinRow)();
+ };
+
+ int getMaxRow() const
+ {
+ dispatch(getMaxRow)();
+ };
+
+ int getMaxCol() const
+ {
+ dispatch(getMaxCol)();
+ };
+
+ int getMinCol() const
+ {
+ dispatch(getMinCol)();
+ };
+
+ // impl
+ int getMinRow_impl() const
+ {
+ return min_row_;
+ };
+
+ int getMaxRow_impl() const
+ {
+ return max_row_;
+ };
+
+ int getMaxCol_impl() const
+ {
+ return max_col_;
+ };
+
+ int getMinCol_impl() const
+ {
+ return min_col_;
+ };
+
+ void pe_impl(const square_type& rhs)
+ {
+ min_row_ = my::min(min_row_, rhs.getMinRow());
+ min_col_ = my::min(min_col_, rhs.getMinCol());
+ max_row_ = my::max(max_row_, rhs.getMaxRow());
+ max_col_ = my::max(max_col_, rhs.getMaxCol());
+ value_ = my::max(max_row_ - min_row_, max_col_ - min_col_);
+ }
+
+ bool less_impl(const lambda_type& lambda) const
+ {
+ return value_ < lambda;
+ }
+
+ bool ne_impl(const lambda_type &lambda) const
+ {
+ return value_ != lambda;
+ };
+
+ protected:
+ value_type value_;
+ int min_row_;
+ int max_row_;
+ int min_col_;
+ int max_col_;
+ };
+
+
+
+// /*-----------*
+// | rectangle |
+// *-----------*/
+// template <class I, class Exact = mlc::final>
+// struct rectangle_type
+// {
+// typedef unsigned value_type;
+// typedef std::pair<value_type,value_type> lambda_type;
+
+// value_type drow, dcol;
+// int min_row, max_row, min_col, max_col;
+
+// rectangle_type()
+// {
+// }
+
+// template <class T>
+// rectangle_type(const image2d<T>&, const point2d& p) :
+// drow(0),
+// dcol(0)
+// {
+// min_row = max_row = p.row();
+// min_col = max_col = p.col();
+// }
+
+// void operator+=(const rectangle_type& rhs)
+// {
+// min_row = my::min(min_row, rhs.min_row);
+// min_col = my::min(min_col, rhs.min_col);
+// max_row = my::max(max_row, rhs.max_row);
+// max_col = my::max(max_col, rhs.max_col);
+// drow = max_row - min_row;
+// dcol = max_col - min_col;
+// }
+
+// bool operator>=(const lambda_type& lambda) const
+// {
+// return drow >= lambda.first || dcol >= lambda.second;
+// }
+// };
+
+
+// traits specialisations
+
+
+ // volume traits
+ template <class T, class Exact>
+ struct attr_traits<volume_type<T, Exact> >
+ {
+ typedef T value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // volume traits
+ template <class T, class Exact>
+ struct attr_traits<height_type<T, Exact> >
+ {
+ typedef T value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // area traits
+ template <class T, class Exact>
+ struct attr_traits<area_type<T, Exact> >
+ {
+ typedef T value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // maxvalue traits
+ template <class T, class Exact>
+ struct attr_traits<maxvalue_type<T, Exact> >
+ {
+ typedef T value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // minvalue traits
+ template <class T, class Exact>
+ struct attr_traits<minvalue_type<T, Exact> >
+ {
+ typedef T value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // disk traits
+ template <class I, class Exact>
+ struct attr_traits<disk_type<I, Exact> >
+ {
+ typedef unsigned value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // dist traits
+ template <class I, class Exact>
+ struct attr_traits<dist_type<I, Exact> >
+ {
+ typedef float value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+ // square traits
+ template <class I, class Exact>
+ struct attr_traits<square_type<I, Exact> >
+ {
+ typedef unsigned value_type;
+ typedef value_type lambda_type;
+ typedef NullEnv env_type;
+ };
+
+// // rectangle traits
+// tempalte <class Exact>
+// typedef unsigned value_type;
+// typedef std::pair<value_type,value_type> lambda_type;
+
+ }
+ }
+}
+
+
+/*-----------*
+ | diamond |
+ *-----------*/
+
+// FIXME: to be written...
+
+
+#endif // ndef ATTRIBUTES_HH
+
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
2
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* oln/utils/histogram.hh: Inherit from mlc_hierarchy::any.
* value_to_point.hh: Inherit from conversion_from_type_to_type.
* tests/utils/tests/histogram: Add namespace.
* tests/morpho/tests/area: Add file.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Mon, 02 Feb 2004 15:36:12 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.2 644)
+++ olena/oln/utils/histogram.hh Fri, 06 Feb 2004 15:03:47 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.2 644)
@@ -28,60 +28,134 @@
#ifndef OLENA_UTILS_HISTOGRAM_HH
# define OLENA_UTILS_HISTOGRAM_HH
-# include <ntg/basics.hh>
-# include <oln/basics.hh>
+
+# include <oln/core/image1d.hh>
+# include <oln/core/image3d.hh>
+
# include <oln/convert/value_to_point.hh>
+
+# include <oln/core/abstract/image.hh>
+
# include <vector>
namespace oln {
namespace utils {
- template< typename T, typename CPT, class V2P>
- class histogram;
+ namespace internal {
+ //! Return the size of the space needed to explore the type T
+ template <typename T>
+ struct img_max_size
+ {
+ private:
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type;
+ public:
+ typedef image1d_size size_type;
+ typedef T comp_type;
+
+ image1d_size
+ operator()()
+ {
+ size_type s(ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ 1);
+ return s;
+ }
+ };
- template< typename T, typename CPT, class V2P >
- T
- min(const histogram<T, CPT, V2P>& hist);
- template< typename T, typename CPT, class V2P >
- T
- max(const histogram<T, CPT, V2P>& hist);
+ template <unsigned Qbits, template <unsigned> class S>
+ struct img_max_size<ntg::color<3, Qbits, S> >
+ {
+ public:
+ typedef image3d_size size_type;
+ typedef typename ntg::color<3, Qbits, S>::comp_type comp_type;
+
+ image3d_size
+ operator()()
+ {
+ size_type s(ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ 1);
+ return s;
+ }
+ };
+ }
+
+ namespace abstract
+ {
+ template<class T,
+ typename CPT,
+ 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;
+
+ void
+ clear()
+ {
+ this->exact().clear_impl();
+ }
+
+ const CPT&
+ operator[](const T &v)const
+ {
+ return this->exact().at(v);
+ }
+
+ CPT&
+ operator[](const T &v)
+ {
+ return this->exact().at(v);
+ }
+
+ template <class I>
+ void
+ init(const oln::abstract::image<I> &img)
+ {
+ return this->exact().init_impl(img.exact());
+ }
+ };
+ }
template<typename T,
typename CPT = unsigned,
- class V2P = value_to_point<T> >
- class histogram
+ class V2P = oln::convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram: public abstract::histogram
+ <T, CPT, 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 histogram<T, CPT, V2P> self_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;
- friend T min<T, CPT, V2P>(const histogram<T, CPT, V2P>& hist);
- friend T max<T, CPT, V2P>(const histogram<T, CPT, V2P>& hist);
-
histogram(const value_to_point_type & c2p = value_to_point_type()):
- v2p_(c2p), img_(v2p_.size())
+ v2p_(c2p), img_(internal::img_max_size<input_type>()())
{
clear();
}
template <class I>
- histogram(const abstract::image<I> & input,
+ histogram(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()):
- v2p_(v2p), img_(v2p_.size())
+ v2p_(v2p), img_(internal::img_max_size<input_type>()())
{
clear();
init(input);
}
void
- clear()
+ clear_impl()
{
typename img_type::iter_type it(img_ );
for_all(it)
@@ -89,20 +163,20 @@
}
const CPT&
- operator[](const T &v)const
+ at(const T &v)const
{
return img_[v2p_(v)];
}
CPT&
- operator[](const T &v)
+ at(const T &v)
{
return img_[v2p_(v)];
}
template <class I>
void
- init(const abstract::image<I> &img)
+ init_impl(const oln::abstract::image<I> &img)
{
oln_iter_type(I) it_img(img);
@@ -122,9 +196,9 @@
};
//Note: If there is no min an assertion will fail at the end of
the loop.
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class Exact>
inline T
- min(const histogram<T, CPT, V2P>& hist)
+ min(const abstract::histogram<T, CPT, Exact>& hist)
{
typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
@@ -134,11 +208,10 @@
break;
return i;
}
-
//Note: If there is no max an assertion will fail at the end of
the loop.
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class Exact>
inline T
- max(const histogram<T, CPT, V2P>& hist)
+ max(const abstract::histogram<T, CPT, Exact>& hist)
{
typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
@@ -169,8 +242,13 @@
value are accessed, and delay the _real_ min and max compuation
until min() or max() is called. */
- template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
- class histogram_minmax : public histogram<T, CPT, V2P>
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T>,
+ class Exact = mlc::final>
+ class histogram_minmax : public histogram
+ <T, CPT, V2P,
+ 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;
@@ -183,31 +261,32 @@
if (idx < min_)
min_ = idx;
}
-
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;
histogram_minmax(const value_to_point_type & v2p =
value_to_point_type()) :
- histogram<T, CPT, V2P>(v2p),
+ upper_type(v2p),
min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
template <class I>
- histogram_minmax(const abstract::image<I> & input,
+ histogram_minmax(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
- histogram<T, CPT, V2P>(input, v2p),
+ upper_type(input, v2p),
min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
const CPT&
- operator[](const T& i) const
+ at(const T& i) const
{
adjust(i);
return img_[v2p_(i)];
}
CPT&
- operator[](const T& i)
+ at(const T& i)
{
adjust(i);
return img_[v2p_(i)];
@@ -235,8 +314,13 @@
T min_, max_; // indices of min and max elements
};
- template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
- class histogram_min : public histogram<T, CPT, V2P>
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T>,
+ class Exact = mlc::final>
+ 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;
@@ -248,26 +332,29 @@
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;
+
histogram_min(const value_to_point_type & v2p =
value_to_point_type()) :
- histogram<T, CPT, V2P>(v2p), min_(ntg_min_val(T)) {}
+ upper_type(v2p), min_(ntg_min_val(T)) {}
template <class I>
- histogram_min(const abstract::image<I> & input,
+ histogram_min(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
- histogram<T, CPT, V2P>(input, v2p), min_(ntg_min_val(T)) {}
+ upper_type(input, v2p), min_(ntg_min_val(T)) {}
const CPT&
- operator[](const T& i) const
+ at(const T& i) const
{
- adjust(i);
return img_[v2p_(i)];
}
CPT&
- operator[](const T& i)
+ at(const T& i)
{
adjust(i);
return img_[v2p_(i)];
@@ -292,8 +379,13 @@
T min_; // index of min element
};
- template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
- class histogram_max : public histogram<T, CPT, V2P>
+ template< typename T,
+ typename CPT = unsigned,
+ class V2P = convert::value_to_point<T> ,
+ class Exact = mlc::final>
+ class histogram_max : public histogram<T, CPT, V2P,
+ typename mlc::exact_vt<histogram_max<T, CPT, V2P, Exact>,
+ Exact>::ret>
{
protected:
void
@@ -304,25 +396,27 @@
}
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;
histogram_max(const value_to_point_type & v2p =
value_to_point_type()) :
- histogram<T, CPT, V2P>(v2p),max_(ntg_max_val(T)) {}
+ upper_type(v2p),max_(ntg_max_val(T)) {}
template <class I>
- histogram_max(const abstract::image<I> & input,
+ histogram_max(const oln::abstract::image<I> & input,
const value_to_point_type & v2p = value_to_point_type()) :
- histogram<T, CPT, V2P>(input, v2p),max_(ntg_max_val(T)) {}
+ upper_type(input, v2p),max_(ntg_max_val(T)) {}
const CPT&
- operator[](const T& i) const
+ at(const T& i) const
{
- adjust(i);
return img_[v2p_(i)];
}
CPT&
- operator[](const T& i)
+ at(const T& i)
{
adjust(i);
return img_[v2p_(i)];
@@ -347,34 +441,34 @@
T max_; // index of max element
};
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class V2P, class Exact >
inline T
- min(histogram_minmax<T, CPT, V2P>& hist)
+ min(histogram_minmax<T, CPT, V2P, Exact>& hist)
{
return hist.min();
}
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class V2P, class Exact >
inline T
- min(histogram_min<T, CPT, V2P>& hist)
+ min(histogram_min<T, CPT, V2P, Exact>& hist)
{
return hist.min();
}
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class V2P, class Exact >
inline T
- max(histogram_minmax<T, CPT, V2P>& hist)
+ max(histogram_minmax<T, CPT, V2P, Exact>& hist)
{
return hist.max();
}
- template< typename T, typename CPT, class V2P >
+ template< typename T, typename CPT, class V2P, class Exact >
inline T
- max(histogram_max<T, CPT, V2P>& hist)
+ max(histogram_max<T, CPT, V2P, Exact>& hist)
{
return hist.max();
}
template<class I>
void
- distrib_sort(const abstract::image<I>& im,
+ distrib_sort(const oln::abstract::image<I>& im,
std::vector<oln_point_type(I)> &v)
{
typedef oln_value_type(I) val;
@@ -406,7 +500,7 @@
template<class I>
void
- distrib_sort_inv(const abstract::image<I>& im,
+ distrib_sort_inv(const oln::abstract::image<I>& im,
std::vector<oln_point_type(I)> &v)
{
typedef oln_value_type(I) val;
Index: olena/tests/utils/tests/histogram
--- olena/tests/utils/tests/histogram Mon, 02 Feb 2004 15:36:12 +0100
van-vl_n (oln/u/27_histogram. 1.2.1.2 604)
+++ olena/tests/utils/tests/histogram Wed, 04 Feb 2004 18:24:49 +0100
van-vl_n (oln/u/27_histogram. 1.2.1.2 604)
@@ -92,9 +92,9 @@
histogram<int_s<4> > his4(is4);
res = res &&
- min(his4) == -4
+ utils::min(his4) == -4
&&
- max(his4) == 3;
+ utils::max(his4) == 3;
histogram_min<int_s<4> > his4_min(is4);
histogram_max<int_s<4> > his4_max(is4);
@@ -106,14 +106,14 @@
his4_minmax[2] = his4_min[2] = his4_max[2] = his4[2] = 42;
res = res &&
- min(his4) == -5 &&
- max(his4) == 2 &&
- min(his4) == min(his4_min) &&
- min(his4) == min(his4_max) &&
- min(his4) == min(his4_minmax) &&
- max(his4) == max(his4_min) &&
- max(his4) == max(his4_max) &&
- max(his4) == max(his4_minmax);
+ utils::min(his4) == -5 &&
+ utils::max(his4) == 2 &&
+ utils::min(his4) == utils::min(his4_min) &&
+ utils::min(his4) == utils::min(his4_max) &&
+ utils::min(his4) == utils::min(his4_minmax) &&
+ utils::max(his4) == utils::max(his4_min) &&
+ utils::max(his4) == utils::max(his4_max) &&
+ utils::max(his4) == utils::max(his4_minmax);
return res;
};
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Mon, 02 Feb 2004 10:57:28 +0100
van-vl_n (oln/j/43_value_to_p 1.1 644)
+++ olena/oln/convert/value_to_point.hh Fri, 06 Feb 2004 15:14:05 +0100
van-vl_n (oln/j/43_value_to_p 1.1 644)
@@ -27,66 +27,62 @@
#ifndef OLENA_VALUE_TO_POINT
# define OLENA_VALUE_TO_POINT
-# include <oln/core/image1d.hh>
-# include <oln/core/image2d.hh>
-# include <oln/core/image3d.hh>
+# include <oln/core/point1d.hh>
+# include <oln/core/point3d.hh>
# include <ntg/int.hh>
# include <ntg/color/color.hh>
+# include <oln/convert/conversion.hh>
namespace oln {
- template <typename T>
- struct value_to_point
- {
+ namespace convert {
+
+ template <typename Argument_type,
+ class Exact = mlc::final>
+ struct value_to_point:
+ public abstract::conversion_from_type_to_type
+ <Argument_type,
+ point1d,
+ typename mlc::exact_vt<value_to_point<Argument_type,
+ Exact>,
+ Exact>::ret>
+ {
+ private:
+ typedef typename ntg_is_a(Argument_type,
ntg::non_vectorial)::ensure_type ensure_type;
+ public:
typedef point1d result_type;
- typedef T input_type;
- typedef image1d_size size_type;
+ typedef Argument_type argument_type;
+ template <class input_type>
result_type
- operator()(const input_type &input) const
+ doit(const input_type &input) const
{
result_type r(input - ntg_min_val(input_type));
return r;
}
-
- size_type
- size() const
- {
- return size_type(ntg_max_val(input_type) -
ntg_min_val(input_type) + 1,
- 1);
- }
- protected:
- typedef typename ntg_is_a(input_type,
ntg::non_vectorial)::ensure_type ensure_type;
};
- //FIXME: the number of components is not a parameter (due to size_type)
- template <unsigned Qbits,template <unsigned> class S>
- struct value_to_point<typename ntg::color<3, Qbits, S> >
+ template <unsigned Qbits, template <unsigned> class S, class Exact>
+ struct value_to_point<ntg::color<3, Qbits, S>, Exact>:
+ public abstract::conversion_from_type_to_type
+ <typename ntg::color<3, Qbits, S>,
+ point3d,
+ typename mlc::exact_vt<value_to_point<typename ntg::color<3, Qbits, S>,
+ Exact>,
+ Exact>::ret>
{
- enum {nbcomps = 3, qbits = Qbits};
-
- typedef ntg::color<nbcomps, qbits, S> input_type;
- typedef typename dim_traits<nbcomps, unsigned>::img_type::size_type
- size_type;
- typedef typename input_type::comp_type comp_type;
+ public:
typedef point3d result_type;
+ typedef typename ntg::color<3, Qbits, S> argument_type;
result_type
- operator()(const input_type &input) const
+ operator()(const argument_type &input) const
{
result_type r;
- for (unsigned i = 0; i < nbcomps; ++i)
+ for (unsigned i = 0; i < 3; ++i)
r.nth(i) = input[i];
return r;
}
-
- size_type
- size() const
- {
- return size_type(ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
- ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
- ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
- 1);
- }
};
}
+}
#endif
Index: olena/tests/morpho/tests/area
--- olena/tests/morpho/tests/area Fri, 06 Feb 2004 15:24:17 +0100
van-vl_n ()
+++ olena/tests/morpho/tests/area Fri, 06 Feb 2004 10:30:34 +0100
van-vl_n (oln/j/44_area 644)
@@ -0,0 +1,197 @@
+// -*- c++ -*-
+
+#include <oln/basics2d.hh>
+#include <oln/basics1d.hh>
+#include <oln/morpho/attribute_closing_opening.hh>
+#include <ntg/all.hh>
+
+#include "check.hh"
+#include "data.hh"
+
+using namespace oln;
+using namespace ntg;
+
+#define OK_OR_FAIL \
+ std::cout << "OK" << std::endl; \
+ else \
+ { \
+ std::cout << "FAIL" << std::endl; \
+ fail = true; \
+ }
+
+bool
+check_opening1d()
+{
+ bool fail(false);
+
+ image1d<int_u8> im(11);
+ image1d<int_u8>::iter_type it(im);
+ for_all(it)
+ im[it] = ntg_min_val(int_u8);
+ im(0) = 0;
+ im(1) = 1 ;
+ im(2) = 1 ;
+ im(3) = 0;
+ im(4) = 1 ;
+ im(5) = 2 ;
+ im(6) = 3 ;
+ im(7) = 3 ;
+ im(8) = 5 ;
+ im(9) = 1 ;
+ im(10) = 0;
+
+ image1d<int_u8> im2 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 2);
+
+ fail = fail ||
+ im2(0) != 0 ||
+ im2(1) != 1 ||
+ im2(2) != 1 ||
+ im2(3) != 0 ||
+ im2(4) != 1 ||
+ im2(5) != 2 ||
+ im2(6) != 3 ||
+ im2(7) != 3 ||
+ im2(8) != 3 ||
+ im2(9) != 1 ||
+ im2(10)!= 0;
+
+ image1d<int_u8> im3 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 3);
+ fail = fail ||
+ im3(0) != 0 ||
+ im3(1) != 0 ||
+ im3(2) != 0 ||
+ im3(3) != 0 ||
+ im3(4) != 1 ||
+ im3(5) != 2 ||
+ im3(6) != 3 ||
+ im3(7) != 3 ||
+ im3(8) != 3 ||
+ im3(9) != 1 ||
+ im3(10)!= 0;
+
+ image1d<int_u8> im4 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 4);
+ fail = fail ||
+ im4(0) != 0 ||
+ im4(1) != 0 ||
+ im4(2) != 0 ||
+ im4(3) != 0 ||
+ im4(4) != 1 ||
+ im4(5) != 2 ||
+ im4(6) != 2 ||
+ im4(7) != 2 ||
+ im4(8) != 2 ||
+ im4(9) != 1 ||
+ im4(10)!= 0;
+ return fail;
+}
+
+
+bool
+check_opening1d_s()
+{
+ bool fail(false);
+
+ image1d<int_s<3> > im(11);
+ image1d<int_s<3> >::iter_type it(im);
+ for_all(it)
+ im[it] = ntg_min_val(int_s<3> );
+ im(0) = -4;
+ im(1) = -2 ;
+ im(2) = -2 ;
+ im(3) = -4;
+ im(4) = -2 ;
+ im(5) = 0 ;
+ im(6) = 2 ;
+ im(7) = 2 ;
+ im(8) = 3 ;
+ im(9) = -2 ;
+ im(10) = -4;
+
+ image1d<int_s<3> > im2 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 2);
+
+ fail = fail ||
+ im2(0) != -4 ||
+ im2(1) != -2 ||
+ im2(2) != -2 ||
+ im2(3) != -4 ||
+ im2(4) != -2 ||
+ im2(5) != 0 ||
+ im2(6) != 2 ||
+ im2(7) != 2 ||
+ im2(8) != 2 ||
+ im2(9) != -2 ||
+ im2(10)!= -4;
+
+ image1d<int_s<3> > im3 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 3);
+ fail = fail ||
+ im3(0) != -4 ||
+ im3(1) != -4 ||
+ im3(2) != -4 ||
+ im3(3) != -4 ||
+ im3(4) != -2 ||
+ im3(5) != 0 ||
+ im3(6) != 2 ||
+ im3(7) != 2 ||
+ im3(8) != 2 ||
+ im3(9) != -2 ||
+ im3(10)!= -4;
+
+ image1d<int_s<3> > im4 =
+ morpho::tarjan::area_opening(im, neighb_c2(), 4);
+ fail = fail ||
+ im4(0) != -4 ||
+ im4(1) != -4 ||
+ im4(2) != -4 ||
+ im4(3) != -4 ||
+ im4(4) != -2 ||
+ im4(5) != 0 ||
+ im4(6) != 0 ||
+ im4(7) != 0 ||
+ im4(8) != 0 ||
+ im4(9) != -2 ||
+ im4(10)!= -4;
+
+ return fail;
+}
+
+bool
+check_lena()
+{
+ bool fail(false);
+
+ image2d<int_u8> lena = load(rdata("lena.pgm"));
+ image2d<int_u8> lena5 = morpho::tarjan::area_closing(lena,
neighb_c8(), 100);
+
+ unsigned l = 0;
+ image2d<int_u8>::iter_type it_l(lena5);
+ for_all(it_l)
+ l += lena5[it_l];
+ fail = fail ||
+ l != 31472398;
+ return fail;
+}
+
+bool
+check()
+{
+ bool fail = false;
+
+ std::cout << "area opening 1d ... " << std::flush;
+ if (check_opening1d() == false)
+ OK_OR_FAIL;
+
+ std::cout << "area opening with int_s<3> ... " << std::flush;
+ if (check_opening1d_s() == false)
+ OK_OR_FAIL;
+
+ std::cout << "area closing 2d on lena.pgm ... " << std::flush;
+ if (check_lena() == false)
+ OK_OR_FAIL;
+
+ return fail;
+}
1
0
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Find your Match by Compatibility
URI:http://65.110.21.2/compatti/redirectCompatti.jsp?source=ntk040203
Find Your Match by Compatibility with Unique Relationship Astrology
URI:http://65.110.21.2/compatti/images/marriage_336x280_static.jpg
[...]
Content analysis details: (16.0 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.3 NO_REAL_NAME From: does not include a real name
1.0 SUBJ_HAS_SPACES Subject contains lots of white space
0.9 FROM_ENDS_IN_NUMS From: ends in numbers
0.7 ADDR_NUMS_AT_BIGSITE Uses an address with lots of numbers, at a big ISP
1.6 FROM_STARTS_WITH_NUMS From: starts with nums
0.3 LOTS_OF_STUFF BODY: Thousands or millions of pics/movies/etc
0.0 HTML_MESSAGE BODY: HTML included in message
0.0 LINES_OF_YELLING BODY: A WHOLE LINE OF YELLING DETECTED
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.4 HTML_FONT_INVISIBLE BODY: HTML font color is same as background
0.2 HTML_50_60 BODY: Message is 50% to 60% HTML
1.5 HTML_IMAGE_ONLY_04 BODY: HTML: images with 200-400 bytes of words
0.2 NORMAL_HTTP_TO_IP URI: Uses a dotted-decimal IP address in URL
0.2 SUBJ_HAS_UNIQ_ID Subject contains a unique ID
1.1 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=24.15.48.10>]
2.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
[Blocked - see <http://www.spamcop.net/bl.shtml?24.15.48.10>]
1.2 FROM_ALL_NUMS From an address that is all numbers (non-phone)
1.1 FORGED_OUTLOOK_TAGS Outlook can't send HTML in this format
0.3 UPPERCASE_25_50 message body is 25-50% uppercase
2.7 FORGED_MUA_OIMO Forged mail pretending to be from MS Outlook IMO
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* oln/utils/histogram.hh: Add revert sort.
* tests/utils/tests/histogram: Add tests.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Mon, 02 Feb 2004 10:57:28 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.1 646)
+++ olena/oln/utils/histogram.hh Mon, 02 Feb 2004 14:43:02 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.1 646)
@@ -394,7 +394,7 @@
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++)
+ for (ntg_cumul_type(val) i = 1; i < card; ++i)
ptr[i] = ptr[i - 1] + histo[i - 1 + ntg_min_val(val)];
// Now iterate on the image to sort point in the order of their
@@ -404,6 +404,31 @@
*(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
}
+ template<class I>
+ void
+ distrib_sort_inv(const abstract::image<I>& im,
+ std::vector<oln_point_type(I)> &v)
+ {
+ typedef oln_value_type(I) val;
+
+ 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;
+ std::vector<oln_point_type(I)* > ptr(card);
+ ptr[card - 1] = &(v[0]);
+
+ for (ntg_signed_cumul_type(val) i = card - 2; i >= 0; --i)
+ ptr[i] = ptr[i + 1] + histo[i + 1 + ntg_min_val(val)];
+
+ oln_iter_type(I) p(im);
+ for_all(p)
+ *(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
+ }
+
} // end of namespace utils
} // end of namespace oln
Index: olena/tests/utils/tests/histogram
--- olena/tests/utils/tests/histogram Mon, 02 Feb 2004 10:57:28 +0100
van-vl_n (oln/u/27_histogram. 1.2.1.1 606)
+++ olena/tests/utils/tests/histogram Mon, 02 Feb 2004 15:26:50 +0100
van-vl_n (oln/u/27_histogram. 1.2.1.1 606)
@@ -63,8 +63,18 @@
res = res &&
(v1[0] == point1d(0) || v1[0] == point1d(1)) &&
(v1[1] == point1d(0) || v1[1] == point1d(1)) &&
- v1[2] == point1d(3) &
+ v1[2] == point1d(3) &&
v1[3] == point1d(2);
+
+ std::vector<point1d> v2(is4.npoints());
+
+ distrib_sort_inv(is4, v2);
+
+ res = res &&
+ v2[0] == point1d(2) &&
+ v2[1] == point1d(3) &&
+ (v2[2] == point1d(0) || v2[2] == point1d(1)) &&
+ (v2[3] == point1d(0) || v2[3] == point1d(1));
return res;
}
1
0
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* oln/utils/histogram.hh: Store histograms in images. Support
histograms of non-scalar types (ie. rgb_8). Fix bugs.
* oln/convert/value_to_point: Add file. Add conversions from values
to points.
* tests/utils/tests/histogram: Add tests.
* oln/core/image.hh: Add dim_traits.
* oln/core/image1.hh: Likewise.
* oln/core/image2.hh: Likewise.
* oln/core/image3.hh: Likewise.
* Makefile.am: Include convert/value_to_point.hh
Index: olena/oln/core/image1d.hh
--- olena/oln/core/image1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/47_image1d.hh 1.28 640)
+++ olena/oln/core/image1d.hh Mon, 02 Feb 2004 09:38:51 +0100 niels
(oln/c/47_image1d.hh 1.28 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
@@ -160,7 +160,11 @@
};
-
+ template <class T, class Exact>
+ struct dim_traits<1, T, Exact>
+ {
+ typedef image1d<T, Exact> img_type;
+ };
} // end of oln
#endif // ! OLENA_CORE_IMAGE1D_HH
Index: olena/oln/core/image2d.hh
--- olena/oln/core/image2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/45_image2d.hh 1.30 640)
+++ olena/oln/core/image2d.hh Mon, 02 Feb 2004 09:39:16 +0100 niels
(oln/c/45_image2d.hh 1.30 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
@@ -160,6 +160,11 @@
};
+ template <class T, class Exact>
+ struct dim_traits<2, T, Exact>
+ {
+ typedef image2d<T, Exact> img_type;
+ };
} // end of oln
#endif // ! OLENA_CORE_IMAGE2D_HH
Index: olena/oln/core/image3d.hh
--- olena/oln/core/image3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/43_image3d.hh 1.27 640)
+++ olena/oln/core/image3d.hh Mon, 02 Feb 2004 09:39:51 +0100 niels
(oln/c/43_image3d.hh 1.27 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
@@ -159,6 +159,11 @@
};
+ template <class T, class Exact>
+ struct dim_traits<3, T, Exact>
+ {
+ typedef image3d<T, Exact> img_type;
+ };
} // end of oln
#endif // ! OLENA_CORE_IMAGE3D_HH
Index: olena/oln/core/image.hh
--- olena/oln/core/image.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/18_image.hh 1.20 640)
+++ olena/oln/core/image.hh Mon, 02 Feb 2004 09:37:19 +0100 niels
(oln/d/18_image.hh 1.20 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
@@ -121,6 +121,11 @@
typedef typename mlc::exact<I>::ret::template mute<T>::ret ret;
};
+ //define img_type equals to the image of dim Dim
+ template <unsigned Dim, class T, class Exact = mlc::final>
+ struct dim_traits
+ {
+ };
} // end of oln
#endif // ! OLENA_CORE_IMAGE_HH
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Thu, 09 Oct 2003 15:31:32 +0200
burrus_n (oln/10_histogram. 1.6.1.14 640)
+++ olena/oln/utils/histogram.hh Sun, 01 Feb 2004 23:07:40 +0100 niels
(oln/10_histogram. 1.6.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
@@ -30,98 +30,123 @@
# include <ntg/basics.hh>
# include <oln/basics.hh>
-
+# include <oln/convert/value_to_point.hh>
# include <vector>
namespace oln {
namespace utils {
- template< typename T, typename U>
+ template< typename T, typename CPT, class V2P>
class histogram;
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
T
- min(const histogram<T, U>& hist);
+ min(const histogram<T, CPT, V2P>& hist);
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
T
- max(const histogram<T, U>& hist);
+ max(const histogram<T, CPT, V2P>& hist);
- template< typename T, typename U = unsigned>
+ template<typename T,
+ typename CPT = unsigned,
+ class V2P = value_to_point<T> >
class histogram
{
- private:
- typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
public:
+ typedef T input_type;
+ typedef V2P value_to_point_type;
+ typedef CPT cpt_type;
+ typedef histogram<T, CPT, V2P> self_type;
+ typedef typename value_to_point_type::result_type point_type;
+ enum {dim = value_to_point_type::result_type::dim};
+ typedef typename dim_traits<dim, CPT>::img_type img_type;
+
+ friend T min<T, CPT, V2P>(const histogram<T, CPT, V2P>& hist);
+ friend T max<T, CPT, V2P>(const histogram<T, CPT, V2P>& hist);
- histogram() : values_(0)
+ histogram(const value_to_point_type & c2p = value_to_point_type()):
+ v2p_(c2p), img_(v2p_.size())
{
- unsigned size = unsigned(ntg_max_val(T)
- - ntg_min_val(T)
- + ntg_unit_val(T));
- // FIXME: what if T is an unsigned int?
- // This should be checked more strictly somewhere.
- // size = max + 1 = 0
- precondition(size > 0);
- values_ = new U[size];
- for (unsigned i = 0; i < size; ++i)
- values_[i] = 0;
+ clear();
}
- ~histogram()
- {
- if (values_)
+ template <class I>
+ histogram(const abstract::image<I> & input,
+ const value_to_point_type & v2p = value_to_point_type()):
+ v2p_(v2p), img_(v2p_.size())
{
- delete[] values_;
- values_ = 0;
+ clear();
+ init(input);
}
+
+ void
+ clear()
+ {
+ typename img_type::iter_type it(img_ );
+ for_all(it)
+ img_[it] = ntg_zero_val(CPT);
}
- U&
- operator[](const T& i)
+ const CPT&
+ operator[](const T &v)const
{
- return values_[unsigned(i - ntg_min_val(T))];
+ return img_[v2p_(v)];
}
- friend T min<T, U>(const histogram<T, U>& hist);
- friend T max<T, U>(const histogram<T, U>& hist);
+ CPT&
+ operator[](const T &v)
+ {
+ return img_[v2p_(v)];
+ }
template <class I>
void
init(const abstract::image<I> &img)
{
- oln_iter_type(I) p(img);
+ oln_iter_type(I) it_img(img);
- for_all (p)
- values_[unsigned(img[p])]++;
+ for_all(it_img)
+ ++img_[v2p_(img[it_img])];
+ }
+
+ const img_type &
+ image() const
+ {
+ return img_;
}
protected:
- U *values_;
+ const value_to_point_type v2p_;
+ img_type img_;
};
- template< typename T, typename U >
+ //Note: If there is no min an assertion will fail at the end of the
loop.
+ template< typename T, typename CPT, class V2P >
inline T
- min(const histogram<T, U>& hist)
+ min(const histogram<T, CPT, V2P>& hist)
{
- unsigned i;
- for (i = 0; i < unsigned(ntg_max_val(T) - ntg_min_val(T)); ++i)
- if (hist.values_[i] > 0)
+ 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))
break;
- return T(ntg_min_val(T) + i);
+ return i;
}
-
- template< typename T, typename U >
+ //Note: If there is no max an assertion will fail at the end of the
loop.
+ template< typename T, typename CPT, class V2P >
inline T
- max(const histogram<T, U>& hist)
+ max(const histogram<T, CPT, V2P>& hist)
{
- unsigned i;
- for (i = unsigned(ntg_max_val(T) - ntg_min_val(T)); i > 0; --i)
- if (hist.values_[i] > 0)
+ 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))
break;
- return T(ntg_min_val(T) + i);
+ return i;
}
/* The two functions above can be slow when the histogram is sparse
@@ -144,12 +169,14 @@
value are accessed, and delay the _real_ min and max compuation
until min() or max() is called. */
- template< typename T, typename U = unsigned>
- class histogram_minmax : public histogram<T, U>
+ template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
+ class histogram_minmax : public histogram<T, CPT, V2P>
{
+ private:
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
protected:
void
- adjust(unsigned idx)
+ adjust(const T &idx)
{
if (idx > max_)
max_ = idx;
@@ -158,78 +185,101 @@
}
public:
- histogram_minmax() :
- histogram<T,U>(),
- min_(0), max_(unsigned(ntg_max_val(T) - ntg_min_val(T))) {}
- U&
+ typedef V2P value_to_point_type;
+
+ histogram_minmax(const value_to_point_type & v2p =
value_to_point_type()) :
+ histogram<T, CPT, V2P>(v2p),
+ min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
+
+ template <class I>
+ histogram_minmax(const abstract::image<I> & input,
+ const value_to_point_type & v2p = value_to_point_type()) :
+ histogram<T, CPT, V2P>(input, v2p),
+ min_(ntg_min_val(T)), max_(ntg_max_val(T)) {}
+
+
+ const CPT&
+ operator[](const T& i) const
+ {
+ adjust(i);
+ return img_[v2p_(i)];
+ }
+
+ CPT&
operator[](const T& i)
{
- unsigned idx = unsigned(i - ntg_min_val(T));
- adjust(idx);
- return this->values_[idx];
+ adjust(i);
+ return img_[v2p_(i)];
}
- U
+ T
min()
{
- unsigned i;
- for (i = min_; i < unsigned(ntg_max_val(T) - ntg_min_val(T)); ++i)
- if (this->values_[i] > 0)
+ for (; min_ <= ntg_max_val(T); ++min_)
+ if (img_[v2p_(min_)] > ntg_zero_val(CPT))
break;
- min_ = i;
- return T(ntg_min_val(T) + i);
+ return min_;
}
T
max()
{
- unsigned i;
- for (i = max_; i > 0; --i)
- if (this->values_[i] > 0)
+ for (; max_ > 0; --max_)
+ if (img_[v2p_(max_)] > ntg_zero_val(CPT))
break;
- max_ = i;
- return T(ntg_min_val(T) + i);
+ return max_;
}
protected:
- unsigned min_, max_; // indices of min and max elements
+ T min_, max_; // indices of min and max elements
};
- template< typename T, typename U = unsigned>
- class histogram_min : public histogram<T, U>
+ template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
+ class histogram_min : public histogram<T, CPT, V2P>
{
+ private:
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type
ensure_type;
protected:
void
- adjust(unsigned idx)
+ adjust(const T& idx)
{
if (idx < min_)
min_ = idx;
}
-
public:
- histogram_min() : histogram<T,U>(), min_(0) {}
+ typedef V2P value_to_point_type;
+
+ histogram_min(const value_to_point_type & v2p =
value_to_point_type()) :
+ histogram<T, CPT, V2P>(v2p), min_(ntg_min_val(T)) {}
+
+ template <class I>
+ histogram_min(const abstract::image<I> & input,
+ const value_to_point_type & v2p = value_to_point_type()) :
+ histogram<T, CPT, V2P>(input, v2p), min_(ntg_min_val(T)) {}
+
- U&
+ const CPT&
+ operator[](const T& i) const
+ {
+ adjust(i);
+ return img_[v2p_(i)];
+ }
+
+ CPT&
operator[](const T& i)
{
- // FIXME: subtractions is not necessarily defined for T
- // Casts should be done sooner and type conformance checked.
- // ntg_storage_type(T) is really weird.
- unsigned idx = unsigned(ntg_storage_type(T)(i) - ntg_min_val(T));
- adjust(idx);
- return this->values_[idx];
+ adjust(i);
+ return img_[v2p_(i)];
}
- U
+ T
min()
{
- unsigned i;
- for (i = min_; i < unsigned(ntg_max_val(T) - ntg_min_val(T)); ++i)
- if (this->values_[i] > 0)
+ for (; min_ <= ntg_max_val(T); ++min_)
+ if (img_[v2p_(min_)] > ntg_zero_val(CPT))
break;
- min_ = i;
- return T(ntg_min_val(T) + i);
+ return min_;
}
T
@@ -239,41 +289,52 @@
}
protected:
- unsigned min_; // index of min element
+ T min_; // index of min element
};
- template< typename T, typename U = unsigned>
- class histogram_max : public histogram<T, U>
+ template< typename T, typename CPT = unsigned, class V2P =
value_to_point<T> >
+ class histogram_max : public histogram<T, CPT, V2P>
{
protected:
void
- adjust(unsigned idx)
+ adjust(const T& idx)
{
if (idx > max_)
max_ = idx;
}
public:
- histogram_max() :
- histogram<T,U>(),max_(unsigned(ntg_max_val(T) - ntg_min_val(T))) {}
+ typedef V2P value_to_point_type;
+
+ histogram_max(const value_to_point_type & v2p =
value_to_point_type()) :
+ histogram<T, CPT, V2P>(v2p),max_(ntg_max_val(T)) {}
+
+ template <class I>
+ histogram_max(const abstract::image<I> & input,
+ const value_to_point_type & v2p = value_to_point_type()) :
+ histogram<T, CPT, V2P>(input, v2p),max_(ntg_max_val(T)) {}
+
+ const CPT&
+ operator[](const T& i) const
+ {
+ adjust(i);
+ return img_[v2p_(i)];
+ }
- U&
+ CPT&
operator[](const T& i)
{
- unsigned idx = unsigned(unsigned(i) - unsigned(ntg_min_val(T)));
- adjust(idx);
- return this->values_[idx];
+ adjust(i);
+ return img_[v2p_(i)];
}
T
max()
{
- unsigned i;
- for (i = max_; i > 0; --i)
- if (this->values_[i] > 0)
+ for (; max_ > 0; --max_)
+ if (img_[v2p_(max_)] > ntg_zero_val(CPT))
break;
- max_ = i;
- return T(ntg_min_val(T) + i);
+ return max_;
}
T
@@ -283,31 +344,30 @@
}
protected:
- unsigned max_; // index of max element
+ T max_; // index of max element
};
-
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
inline T
- min(histogram_minmax<T, U>& hist)
+ min(histogram_minmax<T, CPT, V2P>& hist)
{
return hist.min();
}
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
inline T
- min(histogram_min<T, U>& hist)
+ min(histogram_min<T, CPT, V2P>& hist)
{
return hist.min();
}
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
inline T
- max(histogram_minmax<T, U>& hist)
+ max(histogram_minmax<T, CPT, V2P>& hist)
{
return hist.max();
}
- template< typename T, typename U >
+ template< typename T, typename CPT, class V2P >
inline T
- max(histogram_max<T, U>& hist)
+ max(histogram_max<T, CPT, V2P>& hist)
{
return hist.max();
}
@@ -319,28 +379,29 @@
{
typedef oln_value_type(I) val;
+ typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type
ensure_type;
+
// check the size
- precondition(v.size() == unsigned(im.npoints()));
- // unsigned(im.nrows() * im.ncols()));
+ precondition(v.size() == im.npoints());
// calculate the histogram of the image
- utils::histogram<oln_value_type(I) > histo;
- histo.init(im);
+ 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
- std::vector<oln_point_type(I)* > ptr(ntg_max_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 (int i = ntg_min_val(val) + 1; i <= ntg_max_val(val); i++)
- ptr[unsigned(i)] = ptr[unsigned(i - 1)] + histo[i - 1];
+ for (ntg_cumul_type(val) i = 1; i < card; i++)
+ ptr[i] = ptr[i - 1] + histo[i - 1 + ntg_min_val(val)];
// Now iterate on the image to sort point in the order of their
// level
oln_iter_type(I) p(im);
for_all(p)
- *(ptr[unsigned(im[p])]++) = p;
+ *(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
}
} // end of namespace utils
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/q/47_Makefile.a 1.3.1.1.1.6.1.7 640)
+++ olena/oln/Makefile.am Sun, 01 Feb 2004 18:24:02 +0100 niels
(oln/q/47_Makefile.a 1.3.1.1.1.6.1.7 640)
@@ -33,6 +33,7 @@
convert/rgbnrgb.hh \
convert/rgbxyz.hh \
convert/stretch.hh \
+ convert/value_to_point.hh \
convol/convolution.hh \
convol/fast_gaussian.hh \
convol/fast_gaussian.hxx \
Index: olena/tests/utils/tests/histogram
--- olena/tests/utils/tests/histogram Thu, 07 Aug 2003 02:37:23 +0200
burrus_n (oln/u/27_histogram. 1.2 600)
+++ olena/tests/utils/tests/histogram Sun, 01 Feb 2004 21:07:51 +0100
niels (oln/u/27_histogram. 1.2 600)
@@ -2,6 +2,7 @@
#include <ntg/int.hh>
#include <oln/basics2d.hh>
+#include <oln/basics1d.hh>
#include <oln/utils/histogram.hh>
#include <iostream>
@@ -21,6 +22,112 @@
fail = true; \
}
+
+bool
+check_int_u8()
+{
+ bool res(true);
+ image1d<int_u8> iu8(4);
+ iu8(0) = 8;
+ iu8(1) = 8;
+ iu8(2) = 7;
+ iu8(3) = 1;
+ histogram<int_u8> hu8(iu8);
+ res = res &&
+ hu8[8] == 2 &&
+ hu8[7] == 1 &&
+ hu8[1] == 1 &&
+ hu8[4] == 0 &&
+ hu8[ntg_max_val(int_u8)] == 0 &&
+ hu8[ntg_min_val(int_u8)] == 0;
+ return res;
+};
+
+bool
+check_int_s4_and_distr()
+{
+ bool res(true);
+ image1d<int_s<4> > is4(4);
+ is4(0) = -8;
+ is4(1) = -8;
+ is4(2) = +7;
+ is4(3) = 0;
+ histogram<int_s<4> > his4(is4);
+ res = res &&
+ his4[-8] == 2 &&
+ his4[+7] == 1 &&
+ his4[0] == 1 &&
+ his4[-7] == 0;
+ std::vector<point1d> v1(is4.npoints());
+ distrib_sort(is4, v1);
+ res = res &&
+ (v1[0] == point1d(0) || v1[0] == point1d(1)) &&
+ (v1[1] == point1d(0) || v1[1] == point1d(1)) &&
+ v1[2] == point1d(3) &
+ v1[3] == point1d(2);
+ return res;
+}
+
+
+
+bool
+check_min_max()
+{
+ bool res(true);
+ image1d<int_s<4> > is4(4);
+ is4(0) = -4;
+ is4(1) = -2;
+ is4(2) = +3;
+ is4(3) = 1;
+ histogram<int_s<4> > his4(is4);
+
+ res = res &&
+ min(his4) == -4
+ &&
+ max(his4) == 3;
+
+ histogram_min<int_s<4> > his4_min(is4);
+ histogram_max<int_s<4> > his4_max(is4);
+ histogram_minmax<int_s<4> > his4_minmax(is4);
+
+ his4_minmax[-5] = his4_min[-5] = his4_max[-5] = his4[-5] = 20;
+ his4_minmax[3] = his4_min[3] = his4_max[3] = his4[3] = 0;
+
+ his4_minmax[2] = his4_min[2] = his4_max[2] = his4[2] = 42;
+
+ res = res &&
+ min(his4) == -5 &&
+ max(his4) == 2 &&
+ min(his4) == min(his4_min) &&
+ min(his4) == min(his4_max) &&
+ min(his4) == min(his4_minmax) &&
+ max(his4) == max(his4_min) &&
+ max(his4) == max(his4_max) &&
+ max(his4) == max(his4_minmax);
+ return res;
+};
+
+
+bool
+check_rgb_8()
+{
+ bool res(true);
+ image1d<rgb_8> ir8(4);
+ ir8(0) = rgb_8(1, 1, 1);
+ ir8(1) = rgb_8(1, 2, 1);
+ ir8(2) = rgb_8(255, 255, 255);
+ ir8(3) = rgb_8(1, 2, 1);
+
+ histogram<rgb_8> hr8(ir8);
+ res = res &&
+ hr8[rgb_8(1, 1, 1)] == 1 &&
+ hr8[rgb_8(1, 2, 1)] == 2 &&
+ hr8[rgb_8(255, 255, 255)] == 1 &&
+ hr8[rgb_8(0, 0, 0)] == 0 &&
+ hr8[rgb_8(44, 44, 44)] == 0;
+ return res;
+};
+
bool
check()
{
@@ -34,5 +141,11 @@
distrib_sort<input>(src, v);
+ fail = fail
+ || check_int_u8() == false
+ || check_rgb_8() == false
+ || check_int_s4_and_distr() == false
+ || check_min_max() == false;
+
return fail;
}
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Mon, 02 Feb 2004 10:54:55 +0100
niels ()
+++ olena/oln/convert/value_to_point.hh Mon, 02 Feb 2004 10:08:35 +0100
niels (oln/j/42_value_to_p 644)
@@ -0,0 +1,92 @@
+// 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 OLENA_VALUE_TO_POINT
+# define OLENA_VALUE_TO_POINT
+# include <oln/core/image1d.hh>
+# include <oln/core/image2d.hh>
+# include <oln/core/image3d.hh>
+# include <ntg/int.hh>
+# include <ntg/color/color.hh>
+namespace oln {
+
+ template <typename T>
+ struct value_to_point
+ {
+ typedef point1d result_type;
+ typedef T input_type;
+ typedef image1d_size size_type;
+
+ result_type
+ operator()(const input_type &input) const
+ {
+ result_type r(input - ntg_min_val(input_type));
+ return r;
+ }
+
+ size_type
+ size() const
+ {
+ return size_type(ntg_max_val(input_type) -
ntg_min_val(input_type) + 1,
+ 1);
+ }
+ protected:
+ typedef typename ntg_is_a(input_type,
ntg::non_vectorial)::ensure_type ensure_type;
+ };
+
+ //FIXME: the number of components is not a parameter (due to size_type)
+ template <unsigned Qbits,template <unsigned> class S>
+ struct value_to_point<typename ntg::color<3, Qbits, S> >
+ {
+ enum {nbcomps = 3, qbits = Qbits};
+
+ typedef ntg::color<nbcomps, qbits, S> input_type;
+ typedef typename dim_traits<nbcomps, unsigned>::img_type::size_type
+ size_type;
+ typedef typename input_type::comp_type comp_type;
+ typedef point3d result_type;
+
+ result_type
+ operator()(const input_type &input) const
+ {
+ result_type r;
+ for (unsigned i = 0; i < nbcomps; ++i)
+ r.nth(i) = input[i];
+ return r;
+ }
+
+ size_type
+ size() const
+ {
+ return size_type(ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ ntg_max_val(comp_type) - ntg_min_val(comp_type) + 1,
+ 1);
+ }
+ };
+}
+#endif
1
0