Skip to content

Commit de86f78

Browse files
anna-grimanna-grim
andauthored
Feat s3 loading (#177)
* refactor: improved txt reader * remove print * feat: load swcs from s3 * feat: read json * bug: read local txt * bug: swc loading, merge sites --------- Co-authored-by: anna-grim <anna.grim@alleninstitute.org>
1 parent 852d386 commit de86f78

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/segmentation_skeleton_metrics/data_handling/swc_loading.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ def read_from_gcs_swcs(self, bucket_name, swc_paths):
329329
threads.append(
330330
executor.submit(self.read_from_gcs_swc, bucket_name, path)
331331
)
332+
break # TEMP
332333

333334
# Store results
334335
swc_dicts = deque()
@@ -475,11 +476,6 @@ def read_from_s3_swcs(self, bucket_name, swc_paths):
475476
Dictionaries whose keys and values are the attribute names and
476477
values from an SWC file.
477478
"""
478-
# List filenames
479-
bucket_name, prefix = util.parse_cloud_path(s3_path)
480-
swc_paths = util.list_s3_paths(bucket_name, prefix, extension=".swc")
481-
482-
# Parse SWC files
483479
swc_dicts = deque()
484480
for path in swc_paths:
485481
content = util.read_txt(bucket_name, path).splitlines()
@@ -518,7 +514,6 @@ def read_from_s3_zips(self, bucket_name, zip_paths):
518514
)
519515

520516
# Store results
521-
pbar = tqdm(total=len(processes), desc="Read SWCs")
522517
swc_dicts = deque()
523518
for process in as_completed(processes):
524519
result = process.result()

src/segmentation_skeleton_metrics/skeleton_metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def verify_site(self, gt_graph, fragment_graph, gt_node, fragment_node):
525525
self.fragments_with_merge.add(fragment_graph.name)
526526
self.merge_sites.append(
527527
{
528-
"Segment_ID": fragment_graph.name,
528+
"Segment_ID": fragment_graph.segment_id,
529529
"GroundTruth_ID": gt_graph.name,
530530
"Voxel": tuple(map(int, voxel)),
531531
"World": tuple([float(round(t, 2)) for t in xyz]),
@@ -924,7 +924,7 @@ def __call__(self, gt_graphs, fragment_graphs, merge_sites):
924924
"""
925925
# Check if merge sites is non-empty
926926
if len(merge_sites) == 0:
927-
return _
927+
return None
928928

929929
# Compute metric
930930
pbar = self.get_pbar(len(merge_sites))

0 commit comments

Comments
 (0)