
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Update IRM segmentation. * theo/igr/dump_cut.cc: New. * theo/igr/irm_anat_segm.cc: Update. dump_cut.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ irm_anat_segm.cc | 14 ++++++++------ 2 files changed, 55 insertions(+), 6 deletions(-) Index: theo/igr/dump_cut.cc --- theo/igr/dump_cut.cc (revision 0) +++ theo/igr/dump_cut.cc (revision 0) @@ -0,0 +1,47 @@ + +#include <mln/make/image3d.hh> +#include <mln/data/fill.hh> +#include <mln/value/int_u8.hh> +#include <mln/io/dump/load.hh> +#include <mln/io/dump/save.hh> + + + +void usage(char* argv[]) +{ + std::cerr << "usage: " << argv[0] << " input.dump s_min r_min c_min s_max r_max c_max output.dump" << std::endl; + abort(); +} + + + +int main(int argc, char* argv[]) +{ + using namespace mln; + using value::int_u8; + + if (argc != 9) + usage(argv); + + image3d<int_u8> vol; + io::dump::load(vol, argv[1]); + + int + s_min = atoi(argv[2]), + r_min = atoi(argv[3]), + c_min = atoi(argv[4]), + + s_max = atoi(argv[5]), + r_max = atoi(argv[6]), + c_max = atoi(argv[7]); + + // FIXME: Test! + + box3d b = make::box3d(s_min, r_min, c_min, s_max, r_max, c_max); + + // IRM.dump => 0, 180, 50, 14, 340, 400 + + image3d<int_u8> ima(b); + data::fill(ima, vol); + io::dump::save(ima, argv[8]); +} Index: theo/igr/irm_anat_segm.cc --- theo/igr/irm_anat_segm.cc (revision 3315) +++ theo/igr/irm_anat_segm.cc (working copy) @@ -7,7 +7,7 @@ #include <mln/io/dump/save.hh> #include <mln/morpho/elementary/gradient.hh> -#include <mln/morpho/closing_volume.hh> +#include <mln/morpho/closing_height.hh> #include <mln/morpho/watershed/flooding.hh> #include <mln/accu/mean.hh> @@ -19,7 +19,8 @@ void usage(char* argv[]) { - std::cerr << "usage: " << argv[0] << " input.dump output.dump" << std::endl; + std::cerr << "usage: " << argv[0] << " input.dump lambda output.dump" << std::endl + << " It relies on height closing; e.g., take lambda = 20" << std::endl; abort(); } @@ -30,7 +31,7 @@ using namespace mln; using value::int_u8; - if (argc != 3) + if (argc != 4) usage(argv); trace::quiet = false; @@ -40,8 +41,10 @@ image3d<int_u8> vol, grad, clo; io::dump::load(vol, argv[1]); + unsigned lambda = atoi(argv[2]); + grad = morpho::elementary::gradient(vol, c6()); - clo = morpho::closing_volume(grad, c6(), 666); + clo = morpho::closing_height(grad, c6(), lambda); typedef value::label_16 L; L n_basins; @@ -60,8 +63,7 @@ convert::from_to(a, f); image3d<int_u8> out = level::transform(wst, f); - io::dump::save(out, argv[2]); - + io::dump::save(out, argv[3]); trace::exiting("main"); }