34 #ifndef AIMS_IO_BCKMAPW_H 35 #define AIMS_IO_BCKMAPW_H 56 : _name(name), _itemw( 0 ), _binmode( !ascii ) {}
63 {
delete _itemw; _itemw = iw; }
80 template<
class T>
inline 83 std::string openmode = ( _binmode ?
"binar" :
"ascii" );
91 std::string name = hdr.filename();
92 std::ios::openmode omd = std::ios::app;
94 omd |= std::ios::binary;
95 std::ofstream os( name.c_str(), omd );
109 sw.
write( os, thing.size() );
111 os <<
"-dimt " << thing.size() << std::endl;;
113 for( ib=thing.begin(); ib!=eb; ++ib )
117 sw.
write( os, ib->first );
118 sw.
write( os, ib->second.size() );
122 os <<
"-time " << ib->first << std::endl;
123 os <<
"-dim " << ib->second.size() << std::endl;
125 for( ibi=ib->second.begin(), ebi=ib->second.end(); ibi!=ebi; ++ibi )
127 posw->
write( os, ibi->first );
128 iw->
write( os, ibi->second );
141 template<
class T>
inline 145 writer.
write( thing );
Default low-levels writers.
virtual ItemWriter< T > * writer(const std::string &openmode="binar", bool bswap=false) const
virtual void write(std::ostream &os, const T &item) const
float sizeY() const
returns the Y resolution in mm
float sizeZ() const
returns the Z resolution in mm
BucketMap objects can be read / written by BckMapReader / BckMapWriter, these IO classes operate on t...
float sizeX() const
returns the X resolution in mm
The class for EcatSino data write operation.
void write(const BucketMap< T > &thing)
An alternate, ordered, representation for buckets (voxels lists).
static void launchErrnoExcept(const std::string &filename="")
Low-level "small item" writer, used by higher-level file readers.
BckMapWriter(const std::string &name, bool ascii=false)
#define AIMS_MAGIC_NUMBER
void setItemWriter(ItemWriter< T > *iw)
virtual void write(std::ostream &os, const T &item) const
float sizeT() const
returns the T resolution in s
std::map< int, Bucket >::const_iterator const_iterator
const aims::PythonHeader & header() const