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" );
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 );
aims::BckMapWriter< T > & operator<<(aims::BckMapWriter< T > &writer, aims::BucketMap< T > &thing)
BucketMap objects can be read / written by BckMapReader / BckMapWriter, these IO classes operate on t...
void write(const BucketMap< T > &thing)
void setItemWriter(ItemWriter< T > *iw)
BckMapWriter(const std::string &name, bool ascii=false)
An alternate, ordered, representation for buckets (voxels lists).
float sizeZ() const
returns the Z resolution in mm
const aims::PythonHeader & header() const
float sizeT() const
returns the T resolution in s
float sizeY() const
returns the Y resolution in mm
float sizeX() const
returns the X resolution in mm
std::map< int, Bucket >::const_iterator const_iterator
Default low-levels writers.
virtual void write(std::ostream &os, const T &item) const
virtual ItemWriter< T > * writer(const std::string &openmode="binar", bool bswap=false) const
Low-level "small item" writer, used by higher-level file readers.
virtual ItemWriter< T > * writer(const std::string &openmode="binar", bool bswap=false) const =0
virtual void write(std::ostream &os, const T &item) const
static void launchErrnoExcept(const std::string &filename="")
#define AIMS_MAGIC_NUMBER
The class for EcatSino data write operation.