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 )
117 inline void insert(
const Point3d & pos,
const T & item );
119 inline void insert(
const std::pair<const Point3d,T> & item );
120 using BaseMap::insert;
123 inline void erase(
const Point3d & pos );
124 using BaseMap::erase;
129 inline float sizeX()
const;
131 inline float sizeY()
const;
133 inline float sizeZ()
const;
135 inline float sizeT()
const;
138 inline void setSizeX(
float sizex);
140 inline void setSizeY(
float sizey);
142 inline void setSizeZ(
float sizez);
144 inline void setSizeT(
float sizet);
146 inline void setSizeXYZT(
float sizex,
float sizey,
float sizez,
float sizet);
160 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 180 #endif // DOXYGEN_HIDE_INTERNAL_CLASSES 186 template <
class T>
inline 189 (*this)[0][pos] = item;
193 template <
class T>
inline 196 (*this)[0].insert(item);
200 template <
class T>
inline 203 (*this)[0].erase( pos );
207 template <
class T>
inline 211 for( i=bck.begin(); i!=e; ++i )
212 (*
this)[ i->first ].
insert( i->second.begin(), i->second.end() );
218 std::vector<float> vs;
219 _header.getProperty(
"voxel_size", vs );
228 std::vector<float> vs;
229 _header.getProperty(
"voxel_size", vs );
238 std::vector<float> vs;
239 _header.getProperty(
"voxel_size", vs );
248 std::vector<float> vs;
249 _header.getProperty(
"voxel_size", vs );
256 template <
class T>
inline 260 std::vector<float> vs;
261 _header.getProperty(
"voxel_size", vs );
262 while( vs.size() < 4 )
265 _header.setProperty(
"voxel_size", vs );
269 template <
class T>
inline 273 std::vector<float> vs;
274 _header.getProperty(
"voxel_size", vs );
275 while( vs.size() < 4 )
278 _header.setProperty(
"voxel_size", vs );
282 template <
class T>
inline 286 std::vector<float> vs;
287 _header.getProperty(
"voxel_size", vs );
288 while( vs.size() < 4 )
291 _header.setProperty(
"voxel_size", vs );
295 template <
class T>
inline 299 std::vector<float> vs;
300 _header.getProperty(
"voxel_size", vs );
301 while( vs.size() < 4 )
304 _header.setProperty(
"voxel_size", vs );
308 template <
class T>
inline 312 std::vector<float> vs(4);
317 _header.setProperty(
"voxel_size", vs );
321 template<
class T>
inline 323 : _header( other.header() )
336 for ( ib=other.begin(); ib!=eb; ++ib )
338 Bucket & bk = (*this)[ ib->first ];
339 for ( ibi=ib->second.begin(), ebi=ib->second.end(); ibi!=ebi; ++ibi )
340 bk[ ibi->location() ] = ibi->value();
349 template <
class T>
inline 350 std::ostream& operator << (std::ostream& out, const aims::BucketMap<T> & thing)
356 for ( it1=thing.begin(); it1!=e1; ++it1 )
360 out <<
"t=" << (*it1).first <<
",";
361 for ( it2=it1->second.begin(); it2!=e2; ++it2 )
366 return out <<
"NULL}" << std::flush;
371 template<
class T>
inline 386 for ( ib=b2.begin(); ib!=eb; ++ib )
388 std::list<AimsBucketItem<T> > & bk = (*this)[ ib->first ];
389 for ( ibi=ib->second.begin(), ebi=ib->second.end(); ibi!=ebi; ++ibi )
392 bitem.
value() = ibi->second;
393 bk.push_back( bitem );
#define DECLARE_GENERIC_OBJECT_TYPE(T)
AimsBucket< T > & operator=(const aims::BucketMap< T > &)
std::map< int, std::list< AimsBucketItem< T > > >::const_iterator const_iterator
void setSizeT(float sizet)
sets the T resolution of the data in s
std::map< int, std::map< Point3d, T, BucketMapLess > > BaseMap
float sizeY() const
returns the Y resolution in mm
const aims::PythonHeader & header() const
void erase(const Point3d &pos)
Function redefined to omit time.
BucketMap(const BucketMap< T > &other)
float sizeZ() const
returns the Z resolution in mm
static std::string dataType()
float sizeX() const
returns the X resolution in mm
The class for EcatSino data write operation.
void setSizeY(float sizey)
sets the Y resolution of the data in mm
const AimsVector< short, 3 > & location() const
Get a const reference to the location of the bucket item.
An alternate, ordered, representation for buckets (voxels lists).
std::map< Point3d, T, BucketMapLess > Bucket
void setSizeX(float sizex)
sets the X resolution of the data in mm
void setSizeXYZT(float sizex, float sizey, float sizez, float sizet)
sets X,Y,Z and T resolutions of the data
The bucket base class to manage packages of points associated to their value during time...
const T & value() const
Get a const reference to the value of the bucket item.
void insert(const Point3d &pos, const T &item)
Function redefined to omit time.
void merge(const BucketMap< T > &)
The template base class for all types of bucket items.
void setSizeZ(float sizez)
sets the Z resolution of the data in mm
std::map< int, Bucket >::iterator iterator
static std::string objectType()
aims::PythonHeader _header
float sizeT() const
returns the T resolution in s
aims::PythonHeader & header()
std::map< int, Bucket >::const_iterator const_iterator
void setHeader(const aims::PythonHeader &hdr)
const aims::PythonHeader & header() const
static std::string name()
Helper class for ordering Coordinates by their z, y, x coordinates.
CoordinatesLess< Point3d, 3 > BucketMapLess