29 MITK_INFO <<
"########### 15 cm distance errors #############";
35 std::vector<double> distances;
36 std::vector<std::string> descriptions;
39 int distanceCounter = 0;
40 for (
int row = 0; row < 9; row++)
41 for (
int distance = 0; distance < 7; distance++)
44 mitk::Point3D point1 = p->GetPoint(row * 10 + distance);
45 mitk::Point3D point2 = p->GetPoint(row * 10 + distance + 3);
46 distances.push_back(point1.EuclideanDistanceTo(point2));
47 std::stringstream description;
48 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (distance + 1) <<
" to " << (row + 1) <<
"/" << (distance + 4);
49 descriptions.push_back(description.str());
53 for (
int column = 0; column < 10; column++)
54 for (
int row = 0; row < 6; row++)
57 mitk::Point3D point1 = matrix[row][column];
58 mitk::Point3D point2 = matrix[row + 3][column];
59 distances.push_back(point1.EuclideanDistanceTo(point2));
60 std::stringstream description;
61 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (column + 1) <<
" to " << (row + 4) <<
"/" << (column + 1);
62 descriptions.push_back(description.str());
66 for (std::size_t i = 0; i < distances.size(); ++i)
69 currentError.
distanceError = fabs(distances.at(i) - (
double)150.0);
71 Results.push_back(currentError);
77 for (
auto currentError : statistics)
79 Results.push_back(currentError);
80 MITK_INFO << currentError.description <<
" : " << currentError.distanceError;
89 MITK_INFO <<
"########### 30 cm distance errors #############";
92 std::array<std::array<mitk::Point3D, 10> ,9> matrix = ParseMatrixStandardVolume(p);
95 std::vector<double> distances;
96 std::vector<std::string> descriptions;
99 int distanceCounter = 0;
100 for (
int row = 0; row < 9; row++)
101 for (
int distance = 0; distance < 4; distance++)
104 mitk::Point3D point1 = p->GetPoint(row * 10 + distance);
105 mitk::Point3D point2 = p->GetPoint(row * 10 + distance + 6);
106 distances.push_back(point1.EuclideanDistanceTo(point2));
107 std::stringstream description;
108 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (distance + 1) <<
" to " << (row + 1) <<
"/" << (distance + 7);
109 descriptions.push_back(description.str());
113 for (
int column = 0; column < 10; column++)
114 for (
int row = 0; row < 3; row++)
117 mitk::Point3D point1 = matrix[row][column];
118 mitk::Point3D point2 = matrix[row + 6][column];
119 distances.push_back(point1.EuclideanDistanceTo(point2));
120 std::stringstream description;
121 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (column + 1) <<
" to " << (row + 7) <<
"/" << (column + 1);
122 descriptions.push_back(description.str());
126 for (std::size_t i = 0; i < distances.size(); ++i)
129 currentError.
distanceError = fabs(distances.at(i) - (
double)300.0);
131 Results.push_back(currentError);
137 for (
auto currentError : statistics)
139 Results.push_back(currentError);
140 MITK_INFO << currentError.description <<
" : " << currentError.distanceError;
150 MITK_INFO <<
"########### accumulated distance errors #############";
152 int distanceCounter = 0;
155 for (
int row = 0; row < 9; row++)
156 for (
int distance = 0; distance < 9; distance++)
159 mitk::Point3D point1 = p->GetPoint(row * 10);
160 mitk::Point3D point2 = p->GetPoint(row * 10 + distance + 1);
161 std::stringstream description;
162 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/1 to " << (row + 1) <<
"/" << (distance + 2);
165 currentError.
distanceError = fabs(point1.EuclideanDistanceTo(point2) - (
double)(50.0*(distance+1)));
166 currentError.description = description.str();
167 Results.push_back(currentError);
168 MITK_INFO <<
"Error " << currentError.description <<
" : " << currentError.distanceError;
175 for (
auto currentError : statistics)
177 Results.push_back(currentError);
178 MITK_INFO << currentError.description <<
" : " << currentError.distanceError;
188MITK_INFO <<
"########### 5 cm distance errors #############";
189std::vector<double> distances;
190std::vector<std::string> descriptions;
194 if (p->GetSize() != 12) {
195 MITK_WARN <<
"Wrong number of points: " << p->GetSize() <<
" (expected 12), aborting";
198 MITK_INFO <<
"Computing Hummel protocol distance errors for small measurement volumes (12 points)...";
201 distances.push_back(p->GetPoint(0).EuclideanDistanceTo(p->GetPoint(1)));
202 descriptions.push_back(
"Distance 4/4 to 4/5");
203 distances.push_back(p->GetPoint(1).EuclideanDistanceTo(p->GetPoint(2)));
204 descriptions.push_back(
"Distance 4/5 to 4/6");
205 distances.push_back(p->GetPoint(2).EuclideanDistanceTo(p->GetPoint(3)));
206 descriptions.push_back(
"Distance 4/6 to 4/7");
208 distances.push_back(p->GetPoint(4).EuclideanDistanceTo(p->GetPoint(5)));
209 descriptions.push_back(
"Distance 5/4 to 5/5");
210 distances.push_back(p->GetPoint(5).EuclideanDistanceTo(p->GetPoint(6)));
211 descriptions.push_back(
"Distance 5/5 to 5/6");
212 distances.push_back(p->GetPoint(6).EuclideanDistanceTo(p->GetPoint(7)));
213 descriptions.push_back(
"Distance 5/6 to 5/7");
215 distances.push_back(p->GetPoint(8).EuclideanDistanceTo(p->GetPoint(9)));
216 descriptions.push_back(
"Distance 6/4 to 6/5");
217 distances.push_back(p->GetPoint(9).EuclideanDistanceTo(p->GetPoint(10)));
218 descriptions.push_back(
"Distance 6/5 to 6/6");
219 distances.push_back(p->GetPoint(10).EuclideanDistanceTo(p->GetPoint(11)));
220 descriptions.push_back(
"Distance 6/6 to 6/7");
222 distances.push_back(p->GetPoint(0).EuclideanDistanceTo(p->GetPoint(4)));
223 descriptions.push_back(
"Distance 4/4 to 5/4");
224 distances.push_back(p->GetPoint(4).EuclideanDistanceTo(p->GetPoint(8)));
225 descriptions.push_back(
"Distance 5/4 to 6/4");
227 distances.push_back(p->GetPoint(1).EuclideanDistanceTo(p->GetPoint(5)));
228 descriptions.push_back(
"Distance 4/5 to 5/5");
229 distances.push_back(p->GetPoint(5).EuclideanDistanceTo(p->GetPoint(9)));
230 descriptions.push_back(
"Distance 5/5 to 6/5");
232 distances.push_back(p->GetPoint(2).EuclideanDistanceTo(p->GetPoint(6)));
233 descriptions.push_back(
"Distance 4/6 to 5/6");
234 distances.push_back(p->GetPoint(6).EuclideanDistanceTo(p->GetPoint(10)));
235 descriptions.push_back(
"Distance 5/6 to 6/6");
237 distances.push_back(p->GetPoint(3).EuclideanDistanceTo(p->GetPoint(7)));
238 descriptions.push_back(
"Distance 4/7 to 5/7");
239 distances.push_back(p->GetPoint(7).EuclideanDistanceTo(p->GetPoint(11)));
240 descriptions.push_back(
"Distance 5/7 to 6/7");
246 if (p->GetSize() != 25) {
247 MITK_WARN <<
"Wrong number of points (expected 25), aborting";
250 MITK_INFO <<
"Computing Hummel protocol distance errors for medium measurement volumes (25 points)...";
252 int distanceCounter = 0;
255 std::array<std::array<mitk::Point3D, 5>, 5> matrix = ParseMatrixMediumVolume(p);
258 for (
int row = 0; row < 5; row++)
259 for (
int distance = 0; distance < 4; distance++)
262 mitk::Point3D point1 = p->GetPoint(row * 5 + distance);
263 mitk::Point3D point2 = p->GetPoint(row * 5 + distance + 1);
264 distances.push_back(point1.EuclideanDistanceTo(point2));
265 std::stringstream description;
266 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (distance + 1) <<
" to " << (row + 1) <<
"/" << (distance + 2);
267 descriptions.push_back(description.str());
271 for (
int column = 0; column < 5; column++)
272 for (
int row = 0; row < 4; row++)
275 mitk::Point3D point1 = matrix[row][column];
276 mitk::Point3D point2 = matrix[row + 1][column];
277 MITK_INFO <<
"Point 1:" << point1 <<
"/Point 2:" << point2 <<
"/Distance:" << point1.EuclideanDistanceTo(point2);
278 distances.push_back(point1.EuclideanDistanceTo(point2));
279 std::stringstream description;
280 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (column + 1) <<
" to " << (row + 2) <<
"/" << (column + 1);
281 descriptions.push_back(description.str());
288 if (p->GetSize() != 90) {
289 MITK_WARN <<
"Wrong number of points (expected 90), aborting";
292 MITK_INFO <<
"Computing Hummel protocol distance errors for standard measurement volumes (90 points)...";
294 int distanceCounter = 0;
297 std::array<std::array<mitk::Point3D, 10>, 9> matrix = ParseMatrixStandardVolume(p);
300 for (
int row = 0; row < 9; row++)
301 for (
int distance = 0; distance < 9; distance++)
304 mitk::Point3D point1 = p->GetPoint(row * 10 + distance);
305 mitk::Point3D point2 = p->GetPoint(row * 10 + distance + 1);
306 distances.push_back(point1.EuclideanDistanceTo(point2));
307 std::stringstream description;
308 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (distance + 1) <<
" to " << (row + 1) <<
"/" << (distance + 2);
309 descriptions.push_back(description.str());
313 for (
int column = 0; column < 10; column++)
314 for (
int row = 0; row < 8; row++)
317 mitk::Point3D point1 = matrix[row][column];
318 mitk::Point3D point2 = matrix[row + 1][column];
319 distances.push_back(point1.EuclideanDistanceTo(point2));
320 std::stringstream description;
321 description <<
"Distance(" << distanceCounter <<
") " << (row + 1) <<
"/" << (column + 1) <<
" to " << (row + 2) <<
"/" << (column + 1);
322 descriptions.push_back(description.str());
331for (std::size_t i = 0; i < distances.size(); ++i)
334currentError.
distanceError = fabs(distances.at(i) - (
double)50.0);
336Results.push_back(currentError);
342for (
auto currentError : statistics)
344 Results.push_back(currentError);
345 MITK_INFO << currentError.description <<
" : " << currentError.distanceError;
391 std::vector<mitk::HummelProtocolEvaluation::HummelProtocolDistanceError> returnValue;
394 boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::mean,
396 boost::accumulators::tag::variance,
397 boost::accumulators::tag::max,
398 boost::accumulators::tag::min
403 acc(each.distanceError);
406 returnValue.push_back({
static_cast<double>(values.size()),
"N" });
407 returnValue.push_back({ boost::accumulators::mean(acc),
"Mean" });
411 returnValue.push_back({ boost::accumulators::min(acc),
"Min" });
412 returnValue.push_back({ boost::accumulators::max(acc),
"Max" });
415 std::vector<double> quantile;
417 {quantile.push_back(each.distanceError);}
419 auto const Q1 = quantile.size() / 4;
420 auto const Q2 = quantile.size() / 2;
421 auto const Q3 = Q1 + Q2;
423 std::sort(quantile.begin(),quantile.end());
425 returnValue.push_back({ quantile[Q1],
"Quartile 1" });
426 returnValue.push_back({ quantile[Q2],
"Median" });
427 returnValue.push_back({ quantile[Q3],
"Quartile 3" });
429 double mean = boost::accumulators::mean(acc);
433 double error = pow((each.distanceError - mean),2);
436 double variance = errorSum / values.size();
437 double sampleVariance = errorSum / (values.size()-1);
438 double standardDev = sqrt(variance);
439 double sampleStandardDev = sqrt(sampleVariance);
441 returnValue.push_back({ variance,
"Variance" });
442 returnValue.push_back({ sampleVariance,
"Sample Variance" });
443 returnValue.push_back({ standardDev,
"Standard Deviation" });
444 returnValue.push_back({ sampleStandardDev,
"Sample Standard Deviation" });