Skip to content

Commit

Permalink
minor upds
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-grim committed Sep 25, 2024
1 parent fad6fe3 commit e842b59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
'torcheval',
'torchio',
'torch_geometric',
'tqdm',
'zarr',
]

Expand Down
1 change: 1 addition & 0 deletions src/deep_neurographs/delete_merges_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def delete_merges(
# Finish
if len(delete_nodes) > 0:
graph.remove_nodes_from(delete_nodes)
print("Merge Detected:", swc_id)
print("# Nodes Deleted:", len(delete_nodes))
print("")
pred_densegraph.graphs[swc_id] = graph
Expand Down
12 changes: 7 additions & 5 deletions src/deep_neurographs/densegraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from scipy.spatial import KDTree

from deep_neurographs.utils import graph_util as gutil
from deep_neurographs.utils import swc_util, util
from deep_neurographs.utils import img_util, swc_util, util

DELETION_RADIUS = 10

Expand Down Expand Up @@ -43,7 +43,7 @@ def __init__(self, swc_paths, img_patch_origin=None, img_patch_shape=None):
None
"""
self.bbox = util.get_img_bbox(img_patch_origin, img_patch_shape)
self.bbox = img_util.get_bbox(img_patch_origin, img_patch_shape)
self.init_graphs(swc_paths)
self.init_kdtree()

Expand All @@ -65,7 +65,7 @@ def init_graphs(self, paths):
"""
self.graphs = dict()
self.xyz_to_swc = dict()
swc_dicts, _ = swc_util.process_local_paths(paths)
swc_dicts = swc_util.Reader().load(paths)
for i, swc_dict in enumerate(swc_dicts):
# Build graph
swc_id = swc_dict["swc_id"]
Expand Down Expand Up @@ -179,11 +179,13 @@ def make_entries(self, graph, component):
node_to_idx[i] = 1
x, y, z = tuple(graph.nodes[i]["xyz"])
r = graph.nodes[i]["radius"]
entry_list.append([1, 2, x, y, z, r, -1])
entry_list.append(f"1 2 {x} {y} {z} {r} -1")

# Create entry
node_to_idx[j] = len(entry_list) + 1
x, y, z = tuple(graph.nodes[j]["xyz"])
r = graph.nodes[j]["radius"]
entry_list.append([node_to_idx[j], 2, x, y, z, r, node_to_idx[i]])
entry_list.append(
f"{node_to_idx[j]} 2 {x} {y} {z} {r} {node_to_idx[i]}"
)
return entry_list

0 comments on commit e842b59

Please sign in to comment.