Switch to unified view

a b/script_update_Threshold_and_display.m
1
% This script does the following 
2
% Update the Current Thresholds and update the text box named "Threshold_Val_display_object"
3
% Update the BOX locations
4
5
% handles.Bmode is false if the input data is Pulsed Doppler data
6
if( handles.Bmode ~= true ), return; end
7
8
% Set the threshold value
9
handles.Current_Threshold   = (handles.Max_threshold - handles.Min_threshold) * handles.Threshold_Slider.Value + handles.Min_threshold;
10
11
% Set the display to the current threshold
12
handles.Threshold_Val_display_object.String = num2str(floor(handles.Current_Threshold));
13
14
% Processing only one frame to make the display faster. If you process all 
15
% the frames, update algorithm will be delayed. We will run the process 
16
% on frames when the user press "Play movie button"
17
Input_Image                 = handles.first_frame;                  
18
Input_Image                 = Input_Image .* bwareaopen(Input_Image > handles.Current_Threshold, 15);
19
20
% Update the tag for the button "Add BOX #"
21
handles.Add_Box.String      = sprintf('Add BOX %d', handles.number_Box+1);
22
23
% This program updates the variable Rectangular Proximal/Diatal Position, 
24
% Mask and rotation to the latest value. 
25
26
% This if-else condition is to address the initializtion scripts.
27
for Num = 1:handles.number_Box
28
    
29
    Num_updated     = script_adjust_NUM_for_intialization(Num);
30
    
31
    % Save the Box information
32
    script_update_rectangular_box_handles;
33
    
34
    % Ensure that proximal wall rectangular box is above the distal wall
35
    % box. If not, switch the box.
36
    Swap_proximal_distal_box;
37
    
38
    % Ensure that the Proximal and Distal rectangular boxes have common 
39
    % region. If not, delete the BOX
40
    check_if_boxes_have_common_region;
41
    
42
end
43
% Update the plot
44
update_plot(Input_Image, handles.Plot_Image, ...
45
                handles.Rect_Proximal_Position, handles.Rect_Distal_Position, ...
46
                handles.Rect_proximal_Rotation_in_degree, handles.Rect_distal_Rotation_in_degree);
47
48
% Clear the diameter plot with a dummay image
49
script_clear_diameter_plot