| Name | osteoid JSON |
| Version |
0.4.0
JSON |
| download |
| home_page | None |
| Summary | Skeleton object used for representing neurons, adjacent cells, and organelles. |
| upload_time | 2025-08-22 01:49:30 |
| maintainer | None |
| docs_url | None |
| author | None |
| 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, Bbox
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
skel2 = skel.crop([ minx, miny, minz, maxx, maxy, maxz ])
skel2 = skel.crop(Bbox([minx, miny, minz], [maxx, maxy, maxz]))
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": null,
"author_email": "William Silversmith <william.silversmith@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/8b/2e/e98aff6a5980244e18b53e0c1a9275b551fcb5593ade6de5752d14cbc147/osteoid-0.4.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, Bbox\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\nskel2 = skel.crop([ minx, miny, minz, maxx, maxy, maxz ])\nskel2 = skel.crop(Bbox([minx, miny, minz], [maxx, maxy, maxz]))\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",
"bugtrack_url": null,
"license": "BSD-3 Clause",
"summary": "Skeleton object used for representing neurons, adjacent cells, and organelles.",
"version": "0.4.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c85201157438d577802d903bc1250459de2aeac0b5d6c1bb1f1db6c4e4a186b9",
"md5": "93fa53d9a154cb7fa7821ee05c20b034",
"sha256": "0ecf9a5503eacdb07a86c3390897c9b4e9b532e5cc26c26fc56700159e9dc27d"
},
"downloads": -1,
"filename": "osteoid-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "93fa53d9a154cb7fa7821ee05c20b034",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 23297,
"upload_time": "2025-08-22T01:49:29",
"upload_time_iso_8601": "2025-08-22T01:49:29.683550Z",
"url": "https://files.pythonhosted.org/packages/c8/52/01157438d577802d903bc1250459de2aeac0b5d6c1bb1f1db6c4e4a186b9/osteoid-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8b2ee98aff6a5980244e18b53e0c1a9275b551fcb5593ade6de5752d14cbc147",
"md5": "5255761ab2d861624be1d8d59e96b84e",
"sha256": "47a7356c6dd0e95e11a582a7e50551c4d24acf185118543e0dd2f74430f74cc7"
},
"downloads": -1,
"filename": "osteoid-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "5255761ab2d861624be1d8d59e96b84e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 22859,
"upload_time": "2025-08-22T01:49:30",
"upload_time_iso_8601": "2025-08-22T01:49:30.483405Z",
"url": "https://files.pythonhosted.org/packages/8b/2e/e98aff6a5980244e18b53e0c1a9275b551fcb5593ade6de5752d14cbc147/osteoid-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-22 01:49:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "osteoid"
}