-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMTbundling.m
89 lines (59 loc) · 2.01 KB
/
MTbundling.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
81
82
83
84
85
86
87
88
89
function MTbundling
% Luigi AR localization
% open file manually
[fileName,dirName] = uigetfile('*.tif','Choose a .tif file');
I = imread([dirName,fileName]);
Idapi = imread([dirName,fileName(1:end-7),'Dapi.tif']);
Iar = imread([dirName,fileName(1:end-7),'ARGFP.tif']);
% DoG
nor=1;%2^16;
I=double(I)/nor;
Iar=double(Iar)/nor;
Idapi = double(Idapi)/nor;
[cutoffInd4, cutDAPI] = cutFirstHistMode(Idapi,0);
Idapi2 = Idapi>cutDAPI*2;
figure,imshow(Idapi,[])
figure,imshow(Idapi2,[])
figure,imshow(Iar,[])
% distance_image = bwdist(~Idapi2);
%
% figure, imshow(distance_image,[])
% colormap(bone)
% colorbar
Id2 = bwmorph(Idapi2,'dilate');
Id7 = bwmorph(Id2,'dilate');
% Id2 = bwmorph(Id3,'dilate');
% Id5 = bwmorph(Id4,'dilate');
% Id6 = bwmorph(Id5,'dilate');
% Id7 = bwmorph(Id6,'dilate');
Idn = Id7 - Idapi2;
X = bwlabel(Idn);
stats = regionprops(X,'all');
% list = stats(5).PixelIdxList;
% Itest = zeros(size(I,1),size(I,2));
% Itest(list) = I(list);
% figure,imshow(Itest,[])
Iaux = Idn.*Iar; % read the AR channel
figure,imshow(Iaux,[])
colormap(jet)
colorbar
hold on
for i = 1: length(stats) % CYTOPLASM
s(i) = ceil(sum(Iar(stats(i).PixelIdxList))/length(stats(i).PixelIdxList)); % NORMALIZE AR INT PER AREA
text(stats(i).Centroid(1)-5,stats(i).Centroid(2)-5,[num2str(s(i))],'Color','r');
end
%-------------------------------------------------------------
X1 = bwlabel(Idapi2);
stats1 = regionprops(X1,'all');
Iaux1 = Idapi2.*Iar; % read the AR channel
figure,imshow(Iaux1,[])
colormap(jet)
colorbar
hold on
for i = 1: length(stats1) % NUCLEAR
s1(i) = ceil(sum(Iar(stats1(i).PixelIdxList))/length(stats1(i).PixelIdxList));% NORMALIZE AR INT PER AREA
text(stats1(i).Centroid(1)-5,stats1(i).Centroid(2)-5,[num2str(s1(i))],'Color','r');
end
sa=sort(s);
s1a=sort(s1);
NUC_TO_CYTO_AR = mean(s1a(end-5:end))/mean(sa(end-5:end))