last-svn-commit-242-g082d9ae New app: binary OFF to VTK mesh conversion.

* apps/mesh-segm-skel/off-to-vtk-bin.cc: New. * apps/mesh-segm-skel/Makefile.am (bin_PROGRAMS): Add off-to-vtk-bin. (off_to_vtk_bin_SOURCES): New. --- milena/ChangeLog | 9 +++ milena/apps/mesh-segm-skel/Makefile.am | 9 +++ .../mesh-segm-skel/off-to-vtk-bin.cc} | 52 ++++++++++---------- 3 files changed, 44 insertions(+), 26 deletions(-) copy milena/{sandbox/theo/tufa_2008/gradient.cc => apps/mesh-segm-skel/off-to-vtk-bin.cc} (62%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 010bf56..57fa1a1 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,14 @@ 2011-03-14 Roland Levillain <roland@lrde.epita.fr> + New app: binary OFF to VTK mesh conversion. + + * apps/mesh-segm-skel/off-to-vtk-bin.cc: New. + * apps/mesh-segm-skel/Makefile.am + (bin_PROGRAMS): Add off-to-vtk-bin. + (off_to_vtk_bin_SOURCES): New. + +2011-03-14 Roland Levillain <roland@lrde.epita.fr> + New app performing a 2-collapse on a mesh. * apps/mesh-segm-skel/mesh-complex-2-collapse.cc: New. diff --git a/milena/apps/mesh-segm-skel/Makefile.am b/milena/apps/mesh-segm-skel/Makefile.am index d68ae7c..1b4d20f 100644 --- a/milena/apps/mesh-segm-skel/Makefile.am +++ b/milena/apps/mesh-segm-skel/Makefile.am @@ -236,3 +236,12 @@ TESTS += test-mesh-complex-pinv-curv-skel MOSTLYCLEANFILES += \ socket-complex-pinv-curv-skel.off \ teapot-complex-pinv-curv-skel.off + +## ------------------------- ## +## Conversion applications. ## +## ------------------------- ## + +# Convert a binary OFF file (e.g. no value attached to faces) into a +# VTK file. +bin_PROGRAMS += off-to-vtk-bin +off_to_vtk_bin_SOURCES = off-to-vtk-bin.cc diff --git a/milena/sandbox/theo/tufa_2008/gradient.cc b/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc similarity index 62% copy from milena/sandbox/theo/tufa_2008/gradient.cc copy to milena/apps/mesh-segm-skel/off-to-vtk-bin.cc index 31c308e..926da7d 100644 --- a/milena/sandbox/theo/tufa_2008/gradient.cc +++ b/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,36 +25,36 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file sandbox/geraud/tufa/gradient.cc +/// \file -#include <mln/core/image/image2d.hh> -#include <mln/value/int_u8.hh> -#include <mln/io/pgm/load.hh> -#include <mln/io/pgm/save.hh> -#include <mln/core/alias/neighb2d.hh> +/// \brief A program converting a binary OFF file (e.g. no value +/// attached to faces) into a VTK file. -#include <mln/morpho/elementary/gradient.hh> +#include <iostream> +#include <mln/io/off/load.hh> +#include <mln/io/vtk/save.hh> -void usage(char* argv[]) +int +main(int argc, char* argv[]) { - std::cerr << "usage: " << argv[0] << " input.pgm output.pgm" << std::endl; - std::cerr << "elementary gradient with c4" << std::endl; - std::abort(); -} - - -int main(int argc, char* argv[]) -{ - using namespace mln; - using value::int_u8; - if (argc != 3) - usage(argv); - - image2d<int_u8> f; - io::pgm::load(f, argv[1]); - io::pgm::save(morpho::elementary::gradient(f, c4()), - argv[2]); + { + std::cerr << "usage: " << argv[0] << " input.off output.vtk" + << std::endl; + std::exit(1); + } + + std::string input_filename = argv[1]; + std::string output_filename = argv[2]; + + typedef mln::bin_2complex_image3df ima_t; + ima_t ima; + + // FIXME: Converting bunny-holefilled.off to VTK took 30 sec, which + // is awfully slow. Time the load and save operations and find + // where is (are) the issue(s). + mln::io::off::load(ima, input_filename); + mln::io::vtk::save(ima, output_filename); } -- 1.5.6.5
participants (1)
-
Roland Levillain