MeVisLab Toolbox Reference
mlSimilarIntensitiesClusterAlgorithm.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_SIMILAR_INTENSITIES_CLUSTER_ALGORITHM_H
14 #define ML_SIMILAR_INTENSITIES_CLUSTER_ALGORITHM_H
15 
16 #include "mlClusterAlgorithm.h"
17 
18 
19 ML_START_NAMESPACE
20 
21 
29 template <typename DATATYPE>
30 class SimilarIntensitiesClusterAlgorithm : public ClusterAlgorithm<DATATYPE, SimilarIntensitiesClusterAlgorithm <DATATYPE> >
31 {
32 public:
33 
35  ClusterAlgorithm<DATATYPE, SimilarIntensitiesClusterAlgorithm <DATATYPE> >(parameters, clusters)
36  {
37  }
38 
40  ML_FORCE_INLINE static DATATYPE getVoxel(void* position)
41  {
42  return *static_cast<DATATYPE*>(position);
43  }
44 
46  {
47  return 0;
48  }
49 
50  //-----------------------------------------------------------------------------------------------
52  //-----------------------------------------------------------------------------------------------
53  ML_FORCE_INLINE bool isInTolerance(DATATYPE neighborValue, DATATYPE currentValue)
54  {
55  // intensity difference
56  const DATATYPE intensityDifference = (currentValue>neighborValue) ? (currentValue - neighborValue) : (neighborValue - currentValue);
57  const bool isInToleranceFlag = (intensityDifference <= this->_parameters.similarityToleranceIntensities);
58  return isInToleranceFlag;
59  }
60 };
61 
62 
63 ML_END_NAMESPACE
64 
65 
66 #endif
Type specific implementations of the interface class for clustering algorithms.
Structure computes and holds all cluster information. For internal use.
Definition: mlClusters.h:29
Implementation of a SimilarIntensities clustering algorithm.
ML_FORCE_INLINE bool isInTolerance(DATATYPE neighborValue, DATATYPE currentValue)
Tolerance calculation for scalar images.
static ML_FORCE_INLINE DATATYPE getVoxel(void *position)
Get the typed voxel value for current position.
SimilarIntensitiesClusterAlgorithm(const ComputeClusterParameters &parameters, Clusters *clusters)
static ML_FORCE_INLINE MLdouble getVoxelAsDouble(void *)
#define ML_FORCE_INLINE
Forcing the use of 'inline' for methods.
Definition: mlMacros.h:87
double MLdouble
Definition: mlTypeDefs.h:223
Structure to hold parameters for cluster computation.