Hide the function files to directory
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 14 Oct 2024 12:51:58 +0000 (14:51 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 14 Oct 2024 12:51:58 +0000 (14:51 +0200)
Matlab needs to know where to look for the functions, so the scripts
were updated to add (and later remove) ./functions to path.

20 files changed:
Bubliny.m
create_mask.m
create_meter.m
functions/clean_mask.m [moved from clean_mask.m with 100% similarity]
functions/get_aggregate_images.m [moved from get_aggregate_images.m with 100% similarity]
functions/get_data_dir.m [moved from get_data_dir.m with 100% similarity]
functions/get_last_path.m [moved from get_last_path.m with 100% similarity]
functions/get_levels.m [moved from get_levels.m with 100% similarity]
functions/get_mark_frequency.m [moved from get_mark_frequency.m with 100% similarity]
functions/get_mark_indeces.m [moved from get_mark_indeces.m with 100% similarity]
functions/get_mask.m [moved from get_mask.m with 100% similarity]
functions/get_meter.m [moved from get_meter.m with 100% similarity]
functions/get_meter_picture.m [moved from get_meter_picture.m with 100% similarity]
functions/get_simple_mask.m [moved from get_simple_mask.m with 100% similarity]
functions/load_mask.m [moved from load_mask.m with 80% similarity]
functions/load_meter.m [moved from load_meter.m with 83% similarity]
functions/name_to_time.m [moved from name_to_time.m with 100% similarity]
functions/save_meter.m [moved from save_meter.m with 100% similarity]
functions/smooth_peaks.m [moved from smooth_peaks.m with 100% similarity]
functions/update_last_path.m [moved from update_last_path.m with 100% similarity]

index 05f300d1cf36a87cf66c434f84e29effc532339b..a6b8d640fefb69ecb0d7501d57db180b05f587a4 100755 (executable)
--- a/Bubliny.m
+++ b/Bubliny.m
@@ -1,11 +1,13 @@
 close all;\r
 clear all;\r
+oldpath = addpath('./functions');\r
 \r
 % User dialog for the data directory used for files\r
 \r
 DirectoryName = get_data_dir();\r
 \r
 if DirectoryName == 0\r
+       path(oldpath);\r
        return\r
 end\r
 \r
@@ -21,6 +23,7 @@ list={DDirectory.name};
 [Selected,OK] = listdlg('ListString',list,'ListSize',[200 500]);\r
 SelectedDirectory = list(Selected)';\r
 if isempty(SelectedDirectory)\r
+       path(oldpath);\r
        return\r
 end\r
 nSelectedDirectory = numel(SelectedDirectory);\r
@@ -34,7 +37,16 @@ ResFile = [res_path, ResFile];
 %}\r
 \r
 mask = load_mask();\r
+if (mask == 0)\r
+       path(oldpath);\r
+       return\r
+end\r
+\r
 meter = load_meter();\r
+if (meter == 0)\r
+       path(oldpath);\r
+       return\r
+end\r
 \r
 FileType = '*.png';\r
 \r
@@ -51,6 +63,7 @@ for i=1:nSelectedDirectory
                mn = menu('May the computation proceed with this mask?', 'Yes', 'No');\r
                if (mn == 2)\r
                        close all\r
+                       path(oldpath);\r
                        return\r
                end\r
                main_wb = waitbar(0, 'Whole processing progress');\r
@@ -87,3 +100,4 @@ for i=1:nSelectedDirectory
 \r
 end\r
 close(main_wb);\r
+path(oldpath);\r
index 050edc672786bebc8d34ee8623ea8367c7d70e09..3b95859e6cc9d55bdcaa0d1356941f40c1cf1d19 100644 (file)
@@ -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);
index f23d0d7a2a1151c5aa487bb0edc953069bd303aa..fef8f24ef391a575af6b10814cb8a3505feef3c5 100644 (file)
@@ -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);
similarity index 100%
rename from clean_mask.m
rename to functions/clean_mask.m
similarity index 100%
rename from get_data_dir.m
rename to functions/get_data_dir.m
similarity index 100%
rename from get_last_path.m
rename to functions/get_last_path.m
similarity index 100%
rename from get_levels.m
rename to functions/get_levels.m
similarity index 100%
rename from get_mask.m
rename to functions/get_mask.m
similarity index 100%
rename from get_meter.m
rename to functions/get_meter.m
similarity index 80%
rename from load_mask.m
rename to functions/load_mask.m
index d5bae4b8a77c9d7e0e0fa5dde51216edf1dc399a..d36844b75b526725f591bc631480134b84a4d1de 100644 (file)
@@ -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
similarity index 83%
rename from load_meter.m
rename to functions/load_meter.m
index 2edcc0ff7d07a5fccb8abe8dc929f7742ce054ab..c029c042c5af6874a1f6ddb8c028c28478ee70b5 100644 (file)
@@ -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
similarity index 100%
rename from name_to_time.m
rename to functions/name_to_time.m
similarity index 100%
rename from save_meter.m
rename to functions/save_meter.m
similarity index 100%
rename from smooth_peaks.m
rename to functions/smooth_peaks.m