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

Function ComputeRMSE2

Testing/itkTestHelper.h:242–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240// Helper function to compute RMSE
241template <typename TScalarType, typename CPUImageType, typename GPUImageType>
242TScalarType
243ComputeRMSE2(const CPUImageType * cpuImage, const GPUImageType * gpuImage, const float & threshold)
244{
245 ImageRegionConstIterator<CPUImageType> cit(cpuImage, cpuImage->GetLargestPossibleRegion());
246 ImageRegionConstIterator<GPUImageType> git(gpuImage, gpuImage->GetLargestPossibleRegion());
247
248 TScalarType rmse = 0.0;
249
250 for (cit.GoToBegin(), git.GoToBegin(); !cit.IsAtEnd(); ++cit, ++git)
251 {
252 TScalarType err = static_cast<TScalarType>(cit.Get()) - static_cast<TScalarType>(git.Get());
253 if (err > threshold)
254 {
255 rmse += err * err;
256 }
257 }
258 rmse = std::sqrt(rmse / cpuImage->GetLargestPossibleRegion().GetNumberOfPixels());
259 return rmse;
260} // end ComputeRMSE2()
261
262
263//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected