Diff of /update_plot.m [000000] .. [81c116]

Switch to unified view

a b/update_plot.m
1
function update_plot(input_image, axes_1, ...
2
                Rect_proximal_Position, Rect_distal_Position, ...
3
                Rect_proximal_Rotation_in_degree, Rect_distal_Rotation_in_degree, ...
4
                Proximal_Wall, Distal_Wall, ...
5
                Mean_diameter_in_metric, time_diameter, axes_2)
6
7
    % plot the image and set the color map to "gray"
8
    imagesc(input_image, 'Parent', axes_1); hold (axes_1, 'on');     
9
    colormap(axes_1, 'gray'); 
10
    
11
    % Number of windows selected
12
    N   = size(Rect_proximal_Position, 1);
13
    
14
    % Plot region of interest for the Proximal and distal
15
    for Window_cnt = 1:N
16
        [Xrot, Yrot] = plot_rectangle_with_rotation(...
17
                            Rect_proximal_Position(Window_cnt, :), ...
18
                            Rect_proximal_Rotation_in_degree(Window_cnt, :), ...
19
                            axes_1, '-r', Window_cnt); 
20
        
21
        text(Xrot(4), Yrot(4), sprintf('%d', Window_cnt), ...
22
            'Color', 'red', ...
23
            'FontWeight', 'Bold', ...
24
            'FontSize', 20, ...
25
            'Parent', axes_1); 
26
        
27
        [Xrot, Yrot] = plot_rectangle_with_rotation(...
28
                            Rect_distal_Position(Window_cnt, :), ...
29
                            Rect_distal_Rotation_in_degree(Window_cnt, :), ...
30
                            axes_1, '-y', Window_cnt); 
31
        
32
        text(Xrot(3), Yrot(3), sprintf('%d', Window_cnt), ...
33
            'Color', 'yellow', ...
34
            'FontWeight', 'Bold', ...
35
            'FontSize', 20, ...
36
            'Parent', axes_1); 
37
        
38
        
39
        % This condition is executed if "Proximal_Wall, Distal_Wall" "Mean_diameter_in_metric" is detected        
40
        if nargin >= 7 
41
42
            %plot Proximal wall
43
            line(Proximal_Wall(1, 1:2, Window_cnt), Proximal_Wall(1, 3:4, Window_cnt), 'Color', 'g', 'LineStyle', '-', 'LineWidth', 3, 'Parent', axes_1); 
44
45
            %plot Distal wall
46
            line(Distal_Wall(1, 1:2, Window_cnt), Distal_Wall(1, 3:4, Window_cnt), 'Color', 'g', 'LineStyle', '-', 'LineWidth', 3, 'Parent', axes_1);
47
        end
48
        
49
    end
50
       
51
    if nargin >= 7
52
        %plot mean diameter wall
53
        hold (axes_2, 'off');
54
        plot(time_diameter, Mean_diameter_in_metric, '-xk', ...
55
                time_diameter, nanmean(Mean_diameter_in_metric, 2), '-or', ...
56
                'MarkerSize', 10, 'LineWidth', 3, 'Parent', axes_2); 
57
        if (max(time_diameter) - min(time_diameter) > 5)
58
            xlim(axes_2, [max(time_diameter) - 5 max(time_diameter)])
59
        else
60
            xlim(axes_2, [0 5])
61
        end
62
    end
63
    
64
    hold (axes_1, 'off'); 
65
end