4528: Prepare demo for theo and questions for guillaume.

Rename fraction directory into frac directory. * green/doc/examples/fraction/frac.cc : Delete. * green/doc/examples/fraction/frac.hh : Delete. * green/doc/examples/fraction/gcd.hh : Delete * green/doc/examples/fraction/sign_prod.hh : Delete. * green/doc/examples/frac/frac.cc : New. * green/doc/examples/frac/frac.hh : New. * green/doc/examples/frac/gcd.hh : New. * green/doc/examples/frac/sign_prod.hh : New. * green/doc/examples/frac/Makefile.am : New. Collect some tmp results. * green/mln/io/plot/save_histo_sh.hh (save_histo_sh<2d>) : Comment method. * green/mln/mln/accu/stat/histo1d.hh : Update documentation. * green/mln/mln/accu/stat/histo3d_rgb.hh : Update documentation. * green/mln/mln/accu/stat/histo3d_hsl.hh : Update documentation. * green/mln/tests/accu/stat/histo1d/histo1d.cc (test_8bits_integration, main) : Comment unused code, save tmp results. (test_8bits_operator_equal) : Test infer "!=" operator. * green/mln/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc (test_integration, main) : Comment unused code, save tmp results. * green/mln/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc (test_integration, main) : Comment unused code, save tmp results. --- trunk/milena/sandbox/ChangeLog | 35 +++++ .../sandbox/green/doc/examples/frac/Makefile.am | 148 ++++++++++++++++++++ .../green/doc/examples/{fraction => frac}/frac.cc | 0 .../green/doc/examples/{fraction => frac}/frac.hh | 0 .../green/doc/examples/{fraction => frac}/gcd.hh | 0 .../doc/examples/{fraction => frac}/sign_prod.hh | 0 .../green/doc/examples/fraction/Makefile.am | 49 ------- .../milena/sandbox/green/mln/accu/stat/histo1d.hh | 57 +++++--- .../sandbox/green/mln/accu/stat/histo3d_hsl.hh | 4 +- .../sandbox/green/mln/accu/stat/histo3d_rgb.hh | 56 +++++--- .../sandbox/green/mln/io/plot/save_histo_sh.hh | 10 +- .../green/tests/accu/stat/histo1d/histo1d.cc | 14 +- .../tests/accu/stat/histo3d_hsl/histo3d_hsl.cc | 19 ++-- .../tests/accu/stat/histo3d_rgb/histo3d_rgb.cc | 12 +- 14 files changed, 287 insertions(+), 117 deletions(-) create mode 100644 trunk/milena/sandbox/green/doc/examples/frac/Makefile.am rename trunk/milena/sandbox/green/doc/examples/{fraction => frac}/frac.cc (100%) rename trunk/milena/sandbox/green/doc/examples/{fraction => frac}/frac.hh (100%) rename trunk/milena/sandbox/green/doc/examples/{fraction => frac}/gcd.hh (100%) rename trunk/milena/sandbox/green/doc/examples/{fraction => frac}/sign_prod.hh (100%) delete mode 100644 trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog index cc14c70..cb4de1e 100644 --- a/trunk/milena/sandbox/ChangeLog +++ b/trunk/milena/sandbox/ChangeLog @@ -8,6 +8,41 @@ 2009-09-22 Yann Jacquelet <jacquelet@lrde.epita.fr> + Prepare demo for theo and questions for guillaume. + + Rename fraction directory into frac directory. + + * green/doc/examples/fraction/frac.cc : Delete. + * green/doc/examples/fraction/frac.hh : Delete. + * green/doc/examples/fraction/gcd.hh : Delete + * green/doc/examples/fraction/sign_prod.hh : Delete. + + * green/doc/examples/frac/frac.cc : New. + * green/doc/examples/frac/frac.hh : New. + * green/doc/examples/frac/gcd.hh : New. + * green/doc/examples/frac/sign_prod.hh : New. + * green/doc/examples/frac/Makefile.am : New. + + Collect some tmp results. + + * green/mln/io/plot/save_histo_sh.hh + (save_histo_sh<2d>) : Comment method. + * green/mln/mln/accu/stat/histo1d.hh + : Update documentation. + * green/mln/mln/accu/stat/histo3d_rgb.hh + : Update documentation. + * green/mln/mln/accu/stat/histo3d_hsl.hh + : Update documentation. + * green/mln/tests/accu/stat/histo1d/histo1d.cc + (test_8bits_integration, main) : Comment unused code, save tmp results. + (test_8bits_operator_equal) : Test infer "!=" operator. + * green/mln/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc + (test_integration, main) : Comment unused code, save tmp results. + * green/mln/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc + (test_integration, main) : Comment unused code, save tmp results. + +2009-09-22 Yann Jacquelet <jacquelet@lrde.epita.fr> + Adapt styles. Need some 2d code. * green/mln/io/plot/save_histo_sh.hh (save_histo_sh<2d>) : New func. diff --git a/trunk/milena/sandbox/green/doc/examples/frac/Makefile.am b/trunk/milena/sandbox/green/doc/examples/frac/Makefile.am new file mode 100644 index 0000000..d970989 --- /dev/null +++ b/trunk/milena/sandbox/green/doc/examples/frac/Makefile.am @@ -0,0 +1,148 @@ +# +# Generic Makefile +# + +######### +# TOOLS # +######### + +INCLUDES= -I$(HOME)/svn/oln/trunk/milena/sandbox/green +CXXFLAGS= -ggdb -O0 -Wall -W -pedantic -ansi -pipe $(INCLUDES) +ECHO= echo +RM= rm +MKDIR= mkdir -p +CP= cp + +SOURCE_PATTERN= green/tests +BUILD__PATTERN= green/build/tests + + +ifeq ($(findstring $(BUILD__PATTERN),$(PWD)), $(BUILD__PATTERN)) +# Case where make is done from build directory. +SOURCE_DIR= $(subst $(BUILD__PATTERN),$(SOURCE_PATTERN),$(PWD)) +BUILD__DIR= $(PWD) +else +# Case where make is done from source directory. +SOURCE_DIR= $(PWD) +BUILD__DIR= $(subst $(SOURCE_PATTERN),$(BUILD__PATTERN),$(PWD)) +endif + +SRC= $(notdir $(wildcard $(SOURCE_DIR)/*.cc)) +OLD= $(notdir $(wildcard $(SOURCE_DIR)/*~)) +OBJ= $(patsubst %.cc,%.o,$(SRC)) +SOURCE_MAKEFILE=Makefile.am +BUILD__MAKEFILE=Makefile +TARGET_FILE= $(notdir $(PWD)) +SOURCE_FILES= $(notdir $(wildcard $(SOURCE_DIR)/*.*)) +BUILD__FILES= $(filter-out $(SRC) $(SOURCE_MAKEFILE), $(SOURCE_FILES)) + +BUILD__F_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__FILES)) +SOURCE_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_FILES)) + +BUILD__M_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__MAKEFILE)) +SOURCE_M_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_MAKEFILE)) + +TARGET_F_PATH= $(addprefix $(BUILD__DIR)/,$(TARGET_FILE)) +OBJ_F_PATH= $(addprefix $(BUILD__DIR)/,$(OBJ)) +SRC_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SRC)) +OLD_F_PATH= $(addprefix $(SOURCE_DIR)/,$(OLD)) + +############# +# BOOTSTRAP # +############# + + +bootstrap: $(BUILD__DIR) $(BUILD__F_PATH) $(BUILD__M_PATH) + +# Create, if nessary, the destination directory +$(BUILD__DIR): + $(MKDIR) $(BUILD__DIR) + +# Copy, if nessary, all the files, except the Makefile.am +$(BUILD__F_PATH): $(SOURCE_F_PATH) + $(CP) $(addprefix $(SOURCE_DIR)/,$(@F)) $@ + +# Copy if nessary, the Makefile.am into Makefile +$(BUILD__M_PATH): $(SOURCE_M_PATH) + $(CP) $(SOURCE_M_PATH) $(BUILD__M_PATH) + + +####### +# ALL # +####### + +# We assume that the call is done from the build directory. +# With the directive vpath, hidden files are found in the source directory. + +all: $(TARGET_F_PATH) + + +$(TARGET_F_PATH): $(OBJ_F_PATH) + $(LINK.cc) $< $(LOADLIBES) $(LDLIBS) -o $@ + +$(OBJ_F_PATH):$(SRC_F_PATH) + $(COMPILE.cc) $(OUTPUT_OPTION) $< + + +######### +# CLEAN # +######### + +# Force every time the deletion +clean: clean_target clean_obj clean_dst clean_old #clean_make + + +clean_target: + -@$(RM) $(TARGET_F_PATH) &> /dev/null + +clean_obj: + -@$(RM) $(OBJ_F_PATH) &> /dev/null + +clean_dst: + -@$(RM) $(BUILD_F_PATH) &> /dev/null + +clean_make: + -@$(RM) $(BUILD_M_PATH) &> /dev/null + +clean_old: + -@$(RM) $(OLD_F_PATH) &> /dev/null + + +######### +# PRINT # +######### + +print: print_tools print_bootstrap + +print_tools: + @$(ECHO) "HOME = $(HOME)" + @$(ECHO) "INCLUDES = $(INCLUDES)" + @$(ECHO) "CXXFLAGS = $(CXXFLAGS)" + @$(ECHO) "ECHO = $(ECHO)" + @$(ECHO) "RM = $(RM)" + @$(ECHO) "MKDIR = $(MKDIR)" + @$(ECHO) "CP = $(CP)" + @$(ECHO) + +print_bootstrap: + @$(ECHO) "PWD = $(PWD)" + @$(ECHO) "SOURCE_PATTERN = $(SOURCE_PATTERN)" + @$(ECHO) "BUILD__PATTERN = $(BUILD__PATTERN)" + @$(ECHO) "SOURCE_DIR = $(SOURCE_DIR)" + @$(ECHO) "BUILD__DIR = $(BUILD__DIR)" + @$(ECHO) "SOURCE_MAKEFILE = $(SOURCE_MAKEFILE)" + @$(ECHO) "BUILD__MAKEFILE = $(BUILD__MAKEFILE)" + @$(ECHO) "TARGET_FILE = $(TARGET_FILE)" + @$(ECHO) "SOURCE_FILES = $(SOURCE_FILES)" + @$(ECHO) "SOURCE_F_PATH = $(SOURCE_F_PATH)" + @$(ECHO) "BUILD__FILES = $(BUILD__FILES)" + @$(ECHO) "BUILD__F_PATH = $(BUILD__F_PATH)" + @$(ECHO) "BUILD__M_PATH = $(BUILD__M_PATH)" + @$(ECHO) "SOURCE_M_PATH = $(SOURCE_M_PATH)" + @$(ECHO) "SRC = $(SRC)" + @$(ECHO) "OBJ = $(OBJ)" + @$(ECHO) "OLD = $(OLD)" + @$(ECHO) "SRC_F_PATH = $(SRC_F_PATH)" + @$(ECHO) "OBJ_F_PATH = $(OBJ_F_PATH)" + @$(ECHO) "OLD_F_PATH = $(OLD_F_PATH)" + @$(ECHO) diff --git a/trunk/milena/sandbox/green/doc/examples/fraction/frac.cc b/trunk/milena/sandbox/green/doc/examples/frac/frac.cc similarity index 100% rename from trunk/milena/sandbox/green/doc/examples/fraction/frac.cc rename to trunk/milena/sandbox/green/doc/examples/frac/frac.cc diff --git a/trunk/milena/sandbox/green/doc/examples/fraction/frac.hh b/trunk/milena/sandbox/green/doc/examples/frac/frac.hh similarity index 100% rename from trunk/milena/sandbox/green/doc/examples/fraction/frac.hh rename to trunk/milena/sandbox/green/doc/examples/frac/frac.hh diff --git a/trunk/milena/sandbox/green/doc/examples/fraction/gcd.hh b/trunk/milena/sandbox/green/doc/examples/frac/gcd.hh similarity index 100% rename from trunk/milena/sandbox/green/doc/examples/fraction/gcd.hh rename to trunk/milena/sandbox/green/doc/examples/frac/gcd.hh diff --git a/trunk/milena/sandbox/green/doc/examples/fraction/sign_prod.hh b/trunk/milena/sandbox/green/doc/examples/frac/sign_prod.hh similarity index 100% rename from trunk/milena/sandbox/green/doc/examples/fraction/sign_prod.hh rename to trunk/milena/sandbox/green/doc/examples/frac/sign_prod.hh diff --git a/trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am b/trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am deleted file mode 100644 index 36a83e3..0000000 --- a/trunk/milena/sandbox/green/doc/examples/fraction/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# -# Generic Makefile -# - -BIN_PATTERN= trunk/build/milena -SRC_PATTERN= trunk/milena - -CXXFLAGS= -ggdb -O0 -Wall -W -pedantic -ansi -pipe -ECHO= echo -RM= rm -MKDIR= mkdir -CP= cp - -ifeq ($(findstring $(BIN_PATTERN),$(PWD)), $(BIN_PATTERN)) -BIN_DIR= -SRC_DIR= $(subst $(BIN_PATTERN),$(SRC_PATTERN), $(PWD))/ -else -BIN_DIR= $(subst $(SRC_PATTERN),$(BIN_PATTERN), $(PWD))/ -SRC_DIR= -endif - -TARGET= $(BIN_DIR)$(notdir $(PWD)) -BIN_MAKE= $(BIN_DIR)Makefile -SRC_MAKE= $(SRC_DIR)Makefile.am - - -SRC_FILES= $(wildcard $(SRC_DIR)*.cc) -OLD_FILES= $(addsuffix ~, $(SRC_FILES)) -OBJ_FILES= $(addprefix $(BIN_DIR), $(notdir $(SRC_FILES:%.cc=%.o))) - - -all: $(BIN_DIR) $(TARGET) - @$(ECHO) "Compilation terminée" - -$(BIN_DIR): - $(MKDIR) $(BIN_DIR) - $(CP) $(SRC_MAKE) $(BIN_MAKE) - -$(TARGET):$(OBJ_FILES) - $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ - -$(BIN_DIR)%.o:$(SRC_DIR)%.cc - $(COMPILE.cc) $(OUTPUT_OPTION) $< - -clean: - -@$(RM) $(TARGET) - -@$(RM) $(OBJ_FILES) - -@$(RM) $(OLD_FILES) - diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo1d.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo1d.hh index 541b749..807f3bd 100644 --- a/trunk/milena/sandbox/green/mln/accu/stat/histo1d.hh +++ b/trunk/milena/sandbox/green/mln/accu/stat/histo1d.hh @@ -33,7 +33,7 @@ /// \brief Define a histogram as an accumulator which returns an image1d . /// /// This source implements the discrete histogram version. The number of beans -/// is infer from the number of greylevels. A typical int_u8 image has got +/// is infer from the number of graylevels. A typical int_u8 image has got /// 256 bins. An int_u<14> image has got 16384 bins. /// The following sample is a typical use of the histogram. /// @@ -43,9 +43,8 @@ /// #include <mln/io/pgm/load.hh> /// #include <mln/accu/stat/histo1d.hh> /// #include <mln/data/compute.hh> -/// #include <mln/io/plot/save_histo_sh.hh> /// -/// #define OLENA_LENA ""/usr/local/share/olena/images/lena.pgm" +/// #define OLENA_LENA "/usr/local/share/olena/images/lena.pgm" /// /// void test() /// { @@ -54,7 +53,7 @@ /// mln::image1d<unsigned> img_res; /// /// mln::io::pgm::load(img_ref, OLENA_LENA); -/// img_res = mln::data::compute(mln::accu::stat::histo1d<int_u8>(), img_ref); +/// img_res = mln::data::compute(mln::accu::meta::stat::histo1d(), img_ref); /// } @@ -64,6 +63,7 @@ #include <mln/core/macros.hh> #include <mln/core/image/image1d.hh> +#include <mln/core/concept/meta_accumulator.hh> #include <mln/trait/value/comp.hh> @@ -89,8 +89,27 @@ namespace mln } // end of namespace mln::accu::stat - } // end of namespace mln::accu + namespace meta + { + + namespace stat + { + + struct histo1d : public Meta_Accumulator<histo1d> + { + template <typename V> + struct with + { + typedef accu::stat::histo1d<V> ret; + }; + }; + + } // end of namespace mln::accu::meta::stat + + } // end of namespace mln::accu::meta + + } // end of namespace mln::accu namespace trait { @@ -123,9 +142,9 @@ namespace mln /// \brief Define an histogram which returns an image1d . /// /// Param V defines the space in which we count the values. - /// For instance, this histogram works image2d<int_u8> or + /// For instance, this histogram works with image2d<int_u8> or with /// image1d<int_u<14> >. The histogram count the occurrence of each value. - /// The number of bins depends of the greyscale values, for 8 bits there + /// The number of bins depends of the graylevel values, for 8 bits there /// is 256 bins, for 14 bits there is 16384 bins. Note that over /// quantification works too (up to 14 bits). /// @@ -144,7 +163,7 @@ namespace mln /// \brief Initialize the size of the resulting image1d. /// /// Initialize the size the resulting image from the theorical dynamic - /// of the greylevel values (Use V to manage it). + /// of the graylevel values (Use V to manage it). histo1d(); /// \} @@ -159,8 +178,8 @@ namespace mln void init(); - /// \brief Update the histogram with the greylevel of the pixel t. - /// \param[in] t a greylevel pixel of type V. + /// \brief Update the histogram with the graylevel of the pixel t. + /// \param[in] t a graylevel pixel of type V. /// /// The end user shouldn't call this method. In place of it, he can /// go through the data compute interface. @@ -169,6 +188,10 @@ namespace mln /// \brief Update the histogram with an other histogram. /// \param[in] other the other histogram. + /// + /// The end user shouldn't call this method. This is part of + /// data compute interface mechanism. + void take(const histo1d<V>& other); /// \} @@ -196,7 +219,7 @@ namespace mln /// \param[in] histo1 the first histogram to compare with. /// \param[in] histo2 the second histogram. /// - /// The operator compare all the bins from the two histogram. + /// The operator compare all the bins from the two histograms. template <typename V> bool operator==(const histo1d<V>& histo1, const histo1d<V>& histo2); @@ -219,17 +242,9 @@ namespace mln count_.init_(box1d(point1d(mln_min(comp)), point1d(mln_max(comp)))); - // std::cout << "min : " << mln_min(comp) << std::endl; + // std::cout << "min : " << mln_min(comp) << std::endl; // std::cout << "max : " << mln_max(comp) << std::endl; - // std::cout << "min : " << v_point1d(mln_min(comp)) << std::endl; - // std::cout << "max : " << v_point1d(mln_max(comp)) << std::endl; - - //count_.init_(v_box1d(v_point1d(mln_min(comp)), - // v_point1d(mln_max(comp)))); - // this does not work as image1d is friendly close to box1d - - trace::exiting("mln::accu::stat::histo1d<V>::histo1d"); } @@ -249,7 +264,7 @@ namespace mln { trace::entering("mln::accu::stat::histo1d<V>::take"); - // Just convert a greyscale value (int_u8 like) to a position for an + // Just convert a graylevel value (int_u8 like) to a position for an // iterator on the resulting image. ++count_(point1d(t)); diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh index f29a725..c84aaa4 100644 --- a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh +++ b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_hsl.hh @@ -280,7 +280,7 @@ namespace mln unsigned x = (t.hue() - min_hue)/step_hue; unsigned y = (t.lum() - min_lum)/step_lum; unsigned z = (t.sat() - min_sat)/step_sat; - + /* std::cout << "H : " << t.hue() << std::endl; std::cout << "L : " << t.lum() << std::endl; @@ -293,7 +293,7 @@ namespace mln std::cout << "X : " << x << std::endl; std::cout << "Y : " << y << std::endl; std::cout << "Z : " << z << std::endl; - + */ // faire attention avec les histoires de points et leurs coordonnées ++count_(point3d(z, x, y)); diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh index 461870a..3f6411e 100644 --- a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh +++ b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh @@ -33,28 +33,27 @@ /// \brief Define a histogram as an accumulator which returns an image1d . /// /// This source implements the discrete histogram version. The number of beans -/// is infer from the number of greylevels. A typical int_u8 image has got -/// 256 bins. An int_u16 image has got 65535 bins. +/// is infer from the number of greylevels. A typical rgb8 image has got +/// 256x3 bins. Working with a 8 bit quantification in rgb is very costly. /// The following sample is a typical use of the histogram. /// -/// #include <mln/value/int_u8.hh> +/// #include <mln/value/rgb.hh> /// #include <mln/core/image/image1d.hh> -/// #include <mln/core/image/image2d.hh> -/// #include <mln/io/pgm/load.hh> -/// #include <mln/accu/stat/histo1d.hh> +/// #include <mln/core/image/image3d.hh> +/// #include <mln/io/ppm/load.hh> +/// #include <mln/accu/stat/histo3d_rgb.hh> /// #include <mln/data/compute.hh> -/// #include <mln/io/plot/save_histo_sh.hh> /// -/// #define OLENA_LENA ""/usr/local/share/olena/images/lena.pgm" +/// #define OLENA_LENA ""/usr/local/share/olena/images/lena.ppm" /// /// void test() /// { -/// typedef mln::value::int_u8 int_u8; -/// mln::image2d<int_u8> img_ref; -/// mln::image1d<unsigned> img_res; +/// typedef mln::value::rgb<7> rgb7; +/// mln::image2d<rgb7> img_ref; +/// mln::image3d<unsigned> img_res; /// -/// mln::io::pgm::load(img_ref, OLENA_LENA); -/// img_res = mln::data::compute(mln::accu::stat::histo1d<int_u8>(), img_ref); +/// mln::io::ppm::load(img_ref, OLENA_LENA); +/// img_res=mln::data::compute(mln::accu::meta::stat::histo3d_rgb(),img_ref); /// } @@ -90,7 +89,26 @@ namespace mln struct histo3d_rgb; } // end of namespace mln::accu::stat - + + namespace meta + { + + namespace stat + { + + struct histo3d_rgb : public Meta_Accumulator<histo3d_rgb> + { + template <typename V> + struct with + { + typedef accu::stat::histo3d_rgb<V> ret; + }; + }; + + } // end of namespace mln::accu::meta::stat + + } // end of namespace mln::accu::meta + } // end of namespace mln::accu @@ -122,13 +140,13 @@ namespace mln namespace stat { - /// \brief Define an histogram which returns an image1d . + /// \brief Define an histogram which returns an image3d . /// /// Param V defines the space in which we count the values. - /// For instance, this histogram works image2d<int_u8> or - /// image1d<int_u16>. The histogram count the occurrence of each value. - /// The number of bins depends of the greyscale values, for 8 bits there - /// is 256 bins, for 16 bits there is 65536 bins. Note that over + /// For instance, this histogram works image2d<rgb<2>> or + /// image2d<rgb<7>>. The histogram count the occurrence of each value. + /// The number of bins depends of the grayscale values, for 8 bits there + /// is 256x3 bins. Note that over /// quantification works too. /// /// \ingroup modaccuvalues diff --git a/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh b/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh index cfd3446..111949a 100644 --- a/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh +++ b/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh @@ -63,8 +63,8 @@ namespace mln void save_histo_sh(const image1d<I>& img, const std::string& filename); - template <typename I> - void save_histo_sh(const image2d<I>& img, const std::string& filename); + //template <typename I> + //void save_histo_sh(const image2d<I>& img, const std::string& filename); /// \brief Save an histogram image3d as a gnuplot script shell. /// \param[in] img the 3d image which contains the data to save. @@ -123,7 +123,7 @@ namespace mln out.close(); trace::exiting("mln::io::plot::save_histo_sh<1d>"); } - + /* template <typename I> inline void save_histo_sh(const image2d<I>& img, const std::string& filename) @@ -157,7 +157,7 @@ namespace mln trace::exiting("mln::io::plot::save_histo_sh<2d>"); } - + */ template <typename I> inline void save_histo_sh(const image3d<I>& img, const std::string& filename) @@ -183,7 +183,7 @@ namespace mln out << p.row() << " "; out << p.col() << " "; out << p.sli() << " "; - out << img(p) << std::endl; + out << img(p) << std::endl; } out << "e" << std::endl; out << "EOF" << std::endl; diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo1d/histo1d.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo1d/histo1d.cc index e959cbd..71266d1 100644 --- a/trunk/milena/sandbox/green/tests/accu/stat/histo1d/histo1d.cc +++ b/trunk/milena/sandbox/green/tests/accu/stat/histo1d/histo1d.cc @@ -74,8 +74,7 @@ void test_8bits_operator_equal() histo1.take(val); - /// FIXME mln_assertion(histo1 != histo2); doesn't work!! - mln_assertion(!(histo1 == histo2)); + mln_assertion(histo1 != histo2); histo2.take(val); @@ -259,7 +258,8 @@ void test_8bits_integration() const double mean_ref = mln::data::compute(mean(), img_ref); const double var_ref = mln::data::compute(variance(), img_ref); - img_res = mln::data::compute(mln::accu::stat::histo1d<int_u8>(), img_ref); + img_res = mln::data::compute(mln::accu::meta::stat::histo1d(), img_ref); + // img_res = mln::data::compute(mln::accu::stat::histo1d<int_u8>(), img_ref); const double count_res = count_histo(img_res); const double mean_res = mean_histo(img_res); @@ -678,15 +678,17 @@ void test_14bits_classifying() int main() { + test_8bits_operator_equal(); /* test_8bits_instantiation_without_argument(); test_8bits_initialization(); test_8bits_take_argument(); test_8bits_take_other(); test_8bits_operator_equal(); - test_8bits_integration(); */ - test_8bits_classifying(); + //test_8bits_integration(); + + //test_8bits_classifying(); // PROBLEME AVEC LES COORDONNEES PAR DEFAUT QUI SONT EN SIGNED SHORT // SEE mln/core/def/coord.hh @@ -698,7 +700,7 @@ int main() test_14bits_operator_equal(); test_14bits_integration(); */ - test_14bits_classifying(); + //test_14bits_classifying(); return 0; } diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc index 47b3900..0a12706 100644 --- a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc +++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_hsl/histo3d_hsl.cc @@ -330,13 +330,13 @@ void test_integration() mln::image2d<float> img_sav; - //mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/lena.ppm") - mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/fly.ppm"); - img_sec = mln::data::transform(img_fst, mln::fun::v2v::rgb8_to_rgbn<n>()); - img_thd = mln::data::transform(img_sec,mln::fun::v2v::f_rgb_to_hsl_<hsl_f>()); + mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/lena.ppm"); + //mln::io::ppm::load(img_fst, OLENA_IMG_PATH"/fly.ppm"); + //img_sec = mln::data::transform(img_fst, mln::fun::v2v::rgb8_to_rgbn<n>()); + img_thd = mln::data::transform(img_fst,mln::fun::v2v::f_rgb_to_hsl_<hsl_f>()); - img_sav = mln::data::transform(img_thd, hslf_2_h()); - mln::io::plot::save_histo_sh(img_sav, "fly2.sh"); + //img_sav = mln::data::transform(img_thd, hslf_2_h()); + //mln::io::plot::save_histo_sh(img_sav, "lena2.sh"); img_ref = mln::data::transform(img_thd, hslf_2_vec3f()); @@ -347,7 +347,7 @@ void test_integration() img_res = mln::data::compute(mln::accu::stat::histo3d_hsl<q,hsl_f>(),img_thd); - mln::io::plot::save_histo_sh(img_res, "fly3.sh"); + mln::io::plot::save_histo_sh(img_res, "histo_hsl.sh"); const double count_res = count_histo(img_res); const vec3f mean_res = mean_histo(img_res, q); @@ -410,13 +410,14 @@ void test() int main() { - + /* test_operator_equal<3>(); test_instantiation_without_argument<3>(); test_initialization<3>(); test_take_argument<3>(); test_take_other<3>(); - test_integration<3,7>(); + */ + test_integration<7,6>(); return 0; } diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc index eb87332..cbf273b 100644 --- a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc +++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc @@ -9,6 +9,7 @@ #include <mln/io/ppm/load.hh> #include <mln/io/ppm/save.hh> #include <mln/io/plot/save.hh> +#include <mln/io/plot/save_histo_sh.hh> #include <mln/data/compute.hh> #include <mln/data/transform.hh> @@ -279,6 +280,7 @@ void test_integration() img_res = mln::data::compute(mln::accu::stat::histo3d_rgb<rgbn>(), img_ref); + mln::io::plot::save_histo_sh(img_res, "histo_rgb.sh"); const double count_res = count_histo(img_res); const vec3f mean_res = mean_histo(img_res); @@ -329,14 +331,14 @@ int main() test_take_other<1>(); test_integration<1>(); */ - + /* test_operator_equal<2>(); test_instantiation_without_argument<2>(); test_initialization<2>(); test_take_argument<2>(); test_take_other<2>(); test_integration<2>(); - + */ /* test_operator_equal<3>(); test_instantiation_without_argument<3>(); @@ -361,14 +363,14 @@ int main() test_take_argument<5>(); test_take_other<5>(); test_integration<5>(); - + */ test_operator_equal<6>(); test_instantiation_without_argument<6>(); test_initialization<6>(); test_take_argument<6>(); test_take_other<6>(); test_integration<6>(); - */ + /* test_operator_equal<7>(); test_instantiation_without_argument<7>(); @@ -392,7 +394,5 @@ int main() */ - // p2p/fold+transform_domain for hcv - return 0; } -- 1.5.6.5
participants (1)
-
Yann Jacquelet