MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlClusterInfo.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_INFO_H
14#define ML_CLUSTER_INFO_H
15
17
18#include <mlVector3.h>
19
21
24{
26 {
27 useImageValueAsUserData = false;
28 voxelSizeInMilliliters = 0.001;
29 backgroundValue = 0;
30 }
34};
35
38{
44
46 {
47 if (min[0] > x) {
48 min[0] = static_cast<MLdouble>(x);
49 }
50 if (min[1] > y) {
51 min[1] = static_cast<MLdouble>(y);
52 }
53 if (min[2] > z) {
54 min[2] = static_cast<MLdouble>(z);
55 }
56
57 if (max[0] < x) {
58 max[0] = static_cast<MLdouble>(x);
59 }
60 if (max[1] < y) {
61 max[1] = static_cast<MLdouble>(y);
62 }
63 if (max[2] < z) {
64 max[2] = static_cast<MLdouble>(z);
65 }
66 }
67
70};
71
86{
87public:
90 : _indexId(0)
91 , _numVoxels(0)
92 , _rank(0)
93 , _userData(0)
94 , _imageValue(0)
95 {}
96
99 virtual ~ClusterInfo()
100 {}
101
103
106 {
107 return _indexId;
108 }
109
111
113 {
114 return _numVoxels;
115 }
116
119
122 {
123 return _rank;
124 }
125
128 {
129 return _userData;
130 }
133 {
134 _userData = userData;
135 }
136
139 {
140 return _imageValue;
141 }
144 {
145 _imageValue = imageValue;
146 }
147
150 {
151 _boundingBox.addPosition(x, y, z);
152 }
155 {
156 return _boundingBox.min;
157 }
160 {
161 return _boundingBox.max;
162 }
163
164
165protected:
168
171
173
175
178
181
183};
184
185
187struct less
188{
195 {
196 if (x.numVoxels() > y.numVoxels()) {
197 return true;
198 }
199 if (x.numVoxels() < y.numVoxels()) {
200 return false;
201 }
202 return (x.getId() < y.getId());
203 }
204};
205
206
208
209#endif
Holds basic information about a cluster.
ML_FORCE_INLINE void setImageValue(MLdouble imageValue)
Sets the image value associated with this cluster.
MLuint _indexId
Unique cluster id; default is 0.
ML_FORCE_INLINE MLuint getId() const
Returns a unique id; default is 0.
MLdouble _imageValue
Image value, only meaningful if Identical Intensities is used in the clustering algorithm.
ML_FORCE_INLINE MLuint numVoxels() const
Returns the cluster size in voxel; default is 0.
ClusterBoundingBox _boundingBox
ML_FORCE_INLINE Vector3 getBoundingBoxMax() const
Returns the max bounding box position.
ML_FORCE_INLINE void addPositionToBoundingBox(MLint x, MLint y, MLint z)
Adds the given position to this cluster's bounding box.
ML_FORCE_INLINE Vector3 getBoundingBoxMin() const
Returns the min bounding box position.
ML_FORCE_INLINE MLdouble imageValue() const
Returns the image value associated with this cluster.
MLuint _numVoxels
Cluster size in voxel; default is 0.
MLuint _rank
Rank of the cluster size compared to other cluster; default is 0.
ClusterInfo()
Default constructor.
ML_FORCE_INLINE void setUserData(MLdouble userData)
Sets the user data.
virtual ~ClusterInfo()
Default destructor.
MLdouble _userData
User data, by default its value is set to the rank or original voxel value.
ML_FORCE_INLINE MLdouble userData() const
Returns the user data value.
ML_FORCE_INLINE MLuint rank() const
Returns the rank of the cluster size compared to the other clusters; default is 0.
#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.
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
double MLdouble
Definition mlTypeDefs.h:217
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489
#define ML_DOUBLE_MAX
Definition mlTypeDefs.h:220
Cluster bounding box.
void addPosition(MLint x, MLint y, MLint z)
Cluster user data parameters.
Implement comparison operator for ClusterInfo used by std::sort.
ML_FORCE_INLINE bool operator()(const ClusterInfo &x, const ClusterInfo &y)
Comparison operator, sort decreasing by size/volume.