voidsort();//Sort compartments according to their volume fraction
voidfit_pvf(ColumnVector&x)const;
voidfit_pvf(ColumnVector&x)const;//Estimate the volume fractions given all the other parameters using Linear Least Squares. Used to better initialize the Nonlinear fitter
voidfix_fsum(ColumnVector&fs)const;
voidfix_fsum(ColumnVector&fs)const;
floatpartial_fsum(ColumnVector&fs,intii)const;//Returns 1-Sum(f_j), 1<=j<=ii. (ii<=nfib). Used for transforming beta to f and vice versa
voidprint()const{
voidprint()const;//Print the final estimates (after having them transformed)
cout<<"PVM (Single) FIT RESULTS "<<endl;
voidprint(constColumnVector&p)const;//Print the estimates using a vector with the untransformed parameter values
cout<<"S0 :"<<m_s0<<endl;
ReturnMatrixget_prediction()const;//Applies the forward model and gets the model predicted signal using the estimated parameter values (true,non-transformed space)
//Functions used to obtain a prediction of the fanning angle (if any), associated with each fibre compartment
voideval_Hessian_at_peaks();//For each fibre, compute a 3x3 Hessian of the cartesian (x,y,z) coordinates of the orientation
//evaluated at the estimated parameters
voidFanning_angles_from_Hessian();//For each fibre, get the projection of the 2nd eigenvector of the Hessian to the fanning plane and get a fanning angle in [0,pi).
// useful functions for calculating signal and its derivatives
// useful functions for calculating signal and its derivatives
// functions
// functions
...
@@ -343,7 +338,14 @@ private:
...
@@ -343,7 +338,14 @@ private:
ColumnVectorm_f;
ColumnVectorm_f;
ColumnVectorm_th;
ColumnVectorm_th;
ColumnVectorm_ph;
ColumnVectorm_ph;
constboolm_include_f0;//Indicate whether f0 will be used in the model (an unattenuated signal compartment). That will be added as the last parameter
constboolm_include_f0;//Indicate whether f0 will be used in the model (an unattenuated signal compartment). That will be added as the last parameter
constboolm_eval_BIC;//Indicate whether the Bayesian Information Criterion for the fitted model is computed
constboolm_return_fanning;//Indicate whether fanning angles predictions are made. For each fitted fibre compartment i, use the second eigenvector of the inverse Hessian
//evaluated at this fibre orientation to predict fanning angle for i.
floatm_BIC;//Bayesian Information Criterion for the fitted model
ColumnVectorm_fanning_angles;//Use the second eigenvector of the inverse Hessian evaluated at each fibre orientation i to predict fanning angle for fibre compartment i.
vector<Matrix>m_Hessian;//Vector that keeps the Hessian matrix for each fibre orientation w.r.t. the Cartesian coordinates x,y,z, evaluated at the estimated orientation
vector<ColumnVector>m_invprHes_e1;//Vector that keeps the first eigenvector of the projected inverse Hessian for each fibre orientation w.r.t. the Cartesian coordinates x,y,z, evaluated at the estimated orientation
};
};
...
@@ -461,11 +463,11 @@ class PVM_multi : public PVM, public NonlinCF {
...
@@ -461,11 +463,11 @@ class PVM_multi : public PVM, public NonlinCF {
NEWMAT::ReturnMatrixforwardModel(constNEWMAT::ColumnVector&p)const;//Applies the forward model and gets a model predicted signal using the parameter values in p (transformed parameter space)
//Instead of returning the model predicted signal for each direction returns the individual signal contributions weighted by their fractions
//i.e. isotropic, anisotropic1, anisotropic2, etc. Summing those gives the signal
voidsort();//Sort compartments according to their volume fraction
floatpartial_fsum(ColumnVector&fs,intii)const;//Returns 1-Sum(f_j), 1<=j<=ii. (ii<=nfib). Used for transforming beta to f and vice versa
voidprint()const;//Print the final estimates (after having them untransformed)
voidprint(constColumnVector&p)const;//Print the estimates using a vector with the transformed parameter values (i.e. need to untransform to get d,fs etc)
ReturnMatrixget_prediction()const;//Applies the forward model and gets the model predicted signal using the estimated parameter values (true,non-transformed space)
floatget_s0()const{returnm_s0;}
floatget_f0()const{returnm_f0;}
floatget_d()const{returnm_d;}
ColumnVectorget_f()const{returnm_f;}
ColumnVectorget_th()const{returnm_th;}
ColumnVectorget_ph()const{returnm_ph;}
ColumnVectorget_psi()const{returnm_psi;}
ColumnVectorget_k1()const{returnm_k1;}
ColumnVectorget_k2()const{returnm_k2;}
floatget_f(constint&i)const{returnm_f(i);}
floatget_th(constint&i)const{returnm_th(i);}
floatget_ph(constint&i)const{returnm_ph(i);}
floatget_psi(constint&i)const{returnm_psi(i);}
ReturnMatrixget_fanning_vector(constint&i)const;//Returns a vector that indicates the fanning orientation
floatget_k1(constint&i)const{returnm_k1(i);}
floatget_k2(constint&i)const{returnm_k2(i);}
floatget_BIC()const{returnm_BIC;}
// useful functions for calculating signal and its derivatives
NEWMAT::ReturnMatrixforwardModel(constNEWMAT::ColumnVector&p)const;//Applies the forward model and gets a model predicted signal using the parameter values in p (transformed parameter space)
//Instead of returning the model predicted signal for each direction returns the individual signal contributions weighted by their fractions
//i.e. isotropic, anisotropic1, anisotropic2, etc. Summing those gives the signal
voidsort();//Sort compartments according to their volume fraction
floatpartial_fsum(ColumnVector&fs,intii)const;//Returns 1-Sum(f_j), 1<=j<=ii. (ii<=nfib). Used for transforming beta to f and vice versa
voidprint()const;//Print the final estimates (after having them untransformed)
voidprint(constColumnVector&p)const;//Print the estimates using a vector with the transformed parameter values (i.e. need to untransform to get d,fs etc)
ReturnMatrixget_prediction()const;//Applies the forward model and gets the model predicted signal using the estimated parameter values (true,non-transformed space)
floatget_s0()const{returnm_s0;}
floatget_f0()const{returnm_f0;}
floatget_d()const{returnm_d;}
ColumnVectorget_f()const{returnm_f;}
ColumnVectorget_th()const{returnm_th;}
ColumnVectorget_ph()const{returnm_ph;}
ColumnVectorget_k()const{returnm_k;}
floatget_f(constint&i)const{returnm_f(i);}
floatget_th(constint&i)const{returnm_th(i);}
floatget_ph(constint&i)const{returnm_ph(i);}
floatget_k(constint&i)const{returnm_k(i);}
floatget_BIC()const{returnm_BIC;}
// useful functions for calculating signal and its derivatives