function [info]=ApproxParkerAIF(aif,info)
measAIF=aif{1,1};
Ts=info.acq.Ts;
Nsamples=size(measAIF,2);
selected_model='Parker';
% selected_model='ParkerShift';

switch selected_model
    case 'Parker'
        nPars=10;
    case 'ParkerShift'
        nPars=11;
end

tmin=((0:Nsamples-1)*(Ts/60))';

fig=figure('name',['fitted aif: ' selected_model],'units','normalized','position',[0.1 0.1 0.8 0.8]);

% optimAlg='lsqnonlin';
optimAlg='doplneniG2';
% optimAlg='lsqnonlin2x';
% optimAlg='fmincon';
% optimAlg='lsqnonlin+fmincon';


[estimAIF, par,~,~,A_ineq,b_ineq,alb,aub,exitflag,output]=AIFfit(selected_model,tmin,measAIF,optimAlg);

%save aif
info.aifinfo.aifPars=par;
info.aifinfo.aifModelName=selected_model;
info.aifinfo.aifModel=estimAIF;
info.aifinfo.optimAlg=optimAlg;
info.aifinfo.A_ineq=A_ineq;
info.aifinfo.b_ineq=b_ineq;
info.aifinfo.alb=alb;
info.aifinfo.aub=aub;
info.aifinfo.exitflag=exitflag;
info.aifinfo.output=output;

A=par(1);
B=par(2);
T=par(3);
T2=par(4);
sigma=par(5);
sigma2=par(6);
alpha=par(7);
beta=par(8);
s=par(9);
tau=par(10);

parDisp={...
    '1' '2' '3' '4' '5' '6' '7' '8' '9' '10'
    'A1' 'A2' 'T1' 'T2' 'sigma1' 'sigma2' 'alpha' 'beta' 's' 'tau';...
    A B T T2 sigma sigma2 alpha beta s tau};

switch selected_model
    case 'Parker'
        disp(parDisp);
    case 'ParkerShift'
        shift=par(11);
        parDisp=[parDisp {'11';'shift';shift}];
end


axH=subplot(2,1,1,'parent',fig);
hold(axH,'on');
plot(axH,tmin,measAIF,'k');
plot(axH,tmin,estimAIF,'color',[1 0 0]);
xlabel(axH,'time [min]');
ylabel(axH,'enhancement [-]');

axS=subplot(2,1,2,'parent',fig);
hold(axS,'on');

switch selected_model
    case 'Parker'
        [aif_parker,term]=AIF_Parker2_OM(par,tmin);
    case 'ParkerShift'
        [aif_parker,term]=AIF_Parker2Shift(par,tmin);
end

plot(axS,tmin,aif_parker,'k','LineWidth',2);
plot(axS,tmin,term(1,:),'r','LineWidth',1.5);
plot(axS,tmin,term(2,:),'g','LineWidth',1.5);
plot(axS,tmin,term(3,:),'b','LineWidth',1.5);

plot(axS,tmin,term(4,:),'--y');
plot(axS,tmin,term(5,:),'--m');
ylim(axS,[0 max(estimAIF)]);

xlabel(axS,'time [min]');
ylabel(axS,'enhancement [-]');
legend(axS,{ 'Parker' 'Gauss1' 'Gauss2' 'exp/sigm' 'exp' 'sigm'});
end