
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox ChangeLog: 2009-06-10 Fabien Freling <fabien.freling@lrde.epita.fr> Add new distance and minor updates. * fabien/igr/Makefile.rules: Remove Mac OS X specific framework. * fabien/igr/Makefile: Small update. * fabien/igr/check_dist.sh: Add new distance. * fabien/igr/check_edges.sh: Add new distance. * fabien/igr/crop.cc: Small update. * fabien/igr/dist_edges.cc: Add new distance. * fabien/igr/filter.cc: Small update. * fabien/igr/mean_median_label.cc: Small update. * fabien/igr/wst_edges.cc: Small update. --- Makefile | 3 +++ Makefile.rules | 5 ++--- check_dist.sh | 4 ++-- check_edges.sh | 19 +++++++++++++------ crop.cc | 3 +++ dist_edges.cc | 25 +++++++++++++++++++++++++ filter.cc | 5 ++--- mean_median_label.cc | 1 - wst_edges.cc | 5 ++--- 9 files changed, 52 insertions(+), 18 deletions(-) Index: trunk/milena/sandbox/fabien/igr/mean_median_label.cc =================================================================== --- trunk/milena/sandbox/fabien/igr/mean_median_label.cc (revision 4061) +++ trunk/milena/sandbox/fabien/igr/mean_median_label.cc (revision 4062) @@ -29,7 +29,6 @@ #include <mln/data/paste.hh> #include <mln/debug/quiet.hh> #include <mln/convert/from_to.hh> -#include <mln/fun/v2v/fit.hh> #include <mln/labeling/compute.hh> #include <mln/labeling/wrap.hh> #include <mln/data/compute.hh> Index: trunk/milena/sandbox/fabien/igr/crop.cc =================================================================== --- trunk/milena/sandbox/fabien/igr/crop.cc (revision 4061) +++ trunk/milena/sandbox/fabien/igr/crop.cc (revision 4062) @@ -41,6 +41,8 @@ image3d<int_u12> vol; io::dicom::load(vol, argv[1]); + std::cout << "Input bbox: " << vol.bbox() << std::endl; + int s_min = atoi(argv[2]), r_min = atoi(argv[3]), @@ -51,6 +53,7 @@ c_max = atoi(argv[7]); box3d b = make::box3d(s_min, r_min, c_min, s_max, r_max, c_max); + std::cout << "Output bbox: " << b << std::endl; image3d<int_u12> ima(b); data::fill(ima, vol); Index: trunk/milena/sandbox/fabien/igr/check_edges.sh =================================================================== --- trunk/milena/sandbox/fabien/igr/check_edges.sh (revision 4061) +++ trunk/milena/sandbox/fabien/igr/check_edges.sh (revision 4062) @@ -20,16 +20,22 @@ exit fi - convert dist.pgm dist${2}.png - convert watershed.ppm watershed${2}.png - convert means.pgm means${2}.png - convert dist_mean.pgm dist_mean${2}.png - convert dev.pgm dev${2}.png +#convert dist.pgm dist${2}.png +#convert watershed.ppm watershed${2}.png +#convert means.pgm means${2}.png +#convert dist_mean.pgm dist_mean${2}.png +#convert dev.pgm dev${2}.png + + mv dist.pgm dist${2}.pgm + mv watershed.ppm watershed${2}.pgm + mv means.pgm means${2}.pgm + mv dist_mean.pgm dist_mean${2}.pgm + mv dev.pgm dev${2}.pgm cp watershed.dump watershed${2}.dump # Cleanup. - rm *.pgm *.ppm +#rm *.pgm *.ppm } batch_process () @@ -38,6 +44,7 @@ process $1 2 $2 process $1 3 $2 process $1 4 $2 + process $1 5 $2 } batch_process $1 $2 Index: trunk/milena/sandbox/fabien/igr/wst_edges.cc =================================================================== --- trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4061) +++ trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4062) @@ -29,7 +29,6 @@ #include <mln/data/paste.hh> #include <mln/debug/quiet.hh> #include <mln/convert/from_to.hh> -#include <mln/fun/v2v/fit.hh> #include <mln/labeling/compute.hh> #include <mln/labeling/wrap.hh> #include <mln/data/compute.hh> @@ -40,7 +39,7 @@ #include <mln/math/diff_abs.hh> #include <mln/morpho/dilation.hh> #include <mln/morpho/erosion.hh> -#include <mln/morpho/closing/volume.hh> +#include <mln/morpho/closing/sum.hh> #include <mln/morpho/watershed/flooding.hh> #include <mln/pw/all.hh> #include <mln/util/array.hh> @@ -115,7 +114,7 @@ // Closing. - mln_VAR(d_clo, morpho::closing::volume(input | world::inter_pixel::is_separator(), world::inter_pixel::e2e(), lambda)); + mln_VAR(d_clo, morpho::closing::sum(input | world::inter_pixel::is_separator(), world::inter_pixel::e2e(), lambda)); io_save_edges_int_u12(d_clo, 0, "d_clo.pgm"); Index: trunk/milena/sandbox/fabien/igr/check_dist.sh =================================================================== --- trunk/milena/sandbox/fabien/igr/check_dist.sh (revision 4061) +++ trunk/milena/sandbox/fabien/igr/check_dist.sh (revision 4062) @@ -4,8 +4,7 @@ process () { ./dist_edges $1 -1 $2 dist${2}.dump - convert dist.pgm dist${2}.png - rm dist*.pgm + mv dist.pgm dist${2}.pgm } batch_process () @@ -14,6 +13,7 @@ process $1 2 process $1 3 process $1 4 + process $1 5 } batch_process $1 $2 Index: trunk/milena/sandbox/fabien/igr/Makefile =================================================================== --- trunk/milena/sandbox/fabien/igr/Makefile (revision 4061) +++ trunk/milena/sandbox/fabien/igr/Makefile (revision 4062) @@ -57,6 +57,9 @@ label2gif: label2gif.cc ${CXX} -I../../../ ${DICOM} ${CXXFLAGS} $^ -o label2gif +min_max_float: min_max_float.cc + ${CXX} -I../../../ ${DICOM} ${CXXFLAGS} $^ -o min_max_float + ##################### filter: filter.cc Index: trunk/milena/sandbox/fabien/igr/dist_edges.cc =================================================================== --- trunk/milena/sandbox/fabien/igr/dist_edges.cc (revision 4061) +++ trunk/milena/sandbox/fabien/igr/dist_edges.cc (revision 4062) @@ -1,4 +1,5 @@ #include <algorithm> +#include <cmath> #include <mln/core/image/image1d.hh> #include <mln/core/image/image2d.hh> @@ -188,6 +189,28 @@ } dist4; +struct dist5_t : Function_vv2v<dist5_t> +{ + typedef int_u12 result; + + template <typename V> + int_u12 operator()(const util::array<V>& v1, + const util::array<V>& v2) const + { + double res = 0.f; + + for (unsigned i = 0; i < v1.nelements(); ++i) + res += (double) math::diff_abs(v1[i], v2[i]); + + res = res / v1.nelements(); + //res = 1 - res; + res = (res * 4095) + 0.49; + + return (int) res; + } +} dist5; + + @@ -236,6 +259,8 @@ edges = world::inter_pixel::compute(imax, dist3); else if (dist_type == 4) edges = world::inter_pixel::compute(imax, dist4); + else if (dist_type == 5) + edges = world::inter_pixel::compute(imax, dist5); io_save_edges_int_u12(edges, 0, "dist.pgm"); Index: trunk/milena/sandbox/fabien/igr/Makefile.rules =================================================================== --- trunk/milena/sandbox/fabien/igr/Makefile.rules (revision 4061) +++ trunk/milena/sandbox/fabien/igr/Makefile.rules (revision 4062) @@ -1,9 +1,8 @@ CXX = g++ CXXFLAGS = -Wall -Wextra -DNDEBUG -O1 -DICOM_INC = -I/usr/local/include/gdcm-2.0 -DICOM_LIBS = -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmIOD -lgdcmMSFF -lgdcmexpat -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmjpeg8 -lgdcmopenjpeg -lgdcmuuid -lgdcmzlib \ - -framework CoreFoundation +DICOM_INC = -I/lrde/dev/linux-x86/stable/gdcm/include +DICOM_LIBS = -L/lrde/dev/linux-x86/stable/gdcm/lib -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmIOD -lgdcmMSFF -lgdcmexpat -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmjpeg8 -lgdcmopenjpeg -lgdcmuuid -lgdcmzlib DICOM = ${DICOM_INC} ${DICOM_LIBS} MAGICK = `Magick++-config --cppflags --ldflags --libs` Index: trunk/milena/sandbox/fabien/igr/filter.cc =================================================================== --- trunk/milena/sandbox/fabien/igr/filter.cc (revision 4061) +++ trunk/milena/sandbox/fabien/igr/filter.cc (revision 4062) @@ -5,8 +5,8 @@ #include <mln/core/image/image2d.hh> #include <mln/core/alias/neighb2d.hh> #include <mln/core/image/image3d.hh> -#include <mln/core/image/slice_image.hh> -#include <mln/core/image/image_if.hh> +#include <mln/core/image/dmorph/slice_image.hh> +#include <mln/core/image/dmorph/image_if.hh> #include <mln/core/routine/duplicate.hh> #include <mln/core/routine/extend.hh> #include <mln/core/var.hh> @@ -29,7 +29,6 @@ #include <mln/data/paste.hh> #include <mln/debug/quiet.hh> #include <mln/convert/from_to.hh> -#include <mln/fun/v2v/fit.hh> #include <mln/labeling/compute.hh> #include <mln/labeling/wrap.hh> #include <mln/data/compute.hh>