a b/pushbutton1_Callback.m
1
% Function for the Push Button "Play Movie"
2
% --- Executes on button press in pushbutton1.
3
function pushbutton1_Callback(hObject, eventdata, handles)
4
    % hObject    handle to pushbutton1 (see GCBO)
5
    % eventdata  reserved - to be defined in a future version of MATLAB
6
    % handles    structure with handles and user data (see GUIDATA)
7
    
8
    % handles.Bmode is false if the input data is Pulsed Doppler data
9
    if( handles.Bmode ~= true )
10
        plot(handles.time, handles.Velocity_Data, '-k', ...
11
                    'LineWidth', 1, ...
12
                    'Parent', handles.Diameter_Plot);
13
                
14
        % This script update the message bar
15
        script_to_display_message;                
16
    else
17
        % Update the Threshold based on the new end values of the slider, stops any
18
        % running timers, update box locations. clears the diameter plots
19
        script_update_Threshold_and_display;
20
        
21
        % Check this condition to see if any box were added for processing.
22
        % If not, request user to add some boxes to get results
23
        if(handles.number_Box == 0)
24
            handles.Message_Bar.String  = 'Please add a BOX';
25
            handles.Diameter_data       = [];
26
            return;
27
        else
28
            % Run this script to process the frames. In the process, we are mainly
29
            % running time intensive operations like bwareaopen. Instead of
30
            % running it multiple times, we run these commands only when the slider
31
            % is updated. 
32
            script_to_process_frames;
33
        end
34
35
    end
36
    
37
    % This script update the message bar
38
    script_to_display_message;
39
    
40
    %run this scrip to save the results
41
    script_to_save_results;
42
    
43
    % Update handles structure
44
    guidata(hObject, handles);
45
 
46
end