Name | osteoid JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Skeleton object used for representing neurons, adjacent cells, and organelles. |
upload_time | 2025-02-26 23:43:46 |
maintainer | None |
docs_url | None |
author | William Silversmith |
requires_python | >=3.9 |
license | BSD-3 Clause |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# osteoid
Skeleton object used for representing neurons, adjacent cells, and organelles.
Osteoid is the Skeleton code from [CloudVolume](https://github.com/seung-lab/cloud-volume) refactored into its own library.
## Installation
```bash
pip install osteoid
```
## Examples
```python
import osteoid
skel = osteoid.load("skeleton.swc")
osteoid.save("skeleton.swc", skel)
from osteoid import Skeleton
skel = Skeleton(vertices, edges, radii=radii)
# you can specify a transform to e.g.
# convert the skeleton into a physical space
# with, in this example, 16x16x40 nm^3 resolution
matrix = np.array([
[16, 0, 0, 0],
[0, 16, 0, 0],
[0, 0, 40, 0],
], dtype=np.float32)
skel = Skeleton(vertices, edges, radii=radii, transform=matrix)
skel = skel.physical_space() # applies transform to vertices
skel = skel.voxel_space() # removes transform from vertices
# skeleton functions
l = skel.cable_length() # physical length of the cable
comps = skel.components() # connected components
paths = skel.paths() # convert tree into a list of linear paths
skel = skel.downsample(factor) # factor must be a pos integer
skel = skel.average_smoothing(7) # smooths over a window of e.g. 7 vertices
G = skel.to_networkx() # converts edges to an nx.Graph()
binary = skel.to_precomputed() # Neuroglancer compatible format
swc = skel.to_swc() # Neuroglancer compatible format
skel = Skeleton.from_swc(swc)
skel = Skeleton.from_precomputed(binary, segid=1, vertex_attributes=[
{
'id': 'radius',
'num_components': 1,
'data_type': 'float32',
},
])
# Cross-format transform from Navis. More efficient than
# using SWCs as an interchange medium. Navis is more fully featured,
# and written with a lot of love by Philipp Schlegel and others.
# Consider using it and citing them: https://github.com/navis-org/navis
skel = Skeleton.from_navis(navis_skel)
# remove duplicate vertices and optionally disconnected vertices
skel = skel.consolidate()
skel2 = skel.clone()
# visualize, requires either matplotlib or microviewer+vtk installed
skel.viewer() # select library automatically
skel.viewer(color_by='radius', library='matplotlib')
skel.viewer(color_by='cross_section', library='matplotlib')
skel.viewer(color_by='component', library='matplotlib')
# gpu accelerated, fewer features, colors by component
skel.viewer(library='vtk')
```
Raw data
{
"_id": null,
"home_page": null,
"name": "osteoid",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "William Silversmith",
"author_email": "william.silversmith@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/57/bf/1b57b6a10397590bd697f000d6109ef4a76f5dc89f7aa7dabdc6ad8f30c4/osteoid-0.2.0.tar.gz",
"platform": null,
"description": "# osteoid\n\nSkeleton object used for representing neurons, adjacent cells, and organelles. \n\nOsteoid is the Skeleton code from [CloudVolume](https://github.com/seung-lab/cloud-volume) refactored into its own library.\n\n\n## Installation\n\n```bash\npip install osteoid\n```\n\n## Examples\n\n```python\nimport osteoid\n\nskel = osteoid.load(\"skeleton.swc\")\nosteoid.save(\"skeleton.swc\", skel)\n\nfrom osteoid import Skeleton\n\nskel = Skeleton(vertices, edges, radii=radii)\n\n# you can specify a transform to e.g.\n# convert the skeleton into a physical space\n# with, in this example, 16x16x40 nm^3 resolution\n\nmatrix = np.array([\n [16, 0, 0, 0],\n [0, 16, 0, 0],\n [0, 0, 40, 0],\n], dtype=np.float32)\n\nskel = Skeleton(vertices, edges, radii=radii, transform=matrix)\nskel = skel.physical_space() # applies transform to vertices\nskel = skel.voxel_space() # removes transform from vertices\n\n# skeleton functions\n\nl = skel.cable_length() # physical length of the cable\ncomps = skel.components() # connected components\npaths = skel.paths() # convert tree into a list of linear paths\nskel = skel.downsample(factor) # factor must be a pos integer\nskel = skel.average_smoothing(7) # smooths over a window of e.g. 7 vertices\n\nG = skel.to_networkx() # converts edges to an nx.Graph()\n\nbinary = skel.to_precomputed() # Neuroglancer compatible format\nswc = skel.to_swc() # Neuroglancer compatible format\nskel = Skeleton.from_swc(swc)\nskel = Skeleton.from_precomputed(binary, segid=1, vertex_attributes=[\n {\n 'id': 'radius',\n 'num_components': 1,\n 'data_type': 'float32',\n },\n])\n\n# Cross-format transform from Navis. More efficient than \n# using SWCs as an interchange medium. Navis is more fully featured,\n# and written with a lot of love by Philipp Schlegel and others.\n# Consider using it and citing them: https://github.com/navis-org/navis\nskel = Skeleton.from_navis(navis_skel)\n\n# remove duplicate vertices and optionally disconnected vertices\nskel = skel.consolidate() \nskel2 = skel.clone()\n\n# visualize, requires either matplotlib or microviewer+vtk installed\nskel.viewer() # select library automatically\n\nskel.viewer(color_by='radius', library='matplotlib')\nskel.viewer(color_by='cross_section', library='matplotlib')\nskel.viewer(color_by='component', library='matplotlib')\n\n# gpu accelerated, fewer features, colors by component\nskel.viewer(library='vtk')\n```\n\n\n",
"bugtrack_url": null,
"license": "BSD-3 Clause",
"summary": "Skeleton object used for representing neurons, adjacent cells, and organelles.",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bfa315b0f4cb9207b4610897f56cb87e95a2dc39cd20cb1bc5562c068d9a1431",
"md5": "149af9b8daa43bf947fe7141c5363c4b",
"sha256": "d49fcffb92ac35afcf006cc5048836663f5ab431355a919cc134582e29f5b04a"
},
"downloads": -1,
"filename": "osteoid-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "149af9b8daa43bf947fe7141c5363c4b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 22910,
"upload_time": "2025-02-26T23:43:45",
"upload_time_iso_8601": "2025-02-26T23:43:45.140482Z",
"url": "https://files.pythonhosted.org/packages/bf/a3/15b0f4cb9207b4610897f56cb87e95a2dc39cd20cb1bc5562c068d9a1431/osteoid-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "57bf1b57b6a10397590bd697f000d6109ef4a76f5dc89f7aa7dabdc6ad8f30c4",
"md5": "f8a0a2c981236ed57ead61d38e7c28a7",
"sha256": "9a214001d7d2da942462c3da1592c0757d43be0607b086449ab43f34a702e5fa"
},
"downloads": -1,
"filename": "osteoid-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "f8a0a2c981236ed57ead61d38e7c28a7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 21388,
"upload_time": "2025-02-26T23:43:46",
"upload_time_iso_8601": "2025-02-26T23:43:46.892871Z",
"url": "https://files.pythonhosted.org/packages/57/bf/1b57b6a10397590bd697f000d6109ef4a76f5dc89f7aa7dabdc6ad8f30c4/osteoid-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-26 23:43:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "osteoid"
}