hemispec-toolkit 0.1.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.
- hemispec_toolkit-0.1.0/LICENSE +21 -0
- hemispec_toolkit-0.1.0/MANIFEST.in +17 -0
- hemispec_toolkit-0.1.0/PKG-INFO +166 -0
- hemispec_toolkit-0.1.0/README.md +124 -0
- hemispec_toolkit-0.1.0/pyproject.toml +114 -0
- hemispec_toolkit-0.1.0/setup.cfg +4 -0
- hemispec_toolkit-0.1.0/src/hemispec/__init__.py +100 -0
- hemispec_toolkit-0.1.0/src/hemispec/__main__.py +5 -0
- hemispec_toolkit-0.1.0/src/hemispec/api.py +637 -0
- hemispec_toolkit-0.1.0/src/hemispec/cli.py +604 -0
- hemispec_toolkit-0.1.0/src/hemispec/compute.py +142 -0
- hemispec_toolkit-0.1.0/src/hemispec/dgn_inference.py +141 -0
- hemispec_toolkit-0.1.0/src/hemispec/dgn_model.py +110 -0
- hemispec_toolkit-0.1.0/src/hemispec/gui.py +1031 -0
- hemispec_toolkit-0.1.0/src/hemispec/hemisphere_classifier.py +425 -0
- hemispec_toolkit-0.1.0/src/hemispec/io.py +101 -0
- hemispec_toolkit-0.1.0/src/hemispec/model_assets.py +206 -0
- hemispec_toolkit-0.1.0/src/hemispec/paths.py +302 -0
- hemispec_toolkit-0.1.0/src/hemispec/plots.py +48 -0
- hemispec_toolkit-0.1.0/src/hemispec/py.typed +0 -0
- hemispec_toolkit-0.1.0/src/hemispec/quickstart.py +115 -0
- hemispec_toolkit-0.1.0/src/hemispec/reports.py +46 -0
- hemispec_toolkit-0.1.0/src/hemispec/resources/preprocess/process_single_subject_GM_v2_reorient.sh +80 -0
- hemispec_toolkit-0.1.0/src/hemispec/roi.py +145 -0
- hemispec_toolkit-0.1.0/src/hemispec/similarity.py +254 -0
- hemispec_toolkit-0.1.0/src/hemispec/workflow.py +496 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/PKG-INFO +166 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/SOURCES.txt +37 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/dependency_links.txt +1 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/entry_points.txt +3 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/requires.txt +22 -0
- hemispec_toolkit-0.1.0/src/hemispec_toolkit.egg-info/top_level.txt +1 -0
- hemispec_toolkit-0.1.0/tests/test_api.py +802 -0
- hemispec_toolkit-0.1.0/tests/test_cli_contract.py +27 -0
- hemispec_toolkit-0.1.0/tests/test_compute.py +65 -0
- hemispec_toolkit-0.1.0/tests/test_gui_contract.py +260 -0
- hemispec_toolkit-0.1.0/tests/test_plots.py +26 -0
- hemispec_toolkit-0.1.0/tests/test_quickstart.py +42 -0
- hemispec_toolkit-0.1.0/tests/test_similarity.py +43 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MA Qi
|
|
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,17 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
include src/hemispec/py.typed
|
|
5
|
+
recursive-include src/hemispec/resources *.sh
|
|
6
|
+
|
|
7
|
+
global-exclude __pycache__
|
|
8
|
+
global-exclude *.py[cod]
|
|
9
|
+
global-exclude .DS_Store
|
|
10
|
+
|
|
11
|
+
prune assets
|
|
12
|
+
prune build
|
|
13
|
+
prune dist
|
|
14
|
+
prune data
|
|
15
|
+
prune outputs
|
|
16
|
+
prune reference
|
|
17
|
+
prune p2a-session
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hemispec-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HemiSpec toolkit for reconstruction-derived hemispheric specificity analysis from NIfTI maps.
|
|
5
|
+
Author: HemiSpec Toolkit Authors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://mqqq333.github.io/HemiSpec/
|
|
8
|
+
Project-URL: Documentation, https://mqqq333.github.io/HemiSpec/
|
|
9
|
+
Project-URL: Repository, https://github.com/mqqq333/HemiSpec
|
|
10
|
+
Project-URL: Issues, https://github.com/mqqq333/HemiSpec/issues
|
|
11
|
+
Keywords: neuroimaging,nifti,brain,hemisphere reconstruction,structural specificity,ANS,RNS
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.23
|
|
24
|
+
Requires-Dist: nibabel>=5.0
|
|
25
|
+
Requires-Dist: pandas>=1.5
|
|
26
|
+
Requires-Dist: openpyxl>=3.1
|
|
27
|
+
Requires-Dist: scipy>=1.9
|
|
28
|
+
Requires-Dist: matplotlib>=3.5
|
|
29
|
+
Provides-Extra: model
|
|
30
|
+
Requires-Dist: torch>=2.0; extra == "model"
|
|
31
|
+
Provides-Extra: classifier
|
|
32
|
+
Requires-Dist: scikit-learn<1.8,>=1.3; extra == "classifier"
|
|
33
|
+
Requires-Dist: joblib>=1.3; extra == "classifier"
|
|
34
|
+
Provides-Extra: gui
|
|
35
|
+
Requires-Dist: customtkinter>=5.2; extra == "gui"
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
38
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pyinstaller>=6.0; extra == "dev"
|
|
40
|
+
Requires-Dist: ruff>=0.8; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# HemiSpec
|
|
44
|
+
|
|
45
|
+
**HemiSpec: Reconstruction-derived Hemispheric Specificity**
|
|
46
|
+
|
|
47
|
+
[](#)
|
|
48
|
+
[](LICENSE)
|
|
49
|
+
|
|
50
|
+
HemiSpec is a unified software and documentation project for reconstruction-derived hemispheric specificity analysis. The recommended user path is the PyPI package: it manages the Python runtime dependencies and installs the `hemispec` CLI and `hemispec-gui` entry points in the same environment that carries PyTorch and model-cache access. The repository also contains the MkDocs Material website, public-safe examples, tests, and release scripts.
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<img src="docs/assets/figures/hemispec-study-design.png" alt="HemiSpec study design overview" width="100%">
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
## Recommended PyPI install / Download v0.1.0
|
|
57
|
+
|
|
58
|
+
HemiSpec v0.1.0 is available as a first public beta / research-software release. PyPI is the primary install path because model-enabled workflows need a real Python/PyTorch environment; the CLI and GUI are entry points installed by that package rather than separate primary products.
|
|
59
|
+
|
|
60
|
+
Install the full model/GUI-capable package from PyPI:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m pip install "hemispec-toolkit[gui,model,classifier]"
|
|
64
|
+
hemispec --help
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
GitHub Release artifacts remain available for archived, offline, or Windows-folder fallback installs:
|
|
68
|
+
|
|
69
|
+
- GitHub Release: https://github.com/mqqq333/HemiSpec/releases/tag/v0.1.0
|
|
70
|
+
- Windows CLI: `HemiSpec-CLI-v0.1.0-win64.exe`
|
|
71
|
+
- Windows GUI: `HemiSpec-GUI-v0.1.0-win64.zip`
|
|
72
|
+
- Python artifacts: `hemispec_toolkit-0.1.0-py3-none-any.whl` and `hemispec_toolkit-0.1.0.tar.gz`
|
|
73
|
+
|
|
74
|
+
The source repository carries reusable DGN generator checkpoints and hemisphere-classifier bundles under `assets/models/` via Git LFS, so users can run model-enabled workflows without retraining. Wheels and lightweight desktop builds do not embed the 300 MB+ weights, but the PyPI-installed CLI/GUI/API can auto-download the released model assets into a per-user cache on first model run. The normal path is: input preprocessed GM maps -> run HemiSpec -> get ANS/RNS maps. See [Data and models](docs/data-and-models.md) before publishing or redistributing additional assets.
|
|
75
|
+
|
|
76
|
+
## Method boundary
|
|
77
|
+
|
|
78
|
+
The ANS/RNS metric framework and the original cross-hemispheric DGN approach originate from Wang et al. 2024, *Patterns*, "Using a deep generation network reveals neuroanatomical specificity in hemispheres". HemiSpec builds on that framework and organizes reusable software tooling plus behavioral-phenotype downstream-analysis workflows around it.
|
|
79
|
+
|
|
80
|
+
ANS and RNS remain metric names. The public package, CLI, GUI, and project identity are **HemiSpec**.
|
|
81
|
+
|
|
82
|
+
## Repository layout
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
src/hemispec/ Python package, public API, CLI, GUI, workflows
|
|
86
|
+
docs/ MkDocs Material documentation website
|
|
87
|
+
tests/ pytest regression tests with synthetic fixtures
|
|
88
|
+
examples/ public-safe examples and IO contracts
|
|
89
|
+
scripts/ release/local launcher helpers; research utilities are isolated in scripts/research
|
|
90
|
+
assets/ reusable model bundles plus local atlas/data placement docs
|
|
91
|
+
.github/workflows/ CI and GitHub Pages workflows
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Reusable DGN checkpoints and classifier bundles are tracked with Git LFS. Real subject-level NIfTI files and generated outputs remain excluded.
|
|
95
|
+
|
|
96
|
+
## Install for development
|
|
97
|
+
|
|
98
|
+
For normal use, install the released package from PyPI as shown above. For local development from a source checkout:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
python -m pip install -e .[dev]
|
|
102
|
+
python -m pytest
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Model-enabled source-checkout extras:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
python -m pip install -e .[gui,model,classifier]
|
|
109
|
+
hemispec models --install --with-classifier # optional pre-download; otherwise first model run downloads
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## PyPI-installed CLI
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
hemispec --help
|
|
116
|
+
python -m hemispec --help
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Model-enabled GUI
|
|
120
|
+
|
|
121
|
+
For normal use, launch the GUI from the same PyPI/conda environment that contains PyTorch and HemiSpec. Clone with Git LFS only when you want a source checkout with repository model files:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git lfs install
|
|
125
|
+
git clone https://github.com/mqqq333/HemiSpec.git
|
|
126
|
+
cd HemiSpec
|
|
127
|
+
git lfs pull
|
|
128
|
+
python -m pip install -e .[gui,model,classifier]
|
|
129
|
+
python scripts/hemispec_gui_entry.py
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The GUI setup card should report the DGN model and classifier bundle as found after Git-LFS checkout or PyPI cache download. In a PyPI install, the first model run downloads the released model assets to the user cache if they are not already present. Provide preprocessed `*_GM_masked.nii.gz` inputs and choose an output workspace.
|
|
133
|
+
|
|
134
|
+
## Public-safe quickstart
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python -m pip install hemispec-toolkit
|
|
138
|
+
hemispec quickstart --out-dir hemispec_quickstart
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The built-in synthetic example creates toy NIfTI maps and validates the public file/command contract without private MRI data, model weights, or a source checkout. Source-tree wrapper scripts remain under `examples/synthetic_quickstart/` for development.
|
|
142
|
+
|
|
143
|
+
## Documentation site
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
python -m pip install -r requirements-docs.txt
|
|
147
|
+
python -m mkdocs serve
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Build strictly before publishing:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
python -m mkdocs build --strict
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Citation
|
|
157
|
+
|
|
158
|
+
If you use the reconstruction-derived ANS/RNS framework, cite the original Patterns paper:
|
|
159
|
+
|
|
160
|
+
Wang, G. et al. (2024). Using a deep generation network reveals neuroanatomical specificity in hemispheres. *Patterns*, 5, 100930. https://doi.org/10.1016/j.patter.2024.100930
|
|
161
|
+
|
|
162
|
+
A separate HemiSpec handedness manuscript/software citation will be added when the manuscript, archive DOI, or release record is public.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# HemiSpec
|
|
2
|
+
|
|
3
|
+
**HemiSpec: Reconstruction-derived Hemispheric Specificity**
|
|
4
|
+
|
|
5
|
+
[](#)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
HemiSpec is a unified software and documentation project for reconstruction-derived hemispheric specificity analysis. The recommended user path is the PyPI package: it manages the Python runtime dependencies and installs the `hemispec` CLI and `hemispec-gui` entry points in the same environment that carries PyTorch and model-cache access. The repository also contains the MkDocs Material website, public-safe examples, tests, and release scripts.
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<img src="docs/assets/figures/hemispec-study-design.png" alt="HemiSpec study design overview" width="100%">
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
## Recommended PyPI install / Download v0.1.0
|
|
15
|
+
|
|
16
|
+
HemiSpec v0.1.0 is available as a first public beta / research-software release. PyPI is the primary install path because model-enabled workflows need a real Python/PyTorch environment; the CLI and GUI are entry points installed by that package rather than separate primary products.
|
|
17
|
+
|
|
18
|
+
Install the full model/GUI-capable package from PyPI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python -m pip install "hemispec-toolkit[gui,model,classifier]"
|
|
22
|
+
hemispec --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
GitHub Release artifacts remain available for archived, offline, or Windows-folder fallback installs:
|
|
26
|
+
|
|
27
|
+
- GitHub Release: https://github.com/mqqq333/HemiSpec/releases/tag/v0.1.0
|
|
28
|
+
- Windows CLI: `HemiSpec-CLI-v0.1.0-win64.exe`
|
|
29
|
+
- Windows GUI: `HemiSpec-GUI-v0.1.0-win64.zip`
|
|
30
|
+
- Python artifacts: `hemispec_toolkit-0.1.0-py3-none-any.whl` and `hemispec_toolkit-0.1.0.tar.gz`
|
|
31
|
+
|
|
32
|
+
The source repository carries reusable DGN generator checkpoints and hemisphere-classifier bundles under `assets/models/` via Git LFS, so users can run model-enabled workflows without retraining. Wheels and lightweight desktop builds do not embed the 300 MB+ weights, but the PyPI-installed CLI/GUI/API can auto-download the released model assets into a per-user cache on first model run. The normal path is: input preprocessed GM maps -> run HemiSpec -> get ANS/RNS maps. See [Data and models](docs/data-and-models.md) before publishing or redistributing additional assets.
|
|
33
|
+
|
|
34
|
+
## Method boundary
|
|
35
|
+
|
|
36
|
+
The ANS/RNS metric framework and the original cross-hemispheric DGN approach originate from Wang et al. 2024, *Patterns*, "Using a deep generation network reveals neuroanatomical specificity in hemispheres". HemiSpec builds on that framework and organizes reusable software tooling plus behavioral-phenotype downstream-analysis workflows around it.
|
|
37
|
+
|
|
38
|
+
ANS and RNS remain metric names. The public package, CLI, GUI, and project identity are **HemiSpec**.
|
|
39
|
+
|
|
40
|
+
## Repository layout
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
src/hemispec/ Python package, public API, CLI, GUI, workflows
|
|
44
|
+
docs/ MkDocs Material documentation website
|
|
45
|
+
tests/ pytest regression tests with synthetic fixtures
|
|
46
|
+
examples/ public-safe examples and IO contracts
|
|
47
|
+
scripts/ release/local launcher helpers; research utilities are isolated in scripts/research
|
|
48
|
+
assets/ reusable model bundles plus local atlas/data placement docs
|
|
49
|
+
.github/workflows/ CI and GitHub Pages workflows
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Reusable DGN checkpoints and classifier bundles are tracked with Git LFS. Real subject-level NIfTI files and generated outputs remain excluded.
|
|
53
|
+
|
|
54
|
+
## Install for development
|
|
55
|
+
|
|
56
|
+
For normal use, install the released package from PyPI as shown above. For local development from a source checkout:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
python -m pip install -e .[dev]
|
|
60
|
+
python -m pytest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Model-enabled source-checkout extras:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m pip install -e .[gui,model,classifier]
|
|
67
|
+
hemispec models --install --with-classifier # optional pre-download; otherwise first model run downloads
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## PyPI-installed CLI
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
hemispec --help
|
|
74
|
+
python -m hemispec --help
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Model-enabled GUI
|
|
78
|
+
|
|
79
|
+
For normal use, launch the GUI from the same PyPI/conda environment that contains PyTorch and HemiSpec. Clone with Git LFS only when you want a source checkout with repository model files:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git lfs install
|
|
83
|
+
git clone https://github.com/mqqq333/HemiSpec.git
|
|
84
|
+
cd HemiSpec
|
|
85
|
+
git lfs pull
|
|
86
|
+
python -m pip install -e .[gui,model,classifier]
|
|
87
|
+
python scripts/hemispec_gui_entry.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The GUI setup card should report the DGN model and classifier bundle as found after Git-LFS checkout or PyPI cache download. In a PyPI install, the first model run downloads the released model assets to the user cache if they are not already present. Provide preprocessed `*_GM_masked.nii.gz` inputs and choose an output workspace.
|
|
91
|
+
|
|
92
|
+
## Public-safe quickstart
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
python -m pip install hemispec-toolkit
|
|
96
|
+
hemispec quickstart --out-dir hemispec_quickstart
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The built-in synthetic example creates toy NIfTI maps and validates the public file/command contract without private MRI data, model weights, or a source checkout. Source-tree wrapper scripts remain under `examples/synthetic_quickstart/` for development.
|
|
100
|
+
|
|
101
|
+
## Documentation site
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
python -m pip install -r requirements-docs.txt
|
|
105
|
+
python -m mkdocs serve
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Build strictly before publishing:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python -m mkdocs build --strict
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Citation
|
|
115
|
+
|
|
116
|
+
If you use the reconstruction-derived ANS/RNS framework, cite the original Patterns paper:
|
|
117
|
+
|
|
118
|
+
Wang, G. et al. (2024). Using a deep generation network reveals neuroanatomical specificity in hemispheres. *Patterns*, 5, 100930. https://doi.org/10.1016/j.patter.2024.100930
|
|
119
|
+
|
|
120
|
+
A separate HemiSpec handedness manuscript/software citation will be added when the manuscript, archive DOI, or release record is public.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hemispec-toolkit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "HemiSpec toolkit for reconstruction-derived hemispheric specificity analysis from NIfTI maps."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"numpy>=1.23",
|
|
14
|
+
"nibabel>=5.0",
|
|
15
|
+
"pandas>=1.5",
|
|
16
|
+
"openpyxl>=3.1",
|
|
17
|
+
"scipy>=1.9",
|
|
18
|
+
"matplotlib>=3.5",
|
|
19
|
+
]
|
|
20
|
+
authors = [
|
|
21
|
+
{name = "HemiSpec Toolkit Authors"}
|
|
22
|
+
]
|
|
23
|
+
keywords = [
|
|
24
|
+
"neuroimaging",
|
|
25
|
+
"nifti",
|
|
26
|
+
"brain",
|
|
27
|
+
"hemisphere reconstruction",
|
|
28
|
+
"structural specificity",
|
|
29
|
+
"ANS",
|
|
30
|
+
"RNS",
|
|
31
|
+
]
|
|
32
|
+
classifiers = [
|
|
33
|
+
"Development Status :: 3 - Alpha",
|
|
34
|
+
"Intended Audience :: Science/Research",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3.9",
|
|
37
|
+
"Programming Language :: Python :: 3.10",
|
|
38
|
+
"Programming Language :: Python :: 3.11",
|
|
39
|
+
"Programming Language :: Python :: 3.12",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://mqqq333.github.io/HemiSpec/"
|
|
45
|
+
Documentation = "https://mqqq333.github.io/HemiSpec/"
|
|
46
|
+
Repository = "https://github.com/mqqq333/HemiSpec"
|
|
47
|
+
Issues = "https://github.com/mqqq333/HemiSpec/issues"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
model = [
|
|
51
|
+
"torch>=2.0",
|
|
52
|
+
]
|
|
53
|
+
classifier = [
|
|
54
|
+
"scikit-learn>=1.3,<1.8",
|
|
55
|
+
"joblib>=1.3",
|
|
56
|
+
]
|
|
57
|
+
gui = [
|
|
58
|
+
"customtkinter>=5.2",
|
|
59
|
+
]
|
|
60
|
+
dev = [
|
|
61
|
+
"pytest>=7",
|
|
62
|
+
"build>=1.0",
|
|
63
|
+
"pyinstaller>=6.0",
|
|
64
|
+
"ruff>=0.8",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[project.scripts]
|
|
68
|
+
hemispec = "hemispec.cli:main"
|
|
69
|
+
hemispec-gui = "hemispec.gui:main"
|
|
70
|
+
|
|
71
|
+
[tool.setuptools]
|
|
72
|
+
include-package-data = true
|
|
73
|
+
|
|
74
|
+
[tool.setuptools.packages.find]
|
|
75
|
+
where = ["src"]
|
|
76
|
+
|
|
77
|
+
[tool.setuptools.package-data]
|
|
78
|
+
hemispec = [
|
|
79
|
+
"py.typed",
|
|
80
|
+
"resources/preprocess/*.sh",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
[tool.pytest.ini_options]
|
|
84
|
+
testpaths = ["tests"]
|
|
85
|
+
markers = [
|
|
86
|
+
"gui: tests requiring a graphical display/Tk",
|
|
87
|
+
]
|
|
88
|
+
norecursedirs = [
|
|
89
|
+
".venv-build",
|
|
90
|
+
"build",
|
|
91
|
+
"dist",
|
|
92
|
+
"reference",
|
|
93
|
+
"assets",
|
|
94
|
+
"outputs",
|
|
95
|
+
"data",
|
|
96
|
+
"classifier_models",
|
|
97
|
+
"TRT_outputs",
|
|
98
|
+
]
|
|
99
|
+
[tool.ruff]
|
|
100
|
+
line-length = 100
|
|
101
|
+
target-version = "py39"
|
|
102
|
+
src = ["src", "tests"]
|
|
103
|
+
extend-exclude = [
|
|
104
|
+
"assets",
|
|
105
|
+
"build",
|
|
106
|
+
"data",
|
|
107
|
+
"dist",
|
|
108
|
+
"outputs",
|
|
109
|
+
"reference",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
select = ["E4", "E7", "E9", "F", "I"]
|
|
114
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""ANS/RNS computation and validation toolkit."""
|
|
2
|
+
|
|
3
|
+
from .api import (
|
|
4
|
+
DGNInferenceConfig,
|
|
5
|
+
DGNModelBundle,
|
|
6
|
+
HemisphereClassificationConfig,
|
|
7
|
+
HemisphereClassificationResult,
|
|
8
|
+
MetricComputeConfig,
|
|
9
|
+
MetricComputeResult,
|
|
10
|
+
PipelineRunConfig,
|
|
11
|
+
PipelineRunResult,
|
|
12
|
+
PreprocessingSpec,
|
|
13
|
+
ValidationConfig,
|
|
14
|
+
ValidationRunResult,
|
|
15
|
+
ValidationSummaryRow,
|
|
16
|
+
compute_ans_rns_arrays,
|
|
17
|
+
compute_metrics,
|
|
18
|
+
default_classifier_output_path,
|
|
19
|
+
default_input_glob,
|
|
20
|
+
default_trt_output_path,
|
|
21
|
+
discover_local_dgn_bundles,
|
|
22
|
+
get_preprocessing_spec,
|
|
23
|
+
infer_dgn_direction_from_path,
|
|
24
|
+
normalize_dgn_direction,
|
|
25
|
+
resolve_classifier_model_dir,
|
|
26
|
+
resolve_dgn_model_root,
|
|
27
|
+
resolve_glasser_atlas_path,
|
|
28
|
+
resolve_glasser_label_table,
|
|
29
|
+
resolve_validation_hemis,
|
|
30
|
+
run_dgn_inference,
|
|
31
|
+
run_pipeline,
|
|
32
|
+
target_hemisphere_for_direction,
|
|
33
|
+
validate_hemisphere_classification,
|
|
34
|
+
validate_reliability,
|
|
35
|
+
validate_specificity,
|
|
36
|
+
)
|
|
37
|
+
from .model_assets import (
|
|
38
|
+
ensure_default_classifier_models,
|
|
39
|
+
ensure_default_dgn_models,
|
|
40
|
+
ensure_default_model_assets,
|
|
41
|
+
)
|
|
42
|
+
from .quickstart import make_synthetic_quickstart_inputs, run_synthetic_quickstart
|
|
43
|
+
from .roi import RoiSummaryConfig, summarize_maps_by_atlas
|
|
44
|
+
from .workflow import (
|
|
45
|
+
BilateralWorkflowConfig,
|
|
46
|
+
BilateralWorkflowResult,
|
|
47
|
+
run_bilateral_workflow,
|
|
48
|
+
summarize_bilateral_roi_features,
|
|
49
|
+
summarize_subject_metrics,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
__version__ = "0.1.0"
|
|
53
|
+
|
|
54
|
+
__all__ = [
|
|
55
|
+
"__version__",
|
|
56
|
+
"DGNInferenceConfig",
|
|
57
|
+
"BilateralWorkflowConfig",
|
|
58
|
+
"BilateralWorkflowResult",
|
|
59
|
+
"DGNModelBundle",
|
|
60
|
+
"HemisphereClassificationConfig",
|
|
61
|
+
"HemisphereClassificationResult",
|
|
62
|
+
"MetricComputeConfig",
|
|
63
|
+
"MetricComputeResult",
|
|
64
|
+
"PipelineRunConfig",
|
|
65
|
+
"PipelineRunResult",
|
|
66
|
+
"PreprocessingSpec",
|
|
67
|
+
"RoiSummaryConfig",
|
|
68
|
+
"ValidationConfig",
|
|
69
|
+
"ValidationRunResult",
|
|
70
|
+
"ValidationSummaryRow",
|
|
71
|
+
"compute_ans_rns_arrays",
|
|
72
|
+
"compute_metrics",
|
|
73
|
+
"default_classifier_output_path",
|
|
74
|
+
"default_input_glob",
|
|
75
|
+
"default_trt_output_path",
|
|
76
|
+
"discover_local_dgn_bundles",
|
|
77
|
+
"ensure_default_classifier_models",
|
|
78
|
+
"ensure_default_dgn_models",
|
|
79
|
+
"ensure_default_model_assets",
|
|
80
|
+
"get_preprocessing_spec",
|
|
81
|
+
"infer_dgn_direction_from_path",
|
|
82
|
+
"normalize_dgn_direction",
|
|
83
|
+
"resolve_classifier_model_dir",
|
|
84
|
+
"resolve_dgn_model_root",
|
|
85
|
+
"resolve_glasser_atlas_path",
|
|
86
|
+
"resolve_glasser_label_table",
|
|
87
|
+
"resolve_validation_hemis",
|
|
88
|
+
"make_synthetic_quickstart_inputs",
|
|
89
|
+
"run_dgn_inference",
|
|
90
|
+
"run_bilateral_workflow",
|
|
91
|
+
"run_pipeline",
|
|
92
|
+
"run_synthetic_quickstart",
|
|
93
|
+
"target_hemisphere_for_direction",
|
|
94
|
+
"validate_reliability",
|
|
95
|
+
"validate_hemisphere_classification",
|
|
96
|
+
"validate_specificity",
|
|
97
|
+
"summarize_maps_by_atlas",
|
|
98
|
+
"summarize_bilateral_roi_features",
|
|
99
|
+
"summarize_subject_metrics",
|
|
100
|
+
]
|