swcgeom 0.16.0__py3-none-any.whl → 0.17.1__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/_version.py +2 -2
- swcgeom/analysis/__init__.py +1 -3
- swcgeom/analysis/feature_extractor.py +16 -15
- swcgeom/analysis/{node_features.py → features.py} +105 -3
- swcgeom/analysis/lmeasure.py +5 -5
- swcgeom/analysis/sholl.py +4 -4
- swcgeom/analysis/trunk.py +12 -11
- swcgeom/analysis/visualization.py +9 -9
- swcgeom/analysis/visualization3d.py +85 -0
- swcgeom/analysis/volume.py +4 -4
- swcgeom/core/branch.py +4 -3
- swcgeom/core/branch_tree.py +3 -4
- swcgeom/core/compartment.py +3 -2
- swcgeom/core/node.py +2 -2
- swcgeom/core/path.py +3 -2
- swcgeom/core/population.py +16 -27
- swcgeom/core/swc.py +11 -10
- swcgeom/core/swc_utils/base.py +8 -17
- swcgeom/core/swc_utils/io.py +7 -6
- swcgeom/core/swc_utils/normalizer.py +4 -3
- swcgeom/core/swc_utils/subtree.py +2 -2
- swcgeom/core/tree.py +22 -34
- swcgeom/core/tree_utils.py +11 -10
- swcgeom/core/tree_utils_impl.py +3 -3
- swcgeom/images/augmentation.py +3 -3
- swcgeom/images/folder.py +10 -16
- swcgeom/images/io.py +76 -111
- swcgeom/transforms/image_stack.py +6 -5
- swcgeom/transforms/images.py +105 -5
- swcgeom/transforms/neurolucida_asc.py +4 -6
- swcgeom/transforms/population.py +1 -3
- swcgeom/transforms/tree.py +8 -7
- swcgeom/transforms/tree_assembler.py +4 -3
- swcgeom/utils/ellipse.py +3 -4
- swcgeom/utils/neuromorpho.py +17 -16
- swcgeom/utils/plotter_2d.py +12 -6
- swcgeom/utils/plotter_3d.py +31 -0
- swcgeom/utils/renderer.py +6 -6
- swcgeom/utils/sdf.py +2 -2
- swcgeom/utils/solid_geometry.py +1 -3
- swcgeom/utils/transforms.py +1 -3
- swcgeom/utils/volumetric_object.py +8 -10
- {swcgeom-0.16.0.dist-info → swcgeom-0.17.1.dist-info}/METADATA +1 -1
- swcgeom-0.17.1.dist-info/RECORD +67 -0
- swcgeom/analysis/branch_features.py +0 -67
- swcgeom/analysis/path_features.py +0 -37
- swcgeom-0.16.0.dist-info/RECORD +0 -67
- {swcgeom-0.16.0.dist-info → swcgeom-0.17.1.dist-info}/LICENSE +0 -0
- {swcgeom-0.16.0.dist-info → swcgeom-0.17.1.dist-info}/WHEEL +0 -0
- {swcgeom-0.16.0.dist-info → swcgeom-0.17.1.dist-info}/top_level.txt +0 -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,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
|
|
File without changes
|
|
File without changes
|