Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkConnectomicsNetwork.cpp
Go to the documentation of this file.
1 
2 /*===================================================================
3 
4 The Medical Imaging Interaction Toolkit (MITK)
5 
6 Copyright (c) German Cancer Research Center,
7 Division of Medical and Biological Informatics.
8 All rights reserved.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without
11 even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 A PARTICULAR PURPOSE.
13 
14 See LICENSE.txt or http://www.mitk.org for details.
15 
16 ===================================================================*/
17 
20 #include <boost/graph/clustering_coefficient.hpp>
21 #include <boost/graph/betweenness_centrality.hpp>
22 
23 /* Constructor and Destructor */
25 : m_IsModified( false )
26 {
27 }
28 
30 {
31 }
32 
33 /* Wrapper methods */
34 
37 {
38  return boost::edge(vertexA, vertexB, m_Network ).second;
39 }
40 
43 {
44  m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ].weight++;
45 
46  SetIsModified( true );
47 }
48 
52  )
53 {
54  AddEdge(vertexA, vertexB, m_Network[ vertexA ].id, m_Network[ vertexB ].id );
55 }
56 
60  int sourceID, int targetID, int weight, double edge_weight )
61 {
62  boost::add_edge( vertexA, vertexB, m_Network );
63  m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ].sourceId = sourceID;
64  m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ].targetId = targetID;
65  m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ].weight = weight;
66  m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ].edge_weight = edge_weight;
67 
68  SetIsModified( true );
69 }
70 
72 {
73  VertexDescriptorType vertex = boost::add_vertex( m_Network );
74  m_Network[vertex].id = id;
75 
76  SetIsModified( true );
77 
78  return vertex;
79 }
80 
82  mitk::ConnectomicsNetwork::VertexDescriptorType vertex, std::string inLabel )
83 {
84  m_Network[vertex].label = inLabel;
85 
86  SetIsModified( true );
87 }
88 
90  mitk::ConnectomicsNetwork::VertexDescriptorType vertex, std::vector< float > inCoordinates )
91 {
92  m_Network[vertex].coordinates = inCoordinates;
93 
94  SetIsModified( true );
95 }
96 
98 {
99  m_Network.clear();
100 
101  SetIsModified( true );
102 }
103 
104 /* Superclass methods, that need to be implemented */
106 {
107 
108 }
110 {
111 
112 }
114 {
115  return false;
116 }
118 {
119  return true;
120 }
121 void mitk::ConnectomicsNetwork::SetRequestedRegion(const itk::DataObject * /*data*/ )
122 {
123 
124 }
125 
126 
127 
128 std::vector< mitk::ConnectomicsNetwork::NetworkNode >
130 {
131  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
132 
133  // sets iterator to start end end to end
134  boost::tie(iterator, end) = boost::vertices( m_Network );
135 
136  std::vector< NetworkNode > vectorOfNodes;
137 
138  for ( ; iterator != end; ++iterator)
139  {
140  NetworkNode tempNode;
141 
142  // the value of an iterator is a descriptor
143  tempNode = m_Network[ *iterator ];
144 
145  vectorOfNodes.push_back( tempNode );
146  }
147 
148  return vectorOfNodes;
149 }
150 
151 std::vector< mitk::ConnectomicsNetwork::VertexDescriptorType >
153 {
154  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
155 
156  // sets iterator to start end end to end
157  boost::tie(iterator, end) = boost::vertices( m_Network );
158 
159  std::vector< VertexDescriptorType > vectorOfDescriptors;
160 
161  for ( ; iterator != end; ++iterator)
162  {
163  vectorOfDescriptors.push_back( *iterator );
164  }
165 
166  return vectorOfDescriptors;
167 }
168 
169 std::vector< std::pair<
170 std::pair< mitk::ConnectomicsNetwork::NetworkNode, mitk::ConnectomicsNetwork::NetworkNode >
173 {
174  boost::graph_traits<NetworkType>::edge_iterator iterator, end;
175 
176  // sets iterator to start end end to end
177  boost::tie(iterator, end) = boost::edges( m_Network );
178 
179  std::vector<
180  std::pair<
181  std::pair< NetworkNode, NetworkNode >
182  , NetworkEdge
183  >
184  > vectorOfEdges;
185 
186  for ( ; iterator != end; ++iterator)
187  {
188  NetworkNode sourceNode, targetNode;
189  NetworkEdge tempEdge;
190 
191  // the value of an iterator is a descriptor
192  tempEdge = m_Network[ *iterator ];
193  sourceNode = m_Network[ boost::source( *iterator, m_Network ) ];
194  targetNode = m_Network[ boost::target( *iterator, m_Network ) ];
195 
196  std::pair< NetworkNode, NetworkNode > nodePair( sourceNode, targetNode );
197  std::pair< std::pair< NetworkNode, NetworkNode > , NetworkEdge > edgePair( nodePair, tempEdge);
198  vectorOfEdges.push_back( edgePair );
199  }
200 
201  return vectorOfEdges;
202 }
203 
205 {
206  return boost::num_vertices( m_Network );
207 }
208 
210 {
211  return boost::num_edges( m_Network );
212 }
213 
215 {
216  int maxWeight( 0 );
217 
218  boost::graph_traits<NetworkType>::edge_iterator iterator, end;
219 
220  // sets iterator to start end end to end
221  boost::tie(iterator, end) = boost::edges( m_Network );
222 
223  for ( ; iterator != end; ++iterator)
224  {
225  int tempWeight;
226 
227  // the value of an iterator is a descriptor
228  tempWeight = m_Network[ *iterator ].weight;
229 
230  if( tempWeight > maxWeight )
231  {
232  maxWeight = tempWeight;
233  }
234  }
235 
236  return maxWeight;
237 }
238 
240 {
241  int noOfSelfLoops( 0 );
242 
243  std::vector< std::pair< std::pair< NetworkNode, NetworkNode > , NetworkEdge > >
244  edgeVector = GetVectorOfAllEdges();
245 
246  for( unsigned int index = 0; index < edgeVector.size() ; index++ )
247  {
248  double sourceX, sourceY, sourceZ, targetX, targetY, targetZ;
249 
250  sourceX = edgeVector[ index ].first.first.coordinates[0] ;
251  sourceY = edgeVector[ index ].first.first.coordinates[1] ;
252  sourceZ = edgeVector[ index ].first.first.coordinates[2] ;
253  targetX = edgeVector[ index ].first.second.coordinates[0] ;
254  targetY = edgeVector[ index ].first.second.coordinates[1] ;
255  targetZ = edgeVector[ index ].first.second.coordinates[2] ;
256 
257  // if the coordinates are the same
258  if(
259  sourceX > ( targetX - 0.01 ) &&
260  sourceX < ( targetX + 0.01 ) &&
261  sourceY > ( targetY - 0.01 ) &&
262  sourceY < ( targetY + 0.01 ) &&
263  sourceZ > ( targetZ - 0.01 ) &&
264  sourceZ < ( targetZ + 0.01 )
265  )
266  {
267  noOfSelfLoops++;
268  }
269  }
270 
271  return noOfSelfLoops;
272 }
273 
275 {
276  double vertices = (double) GetNumberOfVertices();
277  double edges = (double) GetNumberOfEdges();
278 
279  return ( ( edges * 2.0 ) / vertices );
280 }
281 
283 {
284  double vertices = (double) GetNumberOfVertices();
285  double edges = (double) GetNumberOfEdges();
286  double numberOfPossibleEdges = vertices * ( vertices - 1 ) / 2 ;
287 
288  return ( edges / numberOfPossibleEdges );
289 }
290 
292 {
293  std::vector< int > vectorOfDegree;
294 
295  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
296 
297  // sets iterator to start end end to end
298  boost::tie( iterator, end ) = boost::vertices( m_Network );
299 
300  vectorOfDegree.resize( this->GetNumberOfVertices() );
301 
302  for ( ; iterator != end; ++iterator)
303  {
304  // the value of an iterator is a descriptor
305  vectorOfDegree[ m_Network[ *iterator ].id ] = GetVectorOfAdjacentNodes( *iterator ).size();
306  }
307  return vectorOfDegree;
308 }
309 
310 std::vector< mitk::ConnectomicsNetwork::VertexDescriptorType >
312 {
313  std::vector< mitk::ConnectomicsNetwork::VertexDescriptorType > vectorOfAdjacentNodes;
314 
315  boost::graph_traits<NetworkType>::adjacency_iterator adjIter, adjEnd;
316 
317  boost::tie( adjIter, adjEnd ) = boost::adjacent_vertices( vertex, m_Network);
318 
319  for ( ; adjIter != adjEnd; ++adjIter)
320  {
321  vectorOfAdjacentNodes.push_back( *adjIter );
322  }
323 
324  return vectorOfAdjacentNodes;
325 }
326 
328 {
329  int maximumDegree( 0 );
330 
331  std::vector< int > vectorOfDegree = GetDegreeOfNodes();
332 
333  for( unsigned int index( 0 ); index < vectorOfDegree.size(); ++index )
334  {
335  if( maximumDegree < vectorOfDegree[ index ] )
336  {
337  maximumDegree = vectorOfDegree[ index ];
338  }
339  }
340 
341  return maximumDegree;
342 }
343 
345 {
346  std::vector< double > vectorOfClusteringCoefficients;
347 
348  typedef boost::graph_traits<NetworkType>::vertex_iterator vertexIter;
349 
350  vectorOfClusteringCoefficients.resize( this->GetNumberOfVertices() );
351 
352  std::pair<vertexIter, vertexIter> vertexPair;
353 
354  //for every vertex calculate the clustering coefficient
355  int size = vectorOfClusteringCoefficients.size();
356  for (vertexPair = vertices(m_Network); vertexPair.first != vertexPair.second; ++vertexPair.first)
357  {
358  int index = m_Network[ *vertexPair.first ].id;
359 
360  if( index > size )
361  {
362  MITK_ERROR << "Trying to access out of bounds clustering coefficient";
363  continue;
364  }
365 
366  vectorOfClusteringCoefficients[ index ] =
367  boost::clustering_coefficient(m_Network,*vertexPair.first) ;
368  }
369 
370  return vectorOfClusteringCoefficients;
371 }
372 
374 {
375  std::vector< double > vectorOfClusteringCoefficients = GetLocalClusteringCoefficients();
376  std::vector< int > vectorOfDegree = GetDegreeOfNodes();
377 
378  std::vector< double > vectorOfClusteringCoefficientsByDegree;
379  vectorOfClusteringCoefficientsByDegree.resize( GetMaximumDegree() + 1, 0 );
380 
381  // c_{mean}(k) = frac{1}_{N_{k}} sum_{i in Y(k)} c_{i}
382  // where N_{k} is the number of vertices of degree k
383  // Y(k) is the set of vertices of degree k
384  // c_{i} is the local clustering coefficient of vertex i
385  for( unsigned int degree( 0 ); degree < vectorOfClusteringCoefficientsByDegree.size(); ++degree )
386  {
387  vectorOfClusteringCoefficientsByDegree[ degree ] = 0;
388  int n_k( 0 );
389  for( unsigned int index( 0 ); index < vectorOfDegree.size(); ++index )
390  {
391  if( degree == (unsigned int)vectorOfDegree[ index ] )
392  {// if in Y( degree )
393  vectorOfClusteringCoefficientsByDegree[ degree ] += vectorOfClusteringCoefficients[ index ];
394  n_k++;
395  }
396  }
397  if( n_k != 0 )
398  {
399  vectorOfClusteringCoefficientsByDegree[ degree ] =
400  vectorOfClusteringCoefficientsByDegree[ degree ] / n_k;
401  }
402  }
403 
404  return vectorOfClusteringCoefficientsByDegree;
405 }
406 
408 {
409  double globalClusteringCoefficient( 0.0 );
410 
411  std::vector< double > vectorOfClusteringCoefficientsByDegree = GetClusteringCoefficientsByDegree();
412  std::vector< int > vectorOfDegree = GetDegreeOfNodes();
413  std::vector< int > degreeDistribution;
414  degreeDistribution.resize( vectorOfClusteringCoefficientsByDegree.size(), 0 );
415 
416  int normalizationParameter( 0 );
417 
418  for( unsigned int index( 0 ); index < vectorOfDegree.size(); ++index )
419  {
420  degreeDistribution[ vectorOfDegree[ index ] ]++;
421  normalizationParameter++;
422  }
423  // c_{mean} = sum_{k} P_{k} c_{mean}(k)
424  // where P_{k} is the degree distribution
425  // k is the degree
426  for( unsigned int degree( 0 ); degree < degreeDistribution.size(); ++degree )
427  {
428  globalClusteringCoefficient +=
429  degreeDistribution[ degree ] / ( (double) normalizationParameter)
430  * vectorOfClusteringCoefficientsByDegree[ degree ];
431  }
432 
433  return globalClusteringCoefficient;
434 }
435 
437 {
438  return &m_Network;
439 }
440 
442 {
443  this->clear();
444 
445  m_Network = *newGraph;
446  this->SetIsModified( true );
447 }
448 
450 {
451  typedef std::vector< std::pair< std::pair< NetworkNode, NetworkNode >, NetworkEdge > > EdgeVectorType;
452  typedef std::vector< NetworkNode > VertexVectorType;
453 
454  this->clear();
455 
456  this->SetGeometry( source->GetGeometry());
457  VertexVectorType vertexVector = source->GetVectorOfAllNodes();
458  EdgeVectorType edgeVector = source->GetVectorOfAllEdges();
459  std::map< int, VertexDescriptorType > idToVertexMap;
460 
461  for( unsigned int loop(0); loop < vertexVector.size(); loop++ )
462  {
463  VertexDescriptorType newVertex = this->AddVertex( vertexVector[ loop ].id );
464  this->SetLabel( newVertex, vertexVector[ loop ].label );
465  this->SetCoordinates( newVertex, vertexVector[ loop ].coordinates );
466 
467  if ( idToVertexMap.count( vertexVector[ loop ].id ) > 0 )
468  {
469  MITK_ERROR << "Aborting network import, duplicate vertex ID discovered.";
470  return;
471  }
472  idToVertexMap.insert( std::pair< int, VertexDescriptorType >( vertexVector[ loop ].id, newVertex) );
473  }
474 
475  for( unsigned int loop(0); loop < edgeVector.size(); loop++ )
476  {
477  VertexDescriptorType source = idToVertexMap.find( edgeVector[ loop ].second.sourceId )->second;
478  VertexDescriptorType target = idToVertexMap.find( edgeVector[ loop ].second.targetId )->second;
479 
480  this->AddEdge( source, target, edgeVector[ loop ].second.sourceId, edgeVector[ loop ].second.targetId, edgeVector[ loop ].second.weight);
481  }
482 
483  this->SetIsModified( true );
484 }
485 
487 {
488  return m_IsModified;
489 }
490 
491 
493 {
494  m_IsModified = value;
495 }
496 
497 
499 {
500  return m_Network[ vertex ];
501 }
502 
503 
505 {
506  if( EdgeExists(vertexA, vertexB) )
507  {
508  return m_Network[ boost::edge(vertexA, vertexB, m_Network ).first ];
509  }
510  else
511  {
512  mitkThrow() << "Edge does not exist";
513  }
514 }
515 
517 {
520  float bounds[] = {max, min, max, min, max, min};
521 
522  std::vector< mitk::ConnectomicsNetwork::NetworkNode > nodeVector = this->GetVectorOfAllNodes();
523 
524  if( nodeVector.size() == 0 )
525  {
526  bounds[0] = 0;
527  bounds[1] = 1;
528  bounds[2] = 0;
529  bounds[3] = 1;
530  bounds[4] = 0;
531  bounds[5] = 1;
532  }
533 
534  // for each direction, make certain the point is in between
535  for(auto & elem : nodeVector)
536  {
537  for( unsigned int direction(0); direction < elem.coordinates.size(); direction++ )
538  {
539  if( elem.coordinates.at(direction) < bounds[ 2 * direction ] )
540  {
541  bounds[ 2 * direction ] = elem.coordinates.at(direction);
542  }
543 
544  if( elem.coordinates.at(direction) > bounds[ 2 * direction + 1] )
545  {
546  bounds[ 2 * direction + 1] = elem.coordinates.at(direction);
547  }
548  }
549  }
550 
551 
552  // provide some border margin
553  for(int i=0; i<=4; i+=2)
554  {
555  bounds[i] -=10;
556  }
557 
558  for(int i=1; i<=5; i+=2)
559  {
560  bounds[i] +=10;
561  }
562 
563  this->GetGeometry()->SetFloatBounds(bounds);
564  this->GetTimeGeometry()->Update();
565 }
566 
568 {
569  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
570 
571  // set to true if iterators are invalidated by deleting a vertex
572  bool vertexHasBeenRemoved( true );
573 
574  // if no vertex has been removed in the last loop, we are done
575  while( vertexHasBeenRemoved )
576  {
577  vertexHasBeenRemoved = false;
578  // sets iterator to start and end to end
579  boost::tie(iterator, end) = boost::vertices( m_Network );
580 
581  for ( ; iterator != end && !vertexHasBeenRemoved; ++iterator)
582  {
583  // If the node has no adjacent vertices it should be deleted
584  if( GetVectorOfAdjacentNodes( *iterator ).size() == 0 )
585  {
586  vertexHasBeenRemoved = true;
587  // this invalidates all iterators
588  boost::remove_vertex( *iterator, m_Network );
589  }
590  }
591  }
592 
593  UpdateIDs();
594 }
595 
597 {
598  boost::graph_traits<NetworkType>::vertex_iterator v_i, v_end;
599  boost::graph_traits<NetworkType>::edge_iterator e_i, e_end;
600 
601  // update node ids
602  boost::tie( v_i, v_end ) = boost::vertices( m_Network );
603 
604  for ( ; v_i != v_end; ++v_i)
605  {
606  m_Network[*v_i].id = *v_i;
607  }
608 
609  // update edge information
610  boost::tie(e_i, e_end) = boost::edges( m_Network );
611 
612  for ( ; e_i != e_end; ++e_i)
613  {
614  m_Network[ *e_i ].sourceId = m_Network[ boost::source( *e_i, m_Network ) ].id;
615  m_Network[ *e_i ].targetId = m_Network[ boost::target( *e_i, m_Network ) ].id;
616  }
617  this->SetIsModified( true );
618 }
619 
621 {
622  std::vector< double > betweennessVector;
623 
624  betweennessVector.clear();
625  betweennessVector.resize( this->GetNumberOfVertices() );
626 
627  boost::brandes_betweenness_centrality(
628  m_Network,
629  boost::centrality_map(
630  boost::make_iterator_property_map( betweennessVector.begin(), boost::get( &NetworkNode::id, m_Network ), double() )
631  ).vertex_index_map( boost::get( &NetworkNode::id, m_Network ) )
632  );
633 
634  return betweennessVector;
635 }
636 
638 {
639  // std::map used for convenient initialization
640  typedef std::map<EdgeDescriptorType, int> EdgeIndexStdMap;
641  EdgeIndexStdMap stdEdgeIndex;
642  // associative property map needed for iterator property map-wrapper
643  typedef boost::associative_property_map< EdgeIndexStdMap > EdgeIndexMap;
644  EdgeIndexMap edgeIndex(stdEdgeIndex);
645 
646  boost::graph_traits<NetworkType>::edge_iterator iterator, end;
647 
648  // sets iterator to start end end to end
649  boost::tie(iterator, end) = boost::edges( m_Network );
650 
651  int i(0);
652  for ( ; iterator != end; ++iterator, ++i)
653  {
654  stdEdgeIndex.insert(std::pair< EdgeDescriptorType, int >( *iterator, i));
655  }
656 
657  // Define EdgeCentralityMap
658  std::vector< double > edgeBetweennessVector(boost::num_edges( m_Network ), 0.0);
659  // Create the external property map
660  boost::iterator_property_map< std::vector< double >::iterator, EdgeIndexMap >
661  e_centrality_map(edgeBetweennessVector.begin(), edgeIndex);
662 
663  // Define VertexCentralityMap
664  typedef boost::property_map< NetworkType, boost::vertex_index_t>::type VertexIndexMap;
665  VertexIndexMap vertexIndex = get(boost::vertex_index, m_Network );
666  std::vector< double > betweennessVector(boost::num_vertices( m_Network ), 0.0);
667  // Create the external property map
668  boost::iterator_property_map< std::vector< double >::iterator, VertexIndexMap >
669  v_centrality_map(betweennessVector.begin(), vertexIndex);
670 
671  boost::brandes_betweenness_centrality( m_Network, v_centrality_map, e_centrality_map );
672 
673  return edgeBetweennessVector;
674 }
675 
676 std::vector< double > mitk::ConnectomicsNetwork::GetShortestDistanceVectorFromLabel( std::string targetLabel ) const
677 {
678  std::vector< VertexDescriptorType > predecessorMap( boost::num_vertices( m_Network ) );
679  int numberOfNodes( boost::num_vertices( m_Network ) );
680 
681  std::vector< double > distanceMatrix;
682  distanceMatrix.resize( numberOfNodes );
683 
684  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
685  boost::tie(iterator, end) = boost::vertices( m_Network );
686 
687  while( (iterator != end) && (m_Network[ *iterator ].label != targetLabel) )
688  {
689  ++iterator;
690  }
691 
692  if( iterator == end )
693  {
694  MITK_WARN << "Label not found";
695  return distanceMatrix;
696  }
697 
698  boost::dijkstra_shortest_paths(m_Network, *iterator, boost::predecessor_map(&predecessorMap[ 0 ]).distance_map(&distanceMatrix[ 0 ]).weight_map( boost::get( &NetworkEdge::edge_weight ,m_Network ) ) ) ;
699 
700  return distanceMatrix;
701 }
702 
703 bool mitk::ConnectomicsNetwork::CheckForLabel( std::string targetLabel ) const
704 {
705  boost::graph_traits<NetworkType>::vertex_iterator iterator, end;
706  boost::tie(iterator, end) = boost::vertices( m_Network );
707 
708  while( (iterator != end) && (m_Network[ *iterator ].label != targetLabel) )
709  {
710  ++iterator;
711  }
712 
713  if( iterator == end )
714  {
715  return false;
716  }
717 
718  return true;
719 }
720 
721 bool mitk::Equal( mitk::ConnectomicsNetwork* leftHandSide, mitk::ConnectomicsNetwork* rightHandSide, mitk::ScalarType eps, bool verbose )
722 {
723  bool noDifferenceFound = true;
724 
725  if( rightHandSide == nullptr )
726  {
727  if(verbose)
728  {
729  MITK_INFO << "[Equal( ConnectomicsNetwork*, ConnectomicsNetwork* )] rightHandSide NULL.";
730  }
731  return false;
732  }
733 
734  if( leftHandSide == nullptr )
735  {
736  if(verbose)
737  {
738  MITK_INFO << "[Equal( ConnectomicsNetwork*, ConnectomicsNetwork* )] leftHandSide NULL.";
739  }
740  return false;
741  }
742 
745 
746  calculatorLeft->SetNetwork( leftHandSide );
747  calculatorRight->SetNetwork( rightHandSide );
748  calculatorLeft->Update();
749  calculatorRight->Update();
750 
751  if( ! mitk::Equal( calculatorLeft->GetNumberOfVertices(), calculatorRight->GetNumberOfVertices(), eps ) )
752  {
753  if(verbose)
754  MITK_INFO << "[Equal( ConnectomicsNetwork*, ConnectomicsNetwork* )] Number of vertices not equal. " << calculatorLeft->GetNumberOfVertices() << " vs " << calculatorRight->GetNumberOfVertices();
755  noDifferenceFound = false;
756  }
757 
758  if( ! mitk::Equal( calculatorLeft->GetNumberOfEdges(), calculatorRight->GetNumberOfEdges(), eps ) )
759  {
760  if(verbose)
761  MITK_INFO << "[Equal( ConnectomicsNetwork*, ConnectomicsNetwork* )] Number of edges not equal. " << calculatorLeft->GetNumberOfEdges() << " vs " << calculatorRight->GetNumberOfEdges();
762  noDifferenceFound = false;
763  }
764 
765  if( ! mitk::Equal( calculatorLeft->GetSmallWorldness(), calculatorRight->GetSmallWorldness(), eps ) )
766  {
767  if(verbose)
768  MITK_INFO << "[Equal( ConnectomicsNetwork*, ConnectomicsNetwork* )] Small worldness not equal. " << calculatorLeft->GetSmallWorldness() << " vs " << calculatorRight->GetSmallWorldness();
769  noDifferenceFound = false;
770  }
771 
772  return noDifferenceFound;
773 }
virtual void UpdateOutputInformation() override
bool EdgeExists(VertexDescriptorType vertexA, VertexDescriptorType vertexB) const
itk::SmartPointer< Self > Pointer
bool CheckForLabel(std::string targetLabel) const
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
#define MITK_INFO
Definition: mitkLogMacros.h:22
std::vector< double > GetNodeBetweennessVector() const
std::vector< double > GetEdgeBetweennessVector() const
void AddEdge(VertexDescriptorType vertexA, VertexDescriptorType vertexB)
#define MITK_ERROR
Definition: mitkLogMacros.h:24
double ScalarType
std::vector< VertexDescriptorType > GetVectorOfAllVertexDescriptors() const
NetworkEdge GetEdge(VertexDescriptorType vertexA, VertexDescriptorType vertexB) const
VertexDescriptorType AddVertex(int id)
virtual void SetRequestedRegion(const itk::DataObject *) override
Set the requested region from this data object to match the requested region of the data object passe...
virtual void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
void ImportNetwort(mitk::ConnectomicsNetwork::Pointer source)
std::vector< NetworkNode > GetVectorOfAllNodes() const
void SetLabel(VertexDescriptorType vertex, std::string inLabel)
void SetCoordinates(VertexDescriptorType vertex, std::vector< float > inCoordinates)
#define MITK_WARN
Definition: mitkLogMacros.h:23
#define mitkThrow()
NetworkNode GetNode(VertexDescriptorType vertex) const
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, NetworkNode, NetworkEdge > NetworkType
std::vector< double > GetShortestDistanceVectorFromLabel(std::string targetLabel) const
std::vector< double > GetClusteringCoefficientsByDegree()
std::vector< VertexDescriptorType > GetVectorOfAdjacentNodes(VertexDescriptorType vertex) const
std::vector< std::pair< std::pair< NetworkNode, NetworkNode >, NetworkEdge > > GetVectorOfAllEdges() const
boost::graph_traits< NetworkType >::vertex_descriptor VertexDescriptorType
static T max(T x, T y)
Definition: svm.cpp:70
static T min(T x, T y)
Definition: svm.cpp:67
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
void SetBoostGraph(NetworkType *newGraph)
std::vector< int > GetDegreeOfNodes() const
Connectomics Network Class.
std::vector< double > GetLocalClusteringCoefficients() const
void IncreaseEdgeWeight(VertexDescriptorType vertexA, VertexDescriptorType vertexB)
virtual bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.