-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOP_8.py
More file actions
45 lines (31 loc) · 1.05 KB
/
Copy pathOP_8.py
File metadata and controls
45 lines (31 loc) · 1.05 KB
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
from ip.ios import *
from ip.enhancement import *
from ip.binary import *
from ip.graph_nx import *
from ip.swc import *
from ip.split import *
from skimage.morphology import skeletonize
# ## Read Data
folder_path = "./OlfactoryProjectionFibers/ImageStacks/OP_8"
images = load_image_stack(folder_path)
# ## Code Process and Execution
threshold1 = mean_threshold(images, 15)
binary1 = simple_binary(images, threshold1)
seg = segment(images, binary1)
denoising = median_blur(seg, 5)
threshold2 = mean_threshold(denoising, 15)
binary2 = simple_binary(denoising, threshold2)
skel = skeletonize(binary2)
# ### For visualization purposes only
blend = blended(skel)
single_download(blend, "./Test/Images/OP_8_skel.png")
# ### Graph generation
graph = Graph(skel)
graph.set_root()
graph.create_graph()
root = graph.get_root()
g_root = (118.64,181.34,55)
print(f"OP_8 GOLD STANDARD ROOT: {g_root}\nTEST ROOT: {root}")
distances, paths = graph.apply_dijkstra_and_label_nodes()
print(len(distances), len(paths))
print("SWC generated:",graph.save_to_swc("./Test/OP_8.swc"))