-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortBKGandFLATcorrectedImagesIntoFolders.m
More file actions
76 lines (69 loc) · 2.63 KB
/
SortBKGandFLATcorrectedImagesIntoFolders.m
File metadata and controls
76 lines (69 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
function SortBKGandFLATcorrectedImagesIntoFolders(A,B)
%%
% channelinputs = '(mKate|EGFP|CFP|DIC)';
channelstoinput = {'_mKate','_EGFP','_CFP','DIC','_Hoechst'};
% channelstoinput = {'_mKate','_EGFP','_CFP','DIC'};
channelinputs = '('; % result is channelinputs = '(mKate|EGFP|CFP|DIC)';
for i=1:length(channelstoinput)
if i ==1
channelinputs = strcat(channelinputs,channelstoinput{i});
elseif i < length(channelstoinput)
channelinputs = strcat(channelinputs,'|',channelstoinput{i});
else
channelinputs = strcat(channelinputs,'|',channelstoinput{i},')');
end
end
cd (strcat(A,B));
cd ('flatfield_corrected')
%%
folderlist = dir('*_s*');
for folder = {folderlist.name} %set the scene directory for all
cd(folder{1})
mkdir('tiffs');
%check if directories have been made previously
%make individual directories
for i = 1:length(channelstoinput)
dd = dir(strcat(channelstoinput{i},'_flat'));
if isempty(dd)
nodir = 1;
filelist = dir(strcat('*_',channelstoinput{i},'*.tif'));
if isempty(filelist) %if no files are present do not make the directory
else
mkdir(strcat(channelstoinput{i},'_flat'))
end
else
nodir = 0;
end
foldername = strcat(channelstoinput{i},'_flat');
filelist = dir(strcat('*_',channelstoinput{i},'*.tif'));
if isempty(filelist) && nodir==0
cd(foldername)
filelist = dir(strcat('*_',channelstoinput{i},'*.tif'));
if isempty(filelist)
cd ..
% disp(foldername)
ddd = dir(foldername);
if isempty(ddd)
else
disp(foldername)
disp(ddd)
pause(0.5)
rmdir(foldername);
end
else
cd ..
end
else
for cfile={filelist.name}
filepath = which(cfile{1});
disp(filepath);
movefile(filepath,foldername)
% cd(foldername)
% movefile(filepath)
% cd ..
end
end
end
cd ..
end
end