Subversion Repositories gelsvn

Rev

Rev 595 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
595 jab 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
61 jab 7
#include <fstream>
601 jab 8
#include "../Geometry/load_raw.h"
61 jab 9
 
10
using namespace CGLA;
11
using namespace std;
12
 
13
namespace Geometry
14
{
15
 
16
	template<class T>
17
	bool load_raw(const string& file, RGrid<T>& grid)
18
	{
19
			int sz = grid.get_size();
20
			ifstream f(file.c_str(),ios::binary);
21
			if(f)
22
			{
23
					f.read(reinterpret_cast<char*>(grid.get()),sz*sizeof(T));
24
					return true;
25
			}
382 jab 26
			cerr << "Could not open volume :" << file << endl;
61 jab 27
			return false;
28
	}
29
 
30
		template bool load_raw(const string&, RGrid<unsigned char>& grid);
191 jab 31
		template bool load_raw(const string&, RGrid<unsigned short>& grid);
214 jab 32
		template bool load_raw(const string&, RGrid<short>& grid);
191 jab 33
		template bool load_raw(const string&, RGrid<float>& grid);
61 jab 34
 
35
}