Skip to content

Commit d162022

Browse files
committed
Updated code to use new version of progress_bar_object.m
1 parent 91bc61a commit d162022

10 files changed

+63
-26
lines changed

build_full_trees_as_named_tree_mats.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
tree_mat_file_name = sprintf('%s.mat', tree_name) ;
7676
tree_mat_file_path = fullfile(output_folder_path, tree_mat_file_name);
7777
does_output_exist_from_processing_index(processing_index) = logical(exist(tree_mat_file_path, 'file')) ;
78-
progress_bar.update(processing_index) ;
78+
progress_bar.update() ;
7979
end
8080
end
8181
component_id_from_will_process_index = component_id_from_processing_index(~does_output_exist_from_processing_index) ;
@@ -180,7 +180,7 @@
180180
end
181181

182182
% Update the progress bar
183-
pbo.update() ;
183+
pbo.update() ; %#ok<PFBNS>
184184
end
185185
%pbo = progress_bar_object(0) ;
186186

build_full_trees_as_named_tree_mats_function.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function build_full_trees_as_named_tree_mats_function(sample_date, ...
9292
tree_mat_file_name = sprintf('%s.mat', tree_name) ;
9393
tree_mat_file_path = fullfile(output_folder_path, tree_mat_file_name);
9494
does_output_exist_from_processing_index(processing_index) = logical(exist(tree_mat_file_path, 'file')) ;
95-
progress_bar.update(processing_index) ;
95+
progress_bar.update() ;
9696
end
9797
end
9898
component_id_from_will_process_index = component_id_from_processing_index(~does_output_exist_from_processing_index) ;

clean_up_skeleton_graph.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function clean_up_skeleton_graph(skeleton_graph, ...
8787
tree_mat_file_name = sprintf('%s.mat', tree_name) ;
8888
tree_mat_file_path = fullfile(output_folder_path, tree_mat_file_name);
8989
does_output_exist_from_processing_index(processing_index) = logical(exist(tree_mat_file_path, 'file')) ;
90-
progress_bar.update(processing_index) ;
90+
progress_bar.update() ;
9191
end
9292
end
9393
component_id_from_will_process_index = component_id_from_processing_index(~does_output_exist_from_processing_index) ;
@@ -192,7 +192,7 @@ function clean_up_skeleton_graph(skeleton_graph, ...
192192
end
193193

194194
% Update the progress bar
195-
pbo.update() ;
195+
pbo.update() ; %#ok<PFBNS>
196196
end
197197
%pbo = progress_bar_object(0) ;
198198

collect_fragments_into_single_mat_file.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function collect_fragments_into_single_mat_file(sample_date)
1919
frag_mat_file_name = frag_mat_file_names{tree_index} ;
2020
frag_mat_file_path = fullfile(input_folder_path, frag_mat_file_name) ;
2121
fragments_from_tree_id{tree_index} = load_anonymous(frag_mat_file_path) ;
22-
pbo.update() ;
22+
pbo.update() ; %#ok<PFBNS>
2323
end
2424
%pbo = progress_bar_object(0) ;
2525
%elapsed_time = toc(tic_id) ;

convert_full_named_trees_as_mat_to_swc.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function convert_full_named_trees_as_mat_to_swc(trees_as_swc_folder_path, trees_
1919
named_tree = mat_contents.named_tree ;
2020
save_named_tree_as_swc(swc_file_path, named_tree) ;
2121
end
22-
pbo.update() ;
22+
pbo.update() ; %#ok<PFBNS>
2323
end
2424
%pbo = progress_bar_object(0) ;
2525
elapsed_time = toc(tic_id) ;

extract_tiles_near_tile.m

+49-11
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,65 @@
99
relative_path_from_full_tile_index, ...
1010
center_tile_relative_path)
1111

12+
% Extracts a 3x3x3 subset of tiles around a given central tile.
13+
% Good for running analysis on a small subset of tiles
14+
%
15+
% The full_tile_index is the index of a tile in the full tile set.
16+
% The tile_index is the index of a tile withing the extracted subset.
17+
% Currently the extracted subset is always a 3x3x3 cuboid of tiles.
18+
19+
% Get the full tile index of the center tile
1220
is_center_tile_from_full_tile_index = strcmp(center_tile_relative_path, relative_path_from_full_tile_index) ;
1321
center_tile_full_index = find(is_center_tile_from_full_tile_index) ;
14-
center_tile_full_ijk1 = full_tile_ijk1_from_full_tile_index(center_tile_full_index, :) ; %#ok<FNDSB>
15-
is_in_hood_from_full_tile_ijk1 = false(size(full_tile_index_from_full_tile_ijk1)) ; % "hood" == "neighborhood" b/c I'm *very* street
16-
is_in_hood_from_full_tile_ijk1(center_tile_full_ijk1(1)-1:center_tile_full_ijk1(1)+1, ...
17-
center_tile_full_ijk1(2)-1:center_tile_full_ijk1(2)+1, ...
18-
center_tile_full_ijk1(3)-1:center_tile_full_ijk1(3)+1) = true ;
1922

23+
% Get the one-based ijk (integral xyz) coordinates of the center tile
24+
% within the full tile block
25+
center_tile_full_ijk1 = full_tile_ijk1_from_full_tile_index(center_tile_full_index, :) ; %#ok<FNDSB>
2026

21-
full_tile_index_from_tile_ijk1 = full_tile_index_from_full_tile_ijk1(is_in_hood_from_full_tile_ijk1) ;
22-
full_tile_index_from_tile_index = full_tile_index_from_tile_ijk1(:) ;
27+
% Get the 3x3x3 array of file tile indices around the central tile
28+
full_tile_index_from_tile_ijk1 = ...
29+
full_tile_index_from_full_tile_ijk1(center_tile_full_ijk1(1)-1:center_tile_full_ijk1(1)+1, ...
30+
center_tile_full_ijk1(2)-1:center_tile_full_ijk1(2)+1, ...
31+
center_tile_full_ijk1(3)-1:center_tile_full_ijk1(3)+1) ;
32+
33+
% The raw tile index is the index of each tile within the 3x3x3 block.
34+
% The actual tile index may differ because some tiles may be missing.
35+
% Missing tiles in full_tile_index_from_full_tile_ijk1 are represented by
36+
% nans.
37+
38+
% Get the array that maps from raw tile indices to full tile indices
39+
full_tile_index_from_raw_tile_index = full_tile_index_from_tile_ijk1(:) ; % may have nans for missing tiles
40+
41+
% Get the mapping from tile indices to raw tile indices
42+
raw_tile_count = length(full_tile_index_from_raw_tile_index) ; % Should be 27, always
43+
assert(raw_tile_count==27) ;
44+
raw_tile_index_from_raw_tile_index = (1:raw_tile_count)' ;
45+
is_present_from_raw_tile_index = isfinite(full_tile_index_from_raw_tile_index) ;
46+
raw_tile_index_from_tile_index = raw_tile_index_from_raw_tile_index(is_present_from_raw_tile_index) ;
47+
assert(all(isfinite(raw_tile_index_from_tile_index))) ; % There shouldn't be any nans in raw_tile_index_from_tile_index
2348

24-
full_tile_count = length(relative_path_from_full_tile_index) ;
25-
tile_index_from_full_tile_index = invert_map_array(full_tile_index_from_tile_index, full_tile_count) ;
26-
tile_index_from_tile_ijk1 = tile_index_from_full_tile_index(full_tile_index_from_tile_ijk1) ;
49+
% Get the mapping from tile indices to full tile indices
50+
full_tile_index_from_tile_index = full_tile_index_from_raw_tile_index(is_present_from_raw_tile_index) ;
2751

52+
% Invert raw_tile_index_from_tile_index
53+
tile_indexoid_from_raw_tile_index = invert_map_array(raw_tile_index_from_tile_index, raw_tile_count) ;
54+
% tile_indexoid_from_raw_tile_index has zeros for missing raw tile indices,
55+
% want those to be nan's
56+
tile_index_from_raw_tile_index = tile_indexoid_from_raw_tile_index ;
57+
tile_index_from_raw_tile_index(tile_indexoid_from_raw_tile_index==0) = nan ;
2858

59+
% Get mapping from tile_ijk1 to the tile index
60+
raw_tile_index_from_tile_ijk1 = reshape(raw_tile_index_from_raw_tile_index, [3 3 3]) ;
61+
tile_index_from_tile_ijk1 = tile_index_from_raw_tile_index(raw_tile_index_from_tile_ijk1) ;
62+
63+
% Get the mapping from tile index to tile ijk1 (within the subset)
2964
full_tile_ijk1_from_tile_index = full_tile_ijk1_from_full_tile_index(full_tile_index_from_tile_index, :) ;
3065
offset_ijk = min(full_tile_ijk1_from_tile_index, [] , 1) ;
3166
tile_ijk1_from_tile_index = full_tile_ijk1_from_tile_index - offset_ijk + 1 ;
32-
67+
68+
% Get the xyz coordinate of each tile in the subset
3369
xyz_from_tile_index = xyz_from_full_tile_index(full_tile_index_from_tile_index,:) ;
70+
71+
% Get the relative path of each tile in the subset
3472
relative_path_from_tile_index = relative_path_from_full_tile_index(full_tile_index_from_tile_index) ;
3573
end

generate_fragments.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ function generate_fragments(input_folder_path, ...
3939
bounding_box_high_corner_xyz) ;
4040

4141
% Update the progress bar
42-
pbo.update(full_tree_index) ;
43-
%pbo.update() ;
42+
pbo.update() ;
4443
end
4544
pbo.finish_up() ;
4645
%%pbo = progress_bar_object(0) ;

generate_fragments_as_one_mat_per_tree.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function generate_fragments_as_one_mat_per_tree(input_folder_path, ...
2525
bounding_box_high_corner_xyz) ;
2626

2727
% Update the progress bar
28-
pbo.update() ;
28+
pbo.update() ; %#ok<PFBNS>
2929
end
3030
%pbo = progress_bar_object(0) ;
3131
toc(tic_id) ;

run_some_tiles_through_1234_stages.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
% Create the bqueue
7474
if do_use_bsub ,
75-
fprintf('Queueing LPL on %d tiles...\n', tile_to_be_run_count) ;
75+
fprintf('Queueing LPL jobs for %d tiles...\n', tile_to_be_run_count) ;
7676
bqueue = bqueue_type(do_actually_submit, max_running_slot_count) ;
7777
pbo = progress_bar_object(tile_to_be_run_count) ;
7878
for tile_to_be_run_index = 1 : tile_to_be_run_count ,
@@ -93,15 +93,15 @@
9393
pbo.update() ;
9494
end
9595
%pbo = progress_bar_object(0) ;
96-
fprintf('Done queueing LPL on %d tiles.\n\n', tile_to_be_run_count) ;
96+
fprintf('Done queueing LPL jobs for %d tiles.\n\n', tile_to_be_run_count) ;
9797

98-
fprintf('LPLing queue on %d tiles...\n', length(bqueue.job_ids)) ;
98+
fprintf('Running queued LPL jobs for %d tiles...\n', length(bqueue.job_ids)) ;
9999
maximum_wait_time = inf ;
100100
do_show_progress_bar = true ;
101101
tic_id = tic() ;
102102
job_statuses = bqueue.run(maximum_wait_time, do_show_progress_bar) ;
103103
toc(tic_id)
104-
fprintf('Done LPLing queue on %d tiles.\n', length(bqueue.job_ids)) ;
104+
fprintf('Done running queued LPL jobs for %d tiles.\n', length(bqueue.job_ids)) ;
105105
job_statuses
106106
successful_job_count = sum(job_statuses==1)
107107
else

sample_rendered_data.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
sample_stack = get_mouselight_rendered_substack(sample_folder_path, 0, sample_offset, sample_shape) ;
1818
sample_index = last_sample_index + 1 ;
1919
sample_stacks(:,:,:,sample_index) = sample_stack ;
20-
pbo.update(sample_index) ;
20+
pbo.update() ;
2121
last_sample_index = sample_index ;
2222
catch err
2323
if isequal(err.identifier, 'mouselight:stackMustBeInOneChunk') ,

0 commit comments

Comments
 (0)