Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkConnectomicsDegreeHistogram.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 
19 
21 {
22  m_Subject = "Node degree";
23 }
24 
26 {
27 }
28 
30 {
31  std::vector< int > degreeOfNodesVector = source->GetDegreeOfNodes();
32 
33  int maximumDegree( 0 );
34 
35  for(unsigned int index( 0 ); index < degreeOfNodesVector.size(); index++ )
36  {
37  if( maximumDegree < degreeOfNodesVector[ index ] )
38  {
39  maximumDegree = degreeOfNodesVector[ index ];
40  }
41  }
42 
43  this->m_HistogramVector.resize( maximumDegree + 1 );
44 
45  for(unsigned int index( 0 ); index < m_HistogramVector.size(); index++ )
46  {
47  this->m_HistogramVector[ index ] = 0;
48  }
49  this->m_TopValue = maximumDegree;
50 
51  for(unsigned int index( 0 ); index < degreeOfNodesVector.size(); index++ )
52  {
53  this->m_HistogramVector[ degreeOfNodesVector[ index ] ]++;
54 
55  }
56  // successfully created a valid histogram
57  this->m_Valid = true;
58 }
virtual void ComputeFromConnectomicsNetwork(ConnectomicsNetwork *source) override
Creates a new histogram from the network source.
std::vector< int > GetDegreeOfNodes() const
Connectomics Network Class.
std::string m_Subject
Subject of the histogram as a string.