MCPcopy Create free account
hub / github.com/MITK/MITK / GetMedian

Method GetMedian

Modules/ImageStatistics/src/mitkPointSetStatisticsCalculator.cpp:99–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99double mitk::PointSetStatisticsCalculator::GetMedian(std::vector<double> list)
100{
101if (list.empty()) return 0;
102std::sort(list.begin(), list.end());
103if (list.size() % 2 == 0.) //even
104 {
105 double element1 = list.at(list.size()/2);
106 double element2 = list.at(list.size()/2);
107 return ((element1+element2)/2.0);
108 }
109else //odd
110 {
111 return list.at((list.size())/2);
112 }
113}
114
115mitk::Point3D mitk::PointSetStatisticsCalculator::GetMean(std::vector<mitk::Point3D> list)
116{

Calls 5

atMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45