-
Notifications
You must be signed in to change notification settings - Fork 1
/
copy_raw_tile_neighborhood_as_links.m
45 lines (42 loc) · 2.61 KB
/
copy_raw_tile_neighborhood_as_links.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function copy_raw_tile_neighborhood_as_links(hood_raw_tile_root_folder_path, ...
raw_tile_root_folder_path, ...
center_tile_relative_path, ...
sample_memo_folder_path, ...
do_force_computation)
% Build the full tile index
raw_tile_index = compute_or_read_from_memo(sample_memo_folder_path, ...
'raw-tile-index', ...
@()(build_raw_tile_index(raw_tile_root_folder_path)), ...
do_force_computation) ;
full_tile_index_from_full_tile_ijk1 = raw_tile_index.tile_index_from_tile_ijk1 ;
full_tile_ijk1_from_full_tile_index = raw_tile_index.ijk1_from_tile_index ;
xyz_from_full_tile_index = raw_tile_index.xyz_from_tile_index ;
relative_path_from_full_tile_index = raw_tile_index.relative_path_from_tile_index ;
%full_tile_grid_shape = size(full_tile_index_from_full_tile_ijk1)
%full_tile_count = length(relative_path_from_full_tile_index)
% Get out just the tiles around the center_tile
[tile_index_from_tile_ijk1, ...
tile_ijk1_from_tile_index, ...
xyz_from_tile_index, ...
relative_path_from_tile_index] = ...
extract_tiles_near_tile(full_tile_index_from_full_tile_ijk1, ...
full_tile_ijk1_from_full_tile_index, ...
xyz_from_full_tile_index, ...
relative_path_from_full_tile_index, ...
center_tile_relative_path) ; %#ok<ASGLU>
tile_count = length(relative_path_from_tile_index) ;
% For each relative path, make a link
for tile_index = 1 : tile_count ,
tile_relative_path = relative_path_from_tile_index{tile_index} ;
destination_path = fullfile(hood_raw_tile_root_folder_path, tile_relative_path) ;
source_path = fullfile(raw_tile_root_folder_path, tile_relative_path) ;
destination_parent_path = fileparts(destination_path) ;
ensure_folder_exists(destination_parent_path) ;
system_from_list_with_error_handling({'ln', '-s', '-T', source_path, destination_path}) ;
end
% Make links for the metadata, etc
file_name = 'sample-metadata.txt' ;
source_path = fullfile(raw_tile_root_folder_path, file_name) ;
destination_path = fullfile(hood_raw_tile_root_folder_path, file_name) ;
system_from_list_with_error_handling({'ln', '-s', '-T', source_path, destination_path}) ;
end