forked from MouseLightPipeline/skeletonize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollect_skeleton_txts_given_file_paths.m
36 lines (32 loc) · 1.88 KB
/
collect_skeleton_txts_given_file_paths.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
function collect_skeleton_txts_given_file_paths(graph_as_mat_file_path, ...
graph_as_single_text_file_path, ...
whole_brain_h5_p_map_file_path, ...
skeletonization_folder_path)
if ~exist(graph_as_mat_file_path, 'file') || ~exist(graph_as_single_text_file_path, 'file') ,
whole_brain_stack_shape = h5parser_new(whole_brain_h5_p_map_file_path, '/prob0') ;
[skeleton_ijks,~,A] = skel2graph(skeletonization_folder_path, whole_brain_stack_shape) ;
end
if ~exist(graph_as_mat_file_path, 'file') ,
output_folder_path = fileparts(graph_as_mat_file_path) ; % the folder that will hold the output files
if ~exist(output_folder_path, 'file') ,
mkdir(output_folder_path) ;
end
skeleton_graph = graph(A) ;
save(graph_as_mat_file_path, 'skeleton_graph', 'skeleton_ijks', '-v7.3') ;
end
if ~exist(graph_as_single_text_file_path, 'file') ,
output_folder_path = fileparts(graph_as_single_text_file_path) ; % the folder that will hold the output files
if ~exist(output_folder_path, 'file') ,
mkdir(output_folder_path) ;
end
neighbors_from_node_index = neighbors_from_node_index_from_adjacency(A) ;
save_skeleton_graph_as_text(graph_as_single_text_file_path, skeleton_ijks, neighbors_from_node_index) ;
end
% if ~exist(graph_as_single_binary_file_path, 'file') ,
% output_folder_path = fileparts(graph_as_single_binary_file_path) ; % the folder that will hold the output files
% if ~exist(output_folder_path, 'file') ,
% mkdir(output_folder_path) ;
% end
% save_skeleton_graph_as_binary(graph_as_single_binary_file_path, skeleton_ijks, neighbors_from_node_index) ;
% end
end