12     unsigned int numberOfParameters = parameters.GetSize();
    18     for (
unsigned int i = 0;i < numberOfParameters;++i)
    23     m_Residuals.SetSize(nbImages);
    27     for (
unsigned int i = 0;i < nbImages;++i)
    40         std::cerr << 
"Noise variance: " << 
m_SigmaSquare << std::endl;
    41         itkExceptionMacro(
"Too low estimated noise variance.");
    51     unsigned int nbImages = m_Residuals.size();
    53     if (m_MarginalEstimation)
    54         costValue = -2.0 * std::log(std::tgamma(1.0 + nbImages / 2.0)) + nbImages * std::log(2.0 * M_PI) + (nbImages + 2.0) * (std::log(nbImages / 2.0) + std::log(
m_SigmaSquare));
    56         costValue = nbImages * (1.0 + std::log(2.0 * M_PI * 
m_SigmaSquare));
    64     unsigned int nbParams = parameters.GetSize();
    65     if (m_MarginalEstimation)
    66         itkExceptionMacro(
"Marginal estimation does not boil down to a least square minimization problem.");
    74     for (
unsigned int i = 0;i < nbParams;++i)
    77             itkExceptionMacro(
"Get derivative not called with the same parameters as GetValue, suggestive of NaN...");
    80     derivative.SetSize(nbValues, nbParams);
    83     std::vector<ListType> signalJacobians(nbValues);
    85     for (
unsigned int i = 0;i < nbValues;++i)
    90         for (
unsigned int j = 0;j < nbParams;++j)
    91             derivative.put(i,j,signalJacobians[i][j]);
    98     unsigned int nbParams = derivativeMatrix.columns();
    99     unsigned int nbValues = derivativeMatrix.rows();
   101     derivative.set_size(nbParams);
   103     for (
unsigned int j = 0;j < nbParams;++j)
   105         double residualJacobianResidualProduct = 0;
   106         for (
unsigned int i = 0;i < nbValues;++i)
   107             residualJacobianResidualProduct += derivativeMatrix(i,j) * m_Residuals[i];
   109         if (!m_MarginalEstimation)
   110             derivative[j] = 2.0 * residualJacobianResidualProduct / 
m_SigmaSquare;
   112             derivative[j] = 2.0 * (nbValues + 2.0) * residualJacobianResidualProduct / (nbValues * 
m_SigmaSquare);
 itk::OptimizerParameters< double > ParametersType
 
std::vector< double > m_PredictedSignals
 
MCMPointer m_MCMStructure
 
ListType m_ObservedSignals
 
double GetCurrentCostValue() ITK_OVERRIDE
For the current set of parameters, compute the cost function value, requires GetValues to be called f...
 
MeasureType GetValues(const ParametersType ¶meters) ITK_OVERRIDE
Get residual values for a given set of parameters, returns a vector of residuals. ...
 
void GetCurrentDerivative(DerivativeMatrixType &derivativeMatrix, DerivativeType &derivative) ITK_OVERRIDE
Get cost function derivatives from a derivative matrix obtained from GetDerivativeMatrix. 
 
void GetDerivativeMatrix(const ParametersType ¶meters, DerivativeMatrixType &derivative) ITK_OVERRIDE
Get residual derivatives for a given set of parameters, returns a matrix of residuals derivatives...
 
ListType m_GradientStrengths
 
ListType m_TestedParameters
 
itk::Array2D< double > DerivativeMatrixType
 
itk::Array< double > MeasureType
 
std::vector< Vector3DType > m_Gradients
 
itk::Array< double > DerivativeType