17 #ifndef _itk_BiExpFitFunctor_h_
18 #define _itk_BiExpFitFunctor_h_
24 #include "vnl/vnl_least_squares_function.h"
25 #include "vnl/algo/vnl_levenberg_marquardt.h"
26 #include "vnl/vnl_math.h"
42 itkFactorylessNewMacro(Self)
47 void operator()(vnl_matrix<
double> & newSignal,const vnl_matrix<
double> & SignalMatrix, const
double & S0) override;
49 void setTargetBValue(const
double & targetBValue){m_TargetBvalue = targetBValue;}
50 void setListOfBValues(
const vnl_vector<double> & BValueList){m_BValueList = BValueList;}
64 measurements.set_size(x.size());
65 measurements.copy_in(x.data_block());
70 bValueVector.set_size(x.size());
71 bValueVector.copy_in(x.data_block());
85 vnl_least_squares_function(3 , number_of_measurements, no_gradient)
87 N = get_number_of_residuals();
90 void f(
const vnl_vector<double>& x, vnl_vector<double>& fx)
override {
92 const double & ADC_slow = x[0];
93 const double & ADC_fast = x[1];
94 const double & lambda = x[2];
96 const vnl_vector<double> & b = bValueVector;
98 for(
int s=0; s<N; s++)
100 double approx = lambda * std::exp(-b[s] * ADC_slow) + (1-lambda) * std::exp(-b[s] * ADC_fast);
101 fx[s] = vnl_math_abs( measurements[s] - approx*S0 );
The DWIVoxelFunctor class Abstract basisclass for voxelprocessing of Diffusion Weighted Images...
lestSquaresFunction(unsigned int number_of_measurements)
The lestSquaresFunction struct for Non-Linear-Least-Squres fit of Biexponential model.
vnl_vector< double > m_BValueList
#define MITKDIFFUSIONCORE_EXPORT
void set_reference_measurement(const double &x)
void setListOfBValues(const vnl_vector< double > &BValueList)
vnl_vector< double > measurements
void f(const vnl_vector< double > &x, vnl_vector< double > &fx) override
vnl_vector< double > bValueVector
void set_bvalues(const vnl_vector< double > &x)
SmartPointer< const Self > ConstPointer
DWIVoxelFunctor Superclass
SmartPointer< Self > Pointer
void set_measurements(const vnl_vector< double > &x)