MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
41 {
42 return _isInitialized;
43 }
44
46 ML_FORCE_INLINE MLuint getClusterRef(MLuint x, MLuint y, MLuint z) const;
47
49 ML_FORCE_INLINE void setClusterRef(MLuint x, MLuint y, MLuint z, MLuint clusterRef);
50
51 MLuint sizeX() const
52 {
53 return _sizeX;
54 }
55 MLuint sizeY() const
56 {
57 return _sizeY;
58 }
59 MLuint sizeZ() const
60 {
61 return _sizeZ;
62 }
63
66 [[deprecated("Multiply components instead.")]]
68 {
69 return _sizeX * _sizeY * _sizeZ;
70 }
71
72protected:
75
76private:
78 bool _use32BitIndexes;
79 MLuint _sizeX;
80 MLuint _sizeY;
81 MLuint _sizeZ;
82 void** _clusterRefLUT;
83 bool _isInitialized;
84};
85
86
87inline MLuint ClusterRefVolume::getClusterRef(MLuint x, MLuint y, MLuint z) const
88{
89 return _use32BitIndexes ? static_cast<MLuint32*>(_clusterRefLUT[z])[x + (y * _sizeX)]
90 : static_cast<MLuint64*>(_clusterRefLUT[z])[x + (y * _sizeX)];
91}
92
93inline void ClusterRefVolume::setClusterRef(MLuint x, MLuint y, MLuint z, MLuint clusterRef)
94{
95 if (_use32BitIndexes) {
96 static_cast<MLuint32*>(_clusterRefLUT[z])[x + (y * _sizeX)] = static_cast<MLuint32>(clusterRef);
97 }
98 else {
99 static_cast<MLuint64*>(_clusterRefLUT[z])[x + (y * _sizeX)] = clusterRef;
100 }
101}
102
104
105#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:772
#define ML_FORCE_INLINE
Forcing the use of 'inline' for methods.
Definition mlMacros.h:51
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
Definition mlTypeDefs.h:424
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:505