Skip to content

Commit 54a679d

Browse files
anna-grimanna-grim
andauthored
Refactor data challenge (#145)
* bug: swc reader * refactor: updated results file * refactor: change default param --------- Co-authored-by: anna-grim <[email protected]>
1 parent 4ddf4a5 commit 54a679d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/segmentation_skeleton_metrics/skeleton_metric.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ def __init__(
100100
Segment IDs that can be assigned to nodes. This argument accounts
101101
for segments that were been removed due to some type of filtering.
102102
Default is None.
103+
use_anisotropy : bool, optional
104+
Indication of whether coordinates in fragment SWC files should be
105+
converted from physical to image coordinates using the given
106+
anisotropy. Default is False.
103107
verbose : bool, optional
104108
Indication of whether to printout updates. Default is True.
105109
"""
@@ -343,9 +347,10 @@ def detect_splits(self):
343347
p_split = 100 * n_split_edges / n_before
344348
rl = np.sum(self.graphs[key].run_lengths())
345349
gt_rl = self.graphs[key].run_length
350+
split_rate = rl / n_splits if n_splits > 0 else np.nan
346351

347352
self.metrics.at[key, "# Splits"] = n_splits
348-
self.metrics.at[key, "Split Rate"] = rl / max(n_splits, 1)
353+
self.metrics.at[key, "Split Rate"] = split_rate
349354
self.metrics.loc[key, "% Split Edges"] = round(p_split, 2)
350355
self.metrics.at[key, "% Omit Edges"] = round(p_omit, 2)
351356
self.metrics.loc[key, "SWC Run Length"] = round(gt_rl, 2)
@@ -428,7 +433,7 @@ def is_fragment_merge(self, key, label, kdtree):
428433
for leaf in gutil.get_leafs(fragment_graph):
429434
voxel = fragment_graph.voxels[leaf]
430435
gt_voxel = util.kdtree_query(kdtree, voxel)
431-
if self.physical_dist(gt_voxel, voxel) > 50:
436+
if self.physical_dist(gt_voxel, voxel) > 40:
432437
self.find_merge_site(
433438
key, kdtree, fragment_graph, leaf, visited
434439
)

src/segmentation_skeleton_metrics/utils/graph_util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ def __init__(
5252
Only SWC files with an swc_id contained in this set are read.
5353
Default is None.
5454
use_anisotropy : bool, optional
55-
Indication of whether to apply anisotropy to coordinates in SWC
56-
files. Default is True.
55+
Indication of whether coordinates in SWC files should be converted
56+
from physical to image coordinates using the given anisotropy.
57+
Default is True.
5758
"""
5859
# Instance attributes
5960
self.anisotropy = anisotropy

0 commit comments

Comments
 (0)