MeVisLab Toolbox Reference
mlClusterRefVolume.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_CLUSTER_REF_VOLUME_H
14#define ML_CLUSTER_REF_VOLUME_H
15
17
19
20
28{
29public:
32
35
38
40 ML_FORCE_INLINE bool isInitialized() const { return _isInitialized; }
41
43 ML_FORCE_INLINE MLuint getClusterRef(MLuint x, MLuint y, MLuint z) const;
44
46 ML_FORCE_INLINE void setClusterRef(MLuint x, MLuint y, MLuint z, MLuint clusterRef);
47
48 MLuint sizeX() const { return _sizeX; }
49 MLuint sizeY() const { return _sizeY; }
50 MLuint sizeZ() const { return _sizeZ; }
51
54 MLuint getSize() const;
55
56protected:
59
60private:
62 bool _use32BitIndexes;
63 MLuint _sizeX;
64 MLuint _sizeY;
65 MLuint _sizeZ;
66 void** _clusterRefLUT;
67 bool _isInitialized;
68};
69
70
71inline MLuint ClusterRefVolume::getClusterRef(MLuint x, MLuint y, MLuint z) const
72{
73 return _use32BitIndexes ?
74 static_cast<MLuint32*>(_clusterRefLUT[z])[x+ (y*_sizeX)] :
75 static_cast<MLuint64*>(_clusterRefLUT[z])[x+ (y*_sizeX)];
76}
77
78inline void ClusterRefVolume::setClusterRef(MLuint x, MLuint y, MLuint z, MLuint clusterRef)
79{
80 if (_use32BitIndexes)
81 {
82 static_cast<MLuint32*>(_clusterRefLUT[z])[x+ (y*_sizeX)] = static_cast<MLuint32>(clusterRef);
83 }
84 else
85 {
86 static_cast<MLuint64*>(_clusterRefLUT[z])[x+ (y*_sizeX)] = clusterRef;
87 }
88}
89
91
92#endif // __mlClusterRefVolume_H
A stack of slices where each entry encodes an id of a ClusterRef.
ClusterRefVolume()
Constructor.
~ClusterRefVolume()
Destructor, cleanup.
ML_FORCE_INLINE bool isInitialized() const
Returns whether the volume is initialized.
MLErrorCode init(MLuint x, MLuint y, MLuint z)
Init volume, reserve memory.
void _deleteArrays()
Deletes all allocated structures.
MLuint getSize() const
For backward compatibility in ConnectComp.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
#define ML_FORCE_INLINE
Forcing the use of 'inline' for methods.
Definition mlMacros.h:54
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
Definition mlTypeDefs.h:425
unsigned int MLuint32
Definition mlTypeDefs.h:185
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
Definition mlTypeDefs.h:506