1#ifndef MATLABWRITER_HPP
2#define MATLABWRITER_HPP
15template<
unsigned int dim,
typename T>
24 template<
typename gr
id,
typename Mem>
int operator<<(
grid data, std::string file)
33 std::cerr <<
"Error Tiff writer support until 5D images" <<
"\n";
40 TIFF *tif = TIFFOpen(file.c_str(),
"w");
48 width = data.getGrid().size(0);
49 height = data.getGrid().size(1);
51 TIFFSetField(tif,TIFFTAG_IMAGEWIDTH, &width);
52 TIFFSetField(tif,TIFFTAG_IMAGELENGTH, &height);
57 typename boost::fusion::result_of::at<T::type,0>::type first_element_type;
59 if (
typeid(
grid).name() ==
"grid_cpu" && T::num_prop == 1 && boost::is_array<first_element_type>::type::value ==
true)
67 for(
int i = 0; i < height ; i++)
74 void * buf = &data.template get<0>(key);
76 TIFFWriteScanline(tif,buf,i, 0);
90 const int n_prp = total_prop<T>;
94 for(
int i = 0; i < height ; i++)
101 void * buf = &data.template get<0>(key);
103 TIFFWriteScanline(tif,buf,i, 0);
This class is able to save grid into tiff files.
int operator<<(grid data, std::string file)
Save grid into tiff files.
void set(int d, size_t sz)
Set the dimension.