Subversion Repositories gelsvn

Rev

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

#include <fstream>
#include "Geometry/load_raw.h"

using namespace CGLA;
using namespace std;

namespace Geometry
{

        template<class T>
        bool load_raw(const string& file, RGrid<T>& grid)
        {
                        int sz = grid.get_size();
                        ifstream f(file.c_str(),ios::binary);
                        if(f)
                        {
                                        f.read(reinterpret_cast<char*>(grid.get()),sz*sizeof(T));
                                        return true;
                        }
                        cout << "Could not open volume" << endl;
                        return false;
        }
                
                template bool load_raw(const string&, RGrid<unsigned char>& grid);
                template bool load_raw(const string&, RGrid<unsigned short>& grid);
                template bool load_raw(const string&, RGrid<short>& grid);
                template bool load_raw(const string&, RGrid<float>& grid);

}