forked from pbl007/iostoolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISI_viewMask.m
79 lines (66 loc) · 1.75 KB
/
ISI_viewMask.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
function ISI_viewMask(handles)
% View the masks over the vessel image
%
% Only the selected masks are displayed, ie. vessel or manual masks or the
% combination of both
%
% Ssed to compare actual coverage, see what areas are being masked out.
%
global ISI
% Get current parameters
tParams = ISI.GetParams(handles);
tParams = tParams.filesQueue(1);
% Load vessel image
sFilename = fullfile(handles.pathstr, get(handles.vessel_filename,'string'));
if ~exist(sFilename, 'file')
warndlg('Vessel image not found.', 'IOS Toolkit');
return
end
mVesselImgOrig = imread(sFilename);
mVesselImg = mat2gray(mVesselImgOrig);
% Get vessel mask
mVesselMask = ISI_createVesselMask(handles);
mVesselImg(~mVesselMask) = NaN;
mMask = mVesselMask;
% Get manual mask
if tParams.useManualMask
tMask = tParams.manualMask;
if ~isempty(tMask)
mVesselImg(~tMask.mROI) = NaN;
mMask = mMask | tMask.mROI;
end
end
% Remove zeros and ones
mVesselImg(mVesselImg == 0) = NaN;
mVesselImg(mVesselImg == 1) = NaN;
% Initialize figure
hFig = findobj('tag', 'ISI_maskPreview');
if isempty(hFig)
hFig = figure('visible', 'off');
set(hFig, 'tag', 'ISI_maskPreview')
else
figure(hFig)
end
set(hFig, 'position', [1 1 750 400])
centerfig(hFig)
set(hFig, 'visible', 'on')
% Original image
hAx = subplot(1,3,1);
imagesc(mVesselImgOrig);
axis(hAx, 'image', 'off');
title('Original')
colormap(hAx, gray(256))
% Mask
hAx = subplot(1,3,2);
imagesc(mMask);
axis(hAx, 'image', 'off');
title('Mask');
% Masked image
hAx = subplot(1,3,3);
hv = imshow(mVesselImg);
axis(hAx, 'image', 'off');
hold(hAx, 'on')
hmask = imshow(mMask);
set(hmask,'alphadata', 0.3, 'CData', mMask);
title('Masked image')
return