swcstudio 0.2.0__tar.gz
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.
- swcstudio-0.2.0/LICENSE +21 -0
- swcstudio-0.2.0/MANIFEST.in +13 -0
- swcstudio-0.2.0/PKG-INFO +172 -0
- swcstudio-0.2.0/README.md +139 -0
- swcstudio-0.2.0/pyproject.toml +77 -0
- swcstudio-0.2.0/setup.cfg +4 -0
- swcstudio-0.2.0/swcstudio/__init__.py +19 -0
- swcstudio-0.2.0/swcstudio/api.py +130 -0
- swcstudio-0.2.0/swcstudio/cli/__init__.py +3 -0
- swcstudio-0.2.0/swcstudio/cli/cli.py +1482 -0
- swcstudio-0.2.0/swcstudio/core/__init__.py +32 -0
- swcstudio-0.2.0/swcstudio/core/api.py +84 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/__init__.py +88 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/branch_features.py +995 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/cell_type_detector.py +325 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/config.py +51 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/features.py +516 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/gnn_apical_basal.py +690 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/gnn_dataset.py +400 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/gnn_inference.py +138 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/pipeline.py +545 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/runner.py +694 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/stage3_refine.py +856 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/subtree_features.py +281 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/train_stage1.py +227 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/train_stage2.py +773 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing/types.py +65 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing_results.py +42 -0
- swcstudio-0.2.0/swcstudio/core/auto_typing_train.py +233 -0
- swcstudio-0.2.0/swcstudio/core/config.py +52 -0
- swcstudio-0.2.0/swcstudio/core/custom_types.py +145 -0
- swcstudio-0.2.0/swcstudio/core/geometry_editing.py +572 -0
- swcstudio-0.2.0/swcstudio/core/issues.py +587 -0
- swcstudio-0.2.0/swcstudio/core/model_paths.py +190 -0
- swcstudio-0.2.0/swcstudio/core/models.py +34 -0
- swcstudio-0.2.0/swcstudio/core/radii_cleaning.py +880 -0
- swcstudio-0.2.0/swcstudio/core/reporting.py +916 -0
- swcstudio-0.2.0/swcstudio/core/simplification.py +227 -0
- swcstudio-0.2.0/swcstudio/core/subtree_editing.py +68 -0
- swcstudio-0.2.0/swcstudio/core/swc_io.py +113 -0
- swcstudio-0.2.0/swcstudio/core/updater.py +382 -0
- swcstudio-0.2.0/swcstudio/core/validation.py +119 -0
- swcstudio-0.2.0/swcstudio/core/validation_catalog.py +252 -0
- swcstudio-0.2.0/swcstudio/core/validation_checks/__init__.py +7 -0
- swcstudio-0.2.0/swcstudio/core/validation_checks/native_checks.py +790 -0
- swcstudio-0.2.0/swcstudio/core/validation_checks/neuron_morphology_checks.py +265 -0
- swcstudio-0.2.0/swcstudio/core/validation_engine.py +446 -0
- swcstudio-0.2.0/swcstudio/core/validation_impl.py +508 -0
- swcstudio-0.2.0/swcstudio/core/validation_registry.py +80 -0
- swcstudio-0.2.0/swcstudio/core/validation_results.py +129 -0
- swcstudio-0.2.0/swcstudio/core/visualization.py +52 -0
- swcstudio-0.2.0/swcstudio/gui/__init__.py +3 -0
- swcstudio-0.2.0/swcstudio/gui/auto_typing_guide.py +76 -0
- swcstudio-0.2.0/swcstudio/gui/auto_typing_workers.py +143 -0
- swcstudio-0.2.0/swcstudio/gui/batch_tab.py +686 -0
- swcstudio-0.2.0/swcstudio/gui/constants.py +33 -0
- swcstudio-0.2.0/swcstudio/gui/context_inspector.py +283 -0
- swcstudio-0.2.0/swcstudio/gui/custom_type_dialog.py +250 -0
- swcstudio-0.2.0/swcstudio/gui/dendrogram_widget.py +945 -0
- swcstudio-0.2.0/swcstudio/gui/editor_tab.py +479 -0
- swcstudio-0.2.0/swcstudio/gui/font_utils.py +28 -0
- swcstudio-0.2.0/swcstudio/gui/geometry_editing_panel.py +989 -0
- swcstudio-0.2.0/swcstudio/gui/graph_utils.py +319 -0
- swcstudio-0.2.0/swcstudio/gui/issue_panel.py +248 -0
- swcstudio-0.2.0/swcstudio/gui/main.py +158 -0
- swcstudio-0.2.0/swcstudio/gui/main_window.py +4568 -0
- swcstudio-0.2.0/swcstudio/gui/manual_radii_panel.py +269 -0
- swcstudio-0.2.0/swcstudio/gui/neuron_3d_widget.py +767 -0
- swcstudio-0.2.0/swcstudio/gui/radii_cleaning_panel.py +678 -0
- swcstudio-0.2.0/swcstudio/gui/report_popup.py +56 -0
- swcstudio-0.2.0/swcstudio/gui/rule_batch_processor.py +22 -0
- swcstudio-0.2.0/swcstudio/gui/simplification_panel.py +369 -0
- swcstudio-0.2.0/swcstudio/gui/swc_table_widget.py +191 -0
- swcstudio-0.2.0/swcstudio/gui/validation_auto_label_panel.py +271 -0
- swcstudio-0.2.0/swcstudio/gui/validation_core.py +19 -0
- swcstudio-0.2.0/swcstudio/gui/validation_tab.py +518 -0
- swcstudio-0.2.0/swcstudio/plugins/__init__.py +58 -0
- swcstudio-0.2.0/swcstudio/plugins/contracts.py +93 -0
- swcstudio-0.2.0/swcstudio/plugins/loader.py +154 -0
- swcstudio-0.2.0/swcstudio/plugins/registry.py +176 -0
- swcstudio-0.2.0/swcstudio/tools/__init__.py +14 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/__init__.py +13 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/__init__.py +23 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/auto_typing.py +88 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/batch_validation.py +95 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/index_clean.py +129 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/radii_cleaning.py +350 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/simplification.py +140 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/split.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/swc_splitter.py +122 -0
- swcstudio-0.2.0/swcstudio/tools/batch_processing/features/validation.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/geometry_editing/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/geometry_editing/features/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/geometry_editing/features/operations.py +100 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/features/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/features/dendrogram_editing.py +104 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/features/manual_label.py +92 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/features/manual_radii.py +93 -0
- swcstudio-0.2.0/swcstudio/tools/morphology_editing/features/simplification.py +126 -0
- swcstudio-0.2.0/swcstudio/tools/validation/__init__.py +37 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/auto_fix.py +89 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/auto_typing.py +138 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/core.py +31 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/index_clean.py +103 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/radii_cleaning.py +87 -0
- swcstudio-0.2.0/swcstudio/tools/validation/features/run_checks.py +64 -0
- swcstudio-0.2.0/swcstudio/tools/visualization/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/visualization/features/__init__.py +5 -0
- swcstudio-0.2.0/swcstudio/tools/visualization/features/mesh_editing.py +55 -0
- swcstudio-0.2.0/swcstudio.egg-info/PKG-INFO +172 -0
- swcstudio-0.2.0/swcstudio.egg-info/SOURCES.txt +117 -0
- swcstudio-0.2.0/swcstudio.egg-info/dependency_links.txt +1 -0
- swcstudio-0.2.0/swcstudio.egg-info/entry_points.txt +3 -0
- swcstudio-0.2.0/swcstudio.egg-info/requires.txt +25 -0
- swcstudio-0.2.0/swcstudio.egg-info/top_level.txt +1 -0
- swcstudio-0.2.0/tests/test_cli_smoke.py +206 -0
- swcstudio-0.2.0/tests/test_gui_smoke.py +91 -0
swcstudio-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SWC-Dash Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Source distribution manifest.
|
|
2
|
+
#
|
|
3
|
+
# Setuptools by default includes every git-tracked file in the sdist.
|
|
4
|
+
# We exclude the model files from the sdist for the same reason
|
|
5
|
+
# pyproject.toml's package-data is empty: SWC-Studio uses Pattern B —
|
|
6
|
+
# code only ships via pip, models download from GitHub Releases on
|
|
7
|
+
# first use. See packaging/MODULAR_BUILD.md.
|
|
8
|
+
#
|
|
9
|
+
# Result: a fresh `pip install --no-binary :all: swcstudio` (source
|
|
10
|
+
# install) produces a model-less install; the first auto-label call
|
|
11
|
+
# triggers swcstudio.core.updater to download models on demand.
|
|
12
|
+
|
|
13
|
+
recursive-exclude swcstudio/data/models *
|
swcstudio-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swcstudio
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Modular SWC processing toolkit with shared core for CLI and GUI
|
|
5
|
+
Author: SWC-Dash Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy>=1.24
|
|
11
|
+
Requires-Dist: pandas>=2.0
|
|
12
|
+
Requires-Dist: scipy>=1.11
|
|
13
|
+
Requires-Dist: morphio>=3.3
|
|
14
|
+
Requires-Dist: neurom>=4.0
|
|
15
|
+
Requires-Dist: scikit-learn<1.6,>=1.5
|
|
16
|
+
Requires-Dist: torch>=2.1
|
|
17
|
+
Requires-Dist: torch-geometric>=2.6
|
|
18
|
+
Requires-Dist: PySide6>=6.6
|
|
19
|
+
Requires-Dist: pyqtgraph>=0.14
|
|
20
|
+
Requires-Dist: vispy>=0.14
|
|
21
|
+
Provides-Extra: build
|
|
22
|
+
Requires-Dist: PyInstaller>=6.11; extra == "build"
|
|
23
|
+
Provides-Extra: docs
|
|
24
|
+
Requires-Dist: sphinx>=8.2; extra == "docs"
|
|
25
|
+
Requires-Dist: pydata-sphinx-theme>=0.16; extra == "docs"
|
|
26
|
+
Requires-Dist: myst-parser>=3.0; extra == "docs"
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: PyInstaller>=6.11; extra == "all"
|
|
29
|
+
Requires-Dist: sphinx>=8.2; extra == "all"
|
|
30
|
+
Requires-Dist: pydata-sphinx-theme>=0.16; extra == "all"
|
|
31
|
+
Requires-Dist: myst-parser>=3.0; extra == "all"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# SWC-Studio
|
|
35
|
+
|
|
36
|
+
`SWC-Studio` is a desktop, CLI, and Python toolkit for working with neuron morphology files in SWC format.
|
|
37
|
+
|
|
38
|
+
It is designed for inspecting reconstructions, finding structural or annotation problems, repairing them, and running repeatable morphology-processing workflows from one shared backend.
|
|
39
|
+
|
|
40
|
+
## Project Overview
|
|
41
|
+
|
|
42
|
+
`SWC-Studio` includes:
|
|
43
|
+
|
|
44
|
+
- a shared Python backend (`swcstudio`)
|
|
45
|
+
- a command-line interface (`swcstudio`)
|
|
46
|
+
- a desktop GUI (`swcstudio-gui`)
|
|
47
|
+
|
|
48
|
+
Both the CLI and GUI use the same core feature logic.
|
|
49
|
+
|
|
50
|
+
### Auto-labeling engine
|
|
51
|
+
|
|
52
|
+
Auto-labeling uses a single ML pipeline: the **v9 engine**. It runs a four-stage process — cell-type detection, per-subtree axon/basal/apical classification, a GraphSAGE GNN apical-vs-basal re-decision, and topology refinement — and automatically chooses between 3-class (no apical) and 4-class output per file. All four stages are required and ship trained out of the box.
|
|
53
|
+
|
|
54
|
+
The toolkit ships with bundled trained models. After `pip install -e .` the engine works out of the box; users can also retrain on their own labeled SWC corpus via `swcstudio train auto-typing` and have the toolkit pick up the new models automatically.
|
|
55
|
+
|
|
56
|
+
## Documentation
|
|
57
|
+
|
|
58
|
+
Project documentation lives on the docs website:
|
|
59
|
+
|
|
60
|
+
- Live docs: [https://mio0v0.github.io/SWC-Studio/](https://mio0v0.github.io/SWC-Studio/)
|
|
61
|
+
- All releases: [https://github.com/Mio0v0/SWC-Studio/releases](https://github.com/Mio0v0/SWC-Studio/releases)
|
|
62
|
+
|
|
63
|
+
Use the docs site for:
|
|
64
|
+
|
|
65
|
+
- installation and getting started
|
|
66
|
+
- GUI and CLI workflows
|
|
67
|
+
- validation, repair, and reporting behavior
|
|
68
|
+
- the auto-typing engine and retraining workflow
|
|
69
|
+
- tutorials
|
|
70
|
+
- API and extension references
|
|
71
|
+
|
|
72
|
+
### Release Assets
|
|
73
|
+
|
|
74
|
+
Current GitHub Releases may include:
|
|
75
|
+
|
|
76
|
+
- macOS application bundle
|
|
77
|
+
- Windows executable package
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
|
|
81
|
+
Option 1: download a packaged executable from the GitHub Releases page and run the app directly.
|
|
82
|
+
|
|
83
|
+
- macOS: [SWC-Studio v0.1.0 for macOS](https://github.com/Mio0v0/SWC-Studio/releases/download/v0.1.0/SWC-Studio.v0.1.0.macOS.zip)
|
|
84
|
+
- Windows: [SWC-Studio v0.1.0 for Windows](https://github.com/Mio0v0/SWC-Studio/releases/download/v0.1.0/SWC-Studio.v0.1.0.Windows.zip)
|
|
85
|
+
- Download the zip for your platform, extract it, and launch the included application
|
|
86
|
+
|
|
87
|
+
Option 2: install from source. Supported Python versions: 3.10, 3.11, 3.12, 3.13.
|
|
88
|
+
|
|
89
|
+
macOS / Linux:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python3 -m venv .venv
|
|
93
|
+
source .venv/bin/activate
|
|
94
|
+
pip install -e .
|
|
95
|
+
swcstudio-gui
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Windows PowerShell:
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
py -3.12 -m venv .venv
|
|
102
|
+
.\.venv\Scripts\Activate.ps1
|
|
103
|
+
pip install -e .
|
|
104
|
+
swcstudio-gui
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A single `pip install -e .` pulls in everything: the CLI, the desktop GUI, the auto-typing engine (sklearn + torch + torch_geometric), and the bundled v9 model files. There are no extras to remember for normal use. Maintainers who need PyInstaller and Sphinx for release packaging and docs builds can use `pip install -e ".[all]"`.
|
|
108
|
+
|
|
109
|
+
CLI help:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
swcstudio --help
|
|
113
|
+
swcstudio models status # confirm the bundled auto-typing models are reachable
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If the script entry point is not on your path, fall back to module mode:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python -m swcstudio.cli.cli --help
|
|
120
|
+
python -m swcstudio.gui.main
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Core Capabilities
|
|
124
|
+
|
|
125
|
+
- issue-driven SWC validation and repair
|
|
126
|
+
- batch processing workflows
|
|
127
|
+
- v9 ML auto-typing engine: Stage 1 cell-type detector + Stage 2 per-subtree classifier + Stage 2b GraphSAGE GNN apical-vs-basal head + Stage 3 topology refinement, with bundled trained models
|
|
128
|
+
- automatic apical detection (3-class vs 4-class output chosen per file)
|
|
129
|
+
- one-command retraining of the engine on user data (`swcstudio train auto-typing`)
|
|
130
|
+
- radii cleaning
|
|
131
|
+
- manual morphology and geometry editing
|
|
132
|
+
- shared GUI, CLI, and Python integration surface
|
|
133
|
+
|
|
134
|
+
## Train your own auto-typing models
|
|
135
|
+
|
|
136
|
+
If you want models tuned to your own SWCs, the toolkit ships a one-command trainer:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
swcstudio train auto-typing \
|
|
140
|
+
--data-dir path/to/labeled/dataset \
|
|
141
|
+
--output-dir path/to/save/models
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The dataset directory must have `pyramidal/` and `interneuron/` subfolders of labeled `.swc` files (each SWC's `type` column is the per-node ground truth).
|
|
145
|
+
|
|
146
|
+
To use the trained models afterwards:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# One-off: pass --model-dir per call
|
|
150
|
+
swcstudio auto-label cell.swc --model-dir path/to/save/models
|
|
151
|
+
|
|
152
|
+
# Or set the env var for the whole shell
|
|
153
|
+
export SWCSTUDIO_MODEL_DIR=path/to/save/models # macOS/Linux
|
|
154
|
+
$env:SWCSTUDIO_MODEL_DIR = "path\to\save\models" # Windows PowerShell
|
|
155
|
+
|
|
156
|
+
# Or make them the persistent default by copying into the user data dir;
|
|
157
|
+
# see the docs site for the per-platform path.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
See the [Auto-Typing Engine](https://mio0v0.github.io/SWC-Studio/documentation/auto-typing-backends.html) page in the docs for the full retraining workflow, hyperparameter flags, and model resolution rules.
|
|
161
|
+
|
|
162
|
+
## Recommended Workflow
|
|
163
|
+
|
|
164
|
+
1. Open one SWC file in the GUI.
|
|
165
|
+
2. Run validation and review the issue list.
|
|
166
|
+
3. Apply the suggested repairs.
|
|
167
|
+
4. Rerun validation.
|
|
168
|
+
5. Save or export the cleaned result.
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
Released under the MIT License. See `LICENSE`.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# SWC-Studio
|
|
2
|
+
|
|
3
|
+
`SWC-Studio` is a desktop, CLI, and Python toolkit for working with neuron morphology files in SWC format.
|
|
4
|
+
|
|
5
|
+
It is designed for inspecting reconstructions, finding structural or annotation problems, repairing them, and running repeatable morphology-processing workflows from one shared backend.
|
|
6
|
+
|
|
7
|
+
## Project Overview
|
|
8
|
+
|
|
9
|
+
`SWC-Studio` includes:
|
|
10
|
+
|
|
11
|
+
- a shared Python backend (`swcstudio`)
|
|
12
|
+
- a command-line interface (`swcstudio`)
|
|
13
|
+
- a desktop GUI (`swcstudio-gui`)
|
|
14
|
+
|
|
15
|
+
Both the CLI and GUI use the same core feature logic.
|
|
16
|
+
|
|
17
|
+
### Auto-labeling engine
|
|
18
|
+
|
|
19
|
+
Auto-labeling uses a single ML pipeline: the **v9 engine**. It runs a four-stage process — cell-type detection, per-subtree axon/basal/apical classification, a GraphSAGE GNN apical-vs-basal re-decision, and topology refinement — and automatically chooses between 3-class (no apical) and 4-class output per file. All four stages are required and ship trained out of the box.
|
|
20
|
+
|
|
21
|
+
The toolkit ships with bundled trained models. After `pip install -e .` the engine works out of the box; users can also retrain on their own labeled SWC corpus via `swcstudio train auto-typing` and have the toolkit pick up the new models automatically.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Project documentation lives on the docs website:
|
|
26
|
+
|
|
27
|
+
- Live docs: [https://mio0v0.github.io/SWC-Studio/](https://mio0v0.github.io/SWC-Studio/)
|
|
28
|
+
- All releases: [https://github.com/Mio0v0/SWC-Studio/releases](https://github.com/Mio0v0/SWC-Studio/releases)
|
|
29
|
+
|
|
30
|
+
Use the docs site for:
|
|
31
|
+
|
|
32
|
+
- installation and getting started
|
|
33
|
+
- GUI and CLI workflows
|
|
34
|
+
- validation, repair, and reporting behavior
|
|
35
|
+
- the auto-typing engine and retraining workflow
|
|
36
|
+
- tutorials
|
|
37
|
+
- API and extension references
|
|
38
|
+
|
|
39
|
+
### Release Assets
|
|
40
|
+
|
|
41
|
+
Current GitHub Releases may include:
|
|
42
|
+
|
|
43
|
+
- macOS application bundle
|
|
44
|
+
- Windows executable package
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
Option 1: download a packaged executable from the GitHub Releases page and run the app directly.
|
|
49
|
+
|
|
50
|
+
- macOS: [SWC-Studio v0.1.0 for macOS](https://github.com/Mio0v0/SWC-Studio/releases/download/v0.1.0/SWC-Studio.v0.1.0.macOS.zip)
|
|
51
|
+
- Windows: [SWC-Studio v0.1.0 for Windows](https://github.com/Mio0v0/SWC-Studio/releases/download/v0.1.0/SWC-Studio.v0.1.0.Windows.zip)
|
|
52
|
+
- Download the zip for your platform, extract it, and launch the included application
|
|
53
|
+
|
|
54
|
+
Option 2: install from source. Supported Python versions: 3.10, 3.11, 3.12, 3.13.
|
|
55
|
+
|
|
56
|
+
macOS / Linux:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
python3 -m venv .venv
|
|
60
|
+
source .venv/bin/activate
|
|
61
|
+
pip install -e .
|
|
62
|
+
swcstudio-gui
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Windows PowerShell:
|
|
66
|
+
|
|
67
|
+
```powershell
|
|
68
|
+
py -3.12 -m venv .venv
|
|
69
|
+
.\.venv\Scripts\Activate.ps1
|
|
70
|
+
pip install -e .
|
|
71
|
+
swcstudio-gui
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
A single `pip install -e .` pulls in everything: the CLI, the desktop GUI, the auto-typing engine (sklearn + torch + torch_geometric), and the bundled v9 model files. There are no extras to remember for normal use. Maintainers who need PyInstaller and Sphinx for release packaging and docs builds can use `pip install -e ".[all]"`.
|
|
75
|
+
|
|
76
|
+
CLI help:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
swcstudio --help
|
|
80
|
+
swcstudio models status # confirm the bundled auto-typing models are reachable
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If the script entry point is not on your path, fall back to module mode:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python -m swcstudio.cli.cli --help
|
|
87
|
+
python -m swcstudio.gui.main
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Core Capabilities
|
|
91
|
+
|
|
92
|
+
- issue-driven SWC validation and repair
|
|
93
|
+
- batch processing workflows
|
|
94
|
+
- v9 ML auto-typing engine: Stage 1 cell-type detector + Stage 2 per-subtree classifier + Stage 2b GraphSAGE GNN apical-vs-basal head + Stage 3 topology refinement, with bundled trained models
|
|
95
|
+
- automatic apical detection (3-class vs 4-class output chosen per file)
|
|
96
|
+
- one-command retraining of the engine on user data (`swcstudio train auto-typing`)
|
|
97
|
+
- radii cleaning
|
|
98
|
+
- manual morphology and geometry editing
|
|
99
|
+
- shared GUI, CLI, and Python integration surface
|
|
100
|
+
|
|
101
|
+
## Train your own auto-typing models
|
|
102
|
+
|
|
103
|
+
If you want models tuned to your own SWCs, the toolkit ships a one-command trainer:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
swcstudio train auto-typing \
|
|
107
|
+
--data-dir path/to/labeled/dataset \
|
|
108
|
+
--output-dir path/to/save/models
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The dataset directory must have `pyramidal/` and `interneuron/` subfolders of labeled `.swc` files (each SWC's `type` column is the per-node ground truth).
|
|
112
|
+
|
|
113
|
+
To use the trained models afterwards:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# One-off: pass --model-dir per call
|
|
117
|
+
swcstudio auto-label cell.swc --model-dir path/to/save/models
|
|
118
|
+
|
|
119
|
+
# Or set the env var for the whole shell
|
|
120
|
+
export SWCSTUDIO_MODEL_DIR=path/to/save/models # macOS/Linux
|
|
121
|
+
$env:SWCSTUDIO_MODEL_DIR = "path\to\save\models" # Windows PowerShell
|
|
122
|
+
|
|
123
|
+
# Or make them the persistent default by copying into the user data dir;
|
|
124
|
+
# see the docs site for the per-platform path.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
See the [Auto-Typing Engine](https://mio0v0.github.io/SWC-Studio/documentation/auto-typing-backends.html) page in the docs for the full retraining workflow, hyperparameter flags, and model resolution rules.
|
|
128
|
+
|
|
129
|
+
## Recommended Workflow
|
|
130
|
+
|
|
131
|
+
1. Open one SWC file in the GUI.
|
|
132
|
+
2. Run validation and review the issue list.
|
|
133
|
+
3. Apply the suggested repairs.
|
|
134
|
+
4. Rerun validation.
|
|
135
|
+
5. Save or export the cleaned result.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
Released under the MIT License. See `LICENSE`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "swcstudio"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Modular SWC processing toolkit with shared core for CLI and GUI"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [{name = "SWC-Dash Contributors"}]
|
|
13
|
+
dependencies = [
|
|
14
|
+
# Core scientific stack
|
|
15
|
+
"numpy>=1.24",
|
|
16
|
+
"pandas>=2.0",
|
|
17
|
+
"scipy>=1.11",
|
|
18
|
+
"morphio>=3.3",
|
|
19
|
+
"neurom>=4.0",
|
|
20
|
+
# Auto-typing engine (v9 ML pipeline) — Stage 1 + Stage 2 sklearn
|
|
21
|
+
# ensembles, Stage 2b GraphSAGE GNN. Pinned to the 1.5.x series the
|
|
22
|
+
# bundled pickles were trained on; sklearn does not guarantee
|
|
23
|
+
# cross-minor pickle compatibility.
|
|
24
|
+
"scikit-learn>=1.5,<1.6",
|
|
25
|
+
"torch>=2.1",
|
|
26
|
+
"torch-geometric>=2.6",
|
|
27
|
+
# GUI — the desktop app is the primary user surface, so PySide6 and
|
|
28
|
+
# the visualization stack are required dependencies.
|
|
29
|
+
"PySide6>=6.6",
|
|
30
|
+
"pyqtgraph>=0.14",
|
|
31
|
+
"vispy>=0.14"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
build = [
|
|
36
|
+
"PyInstaller>=6.11"
|
|
37
|
+
]
|
|
38
|
+
docs = [
|
|
39
|
+
"sphinx>=8.2",
|
|
40
|
+
"pydata-sphinx-theme>=0.16",
|
|
41
|
+
"myst-parser>=3.0"
|
|
42
|
+
]
|
|
43
|
+
# Developer/maintainer extras — packaging tools + Sphinx for the docs.
|
|
44
|
+
# Regular end users do not need this.
|
|
45
|
+
all = [
|
|
46
|
+
"PyInstaller>=6.11",
|
|
47
|
+
"sphinx>=8.2",
|
|
48
|
+
"pydata-sphinx-theme>=0.16",
|
|
49
|
+
"myst-parser>=3.0"
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
swcstudio = "swcstudio.cli.cli:main"
|
|
54
|
+
swcstudio-gui = "swcstudio.gui.main:main"
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.packages.find]
|
|
57
|
+
include = ["swcstudio*"]
|
|
58
|
+
|
|
59
|
+
# Pattern B: lean wheel, models downloaded on first use.
|
|
60
|
+
# Setuptools defaults to auto-including any non-Python file inside a
|
|
61
|
+
# package directory as package-data ("include-package-data = true").
|
|
62
|
+
# We opt out so the model pickles don't end up in the wheel.
|
|
63
|
+
[tool.setuptools]
|
|
64
|
+
include-package-data = false
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
# With include-package-data = false above, this empty mapping is the
|
|
68
|
+
# only source of truth: no extra data files ship in the wheel.
|
|
69
|
+
# Models are downloaded from GitHub Releases on first use by
|
|
70
|
+
# swcstudio.core.updater. The bundled .app distribution still ships
|
|
71
|
+
# models inside the bundle (see packaging/MODULAR_BUILD.md).
|
|
72
|
+
"swcstudio" = []
|
|
73
|
+
|
|
74
|
+
[tool.setuptools.exclude-package-data]
|
|
75
|
+
# Belt-and-suspenders: even if some path drags model files in via
|
|
76
|
+
# auto-discovery, this explicitly excludes them from the wheel.
|
|
77
|
+
"swcstudio" = ["data/models/*"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""swcstudio package entrypoint.
|
|
2
|
+
|
|
3
|
+
Layers:
|
|
4
|
+
- swcstudio.core: shared algorithm/data logic
|
|
5
|
+
- swcstudio.tools: tool + feature modules
|
|
6
|
+
- swcstudio.api: public Python API
|
|
7
|
+
- swcstudio.cli: terminal interface
|
|
8
|
+
- swcstudio.gui: desktop GUI interface
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import PackageNotFoundError, version as _pkg_version
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = _pkg_version("swcstudio")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
# Local source checkout before installation.
|
|
17
|
+
__version__ = "0.1.0"
|
|
18
|
+
|
|
19
|
+
__all__ = ["api", "core", "tools", "plugins", "cli", "gui", "__version__"]
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Public library API for swcstudio.
|
|
2
|
+
|
|
3
|
+
All interfaces (GUI, CLI, and external Python callers) should import these
|
|
4
|
+
functions or the corresponding tool/feature modules.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from swcstudio.core.auto_typing import BatchOptions
|
|
10
|
+
from swcstudio.plugins import (
|
|
11
|
+
autoload_plugins_from_environment,
|
|
12
|
+
get_plugin,
|
|
13
|
+
list_all_feature_methods,
|
|
14
|
+
list_feature_methods,
|
|
15
|
+
list_plugins,
|
|
16
|
+
load_plugin_module,
|
|
17
|
+
load_plugins,
|
|
18
|
+
register_method,
|
|
19
|
+
register_plugin_manifest,
|
|
20
|
+
register_plugin_method,
|
|
21
|
+
unregister_method,
|
|
22
|
+
unregister_plugin,
|
|
23
|
+
)
|
|
24
|
+
from swcstudio.tools.batch_processing.features.auto_typing import run_folder as batch_auto_typing
|
|
25
|
+
from swcstudio.tools.batch_processing.features.index_clean import run_folder as batch_index_clean_folder
|
|
26
|
+
from swcstudio.tools.batch_processing.features.simplification import (
|
|
27
|
+
run_folder as batch_simplify_folder,
|
|
28
|
+
)
|
|
29
|
+
from swcstudio.tools.batch_processing.features.batch_validation import (
|
|
30
|
+
validate_folder as batch_validate_folder,
|
|
31
|
+
)
|
|
32
|
+
from swcstudio.tools.batch_processing.features.radii_cleaning import (
|
|
33
|
+
clean_folder as batch_radii_cleaning,
|
|
34
|
+
clean_path as radii_clean_path,
|
|
35
|
+
)
|
|
36
|
+
from swcstudio.tools.batch_processing.features.swc_splitter import (
|
|
37
|
+
split_folder as batch_split_folder,
|
|
38
|
+
)
|
|
39
|
+
from swcstudio.tools.geometry_editing.features.operations import (
|
|
40
|
+
disconnect_branch as geometry_disconnect_branch,
|
|
41
|
+
delete_node as geometry_delete_node,
|
|
42
|
+
delete_subtree as geometry_delete_subtree,
|
|
43
|
+
insert_node_between as geometry_insert_node_between,
|
|
44
|
+
move_node_absolute as geometry_move_node_absolute,
|
|
45
|
+
move_subtree_absolute as geometry_move_subtree_absolute,
|
|
46
|
+
reconnect_branch as geometry_reconnect_branch,
|
|
47
|
+
reindex_dataframe_with_map as geometry_reindex_dataframe_with_map,
|
|
48
|
+
)
|
|
49
|
+
from swcstudio.tools.morphology_editing.features.dendrogram_editing import (
|
|
50
|
+
reassign_subtree_types,
|
|
51
|
+
reassign_subtree_types_in_file,
|
|
52
|
+
)
|
|
53
|
+
from swcstudio.tools.morphology_editing.features.manual_label import (
|
|
54
|
+
set_node_type_file as morphology_set_node_type_file,
|
|
55
|
+
set_node_type_text as morphology_set_node_type_text,
|
|
56
|
+
)
|
|
57
|
+
from swcstudio.tools.morphology_editing.features.manual_radii import (
|
|
58
|
+
set_node_radius_file as morphology_set_node_radius_file,
|
|
59
|
+
set_node_radius_text as morphology_set_node_radius_text,
|
|
60
|
+
)
|
|
61
|
+
from swcstudio.tools.morphology_editing.features.simplification import (
|
|
62
|
+
simplify_file as morphology_smart_decimation_file,
|
|
63
|
+
simplify_swc_text as morphology_smart_decimation_text,
|
|
64
|
+
)
|
|
65
|
+
from swcstudio.tools.validation.features.auto_fix import auto_fix_file, auto_fix_text
|
|
66
|
+
from swcstudio.tools.validation.features.index_clean import (
|
|
67
|
+
index_clean_file as validation_index_clean_file,
|
|
68
|
+
index_clean_text as validation_index_clean_text,
|
|
69
|
+
)
|
|
70
|
+
from swcstudio.tools.validation.features.auto_typing import (
|
|
71
|
+
auto_label_file as validation_auto_label_file,
|
|
72
|
+
run_file as validation_auto_typing_file,
|
|
73
|
+
)
|
|
74
|
+
from swcstudio.tools.validation.features.run_checks import (
|
|
75
|
+
validate_file as validation_run_file,
|
|
76
|
+
validate_text as validation_run_text,
|
|
77
|
+
)
|
|
78
|
+
from swcstudio.tools.visualization.features.mesh_editing import (
|
|
79
|
+
build_mesh_from_file,
|
|
80
|
+
build_mesh_from_text,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
__all__ = [
|
|
84
|
+
"BatchOptions",
|
|
85
|
+
"batch_validate_folder",
|
|
86
|
+
"batch_split_folder",
|
|
87
|
+
"batch_auto_typing",
|
|
88
|
+
"batch_simplify_folder",
|
|
89
|
+
"batch_index_clean_folder",
|
|
90
|
+
"batch_radii_cleaning",
|
|
91
|
+
"radii_clean_path",
|
|
92
|
+
"auto_fix_text",
|
|
93
|
+
"auto_fix_file",
|
|
94
|
+
"validation_index_clean_text",
|
|
95
|
+
"validation_index_clean_file",
|
|
96
|
+
"validation_auto_typing_file",
|
|
97
|
+
"validation_run_text",
|
|
98
|
+
"validation_run_file",
|
|
99
|
+
"build_mesh_from_text",
|
|
100
|
+
"build_mesh_from_file",
|
|
101
|
+
"reassign_subtree_types",
|
|
102
|
+
"reassign_subtree_types_in_file",
|
|
103
|
+
"morphology_set_node_type_text",
|
|
104
|
+
"morphology_set_node_type_file",
|
|
105
|
+
"morphology_set_node_radius_text",
|
|
106
|
+
"morphology_set_node_radius_file",
|
|
107
|
+
"validation_auto_label_file",
|
|
108
|
+
"morphology_smart_decimation_text",
|
|
109
|
+
"morphology_smart_decimation_file",
|
|
110
|
+
"geometry_move_node_absolute",
|
|
111
|
+
"geometry_move_subtree_absolute",
|
|
112
|
+
"geometry_reconnect_branch",
|
|
113
|
+
"geometry_disconnect_branch",
|
|
114
|
+
"geometry_delete_node",
|
|
115
|
+
"geometry_delete_subtree",
|
|
116
|
+
"geometry_insert_node_between",
|
|
117
|
+
"geometry_reindex_dataframe_with_map",
|
|
118
|
+
"load_plugin_module",
|
|
119
|
+
"load_plugins",
|
|
120
|
+
"autoload_plugins_from_environment",
|
|
121
|
+
"register_plugin_manifest",
|
|
122
|
+
"register_plugin_method",
|
|
123
|
+
"unregister_plugin",
|
|
124
|
+
"list_plugins",
|
|
125
|
+
"get_plugin",
|
|
126
|
+
"register_method",
|
|
127
|
+
"unregister_method",
|
|
128
|
+
"list_feature_methods",
|
|
129
|
+
"list_all_feature_methods",
|
|
130
|
+
]
|