Use point and shape layer to edit swc format in napari
Project description
napari-swc-editor
Use point and shape layer to edit swc format in napari.
This napari plugin was generated with copier using the napari-plugin-template.
Features
https://github.com/user-attachments/assets/cba1820f-d0b5-436c-a981-62bae0e1a6ba
IO
READER
- Your .swc should follow the following specs: http://www.neuronland.org/NLMorphologyConverter/MorphologyFormats/SWC/Spec.html
- the reader will create 2 napari layer:
point_layerandshape_layer. Onlypoint_layeris interactive,shape_layeris used to render path between swc points. - The raw swc can be accessed in the point layer metadata. Such as
point_layer.metadata["raw_swc"] - A
pd.DataFrameobject is also saved in the metadata:point_layer.metadata["swc_data"]
WRITER
- With the
point_layerselected, you can use napari interface to save with.swcextension name. - You can also do it in command line:
napari.save_layers('test.swc', [point_layer])
Napari Interface
Structure ID and point symbol
In swc, structure id allow to label the type of neuron structure the point belongs to. In this plugin by default, the points will follow this symbol mapping:
SWC_SYMBOL = {
0: "clobber", # undefined
1: "star", # soma
2: "disc", # axon
3: "triangle_down", # basal dendrite
4: "triangle_up", # apical dendrite
}
SWC Edition
ALL INTERACTIONS ARE ONLY BOUND TO THE point_layer
THERE IS NO CTRL-Z (please save your progress)
- Add point: You can edit the "r" and the "structure_id" using the
point_sizeandsymbol - Remove point: (Select the point and press
1orsupprordelete) All the link pointing to this point will be removed - Add edge: Select 2 or more point(s) and press on your keyboard
l(aka: link). - Remove edge: Select 1 or more point(s) and press on your keyboard
u(aka: unlink).
Installation
You can install napari-swc-editor via pip:
pip install napari-swc-editor
To install latest development version :
pip install git+https://github.com/LaboratoryOpticsBiosciences/napari-swc-editor.git
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the BSD-3 license, "napari-swc-editor" is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file napari_swc_editor-0.0.4.tar.gz.
File metadata
- Download URL: napari_swc_editor-0.0.4.tar.gz
- Upload date:
- Size: 492.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdb379aff8dc09445b373c1455a12d43d02f63f2066f04ebac8e38e31885b12b
|
|
| MD5 |
1f91ec841c1fbb6ee5dd55e80711972b
|
|
| BLAKE2b-256 |
aa03a82b1db2435391f94047b51de81387c54f77d2cc5bebadb3687fbcb60cd9
|
File details
Details for the file napari_swc_editor-0.0.4-py3-none-any.whl.
File metadata
- Download URL: napari_swc_editor-0.0.4-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6947516b0d0438b4de4bbec59d86f6494986aa40843e391d2f34261a8fddb02a
|
|
| MD5 |
84a1410de0df9f4f023b64cd89d679a4
|
|
| BLAKE2b-256 |
80737e7d3548ddc218a10d8c6229c8eb5804fdfdfa8f20d1b7116918b196c520
|