%% FAST TRACKING %%2
clear;close all;clc

fdir = ['/home/mcm/Desktop/Fiji.app/test/'] % finishing by a /

cd(fdir)

compute_spt = 1;
compute_D = 1;

expList = dir('Tracks/*-*');

peaknbs = []

std_max = 3; 
maxDisplacement = 4; % maximum peak with in pixels and maximum allowed displacement in pixels
ImagingInterval = 60; % time steps in between conscutive images 
raw_th = 1.6 % threshold such as peak intensity must be higher than threshold * median background
Res_max = 0.2 % threshold on the sum of residuals / fitted peak intensity 
Int_min = 'percentage'; % method used to remove 1% of outlayer peaks regarding their intensity

PathC_name = strcat('Res', string(Res_max),'_Int', 'percentage', '_std', string(std_max), ...
'_MaxDisp', string(maxDisplacement), '_rawth', string(raw_th), '/')

for i = 1:length(expList)

expName = expList(i).name

ToSave = 1;
trackingInCells = 1;
peaknbs = [peaknbs, sptFromPosList(fdir,expName,PathC_name,trackingInCells,...
    ImagingInterval, maxDisplacement, ToSave, Res_max, 'percentage', std_max,  raw_th, 4)];

end