20 #ifndef OST_IMG_IO_TIFF_HH
21 #define OST_IMG_IO_TIFF_HH
26 #include <boost/filesystem.hpp>
30 #if defined(TIFFLIB_VERSION) && TIFFLIB_VERSION >= 20111221
31 # define INTNN_T int64_t
32 # define UINTNN uint64
33 # define UINTNN_T uint64_t
34 # define COMPLEXINTNN_T complexint64_t
36 # define INTNN_T int32_t
37 # define UINTNN uint32
38 # define UINTNN_T uint32_t
39 # define COMPLEXINTNN_T complexint32_t
42 namespace ost {
namespace io {
namespace detail {
66 operator std::complex<Real>()
68 return std::complex<Real>(real(),imag());
76 operator std::complex<Real>()
78 return std::complex<Real>(real(),imag());
86 operator std::complex<Real>()
88 return std::complex<Real>(real(),imag());
118 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
121 IN_TYPE* dp =
static_cast<IN_TYPE*
>(buf);
122 for(
uint r=0;r<rps;r++) {
123 for(
uint c=0;c<width;c++) {
124 is->Value(
img::Point(c,current_row))=
static_cast<OUT_TYPE
>(dp[(r*width+c)*spp]);
131 template<
typename IN_TYPE,
typename OUT_TYPE,
class IST>
134 uint datalength=rowsperstrip*width;
135 if((strip+1)*rowsperstrip>height){
136 datalength=(height-strip*rowsperstrip)*width;
138 OUT_TYPE* buf=
new OUT_TYPE[datalength];
139 img::Point start = is->GetExtent().GetStart();
142 for(
uint r=strip*rowsperstrip;r<(strip+1)*rowsperstrip && r<height;r++) {
143 for(
uint c=0;c<width;c++) {
144 buf[i] =
static_cast<OUT_TYPE
>(nptr->Convert(is->Value(
img::Point(c,r)+start)));
148 TIFFWriteEncodedStrip(tif,strip,buf,
sizeof(OUT_TYPE)*datalength);