Medical Imaging Interaction Toolkit  2018.4.99-a28b433c
Medical Imaging Interaction Toolkit
mitkNormalizedSumOfSquaredDifferencesFitCostFunction.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
13 
15 {
16  MeasureType measure = 0.0;
17  unsigned int signalSize = signal.GetSize();
18 
19  for(SignalType::size_type i=0; i<signal.GetSize(); ++i)
20  {
21  measure += (m_Sample[i] - signal[i]) * (m_Sample[i] - signal[i]);
22  }
23  measure = measure / signalSize;
24 
25  return measure;
26 }
MeasureType CalcMeasure(const ParametersType &parameters, const SignalType &signal) const override