| 451 | // Write log file in Microsoft Excel semicolon separated format. |
| 452 | template <typename ImageType> |
| 453 | void |
| 454 | WriteLog(const std::string & filename, |
| 455 | const unsigned int dim, |
| 456 | const typename ImageType::SizeType & imagesize, |
| 457 | const double rmsError, |
| 458 | const double rmsRelative, |
| 459 | const bool testPassed, |
| 460 | const bool exceptionGPU, |
| 461 | const unsigned int numThreads, |
| 462 | const unsigned int runTimes, |
| 463 | const std::string & filterName, |
| 464 | const TimeProbe::TimeStampType cpuTime, |
| 465 | const TimeProbe::TimeStampType gpuTime, |
| 466 | const std::string & comments = "") |
| 467 | { |
| 468 | const std::string s(" ; "); // separator |
| 469 | std::ofstream fout; |
| 470 | const bool fileExists = itksys::SystemTools::FileExists(filename.c_str()); |
| 471 | |
| 472 | fout.open(filename.c_str(), std::ios_base::app); |
| 473 | // If file does not exist, then print table header |
| 474 | if (!fileExists) |
| 475 | { |
| 476 | fout << "Filter Name" << s << "Dimension" << s << "Image Size" << s << "CPU(" << numThreads << ") (s)" << s |
| 477 | << "GPU (s)" << s << "CPU/GPU Speed Ratio" << s << "RMS Error" << s << "RMS Relative" << s << "Test Passed" |
| 478 | << s << "Run Times" << s << "Comments" << std::endl; |
| 479 | } |
| 480 | |
| 481 | fout << filterName << s << dim << s; |
| 482 | for (unsigned int i = 0; i < dim; ++i) |
| 483 | { |
| 484 | fout << imagesize.GetSize()[i]; |
| 485 | if (i < dim - 1) |
| 486 | { |
| 487 | fout << "x"; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | fout << s << cpuTime << s; |
| 492 | |
| 493 | if (!exceptionGPU) |
| 494 | { |
| 495 | fout << gpuTime << s; |
| 496 | } |
| 497 | else |
| 498 | { |
| 499 | fout << "na" << s; |
| 500 | } |
| 501 | |
| 502 | if (!exceptionGPU) |
| 503 | { |
| 504 | if (gpuTime != 0.0) |
| 505 | { |
| 506 | fout << (cpuTime / gpuTime) << s; |
| 507 | } |
| 508 | else |
| 509 | { |
| 510 | fout << "0" << s; |