Switch to unified view

a b/script_create_save_path_name.m
1
% Location of the path to save results
2
% You may modify this script to save the file to a path of your preference.
3
function save_path = script_create_save_path_name(file_name, condition_Bmode)
4
    % Protocol D
5
    %     str1                        = strsplit(file_name, 'Experiment_Data/');
6
    %     str1_TEMP                   = strsplit(str1{2}, '/supine_US');
7
    %     if( size(str1_TEMP, 2) == 1)
8
    %         str1_TEMP             = strsplit(str1{2}, '/tilted_US'); 
9
    %     end
10
    %     if( size(str1_TEMP, 2) == 1 )
11
    %         save_path = [];
12
    %         fprintf('Error in the filename\n');
13
    %         return;
14
    %     end
15
    %     subject_ID        = str1_TEMP{1}; 
16
    %     str                   = strsplit(file_name, 'US/');
17
    %     str_2               = strsplit(str{1}, '_MIT/');
18
19
    % Protocol E
20
    str = strsplit(file_name, filesep);
21
    
22
    if condition_Bmode
23
        % condition_Bmode is true if the input file is a BMODE image
24
        
25
        % Protocol D
26
        %save_path      = fullfile(sprintf('%sUS', str{1}), sprintf('%s_%sDIA_ECG_%s.mat', subject_ID, str_2{2}, str{2}));
27
        
28
        % Protocol E and MGH study
29
        save_name = strcat(str{end-1}, '_supine_DIA_ECG_', str{end}, '.mat');
30
        save_path = fullfile(str{1:end-1}, save_name);
31
    else
32
        % condition_Bmode is false if the input file is a Pulsed-Doppler 
33
        
34
        % Protocol D
35
        %save_path      = fullfile(sprintf('%sUS', str{1}), sprintf('%s_%sVEL_ECG_%s.mat', subject_ID, str_2{2}, str{2}));
36
        
37
        % Protocol E
38
        save_name = strcat(str{end-1}, '_supine_VEL_ECG_', str{end}, '.mat');
39
        save_path = fullfile(str{1:end-1}, save_name);
40
    end
41
end