FileType = '*.png';
last_path = get_last_path();
-[filenames, path] = uigetfile([last_path '/' FileType], ...
+[filenames, new_path] = uigetfile([last_path '/' FileType], ...
'Select all files for mask creation', 'MultiSelect', 'on');
-update_last_path(path);
-files = struct('name', cell(1, numel(filenames)), 'folder', cell(1,...
-numel(filenames)));
+if (isequal(filenames, 0))
+ path(oldpath);
+ return ;
+end
+filenames = cellstr(filenames);
+update_last_path(new_path);
+files = struct('name', cell(1, numel(filenames)), 'folder', cell(1, numel(filenames)));
[files.name] = deal(filenames{:});
-[files.folder] = deal(path);
+[files.folder] = deal(new_path);
[minfig, maxfig, meanfig] = get_aggregate_images(files);
changefig = maxfig - minfig;
mask = get_mask(changefig, meanfig);
figure();
imshow(meanfig .* uint8(mask));
-[mask_file_name, mask_path] = uiputfile([path '/*.pbm'], 'Save you mask as...');
-if (mask_file_name ~= 0)
+[mask_file_name, mask_path] = uiputfile([new_path '/*.pbm'], 'Save you mask as...');
+if (~isequal(mask_file_name, 0))
imwrite(mask, [mask_path '/' mask_file_name], 'PBM', 'Encoding', 'raw');
end
path(oldpath);
FileType = '*.png';
last_path = get_last_path();
-[filenames, last_path] = uigetfile([last_path '/' FileType], ...
+[filenames, new_path] = uigetfile([last_path '/' FileType], ...
'Select all files for meter creation', 'MultiSelect', 'on');
if (isequal(filenames, 0))
path(oldpath);
return ;
end
filenames = cellstr(filenames);
-update_last_path(last_path);
+update_last_path(new_path);
mask = load_mask();
if (isequal(mask, 0))
path(oldpath);
files = struct('name', cell(1, numel(filenames)), 'folder', cell(1,...
numel(filenames)));
[files.name] = deal(filenames{:});
-[files.folder] = deal(last_path);
+[files.folder] = deal(new_path);
[minfig, maxfig, meanfig] = get_aggregate_images(files);
[meter, inverse] = get_meter(maxfig, mask, 2);
figure();
line([line_x line_x], [0 pic_size(1)], 'Color', 'red')
end
end
-[meter_file_name, meter_path] = uiputfile([path '/*.mtr'], 'Save your meter as...');
+[meter_file_name, meter_path] = uiputfile([new_path '/*.mtr'], 'Save your meter as...');
if (~isequal(meter_file_name, 0))
save_meter([meter_path '/' meter_file_name], meter)
end