From 86aa06326304a41d486a8b7934c6879252069713 Mon Sep 17 00:00:00 2001 From: anna-grim Date: Fri, 1 Nov 2024 01:00:24 +0000 Subject: [PATCH] minor upds --- src/deep_neurographs/groundtruth_generation.py | 3 +-- src/deep_neurographs/inference.py | 1 - src/deep_neurographs/neurograph.py | 8 ++------ src/deep_neurographs/utils/util.py | 5 +++-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/deep_neurographs/groundtruth_generation.py b/src/deep_neurographs/groundtruth_generation.py index eb1a5da..fe72ca7 100644 --- a/src/deep_neurographs/groundtruth_generation.py +++ b/src/deep_neurographs/groundtruth_generation.py @@ -15,7 +15,6 @@ import numpy as np from deep_neurographs import geometry -from deep_neurographs.geometry import dist as get_dist from deep_neurographs.utils import util ALIGNED_THRESHOLD = 4.5 @@ -141,7 +140,7 @@ def is_component_aligned(target_graph, pred_graph, nodes, kdtree): for xyz in pred_graph.edges[edge]["xyz"]: hat_xyz = geometry.kdtree_query(kdtree, xyz) hat_swc_id = target_graph.xyz_to_swc(hat_xyz) - d = get_dist(hat_xyz, xyz) + d = geometry.dist(hat_xyz, xyz) dists[hat_swc_id].append(d) # Deterine whether aligned diff --git a/src/deep_neurographs/inference.py b/src/deep_neurographs/inference.py index 6a66275..df168e3 100644 --- a/src/deep_neurographs/inference.py +++ b/src/deep_neurographs/inference.py @@ -132,7 +132,6 @@ def __init__( ) # Set output directory - date = datetime.today().strftime("%Y-%m-%d") self.output_dir = output_dir util.mkdir(self.output_dir, delete=True) if self.log_runtimes: diff --git a/src/deep_neurographs/neurograph.py b/src/deep_neurographs/neurograph.py index 14783b4..0d1b4c4 100644 --- a/src/deep_neurographs/neurograph.py +++ b/src/deep_neurographs/neurograph.py @@ -9,9 +9,7 @@ NOTE: SAVE LABEL UPDATES --- THERE IS A BUG IN FEATURE GENERATION """ -import os import zipfile -from concurrent.futures import ThreadPoolExecutor from copy import deepcopy from io import StringIO @@ -21,10 +19,8 @@ from scipy.spatial import KDTree from deep_neurographs import generate_proposals, geometry -from deep_neurographs.geometry import dist as get_dist from deep_neurographs.groundtruth_generation import init_targets -from deep_neurographs.utils import graph_util as gutil -from deep_neurographs.utils import img_util, swc_util, util +from deep_neurographs.utils import graph_util as gutil, img_util, util class NeuroGraph(nx.Graph): @@ -808,7 +804,7 @@ def dist(self, i, j): Euclidean distance between nodes "i" and "j". """ - return get_dist(self.nodes[i]["xyz"], self.nodes[j]["xyz"]) + return geometry.dist(self.nodes[i]["xyz"], self.nodes[j]["xyz"]) def branches(self, i, ignore_reducibles=True, key="xyz"): branches = list() diff --git a/src/deep_neurographs/utils/util.py b/src/deep_neurographs/utils/util.py index dba2176..a330b04 100644 --- a/src/deep_neurographs/utils/util.py +++ b/src/deep_neurographs/utils/util.py @@ -10,7 +10,6 @@ import json import math -import networkx as nx import os import shutil from io import BytesIO @@ -18,11 +17,13 @@ from zipfile import ZipFile import boto3 +import networkx as nx import numpy as np import psutil from google.cloud import storage -from deep_neurographs.utils import graph_util as gutil, swc_util +from deep_neurographs.utils import graph_util as gutil + # --- os utils --- def mkdir(path, delete=False):