-
Notifications
You must be signed in to change notification settings - Fork 0
/
segment_and_save.m
35 lines (29 loc) · 1.11 KB
/
segment_and_save.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
function segment_and_save()
% Creates segmentation for test images and masks and dumps the output
folder_images= 'dataset\test\images';
folder_mask='dataset\test\mask';
images= fullfile(folder_images, '*.tif');
image_files= dir(images);
mask= fullfile(folder_mask, '*.gif');
mask_files= dir(mask);
num_tiles = [8 8];
nbins = 512;
distribution = 'uniform';
avg_filter_size = [9 9];
binarization_threshold = 0.01;
areaopen_size = 100;
morphological_op = 'majority';
dir_test= "test";
foldername = "predicted_" + datestr(now,"ddmmyy") + "_" + datestr(now,"hhmmss");
fullpath = dir_test + "\" + foldername ;
disp(fullpath);
[status, msg, msgID] = mkdir(fullpath);
for i=1:length(image_files)
name_image=image_files(i).name;
name_mask= mask_files(i).name;
image_route= fullfile(folder_images,name_image);
mask_route= fullfile(folder_mask, name_mask);
result_image= VesselSegmentation(image_route, mask_route,num_tiles,nbins,distribution,avg_filter_size, binarization_threshold,areaopen_size,morphological_op);
imwrite(result_image, fullfile(fullpath,append(sprintf("%d",i),".png")));
end
end