* green/doc/example/io: New directory.
* green/doc/example/io/Makefile.am: New makefile.
* green/doc/example/io/io.cc: New code example.
---
trunk/milena/sandbox/ChangeLog | 9 ++
.../sandbox/green/doc/examples/io/Makefile.am | 148 ++++++++++++++++++++
trunk/milena/sandbox/green/doc/examples/io/io.cc | 72 ++++++++++
3 files changed, 229 insertions(+), 0 deletions(-)
create mode 100644 trunk/milena/sandbox/green/doc/examples/io/Makefile.am
create mode 100644 trunk/milena/sandbox/green/doc/examples/io/io.cc
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 7f3b3ab..2057d9b 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-30 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ First draft for loading and saving example codes for the
+ quick_tour milena documentation.
+
+ * green/doc/example/io: New directory.
+ * green/doc/example/io/Makefile.am: New makefile.
+ * green/doc/example/io/io.cc: New code example.
+
2009-09-29 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Fix behaviour when empty class appears. Fix methods order of the
diff --git a/trunk/milena/sandbox/green/doc/examples/io/Makefile.am
b/trunk/milena/sandbox/green/doc/examples/io/Makefile.am
new file mode 100644
index 0000000..6ed0e88
--- /dev/null
+++ b/trunk/milena/sandbox/green/doc/examples/io/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/doc
+BUILD__PATTERN= green/build/doc
+
+
+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/io/io.cc
b/trunk/milena/sandbox/green/doc/examples/io/io.cc
new file mode 100644
index 0000000..24e94d2
--- /dev/null
+++ b/trunk/milena/sandbox/green/doc/examples/io/io.cc
@@ -0,0 +1,72 @@
+// The aim of this file is to test the different ways to load and save images.
+
+// NEED SPECIFIC LINUX INSTALL
+/*
+#include <mln/io/dicom/load.hh>
+#include <mln/io/fits/load.hh>
+#include <mln/io/magick/load.hh>
+#include <mln/io/magick/save.hh>
+#include <mln/io/tiff/load.hh>
+*/
+
+#include <mln/io/cloud/load.hh>
+#include <mln/io/cloud/save.hh>
+
+
+#include <mln/io/dump/load.hh>
+#include <mln/io/dump/save.hh>
+
+#include <mln/io/off/load.hh>
+#include <mln/io/off/save.hh>
+
+#include <mln/io/pbm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <mln/io/pbms/load.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/io/pgms/load.hh>
+
+#include <mln/io/pfm/load.hh>
+#include <mln/io/pfm/save.hh>
+
+#include <mln/io/pnm/load.hh>
+#include <mln/io/pnm/save.hh>
+
+#include <mln/io/pnms/load.hh>
+
+#include <mln/io/plot/load.hh>
+#include <mln/io/plot/save.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/io/ppms/load.hh>
+
+
+
+#include <mln/io/txt/save.hh>
+
+#include <mln/debug/println.hh>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/img_path.hh>
+
+void test_generic_load()
+{
+ mln::image2d<mln::value::int_u16> input;
+
+ mln::io::pgm::load(input, OLENA_IMG_PATH"/lena.pgm");
+ // mln::io::off::save(OLENA_IMG_PATH"/lena.off");
+}
+
+
+int main()
+{
+ test_generic_load();
+
+ return 0;
+}
--
1.5.6.5