From: Lukáš Jiřiště Date: Mon, 14 Oct 2024 12:51:58 +0000 (+0200) Subject: Hide the function files to directory X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=fd93d28a03b6749bcfdbed7fc7b2d9791ab5dd61;p=Bubble_column.git Hide the function files to directory Matlab needs to know where to look for the functions, so the scripts were updated to add (and later remove) ./functions to path. --- diff --git a/Bubliny.m b/Bubliny.m index 05f300d..a6b8d64 100755 --- a/Bubliny.m +++ b/Bubliny.m @@ -1,11 +1,13 @@ close all; clear all; +oldpath = addpath('./functions'); % User dialog for the data directory used for files DirectoryName = get_data_dir(); if DirectoryName == 0 + path(oldpath); return end @@ -21,6 +23,7 @@ list={DDirectory.name}; [Selected,OK] = listdlg('ListString',list,'ListSize',[200 500]); SelectedDirectory = list(Selected)'; if isempty(SelectedDirectory) + path(oldpath); return end nSelectedDirectory = numel(SelectedDirectory); @@ -34,7 +37,16 @@ ResFile = [res_path, ResFile]; %} mask = load_mask(); +if (mask == 0) + path(oldpath); + return +end + meter = load_meter(); +if (meter == 0) + path(oldpath); + return +end FileType = '*.png'; @@ -51,6 +63,7 @@ for i=1:nSelectedDirectory mn = menu('May the computation proceed with this mask?', 'Yes', 'No'); if (mn == 2) close all + path(oldpath); return end main_wb = waitbar(0, 'Whole processing progress'); @@ -87,3 +100,4 @@ for i=1:nSelectedDirectory end close(main_wb); +path(oldpath); diff --git a/create_mask.m b/create_mask.m index 050edc6..3b95859 100644 --- a/create_mask.m +++ b/create_mask.m @@ -1,4 +1,5 @@ clear all +oldpath = addpath('./functions'); FileType = '*.png'; @@ -19,3 +20,4 @@ imshow(meanfig .* uint8(mask)); if (mask_file_name ~= 0) imwrite(mask, [mask_path '/' mask_file_name], 'PBM', 'Encoding', 'raw'); end +path(oldpath); diff --git a/create_meter.m b/create_meter.m index f23d0d7..fef8f24 100644 --- a/create_meter.m +++ b/create_meter.m @@ -1,4 +1,5 @@ clear all +oldpath = addpath('./functions'); last_path = get_last_path(); [filenames, path] = uigetfile([last_path '/*.mtr'], ... @@ -17,3 +18,4 @@ imshow(meanfig); if (mask_file_name ~= 0) save_meter([meter_path '/' meter_file_name], meter) end +path(oldpath); diff --git a/clean_mask.m b/functions/clean_mask.m similarity index 100% rename from clean_mask.m rename to functions/clean_mask.m diff --git a/get_aggregate_images.m b/functions/get_aggregate_images.m similarity index 100% rename from get_aggregate_images.m rename to functions/get_aggregate_images.m diff --git a/get_data_dir.m b/functions/get_data_dir.m similarity index 100% rename from get_data_dir.m rename to functions/get_data_dir.m diff --git a/get_last_path.m b/functions/get_last_path.m similarity index 100% rename from get_last_path.m rename to functions/get_last_path.m diff --git a/get_levels.m b/functions/get_levels.m similarity index 100% rename from get_levels.m rename to functions/get_levels.m diff --git a/get_mark_frequency.m b/functions/get_mark_frequency.m similarity index 100% rename from get_mark_frequency.m rename to functions/get_mark_frequency.m diff --git a/get_mark_indeces.m b/functions/get_mark_indeces.m similarity index 100% rename from get_mark_indeces.m rename to functions/get_mark_indeces.m diff --git a/get_mask.m b/functions/get_mask.m similarity index 100% rename from get_mask.m rename to functions/get_mask.m diff --git a/get_meter.m b/functions/get_meter.m similarity index 100% rename from get_meter.m rename to functions/get_meter.m diff --git a/get_meter_picture.m b/functions/get_meter_picture.m similarity index 100% rename from get_meter_picture.m rename to functions/get_meter_picture.m diff --git a/get_simple_mask.m b/functions/get_simple_mask.m similarity index 100% rename from get_simple_mask.m rename to functions/get_simple_mask.m diff --git a/load_mask.m b/functions/load_mask.m similarity index 80% rename from load_mask.m rename to functions/load_mask.m index d5bae4b..d36844b 100644 --- a/load_mask.m +++ b/functions/load_mask.m @@ -2,5 +2,9 @@ function mask = load_mask() path = get_last_path(); [mask_file path] = uigetfile([path '/*.pbm'],... 'Select a mask for this batch'); + if (mask_file == 0) + mask = 0; + return + end mask = double(imread([path '/' mask_file])); end diff --git a/load_meter.m b/functions/load_meter.m similarity index 83% rename from load_meter.m rename to functions/load_meter.m index 2edcc0f..c029c04 100644 --- a/load_meter.m +++ b/functions/load_meter.m @@ -2,6 +2,10 @@ function meter = load_meter() path = get_last_path(); [meter_file path] = uigetfile([path '/*.mtr'],... 'Select a meter for this batch'); + if (meter_file == 0) + meter = 0; + return + end coefs = readmatrix([path '/' meter_file], 'FileType', 'text'); meter = @(pix)polyval(coefs, pix); end diff --git a/name_to_time.m b/functions/name_to_time.m similarity index 100% rename from name_to_time.m rename to functions/name_to_time.m diff --git a/save_meter.m b/functions/save_meter.m similarity index 100% rename from save_meter.m rename to functions/save_meter.m diff --git a/smooth_peaks.m b/functions/smooth_peaks.m similarity index 100% rename from smooth_peaks.m rename to functions/smooth_peaks.m diff --git a/update_last_path.m b/functions/update_last_path.m similarity index 100% rename from update_last_path.m rename to functions/update_last_path.m