swcgeom 0.15.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.

Files changed (72) hide show
  1. swcgeom/__init__.py +26 -1
  2. swcgeom/analysis/__init__.py +21 -8
  3. swcgeom/analysis/feature_extractor.py +43 -18
  4. swcgeom/analysis/features.py +250 -0
  5. swcgeom/analysis/lmeasure.py +857 -0
  6. swcgeom/analysis/sholl.py +55 -29
  7. swcgeom/analysis/trunk.py +27 -11
  8. swcgeom/analysis/visualization.py +24 -9
  9. swcgeom/analysis/visualization3d.py +100 -0
  10. swcgeom/analysis/volume.py +19 -4
  11. swcgeom/core/__init__.py +32 -9
  12. swcgeom/core/branch.py +28 -7
  13. swcgeom/core/branch_tree.py +18 -4
  14. swcgeom/core/{segment.py → compartment.py} +31 -10
  15. swcgeom/core/node.py +31 -10
  16. swcgeom/core/path.py +37 -10
  17. swcgeom/core/population.py +103 -34
  18. swcgeom/core/swc.py +26 -10
  19. swcgeom/core/swc_utils/__init__.py +21 -7
  20. swcgeom/core/swc_utils/assembler.py +27 -1
  21. swcgeom/core/swc_utils/base.py +25 -12
  22. swcgeom/core/swc_utils/checker.py +31 -14
  23. swcgeom/core/swc_utils/io.py +24 -7
  24. swcgeom/core/swc_utils/normalizer.py +20 -4
  25. swcgeom/core/swc_utils/subtree.py +17 -2
  26. swcgeom/core/tree.py +85 -72
  27. swcgeom/core/tree_utils.py +31 -16
  28. swcgeom/core/tree_utils_impl.py +18 -3
  29. swcgeom/images/__init__.py +17 -2
  30. swcgeom/images/augmentation.py +24 -4
  31. swcgeom/images/contrast.py +122 -0
  32. swcgeom/images/folder.py +97 -39
  33. swcgeom/images/io.py +108 -121
  34. swcgeom/transforms/__init__.py +28 -10
  35. swcgeom/transforms/base.py +17 -2
  36. swcgeom/transforms/branch.py +74 -8
  37. swcgeom/transforms/branch_tree.py +82 -0
  38. swcgeom/transforms/geometry.py +22 -7
  39. swcgeom/transforms/image_preprocess.py +115 -0
  40. swcgeom/transforms/image_stack.py +37 -13
  41. swcgeom/transforms/images.py +184 -7
  42. swcgeom/transforms/mst.py +20 -5
  43. swcgeom/transforms/neurolucida_asc.py +508 -0
  44. swcgeom/transforms/path.py +15 -0
  45. swcgeom/transforms/population.py +16 -3
  46. swcgeom/transforms/tree.py +89 -31
  47. swcgeom/transforms/tree_assembler.py +23 -7
  48. swcgeom/utils/__init__.py +27 -11
  49. swcgeom/utils/debug.py +15 -0
  50. swcgeom/utils/download.py +59 -21
  51. swcgeom/utils/dsu.py +15 -0
  52. swcgeom/utils/ellipse.py +18 -4
  53. swcgeom/utils/file.py +15 -0
  54. swcgeom/utils/neuromorpho.py +439 -302
  55. swcgeom/utils/numpy_helper.py +29 -4
  56. swcgeom/utils/plotter_2d.py +151 -0
  57. swcgeom/utils/plotter_3d.py +48 -0
  58. swcgeom/utils/renderer.py +49 -145
  59. swcgeom/utils/sdf.py +24 -8
  60. swcgeom/utils/solid_geometry.py +16 -3
  61. swcgeom/utils/transforms.py +17 -4
  62. swcgeom/utils/volumetric_object.py +23 -10
  63. {swcgeom-0.15.0.dist-info → swcgeom-0.18.3.dist-info}/LICENSE +1 -1
  64. {swcgeom-0.15.0.dist-info → swcgeom-0.18.3.dist-info}/METADATA +28 -24
  65. swcgeom-0.18.3.dist-info/RECORD +67 -0
  66. {swcgeom-0.15.0.dist-info → swcgeom-0.18.3.dist-info}/WHEEL +1 -1
  67. swcgeom/_version.py +0 -16
  68. swcgeom/analysis/branch_features.py +0 -67
  69. swcgeom/analysis/node_features.py +0 -121
  70. swcgeom/analysis/path_features.py +0 -37
  71. swcgeom-0.15.0.dist-info/RECORD +0 -62
  72. {swcgeom-0.15.0.dist-info → swcgeom-0.18.3.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,18 @@
1
+ # Copyright 2022-2025 Zexin Yuan
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
1
16
  """Volumetric object.
2
17
 
3
18
  This library implements the calculation of volumes for any shape
@@ -16,7 +31,7 @@ computations.
16
31
 
17
32
  import warnings
18
33
  from abc import ABC, abstractmethod
19
- from typing import Generic, Optional, Tuple, TypeVar
34
+ from typing import Generic, Optional, TypeVar
20
35
 
21
36
  import numpy as np
22
37
  import numpy.typing as npt
@@ -95,7 +110,7 @@ class VolMCObject(VolObject, ABC):
95
110
  self.n_samples = n_samples
96
111
 
97
112
  @abstractmethod
98
- def sample(self, n: int) -> Tuple[npt.NDArray[np.float32], float]:
113
+ def sample(self, n: int) -> tuple[npt.NDArray[np.float32], float]:
99
114
  """Sample points.
100
115
 
101
116
  Parameters
@@ -172,7 +187,7 @@ class VolSDFObject(VolMCObject):
172
187
  super().__init__(**kwargs)
173
188
  self.sdf = sdf
174
189
 
175
- def sample(self, n: int) -> Tuple[npt.NDArray[np.float32], float]:
190
+ def sample(self, n: int) -> tuple[npt.NDArray[np.float32], float]:
176
191
  (min_x, min_y, min_z), (max_x, max_y, max_z) = self.sdf.bounding_box()
177
192
  samples = np.random.uniform(
178
193
  (min_x, min_y, min_z), (max_x, max_y, max_z), size=(n, 3)
@@ -186,17 +201,17 @@ class VolSDFObject(VolMCObject):
186
201
  def union(self, obj: VolObject) -> VolObject:
187
202
  if isinstance(obj, VolSDFObject):
188
203
  return VolSDFUnion(self, obj)
189
- return super().union(obj)
204
+ raise NotImplementedError()
190
205
 
191
206
  def intersect(self, obj: VolObject) -> VolObject:
192
207
  if isinstance(obj, VolSDFObject):
193
208
  return VolSDFIntersection(self, obj)
194
- return super().intersect(obj)
209
+ raise NotImplementedError()
195
210
 
196
211
  def subtract(self, obj: VolObject) -> VolObject:
197
212
  if isinstance(obj, VolSDFObject):
198
213
  return VolSDFDifference(self, obj)
199
- return super().subtract(obj)
214
+ raise NotImplementedError()
200
215
 
201
216
 
202
217
  T = TypeVar("T", bound=VolSDFObject)
@@ -386,9 +401,7 @@ class VolSphere2Intersection(VolSDFIntersection[VolSphere, VolSphere]):
386
401
  return VolSphere.calc_volume(min(r1, r2))
387
402
 
388
403
  part1 = (np.pi / (12 * d)) * (r1 + r2 - d) ** 2
389
- part2 = (
390
- d**2 + 2 * d * r1 - 3 * r1**2 + 2 * d * r2 - 3 * r2**2 + 6 * r1 * r2
391
- )
404
+ part2 = d**2 + 2 * d * r1 - 3 * r1**2 + 2 * d * r2 - 3 * r2**2 + 6 * r1 * r2
392
405
  return part1 * part2
393
406
 
394
407
 
@@ -497,7 +510,7 @@ class VolSphereFrustumConeUnion(VolSDFUnion[VolSphere, VolFrustumCone]):
497
510
  )
498
511
 
499
512
 
500
- def _tp3f(x: npt.NDArray) -> Tuple[float, float, float]:
513
+ def _tp3f(x: npt.NDArray) -> tuple[float, float, float]:
501
514
  """Convert to tuple of 3 floats."""
502
515
 
503
516
  assert len(x) == 3
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [2024] [Zexin Yuan]
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,33 +1,33 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: swcgeom
3
- Version: 0.15.0
3
+ Version: 0.18.3
4
4
  Summary: Neuron geometry library for swc format
5
- Author-email: yzx9 <yuan.zx@outlook.com>
5
+ Author-email: yzx9 <pypi@yzx9.xyz>
6
6
  License: Apache-2.0
7
7
  Project-URL: repository, https://github.com/yzx9/swcgeom
8
8
  Keywords: neuronscience,neuron,neuroanatomy,neuron-morphology
9
9
  Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: imagecodecs >=2023.3.16
13
- Requires-Dist: matplotlib >=3.5.2
14
- Requires-Dist: numpy >=1.22.3
15
- Requires-Dist: pandas >=1.4.2
16
- Requires-Dist: pynrrd >=1.0.0
17
- Requires-Dist: scipy >=1.9.1
18
- Requires-Dist: sdflit >=0.2.1
19
- Requires-Dist: seaborn >=0.12.0
20
- Requires-Dist: tifffile >=2022.8.12
21
- Requires-Dist: typing-extensions >=4.4.0
22
- Requires-Dist: v3d-py-helper >=0.1.0
12
+ Requires-Dist: imagecodecs>=2023.3.16
13
+ Requires-Dist: matplotlib>=3.5.2
14
+ Requires-Dist: numpy>=1.22.3
15
+ Requires-Dist: pandas>=1.4.2
16
+ Requires-Dist: pynrrd>=1.1.0
17
+ Requires-Dist: scipy>=1.9.1
18
+ Requires-Dist: sdflit>=0.2.1
19
+ Requires-Dist: seaborn>=0.12.0
20
+ Requires-Dist: tifffile>=2022.8.12
21
+ Requires-Dist: typing_extensions>=4.4.0
22
+ Requires-Dist: tqdm>=4.46.1
23
+ Requires-Dist: v3d-py-helper>=0.4.1
23
24
  Provides-Extra: all
24
- Requires-Dist: beautifulsoup4 >=4.11.1 ; extra == 'all'
25
- Requires-Dist: certifi >=2023.5.7 ; extra == 'all'
26
- Requires-Dist: chardet >=5.2.0 ; extra == 'all'
27
- Requires-Dist: lmdb >=1.4.1 ; extra == 'all'
28
- Requires-Dist: pycurl >=7.0.0 ; extra == 'all'
29
- Requires-Dist: tqdm >=4.46.1 ; extra == 'all'
30
- Requires-Dist: urllib3 >=1.26.0 ; extra == 'all'
25
+ Requires-Dist: beautifulsoup4>=4.11.1; extra == "all"
26
+ Requires-Dist: certifi>=2023.5.7; extra == "all"
27
+ Requires-Dist: chardet>=5.2.0; extra == "all"
28
+ Requires-Dist: lmdb>=1.4.1; extra == "all"
29
+ Requires-Dist: requests>=2.0.0; extra == "all"
30
+ Requires-Dist: urllib3>=1.26.0; extra == "all"
31
31
 
32
32
  # SWCGEOM
33
33
 
@@ -56,16 +56,20 @@ pip install build
56
56
  pip install --editable .
57
57
  ```
58
58
 
59
- Static analysis don't support import hook used in editable install for [PEP660](https://peps.python.org/pep-0660/) since upgrade to setuptools v64+, detail infomation at [setuptools#3518](https://github.com/pypa/setuptools/issues/3518), a workaround for vscode with pylance:
59
+ Static analysis don't support import hook used in editable install for
60
+ [PEP660](https://peps.python.org/pep-0660/) since upgrade to setuptools v64+,
61
+ detail information at [setuptools#3518](https://github.com/pypa/setuptools/issues/3518),
62
+ a workaround for vscode with pylance:
60
63
 
61
64
  ```json
62
65
  {
63
- "python.analysis.extraPaths": ["/path/to/this/project"]
66
+ "python.analysis.extraPaths": ["/path/to/this/project"]
64
67
  }
65
68
  ```
66
69
 
67
70
  ## LICENSE
68
71
 
69
- This work is licensed under a <a rel="license" href="https://www.apache.org/licenses/">Apache-2.0</a>.
72
+ This work is licensed under a
73
+ <a rel="license" href="https://www.apache.org/licenses/">Apache-2.0</a>.
70
74
 
71
75
  Copyright (c) 2022-present, Zexin Yuan
@@ -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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
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.15.0'
16
- __version_tuple__ = version_tuple = (0, 15, 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()
@@ -1,62 +0,0 @@
1
- swcgeom/__init__.py,sha256=z88Zwcjv-ii7c7dYd9QPg9XrUVorQjtrgGbQCsEnQhc,265
2
- swcgeom/_version.py,sha256=oHv-EAjiXbJma3jZ0Tq6UPimiWYyyw2Ao9S8zdq9uWs,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/node_features.py,sha256=fevnyrF-t4PX39ifLypiDW6EUWB8i-a3PpBnQZU3VOc,3407
7
- swcgeom/analysis/path_features.py,sha256=iE21HBxAoGLxk_qK7MBwQhyUOBqNPcnk4urVHr9SVqk,889
8
- swcgeom/analysis/sholl.py,sha256=9hSW8rZm1gvSIgcEZg8IVPT8kzBgBfwqbwP4E8R7L44,6390
9
- swcgeom/analysis/trunk.py,sha256=L2tjUIUmrRQpah_W3ZETGWd16bDXJ5F8Sk2XBNGms0Q,5558
10
- swcgeom/analysis/visualization.py,sha256=mKOpzTPkLpr1ggGL1MZPZRTG92GEg4idLT4eN5z5KOs,5654
11
- swcgeom/analysis/volume.py,sha256=nWPR7wGOk3Wl5eh97YMws0X-2jk8K7lmFp4-03wL3lY,4628
12
- swcgeom/core/__init__.py,sha256=ZUudZavxAIUU6Q0lBHrQ4ybmL5lBfvzyYsTtpuih9wg,332
13
- swcgeom/core/branch.py,sha256=uuJCxaByRu-OdDZVWEffSFcmZWY-6ZWUhHN1M2Awj1s,3980
14
- swcgeom/core/branch_tree.py,sha256=Ece6q1VNCRLLMj29N_MjXmmlHT8h4tpWCuDE0uSgKJo,1873
15
- swcgeom/core/node.py,sha256=HvfgsW4WU01hkRIPci8KF4bQMAkwtAxOGfUL4yUbuBs,3623
16
- swcgeom/core/path.py,sha256=CsEelHiDR0JPBP1dTvoCSRvX3kBlZxkQilosnncV4nQ,4188
17
- swcgeom/core/population.py,sha256=I9xSeGUveLhxkOg_5FWLcvf4yJVJ6j9_n03Hna3y_6w,8790
18
- swcgeom/core/segment.py,sha256=yabRdFj7KlkJP4V67jAlCIRzpHduNnq3bRBIRMuANfA,3158
19
- swcgeom/core/swc.py,sha256=lSYxAa25l6O8WZ9JtSSET-RZMr6EA1Tq_aXL_x0H9Rc,6795
20
- swcgeom/core/tree.py,sha256=K2k7o8OZ9r2YeMmIebT8_0qvkwJYtLLzFHECz3fmmts,12365
21
- swcgeom/core/tree_utils.py,sha256=3aCHghny5Z727sxkt6P8E2MMr34vK6irfPCelMn3vk4,7681
22
- swcgeom/core/tree_utils_impl.py,sha256=kN2ByjqqQtZUfmC_ac25tXOaE-CMiV2lP58VxFphLEU,1616
23
- swcgeom/core/swc_utils/__init__.py,sha256=qghRxjtzvq5KKfN4HhvLpZNsGPfZQu-Jj2x62_5-TbQ,575
24
- swcgeom/core/swc_utils/assembler.py,sha256=_ByaVFc61rfCS2p9QUw4g40uF4pZ6NJaDc--TcV4jWo,642
25
- swcgeom/core/swc_utils/base.py,sha256=huVxjuMLlTHbEb-KSEFDLgU0Ss3723t2Gr4Z_gQtl00,4737
26
- swcgeom/core/swc_utils/checker.py,sha256=E72GtLZ_1IqQQ7aWQGs0dZ3Z609__bw3EYQqeWrk-EI,2657
27
- swcgeom/core/swc_utils/io.py,sha256=6_--Qoe8kDja4PWsjwqRAvPJZNMFILFgauHaeWeGikU,6444
28
- swcgeom/core/swc_utils/normalizer.py,sha256=_Ysi8bSJ2JBnIGB8o6BvAg2mcz6xuJp9rgNLZqpLuR8,5083
29
- swcgeom/core/swc_utils/subtree.py,sha256=43QITYvgXu3b_kfIod2Irrj3dSfrA-gTFev5VxzRafI,1995
30
- swcgeom/images/__init__.py,sha256=QBP1ZGGo2nWAcV7Krz-vbvW_jN4ChqXrrpoScXcUURs,96
31
- swcgeom/images/augmentation.py,sha256=v9zluYXmBEbafaDBTpvJovi4_KWJmHZZSvcYHzG0oWo,4099
32
- swcgeom/images/folder.py,sha256=2REkrdNghLm1z8kZ2PDVvtsupzog8kARkeMjLuLiLFo,4955
33
- swcgeom/images/io.py,sha256=jUyKjtau8_5V-PN1kRsPHtP1OtueJi1zEf5-7PZ_tG8,21226
34
- swcgeom/transforms/__init__.py,sha256=Mi2mOgkQ50JbZ9LmgXgJIuAA5eio67oe2AOs2CCCxTQ,463
35
- swcgeom/transforms/base.py,sha256=gN5Iqi-OHkYrsjllSOdxI6Yzav3jJGoi6kUPy-38FAs,4101
36
- swcgeom/transforms/branch.py,sha256=R0rVti--u70IiUKyHSx6MsDYJyy6zSCf18Uia2Cmh28,5410
37
- swcgeom/transforms/geometry.py,sha256=XR73fO_8T7otUFIllqKOWW0OnrsXBc7yA01oDT99yMc,7385
38
- swcgeom/transforms/image_stack.py,sha256=KhZ26Ps88jk_7NkI9dkS2E7NZXUvMaN3Ln9WzJ-vPu0,5823
39
- swcgeom/transforms/images.py,sha256=l5Hx8x27zoClUz3s11j2oj0Lt9ROh5JJfjoIU_vd3H8,898
40
- swcgeom/transforms/mst.py,sha256=ceL_EWpCtoSy9zYD6wPP5zO68eNTrDl9JExoPLcE_Lw,6236
41
- swcgeom/transforms/path.py,sha256=Gk2iunGQMX7vE83bdo8xoDO-KAT1Vvep0iZs7oFLzFQ,1089
42
- swcgeom/transforms/population.py,sha256=EmZ6ntuOKe8mXJxMW7nCUA-w2DVlEVe2n0IOVz49tCY,833
43
- swcgeom/transforms/tree.py,sha256=Q45sVA7yi8pINV7ENOWPKz6DnEM3U5uJxwkFKNFS5VE,6262
44
- swcgeom/transforms/tree_assembler.py,sha256=vi_X9CNo5IxHP5J7bRl2z91PWufU6HmYlz1iyfdPUxE,5121
45
- swcgeom/utils/__init__.py,sha256=QfezYuQzgmPziNiWz2T1h77V-gjpuBoUi3mC-K-PZlI,427
46
- swcgeom/utils/debug.py,sha256=qay2qJpViLX82mzxdndxQFn-pi1vaEj9CbLGuGt8Y9k,465
47
- swcgeom/utils/download.py,sha256=By2qZezo6h1Ke_4YpSIhDgcisOrpjVqRmNzbhynC2xs,2834
48
- swcgeom/utils/dsu.py,sha256=3aCbtpnl_D0OXnowTS8-kuwnCS4BKBYL5ECiFQ1fUW8,1435
49
- swcgeom/utils/ellipse.py,sha256=LB3q5CIy75GEUdTauIpKySwIHaDrwXzzkBhOCnjJ8Vw,3259
50
- swcgeom/utils/file.py,sha256=1hchQDsPgn-i-Vz5OQtcogxav_ajCQ_OaEZCLmqczRg,2515
51
- swcgeom/utils/neuromorpho.py,sha256=CDK2tUM2pNwHv_lEserHhQs_VlY3Rn557-jtV63EFlk,14420
52
- swcgeom/utils/numpy_helper.py,sha256=A-F-eFdGktCHVAQ_HcXiFB3Y1YhhSNfAmtOl8483Dvo,1292
53
- swcgeom/utils/renderer.py,sha256=xHVZ06Z1MeKBPC3nKzuwA1HryzR0ga79y6johZA4-q0,7290
54
- swcgeom/utils/sdf.py,sha256=K-LSnwwNsGF85GW1kNBaqXAAVesxZAEsrn0nvOA2LcA,10614
55
- swcgeom/utils/solid_geometry.py,sha256=TV02jhcoCLCqtYA9hfE50LFD_VRfixMiOSiHB5Jb2_U,2431
56
- swcgeom/utils/transforms.py,sha256=PmP5fL_iVguq4GR2aqXhM0TeCsiFVnrPZMZG6zLohrE,6983
57
- swcgeom/utils/volumetric_object.py,sha256=DVRGGmQrAL0oaW6hbNtp5TStbic9DfyJdCzsv2FNw2c,15134
58
- swcgeom-0.15.0.dist-info/LICENSE,sha256=JPtohhZ4XURqoKI0ZqnMYb7dobCOoZR_n5EpnaLTp3E,11344
59
- swcgeom-0.15.0.dist-info/METADATA,sha256=VJX8KlMJWpYCZ-bMUYy_kL05sAHXmvHLMqUepQaKNTQ,2347
60
- swcgeom-0.15.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
61
- swcgeom-0.15.0.dist-info/top_level.txt,sha256=hmLyUXWS61Gxl07haswFEKKefYPBVJYlUlol8ghNkjY,8
62
- swcgeom-0.15.0.dist-info/RECORD,,