* mln/io/dump/all.hh: Include a new file.
* mln/io/dump/get_header.hh: New.
---
milena/ChangeLog | 8 ++++
milena/mln/io/dump/all.hh | 1 +
milena/mln/io/{raw => dump}/get_header.hh | 66 +++++++++++++----------------
3 files changed, 38 insertions(+), 37 deletions(-)
copy milena/mln/io/{raw => dump}/get_header.hh (65%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 05234c0..21d7ddc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2010-02-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add a routine to read dump files header.
+
+ * mln/io/dump/all.hh: Include a new file.
+
+ * mln/io/dump/get_header.hh: New.
+
+2010-02-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add a routine to read DICOM files header.
* mln/io/dicom/all.hh: Include a new file.
diff --git a/milena/mln/io/dump/all.hh b/milena/mln/io/dump/all.hh
index ae405e8..69d465b 100644
--- a/milena/mln/io/dump/all.hh
+++ b/milena/mln/io/dump/all.hh
@@ -41,6 +41,7 @@ namespace mln
}
+# include <mln/io/dump/get_header.hh>
# include <mln/io/dump/load.hh>
# include <mln/io/dump/save.hh>
diff --git a/milena/mln/io/raw/get_header.hh b/milena/mln/io/dump/get_header.hh
similarity index 65%
copy from milena/mln/io/raw/get_header.hh
copy to milena/mln/io/dump/get_header.hh
index fa5dbf3..2cfb4cb 100644
--- a/milena/mln/io/raw/get_header.hh
+++ b/milena/mln/io/dump/get_header.hh
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_IO_RAW_GET_HEADER_HH
-# define MLN_IO_RAW_GET_HEADER_HH
+#ifndef MLN_IO_DUMP_GET_HEADER_HH
+# define MLN_IO_DUMP_GET_HEADER_HH
/// \file
///
-/// Load a Milena image rawed into a file.
+/// Load a Milena image dumped into a file.
# include <iostream>
# include <fstream>
@@ -45,11 +45,11 @@ namespace mln
namespace io
{
- namespace raw
+ namespace dump
{
- /// Store raw file header.
- struct raw_header
+ /// Store dump file header.
+ struct dump_header
{
unsigned dim;
std::string value_type;
@@ -57,79 +57,71 @@ namespace mln
};
- /// Retrieve header in a raw file.
- raw_header get_header(const std::string& filename);
+ /// Retrieve header in a dump file.
+ dump_header get_header(const std::string& filename);
# ifndef MLN_INCLUDE_ONLY
- raw_header get_header(const std::string& filename)
+ dump_header get_header(const std::string& filename)
{
- trace::entering("mln::io::raw::get_header");
+ trace::entering("mln::io::dump::get_header");
- raw_header header;
+ dump_header header;
- std::string info_filename = filename + ".info";
-
- std::ifstream info_file(info_filename.c_str());
- if (! info_file)
+ std::ifstream file(filename.c_str());
+ if (! file)
{
- std::cerr << "io::raw::get_header - Error: cannot open file '"
+ std::cerr << "io::dump::get_header - Error: cannot open file '"
<< filename << "'!"
<< std::endl;
abort();
}
+
+ // Milena's file type ?
std::string file_type;
- info_file >> file_type;
- if (file_type != "milena/raw")
+ file >> file_type;
+ if (file_type != "milena/dump")
{
- std::cerr << "io::raw::load - Error: invalid file type. '"
+ std::cerr << "io::dump::load - Error: invalid file type. '"
<< filename
- << "' is NOT a valid milena/raw info file!"
+ << "' is NOT a valid milena/dump file!"
<< std::endl;
abort();
}
- char dev_null[30];
-
- // Dimension ?
- // Reading line title "Dim: "
- info_file.read(dev_null, 5);
- info_file >> header.dim;
+ // Dimension
+ file >> header.dim;
// Size information - Skip it, useless.
header.size.resize(header.dim);
for (unsigned i = 0; i < header.dim; ++i)
- info_file >> header.size[i];
+ file >> header.size[i];
+
// Skipping endline.
char c;
- info_file.get(c);
-
+ file.get(c);
// Value type name ?
- // Reading line title "data type: "
- info_file.read(dev_null, 11);
// WARNING: value type name limited to 255 characters...
char value_type[255];
- info_file.getline(value_type, 255);
+ file.getline(value_type, 255);
header.value_type = value_type;
- info_file.close();
-
- trace::exiting("mln::io::raw::get_header");
+ trace::exiting("mln::io::dump::get_header");
return header;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::io::raw
+ } // end of namespace mln::io::dump
} // end of namespace mln::io
} // end of namespace mln
-#endif // ! MLN_IO_RAW_GET_HEADER_HH
+#endif // ! MLN_IO_DUMP_GET_HEADER_HH
--
1.5.6.5
Show replies by date