21 #include "vnl/algo/vnl_levenberg_marquardt.h"
25 vnl_vector<double> initalGuess(1);
32 vnl_levenberg_marquardt minimizer(model);
33 minimizer.set_max_function_evals(1000);
34 minimizer.set_f_tolerance(1e-10);
37 for(
unsigned int i = 0 ; i < SignalMatrix.rows(); i++)
39 model.set_measurements(SignalMatrix.get_row(i));
40 model.set_reference_measurement(S0);
42 initalGuess.put(0, 0.f);
45 minimizer.minimize_without_gradient(initalGuess);
47 const double & ADC = initalGuess.get(0);
50 newSignal.put(i, 1, minimizer.get_end_error());
53 std::cout << std::scientific << std::setprecision(5)
56 << minimizer.get_end_error() <<
",";
57 for(
unsigned int j = 0; j < SignalMatrix.get_row(i).size(); j++ ){
58 std::cout << std::scientific << std::setprecision(5) << SignalMatrix.get_row(i)[j];
59 if(j != SignalMatrix.get_row(i).size()-1) std::cout <<
",";
61 std::cout << std::endl;
vnl_vector< double > m_BValueList
The lestSquaresFunction struct for Non-Linear-Least-Squres fit of monoexponential model...
void operator()(vnl_matrix< double > &newSignal, const vnl_matrix< double > &SignalMatrix, const double &S0) override
operator ()
void set_bvalues(const vnl_vector< double > &x)