|
| 1 | +function compute_landmarks_for_all_tile_channels(p_map_root_path, tile_relative_path, landmarks_root_path, ... |
| 2 | + do_force_computation, do_run_in_debug_mode) |
| 3 | + % Deal with args |
| 4 | + if ~exist('do_force_computation', 'var') || isempty(do_force_computation) , |
| 5 | + do_force_computation = false ; |
| 6 | + end |
| 7 | + if ~exist('do_run_in_debug_mode', 'var') || isempty(do_run_in_debug_mode) , |
| 8 | + do_run_in_debug_mode = false ; |
| 9 | + end |
| 10 | + |
| 11 | + % Make sure the output folder exists |
| 12 | + landmark_folder_path = fullfile(landmarks_root_path, tile_relative_path) ; |
| 13 | + ensure_folder_exists(landmark_folder_path) ; |
| 14 | + |
| 15 | + % Run for all channels |
| 16 | + channel_count = 2 ; |
| 17 | + for channel_index = 1 : channel_count , |
| 18 | + compute_landmarks_for_single_tile_channels(p_map_root_path, tile_relative_path, landmarks_root_path, ... |
| 19 | + channel_index, ... |
| 20 | + do_force_computation, do_run_in_debug_mode) ; |
| 21 | + end |
| 22 | +end |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +function compute_landmarks_for_single_tile_channels(p_map_root_path, tile_relative_path, landmarks_root_path, ... |
| 27 | + channel_index, ... |
| 28 | + do_force_computation, do_run_in_debug_mode) |
| 29 | + |
| 30 | + % Compute the p-map file path |
| 31 | + [~,day_tile_index_as_string] = fileparts2(tile_relative_path) ; |
| 32 | + channel_index0 = channel_index - 1 ; |
| 33 | + channel_index0_as_string = num2str(channel_index0) ; |
| 34 | + p_map_file_name = sprintf('%s-prob.%s.h5', day_tile_index_as_string, channel_index0_as_string) ; |
| 35 | + p_map_tile_folder_path = fullfile(p_map_root_path, tile_relative_path) ; |
| 36 | + p_map_file_path = fullfile(p_map_tile_folder_path, p_map_file_name) ; |
| 37 | + |
| 38 | + % Generate the landmarks from the p-map |
| 39 | + landmark_file_name = sprintf('%s-desc.%s.txt', day_tile_index_as_string, channel_index0_as_string) ; |
| 40 | + landmark_folder_path = fullfile(landmarks_root_path, tile_relative_path) ; |
| 41 | + landmark_file_path = fullfile(landmark_folder_path, landmark_file_name) ; |
| 42 | + |
| 43 | +% % Make sure the output folder exists |
| 44 | +% ensure_folder_exists(landmark_folder_path) ; |
| 45 | + |
| 46 | + % Run the core code |
| 47 | + siz = '[11 11 11]' ; |
| 48 | + sig1 = '[3.405500 3.405500 3.405500]' ; |
| 49 | + sig2 = '[4.049845 4.049845 4.049845]' ; |
| 50 | + ROI = '[5 1019 5 1531 5 250]' ; |
| 51 | + rt = '4' ; |
| 52 | + exitcode = dogDescriptor(p_map_file_path, landmark_file_path, siz, sig1, sig2, ROI, rt) ; |
| 53 | + if exitcode ~= 0 , |
| 54 | + error('dogDescriptor() returned a nonzero exit code (%s) when trying to produce output file %s', exitcode, landmark_file_path) ; |
| 55 | + end |
| 56 | +end |
0 commit comments