20 #ifndef OST_IMG_IO_TIFF_HH
21 #define OST_IMG_IO_TIFF_HH
26 #include <boost/filesystem.hpp>
30 namespace ost {
namespace io {
namespace detail {
54 operator std::complex<Real>()
56 return std::complex<Real>(real(),imag());
64 operator std::complex<Real>()
66 return std::complex<Real>(real(),imag());
74 operator std::complex<Real>()
76 return std::complex<Real>(real(),imag());
104 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
105 void do_tiff_read(tdata_t buf,
unsigned int rps,
unsigned int width, IST* is,
unsigned int& current_row, uint16 spp)
107 IN_TYPE* dp =
static_cast<IN_TYPE*
>(buf);
108 for(
uint r=0;r<rps;r++) {
109 for(
uint c=0;c<width;c++) {
110 is->Value(
img::Point(c,current_row))=
static_cast<OUT_TYPE
>(dp[(r*width+c)*spp]);
117 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
120 uint datalength=rowsperstrip*width;
121 if((strip+1)*rowsperstrip>height){
122 datalength=(height-strip*rowsperstrip)*width;
124 OUT_TYPE* buf=
new OUT_TYPE[datalength];
125 img::Point start = is->GetExtent().GetStart();
128 for(
uint r=strip*rowsperstrip;r<(strip+1)*rowsperstrip && r<height;r++) {
129 for(
uint c=0;c<width;c++) {
130 buf[i] =
static_cast<OUT_TYPE
>(nptr->Convert(is->Value(
img::Point(c,r)+start)));
134 TIFFWriteEncodedStrip(tif,strip,buf,
sizeof(OUT_TYPE)*datalength);