-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
anna-grim
committed
Nov 7, 2023
1 parent
54b3654
commit 97d0a35
Showing
19 changed files
with
50 additions
and
1,048 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
""" | ||
Created on Sat November 04 15:30:00 2023 | ||
@author: Anna Grim | ||
@email: [email protected] | ||
Class of graphs that are built from swc files. | ||
""" | ||
|
||
import os | ||
|
||
import networkx as nx | ||
|
@@ -6,7 +16,7 @@ | |
from scipy.spatial import KDTree | ||
|
||
from deep_neurographs import swc_utils, utils | ||
from deep_neurographs.geometry_utils import dist, make_line | ||
from deep_neurographs.geometry_utils import dist | ||
|
||
|
||
class DenseGraph: | ||
|
@@ -69,27 +79,17 @@ def check_aligned(self, pred_xyz_i, pred_xyz_j): | |
if self.xyz_to_swc[xyz_i] != self.xyz_to_swc[xyz_j]: | ||
return False | ||
|
||
# Compare pred and target distances | ||
# Compute distances | ||
pred_xyz_i = np.array(pred_xyz_i) | ||
pred_xyz_j = np.array(pred_xyz_j) | ||
pred_dist = dist(pred_xyz_i, pred_xyz_j) | ||
|
||
target_path, target_dist = self.connect_nodes(graph_id, xyz_i, xyz_j) | ||
target_dist = max(target_dist, 1) | ||
|
||
# Check criteria | ||
ratio = min(pred_dist, target_dist) / max(pred_dist, target_dist) | ||
if ratio < 0.5 and pred_dist > 15: | ||
return False | ||
# elif ratio < 0.2: | ||
# return False | ||
|
||
# Compare projected predicted path | ||
proj_dists = [] | ||
proj_nodes = set() | ||
for xyz in make_line(pred_xyz_i, pred_xyz_j, len(target_path)): | ||
proj_xyz, proj_d = self.get_projection(xyz) | ||
swc = self.xyz_to_swc[tuple(proj_xyz)] | ||
proj_nodes.add(self.xyz_to_node[swc][tuple(proj_xyz)]) | ||
proj_dists.append(proj_d) | ||
|
||
return True | ||
else: | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters