function criterz=extract_waveforms_of_minis_in_ttx(r)

r=r*1000;
criterz=[];

fastemplate=monoexprisedecay_template_generator([14.16371820548567  11.31185487577630  19.35826590564763 0 1],1:50);

for i=1
    a=r(:,i*2);
    a=a-mean(a(1:100000));
    critfast=template_based_mini_detector(a(1:1000)',fastemplate)';
    criterz=[criterz critfast];
end