37 #ifndef AIMS_BUCKET_BUCKETMAP_H 
   38 #define AIMS_BUCKET_BUCKETMAP_H 
   51   template <
class T> 
class BucketMap;
 
   56   template <
class T, 
int D>
 
   64     bool operator () ( 
const T & p1, 
const T & p2 )
 const 
   69       || ( p1[1] == p2[1] && ( p1[0] < p2[0] ) ) ) );
 
   98       public std::map< int , std::map< Point3d, T, BucketMapLess > >
 
  101     typedef std::map< int , std::map< Point3d, T, BucketMapLess > > 
BaseMap;
 
  102     typedef std::map< Point3d, T, BucketMapLess > 
Bucket;
 
  103     typedef typename std::map<int, Bucket >::iterator 
iterator;
 
  109       : RCObject(), std::map< int , 
Bucket >( other ), _header( other._header )
 
  119     inline void insert( 
const std::pair<const Point3d,T> & item );
 
  120     using BaseMap::insert; 
 
  124     using BaseMap::erase; 
 
  147     inline void setSizeXYZT( 
float sizex,
float sizey,
float sizez,
float sizet );
 
  151     { setSizeXYZT( sizex, sizey, sizez, sizet ); }
 
  153     { setSizeXYZT( vsize ); }
 
  167 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 
  193   template <
class T> 
inline 
  196     (*this)[0][pos] = item;
 
  200   template <
class T> 
inline 
  203     (*this)[0].insert(item);
 
  207   template <
class T> 
inline 
  210     (*this)[0].erase( pos );
 
  214   template <
class T> 
inline 
  218     for( i=bck.begin(); i!=e; ++i )
 
  219       (*this)[ i->first ].
insert( i->second.begin(), i->second.end() );
 
  223   template <
class T> 
inline std::vector<float>
 
  226     std::vector<float> vs;
 
  227     _header.getProperty( 
"voxel_size", vs );
 
  228     while( vs.size() < 4 )
 
  236     std::vector<float> vs;
 
  237     _header.getProperty( 
"voxel_size", vs );
 
  246     std::vector<float> vs;
 
  247     _header.getProperty( 
"voxel_size", vs );
 
  256     std::vector<float> vs;
 
  257     _header.getProperty( 
"voxel_size", vs );
 
  266     std::vector<float> vs;
 
  267     _header.getProperty( 
"voxel_size", vs );
 
  274   template <
class T> 
inline 
  278     std::vector<float> vs;
 
  279     _header.getProperty( 
"voxel_size", vs );
 
  280     while( vs.size() < 4 )
 
  283     _header.setProperty( 
"voxel_size", vs );
 
  287   template <
class T> 
inline 
  291     std::vector<float> vs;
 
  292     _header.getProperty( 
"voxel_size", vs );
 
  293     while( vs.size() < 4 )
 
  296     _header.setProperty( 
"voxel_size", vs );
 
  300   template <
class T> 
inline 
  304     std::vector<float> vs;
 
  305     _header.getProperty( 
"voxel_size", vs );
 
  306     while( vs.size() < 4 )
 
  309     _header.setProperty( 
"voxel_size", vs );
 
  313   template <
class T> 
inline 
  317     std::vector<float> vs;
 
  318     _header.getProperty( 
"voxel_size", vs );
 
  319     while( vs.size() < 4 )
 
  322     _header.setProperty( 
"voxel_size", vs );
 
  326   template <
class T> 
inline 
  330     std::vector<float> vs(4);
 
  335     _header.setProperty( 
"voxel_size", vs );
 
  339   template <
class T> 
inline 
  342     std::vector<float> vs = vsize;
 
  343     while( vs.size() < 4 )
 
  345     _header.setProperty( 
"voxel_size", vs );
 
  349   template<
class T> 
inline  
  351   : _header( other.header() )
 
  364     for ( ib=other.begin(); ib!=eb; ++ib )
 
  366         Bucket  & bk = (*this)[ ib->first ];
 
  367         for ( ibi=ib->second.begin(), ebi=ib->second.end(); ibi!=ebi; ++ibi )
 
  368           bk[ ibi->location() ] = ibi->value();
 
  377 template <
class T> 
inline 
  384   for ( it1=thing.begin(); it1!=e1; ++it1 )
 
  388     out << 
"t=" << (*it1).first << 
",";
 
  389     for ( it2=it1->second.begin(); it2!=e2; ++it2 )
 
  394   return out << 
"NULL}" << std::flush;
 
  399 template<
class T> 
inline  
  414   for ( ib=b2.begin(); ib!=eb; ++ib )
 
  416       std::list<AimsBucketItem<T> >     & bk = (*this)[ ib->first ];
 
  417       for ( ibi=ib->second.begin(), ebi=ib->second.end(); ibi!=ebi; ++ibi )
 
  420           bitem.
value() = ibi->second;
 
  421           bk.push_back( bitem );
 
  440 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<int16_t> > )
 
  441 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<uint16_t> > )
 
  442 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<int32_t> > )
 
  443 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<uint32_t> > )
 
  444 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<
float> > )
 
  445 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<
double> > )
 
  446 DECLARE_GENERIC_OBJECT_TYPE( rc_ptr< 
aims::BucketMap<
DtiTensor> > )
 
std::ostream & operator<<(std::ostream &out, const aims::BucketMap< T > &thing)
The template base class for all types of bucket items.
const AimsVector< short, 3 > & location() const
Get a const reference to the location of the bucket item.
const T & value() const
Get a const reference to the value of the bucket item.
The bucket base class to manage packages of points associated to their value during time.
std::map< int, std::list< AimsBucketItem< T > > >::const_iterator const_iterator
AimsBucket< T > & operator=(const aims::BucketMap< T > &)
const aims::PythonHeader & header() const
An alternate, ordered, representation for buckets (voxels lists).
float sizeZ() const
returns the Z resolution in mm
void setSizeX(float sizex)
sets the X resolution of the data in mm
void setVoxelSize(const std::vector< float > &vsize)
void setSizeY(float sizey)
sets the Y resolution of the data in mm
void insert(const Point3d &pos, const T &item)
Function redefined to omit time.
void setSizeXYZT(float sizex, float sizey, float sizez, float sizet)
sets X,Y,Z and T resolutions of the data
const aims::PythonHeader & header() const
std::map< int, Bucket >::iterator iterator
BucketMap(const BucketMap< T > &other)
aims::PythonHeader & header()
void merge(const BucketMap< T > &)
void erase(const Point3d &pos)
Function redefined to omit time.
std::map< int, std::map< Point3d, T, BucketMapLess > > BaseMap
std::map< Point3d, T, BucketMapLess > Bucket
float sizeT() const
returns the T resolution in s
float sizeY() const
returns the Y resolution in mm
void insert(const std::pair< const Point3d, T > &item)
Function redefined to omit time, looks more like STL maps.
BucketMap< T > & operator=(const AimsBucket< T > &)
void setVoxelSize(float sizex, float sizey, float sizez, float sizet)
void setHeader(const aims::PythonHeader &hdr)
aims::PythonHeader _header
void setSizeZ(float sizez)
sets the Z resolution of the data in mm
float sizeX() const
returns the X resolution in mm
void setSizeXYZT(const std::vector< float > &vsize)
std::map< int, Bucket >::const_iterator const_iterator
std::vector< float > getVoxelSize() const
void setSizeT(float sizet)
sets the T resolution of the data in s
BucketMap(const AimsBucket< T > &)
build from AimsBucket
static std::string dataType()
static std::string name()
static std::string objectType()
The class for EcatSino data write operation.
CoordinatesLess< Point3d, 3 > BucketMapLess
#define DECLARE_GENERIC_OBJECT_TYPE(T)
Helper class for ordering Coordinates by their z, y, x coordinates.