From 445f2be86554f71f2d106586f1f995e17996b2f1 Mon Sep 17 00:00:00 2001 From: DEBREUVE Eric <eric.debreuve@inria.fr> Date: Sun, 8 Mar 2020 20:01:25 +0100 Subject: [PATCH] refactoring --- .gitignore | 2 ++ brick/component/connection.py | 4 ++-- brick/component/extension.py | 2 +- brick/component/glial_cmp.py | 2 -- brick/processing/map_labeling.py | 5 ++--- nutrimorph.py | 2 +- parameters.py | 1 + 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e3375c6..1fde90e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ __material__/ __runtime__/ __version__/ +__when__.txt + data/ mprofile_*.dat diff --git a/brick/component/connection.py b/brick/component/connection.py index 3679293..83c482c 100644 --- a/brick/component/connection.py +++ b/brick/component/connection.py @@ -68,8 +68,8 @@ def ShortestPathFromToN( point: site_h, costs: array_t, candidate_points_fct: Callable, - max_straight_sq_dist: cy_.double = np_.inf, -) -> Tuple[site_path_h, cy_.double]: + max_straight_sq_dist: float = np_.inf, +) -> Tuple[site_path_h, float]: # candidate_points, candidate_indexing = candidate_points_fct( point, max_straight_sq_dist diff --git a/brick/component/extension.py b/brick/component/extension.py index a10a0d6..14fd1a9 100644 --- a/brick/component/extension.py +++ b/brick/component/extension.py @@ -126,7 +126,7 @@ class extension_t(glial_cmp_t): ) @staticmethod - def ExtensionWithSite( + def ExtensionContainingSite( extensions: Sequence[extension_t], site: site_h ) -> Optional[extension_t]: # diff --git a/brick/component/glial_cmp.py b/brick/component/glial_cmp.py index b7327e0..ee5aec2 100644 --- a/brick/component/glial_cmp.py +++ b/brick/component/glial_cmp.py @@ -36,8 +36,6 @@ from brick.general.type import array_t, np_array_picker_h, py_array_picker_h, si from abc import abstractmethod from typing import Dict, List, Optional, Tuple -import numpy as np_ - class glial_cmp_t: # diff --git a/brick/processing/map_labeling.py b/brick/processing/map_labeling.py index d3550d0..478de0b 100644 --- a/brick/processing/map_labeling.py +++ b/brick/processing/map_labeling.py @@ -34,9 +34,6 @@ from brick.general.type import array_t import numpy as np_ -invalid_n_neighbors_c = 27 # Must be positive and higher (strictly) than -# the max number of neighbors in a skeleton - shifts_of_26_neighbors_c = tuple( (i, j, k) for i in (-1, 0, 1) @@ -44,6 +41,8 @@ shifts_of_26_neighbors_c = tuple( for k in (-1, 0, 1) if i != 0 or j != 0 or k != 0 # take every direct neighbors except itself ) +# Must be positive and higher (strictly) than the max number of neighbors +invalid_n_neighbors_c = shifts_of_26_neighbors_c.__len__() + 1 def PartLMap(map_: array_t) -> array_t: diff --git a/nutrimorph.py b/nutrimorph.py index 73ce4bf..53e4d50 100644 --- a/nutrimorph.py +++ b/nutrimorph.py @@ -235,7 +235,7 @@ while should_look_for_connections: max_straight_sq_dist=max_straight_sq_dist_c, ) if length <= max_weighted_length_c: - tgt_extenstion = extension_t.ExtensionWithSite(extensions, path[-1]) + tgt_extenstion = extension_t.ExtensionContainingSite(extensions, path[-1]) cn_.ValidateConnection(tgt_extenstion, extension, path, dijkstra_costs) should_look_for_connections = True print(": Made") diff --git a/parameters.py b/parameters.py index 9b5e81d..67c8e73 100644 --- a/parameters.py +++ b/parameters.py @@ -33,6 +33,7 @@ import skimage.morphology as mp_ data_path = "./data/DIO_6H_6_1.70bis_2.2_3.tif" +channel = 1 with_plot = True soma_low_c = 0.15 -- GitLab