-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlobule.m
More file actions
73 lines (66 loc) · 1.69 KB
/
lobule.m
File metadata and controls
73 lines (66 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% close all
% clear all
% clc
%
p = imread('Purple_30.tif');
P0 = rgb2gray(p);
maskp = (hysteresis3d(P0,0.25,0.35,8));
se = strel('sphere',12);
maskp1 = imdilate(maskp,se);
se2 = strel('sphere',8);
maskp2 = imerode(maskp1,se2);
%maskp2 = imfill(maskp2,'holes');
%imshow(maskp2)
%
%load('masks.mat');
I = im2double(imread('merged_30.tif'));
%I = imread('mask2.PNG');
% g1= imread('S4_LYVE1_Align_06_07_21_1.tif');
% g1 = g1+maskedRGBImage;x
% p = imread('purple.tif');
% g0 = imread('green.tif');
r = im2double(imread('Red_30.tif'));
g=I-maskp2-r;
gr = imbinarize(rgb2gray(g));
gr = imfill(gr,'holes');
%g = imgaussfilt(gr,1);
%g=rgb2gray(I);
%
% se = offsetstrel('ball',2,2);
% g = imdilate(g,se);
% g = imerode(g,se);
% % %imshow(g)
%I2 = medfilt2(medfilt2(medfilt2(medfilt2(rgb2gray(g)>90,[2 2]))));
gr1 = medfilt2(gr,[2 2]);
% imshow(I2);
%BW1 = edge(g,'canny',0.9);
%figure
%imshow(g)
%img= hysteresis3d(gr1,0.09,0.1,8);
%img = imerode(img,se);
%imshow(img)
%img = imbinarize(imfill(img,'holes'));
%img1 = 1- img;
%cc = bwconncomp(img);
%img =imgaussfilt(img,1);
% figure
%BW = bwareafilt(imbinarize(img),[0 500]);
BW = bwareaopen(gr1, 1000);
% imshow(BW)
% labeledImage = bwlabel(img);
% labeledImage(labeledImage == 8) = 3; % Blob #8 is now merged with 3
%BW = bwareafilt(imbinarize(img), 16);
%imshow(BW2)
% %img1 = bwconvhull(img,'objects');
[B,L,N] = bwboundaries(BW);
figure;
imshow(g);
hold on;
for k = 1:length(B)
boundary = B{k};
% if(k > N)
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 1.5);
% else
% plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2);
% end
end