%% To generate MSD distribution
clear;close all;clc

fdir = ['/path/to/dataset/']
cd(fdir)

compute_spt = 1;
compute_D = 1;

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

peaknbs = []

Int_min = 'percentage'; std_max = 3; maxDisplacement = 4;

for raw_th = 1.6

for Res_max = 0.2 %[0.3, 0.4, 0.6, 0.8, 0.1]
Int_min = 'percentage'; %[200, 400, 600, 800, 1000]

PathC_name = strcat('Res', string(Res_max),'_Int', string(Int_min), '_std', string(std_max), ...
'_MaxDisp',string(maxDisplacement), '_rawth', string(raw_th), '/')
%PathC_name = 'Res0.08_Int200_std3_MaxDisp8/'
%expList = dir(strcat('Tracks/', PathC_name, '*-*'));
for i = 1:length(expList)

clear Nall N L

expName = expList(i).name
if compute_spt == 1
ToSave = 1; ImagingInterval = 60;
trackingInCells = 1;
peaknbs = [peaknbs, sptFromPosListCoord05c_fastImaging_peak_details(fdir,expName,PathC_name,trackingInCells,...
    ImagingInterval, maxDisplacement, ToSave, Res_max, Int_min, std_max,  raw_th, filter_th)];
end

end
end
end

