MCPcopy Create free account
hub / github.com/SuperElastix/elastix / GetTestFilterResult

Function GetTestFilterResult

Testing/itkTestHelper.h:308–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306// Helper function to get test result from filters
307template <typename TScalarType, typename ImageToImageFilterType, typename OutputImage>
308void
309GetTestFilterResult(typename ImageToImageFilterType::Pointer & cpuFilter,
310 typename ImageToImageFilterType::Pointer & gpuFilter,
311 const float allowedRMSerror,
312 TScalarType & rmsError,
313 TScalarType & rmsRelative,
314 bool & testPassed,
315 const bool skipCPU,
316 const bool skipGPU,
317 const TimeProbe::TimeStampType cpuTime,
318 const TimeProbe::TimeStampType gpuTime,
319 const bool updateExceptionCPU,
320 const bool updateExceptionGPU,
321 const unsigned int outputindex = 0)
322{
323 rmsError = 0.0;
324 testPassed = true;
325 if (updateExceptionCPU || updateExceptionGPU)
326 {
327 testPassed = false;
328 }
329 else
330 {
331 if (!skipCPU && !skipGPU && cpuFilter.IsNotNull() && gpuFilter.IsNotNull())
332 {
333 if (outputindex == 0)
334 {
335 rmsError = ComputeRMSE<TScalarType, OutputImage, OutputImage>(
336 cpuFilter->GetOutput(), gpuFilter->GetOutput(), rmsRelative);
337 }
338 else
339 {
340 rmsError = ComputeRMSE<TScalarType, OutputImage, OutputImage>(
341 cpuFilter->GetOutput(outputindex), gpuFilter->GetOutput(outputindex), rmsRelative);
342 }
343
344 std::cout << ", speed up " << (cpuTime / gpuTime) << std::endl;
345 std::cout << std::fixed << std::setprecision(8);
346 std::cout << "Maximum allowed RMS Error: " << allowedRMSerror << std::endl;
347 std::cout << "Computed real RMS Error: " << rmsError << std::endl;
348 std::cout << "Computed real nRMS Error: " << rmsRelative << std::endl;
349
350 testPassed = (rmsError <= allowedRMSerror);
351 }
352 }
353}
354
355
356//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected