D=dir(fullfile('Data','WrongNames','*.png'));
for i=1:length(D)
    initialname=D(i).name;
    im=imread(fullfile('Data','WrongNames',initialname));
    [pathstr, name, ext] = fileparts(initialname) ;
    ind=regexp(name,'ome');
    number=str2num(name(ind+3:end));
    newname=sprintf('%s%04d.png',name(1:ind-1),number-1);
    imwrite(im,fullfile('Data',newname));
end