Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkConnectomicsStatisticsCalculator.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkConnectomicsStatisticsCalculator_h
18 #define mitkConnectomicsStatisticsCalculator_h
19 
20 #include <itkObject.h>
21 #include <itkObjectFactory.h>
22 #include <itkMacro.h>
23 
24 #include "mitkCommon.h"
25 
26 #include <MitkConnectomicsExports.h>
27 
29 
30 namespace mitk
31 {
34  class MITKCONNECTOMICS_EXPORT ConnectomicsStatisticsCalculator : public itk::Object
35  {
36  public:
37 
42  itkFactorylessNewMacro(Self)
43  itkCloneMacro(Self)
44 
45  // Typedefs
49  typedef boost::graph_traits<NetworkType>::vertex_iterator VertexIteratorType;
50  typedef boost::graph_traits<NetworkType>::edge_iterator EdgeIteratorType;
51  typedef boost::graph_traits<NetworkType>::adjacency_iterator AdjacencyIteratorType;
52  typedef std::map<EdgeDescriptorType, int> EdgeIndexStdMapType;
53  typedef boost::associative_property_map< EdgeIndexStdMapType > EdgeIndexMapType;
54  typedef boost::iterator_property_map< std::vector< double >::iterator, EdgeIndexMapType > EdgeIteratorPropertyMapType;
55  typedef boost::property_map< NetworkType, boost::vertex_index_t>::type VertexIndexMapType;
56  typedef boost::iterator_property_map< std::vector< double >::iterator, VertexIndexMapType > VertexIteratorPropertyMapType;
57 
58  // Set/Get Macros
59  itkSetObjectMacro( Network, mitk::ConnectomicsNetwork );
60  itkGetMacro( NumberOfVertices, unsigned int );
61  itkGetMacro( NumberOfEdges, unsigned int );
62  itkGetMacro( AverageDegree, double );
63  itkGetMacro( ConnectionDensity, double );
64  itkGetMacro( NumberOfConnectedComponents, unsigned int );
65  itkGetMacro( AverageComponentSize, double );
66  itkGetMacro( Components, std::vector< int > );
67  itkGetMacro( LargestComponentSize, unsigned int );
68  itkGetMacro( RatioOfNodesInLargestComponent, double );
69  itkGetMacro( HopPlotExponent, double );
70  itkGetMacro( EffectiveHopDiameter, double );
71  itkGetMacro( VectorOfClusteringCoefficientsC, std::vector< double > );
72  itkGetMacro( VectorOfClusteringCoefficientsD, std::vector< double > );
73  itkGetMacro( VectorOfClusteringCoefficientsE, std::vector< double > );
74  itkGetMacro( AverageClusteringCoefficientsC, double );
75  itkGetMacro( AverageClusteringCoefficientsD, double );
76  itkGetMacro( AverageClusteringCoefficientsE, double );
77  itkGetMacro( VectorOfVertexBetweennessCentralities, std::vector< double > );
78  itkGetMacro( PropertyMapOfVertexBetweennessCentralities, VertexIteratorPropertyMapType );
79  itkGetMacro( AverageVertexBetweennessCentrality, double );
80  itkGetMacro( VectorOfEdgeBetweennessCentralities, std::vector< double > );
81  itkGetMacro( PropertyMapOfEdgeBetweennessCentralities, EdgeIteratorPropertyMapType );
82  itkGetMacro( AverageEdgeBetweennessCentrality, double );
83  itkGetMacro( NumberOfIsolatedPoints, unsigned int );
84  itkGetMacro( RatioOfIsolatedPoints, double );
85  itkGetMacro( NumberOfEndPoints, unsigned int );
86  itkGetMacro( RatioOfEndPoints, double );
87  itkGetMacro( VectorOfEccentrities, std::vector< unsigned int > );
88  itkGetMacro( VectorOfEccentrities90, std::vector< unsigned int > );
89  itkGetMacro( VectorOfAveragePathLengths, std::vector< double > );
90  itkGetMacro( Diameter, unsigned int );
91  itkGetMacro( Diameter90, unsigned int );
92  itkGetMacro( Radius, unsigned int );
93  itkGetMacro( Radius90, unsigned int );
94  itkGetMacro( AverageEccentricity, double );
95  itkGetMacro( AverageEccentricity90, double );
96  itkGetMacro( AveragePathLength, double );
97  itkGetMacro( NumberOfCentralPoints, unsigned int );
98  itkGetMacro( RatioOfCentralPoints, double );
99  itkGetMacro( VectorOfSortedEigenValues, std::vector< double > );
100  itkGetMacro( SpectralRadius, double );
101  itkGetMacro( SecondLargestEigenValue, double );
102  itkGetMacro( AdjacencyTrace, double );
103  itkGetMacro( AdjacencyEnergy, double );
104  itkGetMacro( VectorOfSortedLaplacianEigenValues, std::vector< double > );
105  itkGetMacro( LaplacianTrace, double );
106  itkGetMacro( LaplacianEnergy, double );
107  itkGetMacro( LaplacianSpectralGap, double );
108  itkGetMacro( VectorOfSortedNormalizedLaplacianEigenValues, std::vector< double > );
109  itkGetMacro( NormalizedLaplacianTrace, double );
110  itkGetMacro( NormalizedLaplacianEnergy, double );
111  itkGetMacro( NormalizedLaplacianNumberOf2s, unsigned int );
112  itkGetMacro( NormalizedLaplacianNumberOf1s, unsigned int );
113  itkGetMacro( NormalizedLaplacianNumberOf0s, unsigned int );
114  itkGetMacro( NormalizedLaplacianLowerSlope, double );
115  itkGetMacro( NormalizedLaplacianUpperSlope, double );
116  itkGetMacro( SmallWorldness, double );
117 
118  void Update();
119 
120  protected:
121 
124  ~ConnectomicsStatisticsCalculator();
125 
126  void CalculateNumberOfVertices();
127 
128  void CalculateNumberOfEdges();
129 
130  void CalculateAverageDegree();
131 
132  void CalculateConnectionDensity();
133 
134  void CalculateNumberOfConnectedComponents();
135 
136  void CalculateAverageComponentSize();
137 
138  void CalculateLargestComponentSize();
139 
140  void CalculateRatioOfNodesInLargestComponent();
141 
142  void CalculateHopPlotValues();
143 
154  void CalculateClusteringCoefficients();
155 
156  void CalculateBetweennessCentrality();
157 
158  void CalculateIsolatedAndEndPoints();
159 
160  void CalculateShortestPathMetrics();
161 
162  void CalculateSpectralMetrics();
163 
164  void CalculateLaplacianMetrics();
165 
166  void CalculateNormalizedLaplacianMetrics();
167 
174  void CalculateSmallWorldness();
175 
177 
178  // The connectomics network, which is used for statistics calculation
179  mitk::ConnectomicsNetwork::Pointer m_Network;
180 
181  // Statistics
182  unsigned int m_NumberOfVertices;
183  unsigned int m_NumberOfEdges;
184  double m_AverageDegree;
185  double m_ConnectionDensity;
186  unsigned int m_NumberOfConnectedComponents;
187  double m_AverageComponentSize;
188  std::vector< int > m_Components;
189  unsigned int m_LargestComponentSize;
190  double m_RatioOfNodesInLargestComponent;
191  double m_HopPlotExponent;
192  double m_EffectiveHopDiameter;
193  std::vector< double > m_VectorOfClusteringCoefficientsC;
194  std::vector< double > m_VectorOfClusteringCoefficientsD;
195  std::vector< double > m_VectorOfClusteringCoefficientsE;
196  double m_AverageClusteringCoefficientsC;
197  double m_AverageClusteringCoefficientsD;
198  double m_AverageClusteringCoefficientsE;
199  std::vector< double > m_VectorOfVertexBetweennessCentralities;
200  VertexIteratorPropertyMapType m_PropertyMapOfVertexBetweennessCentralities;
201  double m_AverageVertexBetweennessCentrality;
202  std::vector< double > m_VectorOfEdgeBetweennessCentralities;
203  EdgeIteratorPropertyMapType m_PropertyMapOfEdgeBetweennessCentralities;
204  double m_AverageEdgeBetweennessCentrality;
205  unsigned int m_NumberOfIsolatedPoints;
206  double m_RatioOfIsolatedPoints;
207  unsigned int m_NumberOfEndPoints;
208  double m_RatioOfEndPoints;
209  std::vector< unsigned int > m_VectorOfEccentrities;
210  std::vector< unsigned int > m_VectorOfEccentrities90;
211  std::vector< double > m_VectorOfAveragePathLengths;
212  unsigned int m_Diameter;
213  unsigned int m_Diameter90;
214  unsigned int m_Radius;
215  unsigned int m_Radius90;
216  double m_AverageEccentricity;
217  double m_AverageEccentricity90;
218  double m_AveragePathLength;
219  unsigned int m_NumberOfCentralPoints;
220  double m_RatioOfCentralPoints;
221  std::vector<double> m_VectorOfSortedEigenValues;
222  double m_SpectralRadius;
223  double m_SecondLargestEigenValue;
224  double m_AdjacencyTrace;
225  double m_AdjacencyEnergy;
226  std::vector<double> m_VectorOfSortedLaplacianEigenValues;
227  double m_LaplacianTrace;
228  double m_LaplacianEnergy;
229  double m_LaplacianSpectralGap;
230  std::vector<double> m_VectorOfSortedNormalizedLaplacianEigenValues;
231  double m_NormalizedLaplacianTrace;
232  double m_NormalizedLaplacianEnergy;
233  unsigned int m_NormalizedLaplacianNumberOf2s;
234  unsigned int m_NormalizedLaplacianNumberOf1s;
235  unsigned int m_NormalizedLaplacianNumberOf0s;
236  double m_NormalizedLaplacianLowerSlope;
237  double m_NormalizedLaplacianUpperSlope;
238  double m_SmallWorldness;
239  };
240 
241 }// end namespace mitk
242 
243 #endif // mitkConnectomicsStatisticsCalculator_h
boost::graph_traits< NetworkType >::adjacency_iterator AdjacencyIteratorType
boost::graph_traits< NetworkType >::edge_iterator EdgeIteratorType
mitk::ConnectomicsNetwork::NetworkType NetworkType
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
std::map< EdgeDescriptorType, int > EdgeIndexStdMapType
mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType
A class giving functions for calculating a variety of network indices.
mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeDescriptorType
boost::graph_traits< NetworkType >::vertex_iterator VertexIteratorType
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
boost::associative_property_map< EdgeIndexStdMapType > EdgeIndexMapType
boost::iterator_property_map< std::vector< double >::iterator, VertexIndexMapType > VertexIteratorPropertyMapType
Connectomics Network Class.
boost::property_map< NetworkType, boost::vertex_index_t >::type VertexIndexMapType
boost::iterator_property_map< std::vector< double >::iterator, EdgeIndexMapType > EdgeIteratorPropertyMapType