Skip to content
Snippets Groups Projects
Demo.m 2.32 KiB
Newer Older
  • Learn to ignore specific revisions
  • bepi's avatar
    bepi committed
    close all
    clear
    
    addpath(genpath('../Functions'))
    
    %% Defaults
    Data_path = '..\..\..\..\..\..\LINX FP08.001\Activity 7 - bending - visualizations and tiff stacks\mat_file\';
    samples = {'out_out_CD','out_out_MD','in_in_CD','in_in_MD'};
    degree = {'0','45','90','180'};
    layer_name = {'outer','inner'};
    
    
    %% extract poitns for the pipeline
    clc
    flag_points = 0; % 1 if no point has been extracted and first time use of the code
    
    if flag_points
        for i = 1
            sample = samples{i};
            for j = 1:4
                dg = degree{j};
    
                %% load data
                load([Data_path,'Processed_',sample,'_',dg])
    
                %% use the pre_processing to extract the points
                PointSelection
            end
        end
    end
    
    clearvars -except Data_path samples degree layer_name
    
    %% layer segmentation and investigation
    clc
    answer = questdlg('Do you want to enhance the contrast? ','Contrast:','No','Yes','No');
    
    for i = 1
        sample = samples{i};
        for j = 1:4
            %% load data
            dg = degree{j};
    
            fprintf('Load Data %s %s \n',sample,dg)
            load([Data_path,'Processed_',sample,'_',dg])
            
            %% use the pre_processing to extract the points
            
            % detect the layers
            layer_name = {'outer','inner'};
            
            for l = 1:length(layer_name)
                flag_layer = layer_name{l};
                
                disp(['Layer Detection ',flag_layer])
                load(['Results\point\',flag_layer,'_points_',sample,'_',dg])
                
                Delta_LU = [3, 7];
                
                if any(strcmp(dg,'0') | strcmp(dg,'45'))
                    range = 15:-1:-15;
                else
                    switch flag_layer
                        case 'inner'
                            range = 30:-1:-35;
                        case 'outer'
                            range = 20:-1:-20;
                    end
                end
                LayerDetection
            end
            
             %% measure
            disp('Measure ...')
            PrepMeasure
            
             %% registration
            disp('Registration ...')
            PrepRegistration
            
        end
    end
    
    %% visualize the measure
    for i = 1%:4
        Measure
    end
    close all
    
    %% apply the registration
    for i = 1%:4
        Registration
    end
    close all
    
    %% apply the alignment and transformation
    for i = 1%:4
        Transformation
    end
    close all
    
    %% convert the meshes
    for i = 1%:4
        Export2inp
    end
    close all