-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakeMIP.m
More file actions
55 lines (41 loc) · 1.69 KB
/
Copy pathMakeMIP.m
File metadata and controls
55 lines (41 loc) · 1.69 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
%% Create proper framework for MIP on the dataset
% Allocate Field Matrix
n_Fields = 55;
FieldString = cell(n_Fields,1);
for f = 1:n_Fields;
FieldString{f} = sprintf('%3.3d',f);
end
FieldStorage = repmat(FieldString,n_Fields,1);
% Allocate WellName
RowLetter = [{'B'};{'C'}];
RowNumberTop = [{'02'};{'03'};{'04'};{'05'}];
RowNumberBottom = [{'05'};{'04'};{'03'};{'02'}];
WellStorage = [];
for CurrentRow = 1:length(RowLetter);
for CurrentColumn = 1:length(RowNumberTop);
String = cell(1,1);
if mod(CurrentRow,2) == 0;
CurrentString = [RowLetter{CurrentRow},RowNumberBottom{CurrentColumn}];
else
CurrentString = [RowLetter{CurrentRow},RowNumberTop{CurrentColumn}];
end
String{1,1} = CurrentString;
ReppedString = repmat(String,16,1);
WellStorage = [WellStorage;ReppedString];
end
end
% Load Actual Images, make MIP and save as PNG
parfor CurrentSTK = 1:440;
CurrentImage = tiffread2(['STK/','20170116_BeadsDistribution_1_ledRFP_s',num2str(CurrentSTK),'.stk']);
StackLength = size(CurrentImage,2);
ImageWidth = CurrentImage.width;
ImageHeigth = CurrentImage.height;
ImageMatrix = zeros(ImageHeigth,ImageWidth,StackLength);
ImageMatrix = uint16(ImageMatrix);
for CurrentStack = 1:StackLength
ImageMatrix(:,:,CurrentStack) = CurrentImage(CurrentStack).data;
end
MaxProject = max(ImageMatrix,[],3);
StorageString = ['TIFF/','20170116_BeadsDistribution_',WellStorage{CurrentSTK},'_T0001F0',FieldStorage{CurrentSTK},'L01A01Z01C01.png'];
imwrite(MaxProject,StorageString)
end