34 #ifndef AIMS_IO_TIFFW_H 
   35 #define AIMS_IO_TIFFW_H 
   64                      unsigned zfame, 
unsigned tframe );
 
   71   inline TiffWriter<T> & 
 
   74     writer.
write( thing );
 
   83     unsigned    t, z, dt = thing.
dimT(), dz = thing.
dimZ();
 
   95     hdr.
setProperty( 
"file_type", std::string( 
"TIFF" ) );
 
  101     for( t=0; t<dt; ++t )
 
  102       for( z=0; z<dz; ++z, ++i ) {
 
  103         writeFrame( thing, dir + files[i], z, t );
 
  113                                   const std::string & filename,
 
  117     int bps, spp, photometric;
 
  122     if((tif = TIFFOpen(filename.c_str(), 
"w")) == NULL){
 
  123       std::cout << 
"Could not open '" << filename << 
"' for writing." << std::endl;
 
  128     uint16_t sampleformat = SAMPLEFORMAT_UINT;
 
  134       photometric = PHOTOMETRIC_MINISBLACK;
 
  136     else if ( name == 
"S8"  )
 
  140       photometric = PHOTOMETRIC_MINISBLACK;
 
  141       sampleformat = SAMPLEFORMAT_INT;
 
  143     else if ( name == 
"U16"  )
 
  147       photometric = PHOTOMETRIC_MINISBLACK;
 
  149     else if ( name == 
"S16"  )
 
  153       photometric = PHOTOMETRIC_MINISBLACK;
 
  154       sampleformat = SAMPLEFORMAT_INT;
 
  156     else if ( name == 
"FLOAT"  )
 
  160       photometric = PHOTOMETRIC_MINISBLACK;
 
  161       sampleformat = SAMPLEFORMAT_IEEEFP;
 
  163     else if ( name == 
"DOUBLE"  )
 
  167       photometric = PHOTOMETRIC_MINISBLACK;
 
  168       sampleformat = SAMPLEFORMAT_IEEEFP;
 
  170     else if ( name == 
"CFLOAT"  )
 
  174       photometric = PHOTOMETRIC_MINISBLACK;
 
  175       sampleformat = SAMPLEFORMAT_COMPLEXIEEEFP;
 
  177     else if ( name == 
"CDOUBLE"  )
 
  181       photometric = PHOTOMETRIC_MINISBLACK;
 
  182       sampleformat = SAMPLEFORMAT_COMPLEXIEEEFP;
 
  184     else if ( name == 
"RGBA"  )
 
  188       photometric = PHOTOMETRIC_RGB;
 
  194       photometric = PHOTOMETRIC_RGB;
 
  204     TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, data.
dimX() );
 
  205     TIFFSetField(tif, TIFFTAG_IMAGELENGTH, data.
dimY());
 
  206     TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
 
  207     TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp );
 
  208     TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1 );
 
  210     TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
 
  211     TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
 
  213     TIFFSetField(tif, TIFFTAG_XRESOLUTION, 10. / data.
sizeX());
 
  214     TIFFSetField(tif, TIFFTAG_YRESOLUTION, 10. / data.
sizeY());
 
  215     TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER);
 
  216     TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, sampleformat);
 
  219     int y, ny = data.
dimY(), nx = data.
dimX();
 
  221     long stride = &data( 1 ) - &data( 0 );
 
  222     std::vector<T> buffer;
 
  229     for( y=0; y<ny; ++y )
 
  232         ptr = (
void *) &data(0, y, z, t);
 
  236         const T* p = &data( 0, y, z, t );
 
  237         for( 
long x=0; x<nx; ++x, p+=stride )
 
  239         ptr = (
void *) &buffer[0];
 
  242       res = TIFFWriteEncodedStrip(tif, y, ptr, (bps / 8) * spp * data.
dimX() );
 
const aims::Header * header() const
void write(const AffineTransformation3d &thing)
Write the motion with "name" file name to disk.
TiffWriter(const std::string &name)
void writeFrame(const AimsData< T > &thing, const std::string &filename, unsigned zfame, unsigned tframe)
called by write(), but you can call it for single frame writing (axial slice)
void write(const AimsData< T > &thing)
static std::string dirname(const std::string &)
static std::string removeExtension(const std::string &)
virtual void setProperty(const std::string &, Object)
The class for EcatSino data write operation.
MotionWriter & operator<<(MotionWriter &writer, const AffineTransformation3d &thing) __attribute__((__deprecated__("OBSOLETE")))
— OBSOLETE —