% update the Number of Rectangular boxes.
handles.number_Box = handles.number_Box + 1;
% This if-else condition is to address the initializtion scripts.
[Current_Num, Previous_Num] = script_adjust_NUM_for_intialization(handles.number_Box);
% Rectangular mask for proximal wall
Rect_proximal = images.roi.Rectangle(gca,...
'Position', [randi([100 300],1) 50 50 50],...
'RotationAngle', 0, ...
'StripeColor','r', ...
'Label', sprintf('%d', handles.number_Box), ...
'LabelTextColor', 'r', ...
'LineWidth', 5, ...
'FaceAlpha', 0, ...
'Rotatable', true, ...
'Parent', handles.Plot_Image);
% Rectangular mask for distal wall
Rect_distal = images.roi.Rectangle(gca,...
'Position', [randi([100 300],1) 400 50 50],...
'RotationAngle', 0, ...
'StripeColor','y', ...
'Label', sprintf('%d', handles.number_Box), ...
'LabelTextColor', 'y', ...
'LineWidth', 5, ...
'FaceAlpha', 0, ...
'Rotatable', true, ...
'Parent', handles.Plot_Image);
% Update the handle to load the Rect object to the current box
handles.Rect_proximal(Current_Num, 1) = Rect_proximal;
handles.Rect_distal(Current_Num, 1) = Rect_distal;