function [aif,info]=FindAIF_ApproxAIF(data4D,info)
outputFolder=[];
nSamples=size(data4D,4);
timeAxis=(0:1:nSamples-1)*info.acq.Ts/60;

saveFile=false;
visu=true; %visualisation
evalFM=false;  %use lowest first moment
%evalFM=true;
if evalFM
    info.clusterInfo.SelBasedOn='FirstMoment';
else
    info.clusterInfo.SelBasedOn='MaximumPosition';
end

%% AUC and ROUghness step
% AUCtreshold=0.97;%3 percent nejvetsich ponechat dle clanku https://onlinelibrary.wiley.com/doi/epdf/10.1002/mrm.20759
% ROUtreshold=0.75;
AUCtreshold=0.97
ROUtreshold=0.75; %procento nejmene chlupatych krivek dle clanku https://onlinelibrary.wiley.com/doi/epdf/10.1002/mrm.20759
ROUevalFromSample=200; %calculate roughness from 30th sample until the end of CTC sequence

info.clusterInfo.AUCtreshold=AUCtreshold;
info.clusterInfo.ROUtreshold=ROUtreshold;
info.clusterInfo.ROUevalFromSample=ROUevalFromSample;
info.clusterInfo.nPasses=4;

[AUCfiltered,ROUfiltered,TF_ROU] = AUCandROU(data4D,info,outputFolder,AUCtreshold,ROUtreshold,ROUevalFromSample,visu,saveFile);
%% k-means clustering
[CluSig1,LMs1,TF_1stMomentCluster,~,~,idxSelClu]=DoKmeansClustering(data4D,TF_ROU,timeAxis,1,3,evalFM,visu);              %pass 1, nClu 3
[CluSig2,LMs2,TF_1stMomentCluster,~,~,idxSelClu]=DoKmeansClustering(data4D,TF_1stMomentCluster,timeAxis,2,3,evalFM,visu); %pass 2, nClu 3
[CluSig3,LMs3,TF_1stMomentCluster,~,~,idxSelClu]=DoKmeansClustering(data4D,TF_1stMomentCluster,timeAxis,3,3,evalFM,visu); %pass 3, nClu 3
[CluSig4,LMs4,TF_1stMomentCluster,~,~,idxSelClu]=DoKmeansClustering(data4D,TF_1stMomentCluster,timeAxis,4,2,evalFM,visu); %pass 4, nClu 2
%% Measured AIF based on clustering
[aif,info]=ClusterAIFExport(data4D, TF_1stMomentCluster,outputFolder,info,false);
% [info]=ApproxParkerAIF(aif,info);
aif=aif{1,1};
end

