swcgeom 0.16.0__py3-none-any.whl → 0.18.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of swcgeom might be problematic. Click here for more details.
- swcgeom/__init__.py +26 -1
- swcgeom/analysis/__init__.py +21 -8
- swcgeom/analysis/feature_extractor.py +43 -18
- swcgeom/analysis/features.py +250 -0
- swcgeom/analysis/lmeasure.py +48 -12
- swcgeom/analysis/sholl.py +25 -28
- swcgeom/analysis/trunk.py +27 -11
- swcgeom/analysis/visualization.py +24 -9
- swcgeom/analysis/visualization3d.py +100 -0
- swcgeom/analysis/volume.py +19 -4
- swcgeom/core/__init__.py +31 -12
- swcgeom/core/branch.py +19 -3
- swcgeom/core/branch_tree.py +18 -4
- swcgeom/core/compartment.py +18 -2
- swcgeom/core/node.py +32 -3
- swcgeom/core/path.py +21 -9
- swcgeom/core/population.py +58 -29
- swcgeom/core/swc.py +26 -10
- swcgeom/core/swc_utils/__init__.py +21 -7
- swcgeom/core/swc_utils/assembler.py +15 -0
- swcgeom/core/swc_utils/base.py +23 -17
- swcgeom/core/swc_utils/checker.py +19 -12
- swcgeom/core/swc_utils/io.py +24 -7
- swcgeom/core/swc_utils/normalizer.py +20 -4
- swcgeom/core/swc_utils/subtree.py +17 -2
- swcgeom/core/tree.py +56 -40
- swcgeom/core/tree_utils.py +28 -17
- swcgeom/core/tree_utils_impl.py +18 -3
- swcgeom/images/__init__.py +17 -2
- swcgeom/images/augmentation.py +18 -3
- swcgeom/images/contrast.py +15 -0
- swcgeom/images/folder.py +27 -26
- swcgeom/images/io.py +94 -117
- swcgeom/transforms/__init__.py +28 -12
- swcgeom/transforms/base.py +17 -2
- swcgeom/transforms/branch.py +74 -8
- swcgeom/transforms/branch_tree.py +82 -0
- swcgeom/transforms/geometry.py +22 -7
- swcgeom/transforms/image_preprocess.py +15 -0
- swcgeom/transforms/image_stack.py +36 -9
- swcgeom/transforms/images.py +121 -14
- swcgeom/transforms/mst.py +15 -0
- swcgeom/transforms/neurolucida_asc.py +20 -7
- swcgeom/transforms/path.py +15 -0
- swcgeom/transforms/population.py +16 -3
- swcgeom/transforms/tree.py +84 -30
- swcgeom/transforms/tree_assembler.py +23 -7
- swcgeom/utils/__init__.py +27 -12
- swcgeom/utils/debug.py +15 -0
- swcgeom/utils/download.py +59 -21
- swcgeom/utils/dsu.py +15 -0
- swcgeom/utils/ellipse.py +18 -4
- swcgeom/utils/file.py +15 -0
- swcgeom/utils/neuromorpho.py +35 -23
- swcgeom/utils/numpy_helper.py +15 -0
- swcgeom/utils/plotter_2d.py +27 -6
- swcgeom/utils/plotter_3d.py +48 -0
- swcgeom/utils/renderer.py +21 -6
- swcgeom/utils/sdf.py +19 -7
- swcgeom/utils/solid_geometry.py +16 -3
- swcgeom/utils/transforms.py +17 -4
- swcgeom/utils/volumetric_object.py +23 -10
- {swcgeom-0.16.0.dist-info → swcgeom-0.18.3.dist-info}/LICENSE +1 -1
- {swcgeom-0.16.0.dist-info → swcgeom-0.18.3.dist-info}/METADATA +28 -24
- swcgeom-0.18.3.dist-info/RECORD +67 -0
- {swcgeom-0.16.0.dist-info → swcgeom-0.18.3.dist-info}/WHEEL +1 -1
- swcgeom/_version.py +0 -16
- swcgeom/analysis/branch_features.py +0 -67
- swcgeom/analysis/node_features.py +0 -121
- swcgeom/analysis/path_features.py +0 -37
- swcgeom-0.16.0.dist-info/RECORD +0 -67
- {swcgeom-0.16.0.dist-info → swcgeom-0.18.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
swcgeom/__init__.py,sha256=7Hjtjg2r_dRP-oUmNX_Zza1NqV6703L0XnpuhKQ3wcs,939
|
|
2
|
+
swcgeom/analysis/__init__.py,sha256=1Bp93CxYzKqnTLzRdy8GpnhhBf6t8S2sgpEIhOJOj6w,945
|
|
3
|
+
swcgeom/analysis/feature_extractor.py,sha256=8hmwwWCZ8c_XcnmyY--vRygo-OAovIoMuVTHnixX8KA,14855
|
|
4
|
+
swcgeom/analysis/features.py,sha256=NnFRUsMO7mPoBNLQ_kwSWHSfaV1BCOYTZz6VuG2Cfi8,6905
|
|
5
|
+
swcgeom/analysis/lmeasure.py,sha256=RLhRIo3VOQFqisBDetP120SntWSTE2rJ-vL5l-QGT40,28688
|
|
6
|
+
swcgeom/analysis/sholl.py,sha256=uGElY5hXILON8uHX9phGwFeKMjWCtA1GTeoyKStkSPE,7203
|
|
7
|
+
swcgeom/analysis/trunk.py,sha256=f6oH2Xlpn76JjKNsC0DKFsnYGn4FP4YRucCeyUaGgjg,6147
|
|
8
|
+
swcgeom/analysis/visualization.py,sha256=dioNW7Y596xhUPySkr-gbcCzLFm4PPsizKAjEXgAdyI,6216
|
|
9
|
+
swcgeom/analysis/visualization3d.py,sha256=OIUEtxPZpwK8eDEuy8_ezh5x2oQishQ3-aj-dGselAY,3094
|
|
10
|
+
swcgeom/analysis/volume.py,sha256=KLEqE5OWKckdw2qsI8Ugmxi-_jePnE9N9ZN6QFC07y8,5197
|
|
11
|
+
swcgeom/core/__init__.py,sha256=s6hYMtFY5HKviiNkENlEy4o3taxN5Ogq04ceKQgGL6o,1223
|
|
12
|
+
swcgeom/core/branch.py,sha256=xu5J12FjxXSNL3Q_Uiy5qLlMozfcdnkIDO-XyDB_CYg,4764
|
|
13
|
+
swcgeom/core/branch_tree.py,sha256=jFDKkBgaTCT6C4ZsGdihxBp3xC2k9v6wxE43UGW2AuY,2424
|
|
14
|
+
swcgeom/core/compartment.py,sha256=neoM4nyZxPnaHDnxr-T5xItrf6gqctbo8dOawlFQRlM,3850
|
|
15
|
+
swcgeom/core/node.py,sha256=ZVhAQeadPNVpVd8LAVF5i7DWkGsjsigrUdMIUDUp8BY,4376
|
|
16
|
+
swcgeom/core/path.py,sha256=_j9GP7fSaDUeUeFGXPaWDyq5BcQURzTCCh9iuQKiYWM,5065
|
|
17
|
+
swcgeom/core/population.py,sha256=k-sIaYC-m2S82h-rJM0iocdFpQDKuEBuaw6_WNgI_0s,11039
|
|
18
|
+
swcgeom/core/swc.py,sha256=SqJdj-auOBuxOoRxg33DFcigIx8_BuWfeHyWYBQY7xk,7384
|
|
19
|
+
swcgeom/core/tree.py,sha256=Hq4KOFvEWcFqFvGC3D-1f_WKRu6p6P_hfJT5vOVGKXY,13150
|
|
20
|
+
swcgeom/core/tree_utils.py,sha256=2cg3HBn7-6S_J64z9F12CLGVDarpn5epCk3icVWtgEY,8192
|
|
21
|
+
swcgeom/core/tree_utils_impl.py,sha256=1G1qZA7kwWifol8h5cBsFuwh6YA0ZTfpzG5brGwBFs0,2178
|
|
22
|
+
swcgeom/core/swc_utils/__init__.py,sha256=B-oJffxjFZIzIG_9Jh3uG6G_DHtqqkMxIOIU4A_dLEQ,1239
|
|
23
|
+
swcgeom/core/swc_utils/assembler.py,sha256=lrW0vWFSpvL3PGjA80mCSR9XH3RHX2wLyZ1v4Tux4Gw,1470
|
|
24
|
+
swcgeom/core/swc_utils/base.py,sha256=bjH8AOclIAXGecUVxDOrk9jD7NAq1OdkvXgIQLj6UP0,5312
|
|
25
|
+
swcgeom/core/swc_utils/checker.py,sha256=xbzUjHPR5sMHRCA1f9MAd_4xUvyb5NRsJWSB7cPXSdw,3182
|
|
26
|
+
swcgeom/core/swc_utils/io.py,sha256=Btyg0w5VsYL3LFBF59ADsWNbD3EthR4pKEBpThaJDDM,7047
|
|
27
|
+
swcgeom/core/swc_utils/normalizer.py,sha256=egYdZAex8h1SninrWkkKpU9Tu9rmB9uaHwa3u4kasO0,5673
|
|
28
|
+
swcgeom/core/swc_utils/subtree.py,sha256=Jgk39eguBIxhrz3AL1X6pzLfo0tXovNes51D7U4Qw9k,2569
|
|
29
|
+
swcgeom/images/__init__.py,sha256=gwBZzrsswJ2hyRQA72khFk2JPo1JfWko4-huuAYNCOU,705
|
|
30
|
+
swcgeom/images/augmentation.py,sha256=6YuQpuWaarc_bD0Pjz42eFreVjhA2qmeUEK84RBcc_g,4748
|
|
31
|
+
swcgeom/images/contrast.py,sha256=f5EqJJ4tGcG46dm9pMeQm_cM1fYcIXC6qYjcOFxThTc,2741
|
|
32
|
+
swcgeom/images/folder.py,sha256=-WpAvCBZ5qYfFZTWI1e-O7jAGLjm_PyZWV91fegP45E,7025
|
|
33
|
+
swcgeom/images/io.py,sha256=dgu69iqb_Bkk8guLt5TYSOz-lG_WemEOFrRmoZsQTg8,21137
|
|
34
|
+
swcgeom/transforms/__init__.py,sha256=nE4Uyn5vpYyNiMltTiNHDRkyjYbW6B4ToyZOxUj0TU0,1370
|
|
35
|
+
swcgeom/transforms/base.py,sha256=l5DEZjZhjH23Axg8ozJTFzSmNNwIlTfm0XxAOIAQtlE,4696
|
|
36
|
+
swcgeom/transforms/branch.py,sha256=L8O7CwLdY-q_b53vrKfA_nlePh5lKx2kA-foVtQd6sQ,7861
|
|
37
|
+
swcgeom/transforms/branch_tree.py,sha256=i2w16ny70oWbJhq5mHX7wgEVGol1AYKB3P-N5Kh3z2I,2820
|
|
38
|
+
swcgeom/transforms/geometry.py,sha256=xA9RN1oWRV0S1OVC_vxGZOq8CjGLERnlR5vM4_wvUG8,8008
|
|
39
|
+
swcgeom/transforms/image_preprocess.py,sha256=lT5ceaE9IzJjq6vIFh0p1YzsyBYAtqz_ElqErvZvDdE,4243
|
|
40
|
+
swcgeom/transforms/image_stack.py,sha256=Zc9p5MGt8zdkla-RnKdsF64NLgS7cfK9j2qG4ggiSgI,6720
|
|
41
|
+
swcgeom/transforms/images.py,sha256=bPJwtwIcHVECHV0qQBVWRFzTWLKEf31V4TiRgjFrGn8,6139
|
|
42
|
+
swcgeom/transforms/mst.py,sha256=spUuXjglCBnZmR6mIyCBJJGmQbfpx7hb1nndT3_iUG4,6832
|
|
43
|
+
swcgeom/transforms/neurolucida_asc.py,sha256=0WyM9B5qpJ5hjVGKpO8atWpaUhJdLQ0lKMhcJkuOsfM,14699
|
|
44
|
+
swcgeom/transforms/path.py,sha256=SqBPYvCnDc1yd8UCBwyelAXnduNAvJ16pWo9lMoZVI0,1670
|
|
45
|
+
swcgeom/transforms/population.py,sha256=kayuwNs8jWTrHZ4sqoH9HUcLqR0OybJbGtb7HvpFIdw,1389
|
|
46
|
+
swcgeom/transforms/tree.py,sha256=qlYISDuT7DlEQ2uaa1Y-vqb2rbs9JHr9Bays546XuCI,8152
|
|
47
|
+
swcgeom/transforms/tree_assembler.py,sha256=rWm7D7tAhk9UkX1PL_QfXw2-98xlI7cF3IsIyW7eOzQ,5743
|
|
48
|
+
swcgeom/utils/__init__.py,sha256=sduLt0_W5KfoatIQ5Sj26DndwiCQhpPVkZhUVi7akFE,1215
|
|
49
|
+
swcgeom/utils/debug.py,sha256=ZOYLfj32YDjSU1tJrtThWF2SROwYhG2z7j4Fq0q4Dsw,1046
|
|
50
|
+
swcgeom/utils/download.py,sha256=VNJCsXty3NrwPv9CzyA_OkHsEQj4LArkoAuPmW-NX6c,4237
|
|
51
|
+
swcgeom/utils/dsu.py,sha256=tU_hBjSFBXiraJphB_qQ7Rt1pKNFUIbh0kvU_zJ1UaI,2016
|
|
52
|
+
swcgeom/utils/ellipse.py,sha256=o8CZmEhJIy2bejDX2nr92H5vootuLoIkk-sSTG19cAo,3815
|
|
53
|
+
swcgeom/utils/file.py,sha256=6P_jSfpUPulJ2PSHGr-maEZotLvM35egEmH4RRO022Y,3096
|
|
54
|
+
swcgeom/utils/neuromorpho.py,sha256=AE3wlDckLFYI9MuQv4XlA0LYMLpGUm8OQLNnym-DQB4,19617
|
|
55
|
+
swcgeom/utils/numpy_helper.py,sha256=wsY8-4naAOMfKQ2O-dVRcblM2NrezhjsUEfUzT2holk,2006
|
|
56
|
+
swcgeom/utils/plotter_2d.py,sha256=ojhEUpMbP9-7XE64CNb4kVoUS6WoFrYlmqumbGr79go,4450
|
|
57
|
+
swcgeom/utils/plotter_3d.py,sha256=6IU_Oyls5chq6ol30R4zp85oK_31yHB6vVp09D6pYGA,1458
|
|
58
|
+
swcgeom/utils/renderer.py,sha256=aDp2HZRUe9GDNdslewLKh6OCTKfz8G_6c4AmK14EajQ,4801
|
|
59
|
+
swcgeom/utils/sdf.py,sha256=C8uH9R2qMYeXgy1icHcaGQnjqQbU-0d6gWNw7tfge10,11156
|
|
60
|
+
swcgeom/utils/solid_geometry.py,sha256=2c8MNCfvkF7HAhmLPQXvHF8uexoNJBeFh6Qa9n6M8CQ,2980
|
|
61
|
+
swcgeom/utils/transforms.py,sha256=UKGeCv8O109mcBk1_opnwABLYVpmfF8sT_f5Mx5APSM,7538
|
|
62
|
+
swcgeom/utils/volumetric_object.py,sha256=Y_rEAzeCozJWwXicerwRElwotTgQwHlz9TChzsG9J1I,15683
|
|
63
|
+
swcgeom-0.18.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
64
|
+
swcgeom-0.18.3.dist-info/METADATA,sha256=jAOt9X1yBoGfypR3HTr0NkiyoHpNPmuQ_rtoqJN1LSo,2301
|
|
65
|
+
swcgeom-0.18.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
66
|
+
swcgeom-0.18.3.dist-info/top_level.txt,sha256=hmLyUXWS61Gxl07haswFEKKefYPBVJYlUlol8ghNkjY,8
|
|
67
|
+
swcgeom-0.18.3.dist-info/RECORD,,
|
swcgeom/_version.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools_scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
TYPE_CHECKING = False
|
|
4
|
-
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple, Union
|
|
6
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
-
else:
|
|
8
|
-
VERSION_TUPLE = object
|
|
9
|
-
|
|
10
|
-
version: str
|
|
11
|
-
__version__: str
|
|
12
|
-
__version_tuple__: VERSION_TUPLE
|
|
13
|
-
version_tuple: VERSION_TUPLE
|
|
14
|
-
|
|
15
|
-
__version__ = version = '0.16.0'
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 16, 0)
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"""Branch anlysis of tree."""
|
|
2
|
-
|
|
3
|
-
from functools import cached_property
|
|
4
|
-
from typing import List, TypeVar
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import numpy.typing as npt
|
|
8
|
-
|
|
9
|
-
from swcgeom.core import Branch, Tree
|
|
10
|
-
|
|
11
|
-
__all__ = ["BranchFeatures"]
|
|
12
|
-
|
|
13
|
-
T = TypeVar("T", bound=Branch)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class BranchFeatures:
|
|
17
|
-
"""Analysis bransh of tree."""
|
|
18
|
-
|
|
19
|
-
tree: Tree
|
|
20
|
-
|
|
21
|
-
def __init__(self, tree: Tree) -> None:
|
|
22
|
-
self.tree = tree
|
|
23
|
-
|
|
24
|
-
def get_count(self) -> int:
|
|
25
|
-
return len(self._branches)
|
|
26
|
-
|
|
27
|
-
def get_length(self) -> npt.NDArray[np.float32]:
|
|
28
|
-
"""Get length of branches."""
|
|
29
|
-
length = [br.length() for br in self._branches]
|
|
30
|
-
return np.array(length, dtype=np.float32)
|
|
31
|
-
|
|
32
|
-
def get_tortuosity(self) -> npt.NDArray[np.float32]:
|
|
33
|
-
"""Get tortuosity of path."""
|
|
34
|
-
return np.array([br.tortuosity() for br in self._branches], dtype=np.float32)
|
|
35
|
-
|
|
36
|
-
def get_angle(self, eps: float = 1e-7) -> npt.NDArray[np.float32]:
|
|
37
|
-
"""Get agnle between branches.
|
|
38
|
-
|
|
39
|
-
Returns
|
|
40
|
-
-------
|
|
41
|
-
angle : npt.NDArray[np.float32]
|
|
42
|
-
An array of shape (N, N), which N is length of branches.
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
return self.calc_angle(self._branches, eps=eps)
|
|
46
|
-
|
|
47
|
-
@staticmethod
|
|
48
|
-
def calc_angle(branches: List[T], eps: float = 1e-7) -> npt.NDArray[np.float32]:
|
|
49
|
-
"""Calc agnle between branches.
|
|
50
|
-
|
|
51
|
-
Returns
|
|
52
|
-
-------
|
|
53
|
-
angle : npt.NDArray[np.float32]
|
|
54
|
-
An array of shape (N, N), which N is length of branches.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
vector = np.array([br[-1].xyz() - br[0].xyz() for br in branches])
|
|
58
|
-
vector_dot = np.matmul(vector, vector.T)
|
|
59
|
-
vector_norm = np.linalg.norm(vector, ord=2, axis=1, keepdims=True)
|
|
60
|
-
vector_norm_dot = np.matmul(vector_norm, vector_norm.T) + eps
|
|
61
|
-
arccos = np.clip(vector_dot / vector_norm_dot, -1, 1)
|
|
62
|
-
angle = np.arccos(arccos)
|
|
63
|
-
return angle
|
|
64
|
-
|
|
65
|
-
@cached_property
|
|
66
|
-
def _branches(self) -> List[Tree.Branch]:
|
|
67
|
-
return self.tree.get_branches()
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"""Depth distribution of tree."""
|
|
2
|
-
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from functools import cached_property
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import numpy.typing as npt
|
|
8
|
-
from typing_extensions import Self
|
|
9
|
-
|
|
10
|
-
from swcgeom.core import BranchTree, Tree
|
|
11
|
-
|
|
12
|
-
__all__ = ["NodeFeatures", "BifurcationFeatures", "TipFeatures"]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class NodeFeatures:
|
|
16
|
-
"""Evaluate node feature of tree."""
|
|
17
|
-
|
|
18
|
-
tree: Tree
|
|
19
|
-
|
|
20
|
-
@cached_property
|
|
21
|
-
def _branch_tree(self) -> BranchTree:
|
|
22
|
-
return BranchTree.from_tree(self.tree)
|
|
23
|
-
|
|
24
|
-
def __init__(self, tree: Tree) -> None:
|
|
25
|
-
self.tree = tree
|
|
26
|
-
|
|
27
|
-
def get_count(self) -> npt.NDArray[np.float32]:
|
|
28
|
-
"""Get number of nodes.
|
|
29
|
-
|
|
30
|
-
Returns
|
|
31
|
-
-------
|
|
32
|
-
count : array of shape (1,)
|
|
33
|
-
"""
|
|
34
|
-
return np.array([self.tree.number_of_nodes()], dtype=np.float32)
|
|
35
|
-
|
|
36
|
-
def get_radial_distance(self) -> npt.NDArray[np.float32]:
|
|
37
|
-
"""Get the end-to-end straight-line distance to soma.
|
|
38
|
-
|
|
39
|
-
Returns
|
|
40
|
-
-------
|
|
41
|
-
radial_distance : npt.NDArray[np.float32]
|
|
42
|
-
Array of shape (N,).
|
|
43
|
-
"""
|
|
44
|
-
xyz = self.tree.xyz() - self.tree.soma().xyz()
|
|
45
|
-
radial_distance = np.linalg.norm(xyz, axis=1)
|
|
46
|
-
return radial_distance
|
|
47
|
-
|
|
48
|
-
def get_branch_order(self) -> npt.NDArray[np.int32]:
|
|
49
|
-
"""Get branch order of criticle nodes of tree.
|
|
50
|
-
|
|
51
|
-
Branch order is the number of bifurcations between current
|
|
52
|
-
position and the root.
|
|
53
|
-
|
|
54
|
-
Criticle node means that soma, bifucation nodes, tips.
|
|
55
|
-
|
|
56
|
-
Returns
|
|
57
|
-
-------
|
|
58
|
-
order : npt.NDArray[np.int32]
|
|
59
|
-
Array of shape (N,), which k is the number of branchs.
|
|
60
|
-
"""
|
|
61
|
-
order = np.zeros_like(self._branch_tree.id(), dtype=np.int32)
|
|
62
|
-
|
|
63
|
-
def assign_depth(n: Tree.Node, pre_depth: int | None) -> int:
|
|
64
|
-
cur_order = pre_depth + 1 if pre_depth is not None else 0
|
|
65
|
-
order[n.id] = cur_order
|
|
66
|
-
return cur_order
|
|
67
|
-
|
|
68
|
-
self._branch_tree.traverse(enter=assign_depth)
|
|
69
|
-
return order
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class _SubsetNodesFeatures(ABC):
|
|
73
|
-
_features: NodeFeatures
|
|
74
|
-
|
|
75
|
-
@property
|
|
76
|
-
@abstractmethod
|
|
77
|
-
def nodes(self) -> npt.NDArray[np.bool_]:
|
|
78
|
-
raise NotImplementedError()
|
|
79
|
-
|
|
80
|
-
def __init__(self, features: NodeFeatures) -> None:
|
|
81
|
-
self._features = features
|
|
82
|
-
|
|
83
|
-
def get_count(self) -> npt.NDArray[np.float32]:
|
|
84
|
-
"""Get number of nodes.
|
|
85
|
-
|
|
86
|
-
Returns
|
|
87
|
-
-------
|
|
88
|
-
count : npt.NDArray[np.float32]
|
|
89
|
-
Array of shape (1,).
|
|
90
|
-
"""
|
|
91
|
-
return np.array([np.count_nonzero(self.nodes)], dtype=np.float32)
|
|
92
|
-
|
|
93
|
-
def get_radial_distance(self) -> npt.NDArray[np.float32]:
|
|
94
|
-
"""Get the end-to-end straight-line distance to soma.
|
|
95
|
-
|
|
96
|
-
Returns
|
|
97
|
-
-------
|
|
98
|
-
radial_distance : npt.NDArray[np.float32]
|
|
99
|
-
Array of shape (N,).
|
|
100
|
-
"""
|
|
101
|
-
return self._features.get_radial_distance()[self.nodes]
|
|
102
|
-
|
|
103
|
-
@classmethod
|
|
104
|
-
def from_tree(cls, tree: Tree) -> Self:
|
|
105
|
-
return cls(NodeFeatures(tree))
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
class BifurcationFeatures(_SubsetNodesFeatures):
|
|
109
|
-
"""Evaluate bifurcation node feature of tree."""
|
|
110
|
-
|
|
111
|
-
@cached_property
|
|
112
|
-
def nodes(self) -> npt.NDArray[np.bool_]:
|
|
113
|
-
return np.array([n.is_bifurcation() for n in self._features.tree])
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
class TipFeatures(_SubsetNodesFeatures):
|
|
117
|
-
"""Evaluate tip node feature of tree."""
|
|
118
|
-
|
|
119
|
-
@cached_property
|
|
120
|
-
def nodes(self) -> npt.NDArray[np.bool_]:
|
|
121
|
-
return np.array([n.is_tip() for n in self._features.tree])
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"""Depth distribution of tree."""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
from functools import cached_property
|
|
5
|
-
from typing import List
|
|
6
|
-
|
|
7
|
-
import numpy as np
|
|
8
|
-
import numpy.typing as npt
|
|
9
|
-
|
|
10
|
-
from swcgeom.core import Tree
|
|
11
|
-
|
|
12
|
-
__all__ = ["PathFeatures"]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class PathFeatures:
|
|
16
|
-
"""Path analysis of tree."""
|
|
17
|
-
|
|
18
|
-
tree: Tree
|
|
19
|
-
|
|
20
|
-
def __init__(self, tree: Tree) -> None:
|
|
21
|
-
self.tree = tree
|
|
22
|
-
|
|
23
|
-
def get_count(self) -> int:
|
|
24
|
-
return len(self._paths)
|
|
25
|
-
|
|
26
|
-
def get_length(self) -> npt.NDArray[np.float32]:
|
|
27
|
-
"""Get length of paths."""
|
|
28
|
-
length = [path.length() for path in self._paths]
|
|
29
|
-
return np.array(length, dtype=np.float32)
|
|
30
|
-
|
|
31
|
-
def get_tortuosity(self) -> npt.NDArray[np.float32]:
|
|
32
|
-
"""Get tortuosity of path."""
|
|
33
|
-
return np.array([path.tortuosity() for path in self._paths], dtype=np.float32)
|
|
34
|
-
|
|
35
|
-
@cached_property
|
|
36
|
-
def _paths(self) -> List[Tree.Path]:
|
|
37
|
-
return self.tree.get_paths()
|
swcgeom-0.16.0.dist-info/RECORD
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
swcgeom/__init__.py,sha256=z88Zwcjv-ii7c7dYd9QPg9XrUVorQjtrgGbQCsEnQhc,265
|
|
2
|
-
swcgeom/_version.py,sha256=6rRRmvuDj83YMwAXEQTx-SPTN2ocQjA6cw2_dMCfweM,413
|
|
3
|
-
swcgeom/analysis/__init__.py,sha256=esL_poW8u-_bmp7vR9ldcumX3_xodtaVfM1USqxQo5w,377
|
|
4
|
-
swcgeom/analysis/branch_features.py,sha256=s6PTMwwvxrVtZXRZlQbUSIw4M9-1IG63kf-Nxc0tMB0,1958
|
|
5
|
-
swcgeom/analysis/feature_extractor.py,sha256=coe07_bJau96BkimcnXzuf4KqjY5_QRLwqaumFsu_tQ,14031
|
|
6
|
-
swcgeom/analysis/lmeasure.py,sha256=GI5HoIXkRp_GEDHd_JXJOMeAtZ26HP6lbSfF_0L-2r8,27559
|
|
7
|
-
swcgeom/analysis/node_features.py,sha256=fevnyrF-t4PX39ifLypiDW6EUWB8i-a3PpBnQZU3VOc,3407
|
|
8
|
-
swcgeom/analysis/path_features.py,sha256=iE21HBxAoGLxk_qK7MBwQhyUOBqNPcnk4urVHr9SVqk,889
|
|
9
|
-
swcgeom/analysis/sholl.py,sha256=KeUyEXLatHjmn4hOSs8y_0o8UKDq9VoIufJ_81SOtgw,7249
|
|
10
|
-
swcgeom/analysis/trunk.py,sha256=L2tjUIUmrRQpah_W3ZETGWd16bDXJ5F8Sk2XBNGms0Q,5558
|
|
11
|
-
swcgeom/analysis/visualization.py,sha256=mKOpzTPkLpr1ggGL1MZPZRTG92GEg4idLT4eN5z5KOs,5654
|
|
12
|
-
swcgeom/analysis/volume.py,sha256=nWPR7wGOk3Wl5eh97YMws0X-2jk8K7lmFp4-03wL3lY,4628
|
|
13
|
-
swcgeom/core/__init__.py,sha256=BEfFBnpaKnJOBID5G5kpGcL7_E1Fj0eZZDITDVwvmRY,445
|
|
14
|
-
swcgeom/core/branch.py,sha256=NchxRgXpFv_ImShvQBPU_9xNzufTrPMvEYmx7d46JNA,4162
|
|
15
|
-
swcgeom/core/branch_tree.py,sha256=Ece6q1VNCRLLMj29N_MjXmmlHT8h4tpWCuDE0uSgKJo,1873
|
|
16
|
-
swcgeom/core/compartment.py,sha256=-2EYkGfqN12he2dsrtO1afC52Bk_fMD5aRLO_useGCQ,3248
|
|
17
|
-
swcgeom/core/node.py,sha256=Kwqoh_WMBLIt2WNDwF-7EwS-C8lONG5krGPmmdHwhvY,3329
|
|
18
|
-
swcgeom/core/path.py,sha256=mxexT7eEHpRaCapE4t0dzfQGgW_zPPzn6N1MkD-jLgI,4579
|
|
19
|
-
swcgeom/core/population.py,sha256=MVVAgGki9SQYMuEJpWyG0eBX4ImR2wpfvWxMqAnXRa8,9824
|
|
20
|
-
swcgeom/core/swc.py,sha256=lSYxAa25l6O8WZ9JtSSET-RZMr6EA1Tq_aXL_x0H9Rc,6795
|
|
21
|
-
swcgeom/core/tree.py,sha256=fQM_Z5-bWsh55hS1pde52tSjKE9-aZY75wbKmDOOQcQ,12195
|
|
22
|
-
swcgeom/core/tree_utils.py,sha256=WWh7uizkyG0u7Zs6ZmkSLPYBsU4XC-gqPeOiVGyaqGE,7749
|
|
23
|
-
swcgeom/core/tree_utils_impl.py,sha256=kN2ByjqqQtZUfmC_ac25tXOaE-CMiV2lP58VxFphLEU,1616
|
|
24
|
-
swcgeom/core/swc_utils/__init__.py,sha256=qghRxjtzvq5KKfN4HhvLpZNsGPfZQu-Jj2x62_5-TbQ,575
|
|
25
|
-
swcgeom/core/swc_utils/assembler.py,sha256=XtjEWz_iAOMpQzLnErCiCjbnqrbB7JA4t2-LLi2R4rQ,889
|
|
26
|
-
swcgeom/core/swc_utils/base.py,sha256=6jNf1EeMz7yJQr3rYSi5EuU2ZPjeefB9vIRFaY53PbA,4788
|
|
27
|
-
swcgeom/core/swc_utils/checker.py,sha256=yuLPRoSt9c7No4GGePa05kxjGFCs0zYS7oB1HadNeMI,2852
|
|
28
|
-
swcgeom/core/swc_utils/io.py,sha256=6_--Qoe8kDja4PWsjwqRAvPJZNMFILFgauHaeWeGikU,6444
|
|
29
|
-
swcgeom/core/swc_utils/normalizer.py,sha256=_Ysi8bSJ2JBnIGB8o6BvAg2mcz6xuJp9rgNLZqpLuR8,5083
|
|
30
|
-
swcgeom/core/swc_utils/subtree.py,sha256=43QITYvgXu3b_kfIod2Irrj3dSfrA-gTFev5VxzRafI,1995
|
|
31
|
-
swcgeom/images/__init__.py,sha256=QBP1ZGGo2nWAcV7Krz-vbvW_jN4ChqXrrpoScXcUURs,96
|
|
32
|
-
swcgeom/images/augmentation.py,sha256=cV4k4KR_WcsRajyr0DuhHVDRRZcN4FQ7OIzB_rb2FUo,4173
|
|
33
|
-
swcgeom/images/contrast.py,sha256=ViZVW6XI-l2sLVTODLRLtHinv_7lVgtH-xZmaw1nQLw,2160
|
|
34
|
-
swcgeom/images/folder.py,sha256=YY9YjF17nDwOQEXhzFe-Dj0zPTcG0WP1-gisscImmYg,6674
|
|
35
|
-
swcgeom/images/io.py,sha256=s7YgzlVbl1fTI0PvW09p4_Z-hDdU9Ofh8d99nyhMyY4,21445
|
|
36
|
-
swcgeom/transforms/__init__.py,sha256=1rr4X--qY_lBi7l7_NHyvvkoWpQOQOqkioRT8I20olI,562
|
|
37
|
-
swcgeom/transforms/base.py,sha256=gN5Iqi-OHkYrsjllSOdxI6Yzav3jJGoi6kUPy-38FAs,4101
|
|
38
|
-
swcgeom/transforms/branch.py,sha256=R0rVti--u70IiUKyHSx6MsDYJyy6zSCf18Uia2Cmh28,5410
|
|
39
|
-
swcgeom/transforms/geometry.py,sha256=XR73fO_8T7otUFIllqKOWW0OnrsXBc7yA01oDT99yMc,7385
|
|
40
|
-
swcgeom/transforms/image_preprocess.py,sha256=ZVPpRoO69dmLF5K7CWsGaQJXB2G5gxdvA-FcDmfz4yQ,3662
|
|
41
|
-
swcgeom/transforms/image_stack.py,sha256=RIldGAOI3QeoeBtr0VKeBKJVg-fWSmzWll63SvsaTfI,5775
|
|
42
|
-
swcgeom/transforms/images.py,sha256=ia6h8L7rIubNb02YlbOa-CTScttQJmiS5dHT4D2HpWg,2679
|
|
43
|
-
swcgeom/transforms/mst.py,sha256=Oc_HnaXjg5EXC7ZnOPneHX0-rXizDAEUcjq63GTj-ac,6251
|
|
44
|
-
swcgeom/transforms/neurolucida_asc.py,sha256=O4fK1OMropPnIEVdMenbyT_sV39gEGIv_6vIl6yUOVg,14146
|
|
45
|
-
swcgeom/transforms/path.py,sha256=Gk2iunGQMX7vE83bdo8xoDO-KAT1Vvep0iZs7oFLzFQ,1089
|
|
46
|
-
swcgeom/transforms/population.py,sha256=EmZ6ntuOKe8mXJxMW7nCUA-w2DVlEVe2n0IOVz49tCY,833
|
|
47
|
-
swcgeom/transforms/tree.py,sha256=YzLvKUwTOj92286jHah0CtRYQIxHiNiMGKcgsc_dB0E,6333
|
|
48
|
-
swcgeom/transforms/tree_assembler.py,sha256=vi_X9CNo5IxHP5J7bRl2z91PWufU6HmYlz1iyfdPUxE,5121
|
|
49
|
-
swcgeom/utils/__init__.py,sha256=LXL0wqq6-ggNweZrftp2lrNHCmVJ6LHIto3DuwlYz3c,466
|
|
50
|
-
swcgeom/utils/debug.py,sha256=qay2qJpViLX82mzxdndxQFn-pi1vaEj9CbLGuGt8Y9k,465
|
|
51
|
-
swcgeom/utils/download.py,sha256=By2qZezo6h1Ke_4YpSIhDgcisOrpjVqRmNzbhynC2xs,2834
|
|
52
|
-
swcgeom/utils/dsu.py,sha256=3aCbtpnl_D0OXnowTS8-kuwnCS4BKBYL5ECiFQ1fUW8,1435
|
|
53
|
-
swcgeom/utils/ellipse.py,sha256=LB3q5CIy75GEUdTauIpKySwIHaDrwXzzkBhOCnjJ8Vw,3259
|
|
54
|
-
swcgeom/utils/file.py,sha256=1hchQDsPgn-i-Vz5OQtcogxav_ajCQ_OaEZCLmqczRg,2515
|
|
55
|
-
swcgeom/utils/neuromorpho.py,sha256=xfQ5npDsI_3UHMFbzrBNU453ZG6C6Y271NvU6cExfuc,19107
|
|
56
|
-
swcgeom/utils/numpy_helper.py,sha256=xuvXpZgP-ZeuwTvPFD3DIxwJ5BK4fMCU7k5_5fUHaWE,1425
|
|
57
|
-
swcgeom/utils/plotter_2d.py,sha256=R34_cLfcx_ycPuXS4D0n6ERse7mmzcnhMlkz8KU4yk4,3740
|
|
58
|
-
swcgeom/utils/renderer.py,sha256=yGEu2SBvUQCVwsU8MT273HHgQ9uk5R0Pmo_bJaTN5yU,4233
|
|
59
|
-
swcgeom/utils/sdf.py,sha256=zNDgwXKRNIVcV4ORMmDXup6Bhf_vlHqwa-b3WZn6KhE,10684
|
|
60
|
-
swcgeom/utils/solid_geometry.py,sha256=TV02jhcoCLCqtYA9hfE50LFD_VRfixMiOSiHB5Jb2_U,2431
|
|
61
|
-
swcgeom/utils/transforms.py,sha256=PmP5fL_iVguq4GR2aqXhM0TeCsiFVnrPZMZG6zLohrE,6983
|
|
62
|
-
swcgeom/utils/volumetric_object.py,sha256=DVRGGmQrAL0oaW6hbNtp5TStbic9DfyJdCzsv2FNw2c,15134
|
|
63
|
-
swcgeom-0.16.0.dist-info/LICENSE,sha256=JPtohhZ4XURqoKI0ZqnMYb7dobCOoZR_n5EpnaLTp3E,11344
|
|
64
|
-
swcgeom-0.16.0.dist-info/METADATA,sha256=cSs43xlPOCFXa9GcEGPGUE0tjDo6vDtskZ8IvlZAcuA,2332
|
|
65
|
-
swcgeom-0.16.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
66
|
-
swcgeom-0.16.0.dist-info/top_level.txt,sha256=hmLyUXWS61Gxl07haswFEKKefYPBVJYlUlol8ghNkjY,8
|
|
67
|
-
swcgeom-0.16.0.dist-info/RECORD,,
|
|
File without changes
|