diff --git a/src/deep_neurographs/utils/swc_util.py b/src/deep_neurographs/utils/swc_util.py index 5905dca..ce1eef9 100644 --- a/src/deep_neurographs/utils/swc_util.py +++ b/src/deep_neurographs/utils/swc_util.py @@ -41,7 +41,7 @@ def __init__(self, anisotropy=[1.0, 1.0, 1.0], min_size=0): Parameters ---------- - anisotropy : list[float], optional + anisotropy : List[float], optional Image to world scaling factors applied to xyz coordinates to account for anisotropy of the microscope. The default is [1.0, 1.0, 1.0]. @@ -70,7 +70,7 @@ def load(self, swc_pointer): Returns ------- - list[dict] + List[dict] List of dictionaries whose keys and values are the attribute name and values from an swc file. @@ -102,7 +102,7 @@ def load_from_local_paths(self, swc_paths): Returns ------- - list[dict] + List[dict] List of dictionaries whose keys and values are the attribute name and values from an swc file. @@ -135,7 +135,7 @@ def load_from_local_path(self, path): Returns ------- - list[dict] + List[dict] List of dictionaries whose keys and values are the attribute name and values from an swc file. @@ -156,7 +156,7 @@ def load_from_local_zip(self, zip_path): Paramters --------- - swc_paths : list or dict + swc_paths : Container If swc files are on local machine, list of paths to swc files where each file corresponds to a neuron in the prediction. If swc files are on cloud, then dict with keys "bucket_name" and "path". @@ -284,7 +284,7 @@ def parse(self, content): Parameters ---------- - content : list[str] + content : List[str] List of entries from an swc file. Returns @@ -461,7 +461,7 @@ def write_graph(path, graph, color=None): Returns ------- - list[str] + List[str] List of swc file entries to be written. """ @@ -571,6 +571,29 @@ def make_entry(graph, i, parent, node_to_idx): return entry, node_to_idx +def make_simple_entry(node, parent, xyz, radius=5): + """ + Makes an entry to be written in an swc file. + + Parameters + ---------- + node : int + Node that entry corresponds to. + parent : int + Parent of node "i". + xyz : numpy.ndarray + xyz coordinate to be written to an swc file. + + Returns + ------- + str + Entry of an swc file + + """ + x, y, z = tuple(xyz) + return f"{node} 2 {x} {y} {z} {radius} {parent}" + + def set_radius(graph, i): """ Sets the radius of node "i". @@ -595,28 +618,6 @@ def set_radius(graph, i): return radius -def make_simple_entry(node, parent, xyz, radius=5): - """ - Makes an entry to be written in an swc file. - - Parameters - ---------- - node : int - Node that entry corresponds to. - parent : int - Parent of node "i". - xyz : numpy.ndarray - ... - - Returns - ------- - ... - - """ - x, y, z = tuple(xyz) - return f"{node} 2 {x} {y} {z} {radius} {parent}" - - # --- Miscellaneous --- def to_graph(swc_dict, swc_id=None, set_attrs=False): """