-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainLocal_CFTRimg.m
80 lines (67 loc) · 2.17 KB
/
MainLocal_CFTRimg.m
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
77
78
79
80
clc
clear
close all
addpath(genpath('functions'))
addpath(genpath(fullfile('example','input'))) % location of your input folder
inputFileName = 'example_local.m'; % name of you input file as string
[inputFolder,saveWorkspaceHere] = inputFileCheckAndRun_local(inputFileName);
%% STRUCTURING DATA
tic
plate = createPlateStruct_local(inputFolder); % creates an empty struct for each plate,
plate = populatePlate_local(inputFolder,plate); % moves appropriate data into plate struct
plateN = length(plate); % and creates a struct for each image
disp('Completed setting up data structures')
time(1) = toc;
%% SEGMENTATION
close all
for j = 1:plateN
imageN = length(plate(j).image);
for i = 1:imageN
plate(j).image(i) = imgSegmentWatershed(plate(j).image(i));
end
end
storeSegmented = plate;
disp ('Completed image segmentation')
time(2) = toc;
%% FILTERING
plate = storeSegmented;
for j = 1:plateN
imageN = length(plate(j).image);
for i = 1:imageN
plate(j).image(i).cellN = plate(j).image(i).cellN(1);
plate(j).image(i) = imgFilterEdges(plate(j).image(i));
plate(j).image(i) = imgFilterUnmasked(plate(j).image(i));
plate(j).image(i) = imgFilterCellDimensions(plate(j).image(i));
end
end
storeFiltered = plate;
disp ('Completed cell filtering')
time(3) = toc;
%% DISTANCE MAP
plate = storeFiltered;
for j = 1:plateN
imageN = length(plate(j).image);
for i = 1:imageN
plate(j).image(i) = imgFindBackground(plate(j).image(i));
plate(j).image(i) = distanceMap(plate(j).image(i));
end
end
disp ('Completed localization distance maps')
time(4) = toc;
%% CREATE RESULTS STRUCTS
for j=1:plateN
imageN = length(plate(j).image);
for i=1:imageN
plate(j).image(i) = filterNegativeMetric(plate(j).image(i));
end
plate(j) = logCellLocation(plate(j),j);
end
% move key values into temporary a structure for normalizing
normPlate = createNormalizeStruct(plate);
normPlate = normalizeResultsWT(normPlate);
% move normalized results into a structure ready to output results
resultsLocal = createResultsLocalStruct(normPlate);
resultsLocal = populateResultsLocal(resultsLocal,normPlate);
time(5) = toc;
disp ('Full analysis completed')
save (saveWorkspaceHere)