classdef image_analysis < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                matlab.ui.Figure
        FeaturestatisticsLabel  matlab.ui.control.Label
        ImageanalysisButton     matlab.ui.control.Button
        UITable                 matlab.ui.control.Table
        UIAxes_7                matlab.ui.control.UIAxes
        UIAxes_6                matlab.ui.control.UIAxes
        UIAxes_5                matlab.ui.control.UIAxes
        UIAxes_4                matlab.ui.control.UIAxes
        UIAxes_3                matlab.ui.control.UIAxes
        UIAxes_2                matlab.ui.control.UIAxes
        UIAxes                  matlab.ui.control.UIAxes
    end

    
    properties (Access = public)
        exc % Description
    end
    

    % Callbacks that handle component events
    methods (Access = private)

        % Code that executes after component creation
        function startupFcn(app, edge)
            app.exc = edge;
        end

        % Button pushed function: ImageanalysisButton
        function ImageanalysisButtonPushed(app, event)
            load dataimgaco.mat
            
            if app.exc == 1
            showimg1 = img1;
            showimg2 = img12;
            showimg3 = img13;
            n1 = size(img1);
            n = n1(1,2);
            
            elseif app.exc == 2
            showimg1 = img2;
            showimg2 = img22;
            showimg3 = img23;
            n1 = size(img2);
            n = n1(1,2);
            
            elseif app.exc == 3
            showimg1 = img3;
            showimg2 = img32;
            showimg3 = img33;  
            n1 = size(img3);
            n = n1(1,2);
            
            end
            
            for i = 1:5:n
                imshow(showimg1{i}, 'parent', app.UIAxes);
                imshow(showimg2{i}, 'parent', app.UIAxes_2);
                imshow(showimg3{i}, 'parent', app.UIAxes_3);
                
                pause(0.8);
            end
            
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Position = [100 100 640 530];
            app.UIFigure.Name = 'MATLAB App';

            % Create UIAxes
            app.UIAxes = uiaxes(app.UIFigure);
            title(app.UIAxes, 'Filtered image')
            zlabel(app.UIAxes, 'Z')
            app.UIAxes.XTick = [];
            app.UIAxes.YTick = [];
            app.UIAxes.FontSize = 14;
            app.UIAxes.Position = [11 322 208 185];

            % Create UIAxes_2
            app.UIAxes_2 = uiaxes(app.UIFigure);
            title(app.UIAxes_2, 'Separation image (welding pool)')
            zlabel(app.UIAxes_2, 'Z')
            app.UIAxes_2.XTick = [];
            app.UIAxes_2.YTick = [];
            app.UIAxes_2.FontSize = 14;
            app.UIAxes_2.Position = [218 322 208 185];

            % Create UIAxes_3
            app.UIAxes_3 = uiaxes(app.UIFigure);
            title(app.UIAxes_3, 'Separation image (arc light)')
            zlabel(app.UIAxes_3, 'Z')
            app.UIAxes_3.XTick = [];
            app.UIAxes_3.YTick = [];
            app.UIAxes_3.FontSize = 14;
            app.UIAxes_3.Position = [425 322 208 185];

            % Create UIAxes_4
            app.UIAxes_4 = uiaxes(app.UIFigure);
            title(app.UIAxes_4, 'Title')
            zlabel(app.UIAxes_4, 'Z')
            app.UIAxes_4.XTick = [];
            app.UIAxes_4.YTick = [];
            app.UIAxes_4.Position = [11 163 180 160];

            % Create UIAxes_5
            app.UIAxes_5 = uiaxes(app.UIFigure);
            title(app.UIAxes_5, 'Title')
            zlabel(app.UIAxes_5, 'Z')
            app.UIAxes_5.XTick = [];
            app.UIAxes_5.YTick = [];
            app.UIAxes_5.Position = [219 163 180 160];

            % Create UIAxes_6
            app.UIAxes_6 = uiaxes(app.UIFigure);
            title(app.UIAxes_6, 'Title')
            zlabel(app.UIAxes_6, 'Z')
            app.UIAxes_6.XTick = [];
            app.UIAxes_6.YTick = [];
            app.UIAxes_6.Position = [11 4 180 160];

            % Create UIAxes_7
            app.UIAxes_7 = uiaxes(app.UIFigure);
            title(app.UIAxes_7, 'Title')
            zlabel(app.UIAxes_7, 'Z')
            app.UIAxes_7.XTick = [];
            app.UIAxes_7.YTick = [];
            app.UIAxes_7.Position = [219 3 180 160];

            % Create UITable
            app.UITable = uitable(app.UIFigure);
            app.UITable.ColumnName = {'Column 1'; 'Column 2'; 'Column 3'; 'Column 4'};
            app.UITable.RowName = {};
            app.UITable.Position = [415 73 208 219];

            % Create ImageanalysisButton
            app.ImageanalysisButton = uibutton(app.UIFigure, 'push');
            app.ImageanalysisButton.ButtonPushedFcn = createCallbackFcn(app, @ImageanalysisButtonPushed, true);
            app.ImageanalysisButton.FontSize = 14;
            app.ImageanalysisButton.Position = [514 22 109 42];
            app.ImageanalysisButton.Text = 'Image analysis';

            % Create FeaturestatisticsLabel
            app.FeaturestatisticsLabel = uilabel(app.UIFigure);
            app.FeaturestatisticsLabel.FontSize = 16;
            app.FeaturestatisticsLabel.Position = [456 291 127 22];
            app.FeaturestatisticsLabel.Text = 'Feature statistics';

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = image_analysis(varargin)

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            % Execute the startup function
            runStartupFcn(app, @(app)startupFcn(app, varargin{:}))

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end