20 #ifndef OST_IMG_IO_TIFF_HH
21 #define OST_IMG_IO_TIFF_HH
26 #include <boost/filesystem.hpp>
27 #include <ost/img/alg/normalizer_factory.hh>
31 namespace ost {
namespace io {
namespace detail {
55 operator std::complex<Real>()
57 return std::complex<Real>(real(),imag());
65 operator std::complex<Real>()
67 return std::complex<Real>(real(),imag());
75 operator std::complex<Real>()
77 return std::complex<Real>(real(),imag());
107 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
110 IN_TYPE* dp =
static_cast<IN_TYPE*
>(buf);
111 for(
uint r=0;r<rps;r++) {
112 for(
uint c=0;c<width;c++) {
113 is->Value(img::Point(c,current_row))=
static_cast<OUT_TYPE
>(dp[(r*width+c)*spp]);
120 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
123 uint datalength=rowsperstrip*width;
124 if((strip+1)*rowsperstrip>height){
125 datalength=(height-strip*rowsperstrip)*width;
127 OUT_TYPE* buf=
new OUT_TYPE[datalength];
128 img::Point start = is->GetExtent().GetStart();
131 for(
uint r=strip*rowsperstrip;r<(strip+1)*rowsperstrip && r<height;r++) {
132 for(
uint c=0;c<width;c++) {
133 buf[i] =
static_cast<OUT_TYPE
>(nptr->Convert(is->Value(img::Point(c,r)+start)));
137 TIFFWriteEncodedStrip(tif,strip,buf,
sizeof(OUT_TYPE)*datalength);