MeVisLab Toolbox Reference
mlComputeClusters.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_COMPUTE_CLUSTERS_H
14#define ML_COMPUTE_CLUSTERS_H
15
17
18#include "mlClusterAlgorithm.h"
22
23#include <mlModuleIncludes.h>
24
25
27
28class Clusters;
29class ComputeClusters;
30
33{
34public:
35
37
38 MLErrorCode getErrorCode() const { return _errorCode; }
39
40 template <class DataType> void process()
41 {
42 if (_parameters.contentImage)
43 {
44 switch (_parameters.clusterMode)
45 {
47 {
49 _errorCode = algorithm.runClustering();
50 }
51 break;
53 {
55 _errorCode = algorithm.runClustering();
56 }
57 break;
59 {
61 _errorCode = algorithm.runClustering();
62 }
63 break;
65 default:
66 mlError("ComputeClusters::computeClusters", ML_BAD_PARAMETER);
67 _errorCode = ML_BAD_PARAMETER;
68 }
69 }
70 }
71
72private:
73 Clusters* _clusters;
74 ComputeClusterParameters _parameters;
75 MLErrorCode _errorCode;
76};
77
81{
82public:
83
86
87 void setClusterMode(CLUSTER_MODE_TYPE clusterMode) { _parameters.clusterMode = clusterMode; }
88 void setSimilarityToleranceIntensities(MLdouble similarityTolerance) { _parameters.similarityToleranceIntensities = similarityTolerance; }
89 void setSimilarityToleranceVectors(MLdouble similarityTolerance) { _parameters.similarityToleranceVectors = similarityTolerance; }
90 void setUseBackgroundValue(bool useBackgroundValue) { _parameters.useBackgroundValue = useBackgroundValue; }
91 void setBackgroundValue(MLdouble backgroundValue) { _parameters.backgroundValue = backgroundValue; }
92 void setNeighborhoodRelation(NBH_TYPE neighborhoodRelation) { _parameters.neighborhoodRelation = neighborhoodRelation; }
93 void setContentImage(PagedImage* contentImage) { _parameters.contentImage = contentImage; }
94 void setMaskImage(PagedImage* maskImage) { _parameters.maskImage = maskImage; }
95 void setUseImageValueAsUserData(bool useImageValueAsUserData) { _parameters.useImageValueAsUserData = useImageValueAsUserData; }
96 void setProgressCB(MLRequestProgressCB* cb, void* userData) { _parameters.progressCB = cb; _parameters.progressCBUserData = userData; }
97
99
103
104private:
105
106 ComputeClusterParameters _parameters;
107
109};
110
112
113#endif // __mlComputeClusters_H
#define MLCLUSTERALGORITHM_EXPORT
@ CLUSTER_MODE_IdenticalIntensities
@ CLUSTER_MODE_VectorDirections
@ CLUSTER_MODE_SimilarIntensities
Structure computes and holds all cluster information. For internal use.
Definition mlClusters.h:29
Computes the clusters.
void setUseBackgroundValue(bool useBackgroundValue)
void setSimilarityToleranceIntensities(MLdouble similarityTolerance)
void setClusterMode(CLUSTER_MODE_TYPE clusterMode)
void setNeighborhoodRelation(NBH_TYPE neighborhoodRelation)
void setMaskImage(PagedImage *maskImage)
void setProgressCB(MLRequestProgressCB *cb, void *userData)
void setSimilarityToleranceVectors(MLdouble similarityTolerance)
void setBackgroundValue(MLdouble backgroundValue)
void setContentImage(PagedImage *contentImage)
MLErrorCode computeClusters(Clusters *clusters)
Computes the actual clusters and fills the given structure on base of the set parameters.
void ensureClusterModeForImageDataType()
void setUseImageValueAsUserData(bool useImageValueAsUserData)
Implementation of a clustering algorithm checking for identical image intensity values.
Class which represents an image, which manages properties of an image and image data which is located...
Implementation of a SimilarIntensities clustering algorithm.
Implementation of a clustering algorithm for vector data types.
TypedComputeClusters(ComputeClusters *computer, Clusters *clusters)
MLErrorCode getErrorCode() const
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
Definition mlTypeDefs.h:823
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
#define mlError(FUNCTION,...)
Logs an error for FUNCTION with optional MLErrorCode.
Definition mlLogging.h:52
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
void MLRequestProgressCB(void *usrData, double progress)
double MLdouble
Definition mlTypeDefs.h:217
Structure to hold parameters for cluster computation.