--- a +++ b/update_plot.m @@ -0,0 +1,65 @@ +function update_plot(input_image, axes_1, ... + Rect_proximal_Position, Rect_distal_Position, ... + Rect_proximal_Rotation_in_degree, Rect_distal_Rotation_in_degree, ... + Proximal_Wall, Distal_Wall, ... + Mean_diameter_in_metric, time_diameter, axes_2) + + % plot the image and set the color map to "gray" + imagesc(input_image, 'Parent', axes_1); hold (axes_1, 'on'); + colormap(axes_1, 'gray'); + + % Number of windows selected + N = size(Rect_proximal_Position, 1); + + % Plot region of interest for the Proximal and distal + for Window_cnt = 1:N + [Xrot, Yrot] = plot_rectangle_with_rotation(... + Rect_proximal_Position(Window_cnt, :), ... + Rect_proximal_Rotation_in_degree(Window_cnt, :), ... + axes_1, '-r', Window_cnt); + + text(Xrot(4), Yrot(4), sprintf('%d', Window_cnt), ... + 'Color', 'red', ... + 'FontWeight', 'Bold', ... + 'FontSize', 20, ... + 'Parent', axes_1); + + [Xrot, Yrot] = plot_rectangle_with_rotation(... + Rect_distal_Position(Window_cnt, :), ... + Rect_distal_Rotation_in_degree(Window_cnt, :), ... + axes_1, '-y', Window_cnt); + + text(Xrot(3), Yrot(3), sprintf('%d', Window_cnt), ... + 'Color', 'yellow', ... + 'FontWeight', 'Bold', ... + 'FontSize', 20, ... + 'Parent', axes_1); + + + % This condition is executed if "Proximal_Wall, Distal_Wall" "Mean_diameter_in_metric" is detected + if nargin >= 7 + + %plot Proximal wall + line(Proximal_Wall(1, 1:2, Window_cnt), Proximal_Wall(1, 3:4, Window_cnt), 'Color', 'g', 'LineStyle', '-', 'LineWidth', 3, 'Parent', axes_1); + + %plot Distal wall + line(Distal_Wall(1, 1:2, Window_cnt), Distal_Wall(1, 3:4, Window_cnt), 'Color', 'g', 'LineStyle', '-', 'LineWidth', 3, 'Parent', axes_1); + end + + end + + if nargin >= 7 + %plot mean diameter wall + hold (axes_2, 'off'); + plot(time_diameter, Mean_diameter_in_metric, '-xk', ... + time_diameter, nanmean(Mean_diameter_in_metric, 2), '-or', ... + 'MarkerSize', 10, 'LineWidth', 3, 'Parent', axes_2); + if (max(time_diameter) - min(time_diameter) > 5) + xlim(axes_2, [max(time_diameter) - 5 max(time_diameter)]) + else + xlim(axes_2, [0 5]) + end + end + + hold (axes_1, 'off'); +end \ No newline at end of file