-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathplot_debug_boundary_masks.m
56 lines (41 loc) · 1.67 KB
/
plot_debug_boundary_masks.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
function fig_handles = plot_debug_boundary_masks(masks)
% A simple function to visually inspect interpolation boundary masks
% Input: masks a struct with the violumetric masks and the convex hull
% Needs:
% get_number_subplots()
fig_innies = plot_boundary_volumetric_mask(masks.innies);
fig_outties = plot_boundary_volumetric_mask(masks.outties);
fig_betweenies = plot_boundary_volumetric_mask(masks.betweenies);
fig_handles = [fig_innies, fig_outties, fig_betweenies];
end % function plot_debug_boundary_masks()
function fig_handles = plot_boundary_volumetric_mask(this_mask)
fig_handles = cell(3, 1);
[m, n, p] = size(this_mask);
fig_handles{1} = figure;
fig_handles{2} = figure;
fig_handles{3} = figure;
[row_cols, ~] = get_number_subplots(m);
fig_handles{1} = plot_slices(fig_handles{1}, m, 1, row_cols(1), row_cols(2));
[row_cols, ~] = get_number_subplots(n);
fig_handles{2} = plot_slices(fig_handles{2}, n, 2, row_cols(1), row_cols(2));
[row_cols, ~] = get_number_subplots(p);
fig_handles{3} = plot_slices(fig_handles{3}, p, 3, row_cols(1), row_cols(2));
function fig_handle = plot_slices(fig_handle, num_slices, dim, rr, cc)
if dim==1
for kk=1:num_slices
subplot(rr, cc, kk, 'Parent', fig_handle)
imshow(squeeze(this_mask(kk, :, :)))
end
elseif dim ==2
for kk=1:num_slices
subplot(rr, cc, kk, 'Parent', fig_handle)
imshow(squeeze(this_mask(:, kk, :)))
end
else
for kk=1:num_slices
subplot(rr, cc, kk, 'Parent', fig_handle)
imshow(squeeze(this_mask(:, :, kk)))
end
end
end
end