/
BOEyeCellSgmentation3D.m
52 lines (52 loc) · 1.67 KB
/
BOEyeCellSgmentation3D.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
%% Clear
clc; close all; clear all;
%% Path - Libs
addpath('../../BOMatlabLib/BONormalizeImageND');
addpath('../../BOMatlabLib/BOBlobDetector3D');
addpath('../../BOMatlabLib/BOLocalThreshold3D');
addpath('../../2013/BOBlobColocalisation3D/BOColocalisation3D');
addpath('../../2013/BOBlobTracking3D');
addpath('../../BOMatlabLib/BOLocalThreshold3D');
%% Load image
dirname = '/home/boguslaw/DURHAM/Projects/Durham_2016/Eye/';
%dirname = '/media/boguslaw/My Passport/BACKUP/DURHAM/Projects/Durham_2016/Eye/';
%dirname = 'C:\BACKUP\DURHAM\Projects\Durham_2016\Eye\';
%filename = 'AlexiaEyePin2';
%filename = 'lens02';
%filename = 'lens36';
%filename = 'lens38';
%filename = 'lens42';
%filename = 'lens68';
filename = 'lens17_pole';
file_ext = '.tif';
%% Res
rx = 0.6667; ry = rx; rz = 0.2;
%% Load images
ims = BOReadImage3DC([dirname filename file_ext]);
%% Gray
ims = squeeze(max(ims,[],3));
ims = ims(500:550,500:550,1:10);
ims = BONormalizeImageND(ims);
%% Filter
% disp('Filter');
% rx = 17; rz = 100; f = rz/rx;
% s = 12; s = [s s s/f];
% se = fspecial3('gaussian',s);
% imsf = imfilter(ims,se,'replicate');
%% Normalise images
%imsf = BONormalizeImageND(imsf);
%% Segmentation
%t = graythresh(ims);
%imth = ims>0.25;
n = 30; c = -40;
imth = BOMeanThreshold3D(ims,n,c);
figure; imagesc(max(imth,[],3)); colormap jet; axis off; axis equal; axis tight;
return
%% Label
imlabel = bwlabeln(imth);
%% Plot
figure; imagesc(max(ims,[],3)); colormap jet; axis off; axis equal; axis tight;
figure; imagesc(max(imth,[],3)); colormap jet; axis off; axis equal; axis tight;
figure; imagesc(max(imlabel,[],3)); colormap jet; axis off; axis equal; axis tight;
%% Save
%save(['./mat/' filename '_th.mat'],'imth','imlabel');