MeVisLab Toolbox Reference
mlClusters.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2014, 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_CLUSTERS_H
14#define ML_CLUSTERS_H
15
17#include "mlModuleIncludes.h"
18
19#include "mlClusterRefVolume.h"
21
22
23#include <boost/shared_ptr.hpp>
24
25ML_START_NAMESPACE
26
29{
30public:
31
34
36 MLErrorCode init(MLint extentX, MLint extentY, MLint extentZ);
37
38
41 void calcClusterSizes(const ClusterUserDataParameters& userDataParameters);
43 void incrementClusterSize(MLuint currentClusterRef);
44
47 MLuint merge(MLuint currentClusterRef, MLuint neighborClusterRef);
48
49
51
53 std::vector<ClusterInfo> getClusterInfoList() const;
54
59 const ClusterInfo& getClusterAt(MLuint rank) const;
66 void setUserDataAtRank(MLuint rank, MLdouble userData);
67
72 void setClusterRef(MLint xi, MLint yi, MLint zi, MLuint currentClusterRef);
73
75 void setImageParameters(const PagedImage* inImage);
76
84 ImageVector getImageExtent() const { return _imageProperties.getImageExtent(); }
86 const ImageVector& getPageExtent() const { return _pageExtent; }
88 const Matrix4& getVoxelToWorldMatrix() const { return _imageProperties.getVoxelToWorldMatrix(); }
90 const Matrix4& getWorldToVoxeldMatrix() const { return _imageProperties.getWorldToVoxelMatrix(); }
92 MLdouble getVoxelVolumeInMilliliters() const { return _imageProperties.getVoxelVolumeInMilliliters(); }
94 MedicalImageProperties getImageProperties() const { return _imageProperties; }
98 void setUse2DNeighborhood() { _using2DNeighborhood = true; }
100 bool isUsing2DNeighborhood() const { return _using2DNeighborhood; }
101
102
103private:
104
105 void computeBoundingBoxes();
106
107 void setCTUTo1(ImageVector& v);
108
109 ClusterRefVolume* _clusterRefVolume;
110 ClusterRefCollection* _clusterRefCollection;
111
112 MedicalImageProperties _imageProperties;
113 ImageVector _pageExtent;
114
115 bool _using2DNeighborhood;
116};
117
118
119ML_END_NAMESPACE
120
121
122#endif // __mlClusters_H
#define MLCLUSTERALGORITHM_EXPORT
Class for handling cluster references.
const Matrix4 & getWorldToVoxeldMatrix() const
Returns the world-to-voxel matrix of the input image.
Definition mlClusters.h:90
MLuint merge(MLuint currentClusterRef, MLuint neighborClusterRef)
MedicalImageProperties getImageProperties() const
Returns the whole image properties of the input image (with c,t,u set to 1, because only the first vo...
Definition mlClusters.h:94
std::vector< ClusterInfo > getClusterInfoList() const
Returns the current cluster infos.
MLuint getClusterRef(MLint x, MLint y, MLint z) const
const ImageVector & getPageExtent() const
Returns the page extent of the input image.
Definition mlClusters.h:86
MLdouble getVoxelVolumeInMilliliters() const
Returns the milliliter factor of one voxel.
Definition mlClusters.h:92
bool isUsing2DNeighborhood() const
Returns whether this clusters were computed using a 2D neighborhood.
Definition mlClusters.h:100
void calcClusterSizes(const ClusterUserDataParameters &userDataParameters)
void setImageParameters(const PagedImage *inImage)
Sets image parameters.
void setUserDataAtRank(MLuint rank, MLdouble userData)
Sets the user data value to the cluster with the given rank.
MLuint getRankOfSizeAt(MLint x, MLint y, MLint z) const
Returns the rank at the given position, 0 for background.
MLuint getNewReference(MLdouble imageValue)
MLErrorCode init(MLint extentX, MLint extentY, MLint extentZ)
Initializes this clusters object and returns an error code.
const ClusterInfo & getBackgroundCluster() const
Returns the background cluster.
MLuint getMaxClusterSize() const
Returns the size in voxel of the largest cluster.
const ClusterInfo & getClusterAt(MLuint rank) const
Returns a cluster info for a given rank.
const Matrix4 & getVoxelToWorldMatrix() const
Returns the voxel-to-world matrix of the input image.
Definition mlClusters.h:88
void setUse2DNeighborhood()
Sets that this clusters were computed using a 2D neighborhood.
Definition mlClusters.h:98
void setClusterRef(MLint xi, MLint yi, MLint zi, MLuint currentClusterRef)
Sets a cluster reference id at a given voxel position.
const ClusterInfo & getClusterOfVoxel(MLint x, MLint y, MLint z) const
ImageVector getImageExtent() const
Returns the image extent of the input image.
Definition mlClusters.h:84
MLuint getMaxRank() const
Returns the maximum rank.
MLuint getNumClusters() const
Returns the number of clusters.
void incrementClusterSize(MLuint currentClusterRef)
Increments the cluster size of the given cluster reference.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
MLuint64 MLuint
Definition mlTypeDefs.h:505
double MLdouble
Definition mlTypeDefs.h:216
MLint64 MLint
Definition mlTypeDefs.h:489
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Definition mlMatrix4.h:713
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.
Cluster user data parameters.