gate-converter 1.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.
- gate_converter-1.1.0/LICENSE +22 -0
- gate_converter-1.1.0/PKG-INFO +176 -0
- gate_converter-1.1.0/README.md +122 -0
- gate_converter-1.1.0/pyproject.toml +83 -0
- gate_converter-1.1.0/setup.cfg +4 -0
- gate_converter-1.1.0/src/gate_converter/__init__.py +109 -0
- gate_converter-1.1.0/src/gate_converter/__main__.py +6 -0
- gate_converter-1.1.0/src/gate_converter/api/__init__.py +51 -0
- gate_converter-1.1.0/src/gate_converter/canonical/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/canonical/actor.py +109 -0
- gate_converter-1.1.0/src/gate_converter/canonical/builder.py +378 -0
- gate_converter-1.1.0/src/gate_converter/canonical/builder_ext.py +371 -0
- gate_converter-1.1.0/src/gate_converter/canonical/canonical_hash.py +38 -0
- gate_converter-1.1.0/src/gate_converter/canonical/model.py +302 -0
- gate_converter-1.1.0/src/gate_converter/canonical/treatment_plan.py +120 -0
- gate_converter-1.1.0/src/gate_converter/cli/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/cli/main.py +425 -0
- gate_converter-1.1.0/src/gate_converter/conversion/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/conversion/engine.py +270 -0
- gate_converter-1.1.0/src/gate_converter/conversion/gate10_generator.py +231 -0
- gate_converter-1.1.0/src/gate_converter/conversion/gate10_to_canonical.py +136 -0
- gate_converter-1.1.0/src/gate_converter/conversion/gate9_generator.py +206 -0
- gate_converter-1.1.0/src/gate_converter/conversion/overrides.py +25 -0
- gate_converter-1.1.0/src/gate_converter/data/actors_registry.yaml +241 -0
- gate_converter-1.1.0/src/gate_converter/data/command_registry.yaml +110 -0
- gate_converter-1.1.0/src/gate_converter/data/gate_feature_registry.yaml +78 -0
- gate_converter-1.1.0/src/gate_converter/data/version_registry.csv +13 -0
- gate_converter-1.1.0/src/gate_converter/data/version_registry.json +171 -0
- gate_converter-1.1.0/src/gate_converter/digitizer/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/digitizer/converter.py +100 -0
- gate_converter-1.1.0/src/gate_converter/digitizer/graph.py +104 -0
- gate_converter-1.1.0/src/gate_converter/digitizer/legacy.py +146 -0
- gate_converter-1.1.0/src/gate_converter/digitizer/newarch.py +136 -0
- gate_converter-1.1.0/src/gate_converter/domains/__init__.py +25 -0
- gate_converter-1.1.0/src/gate_converter/domains/actors.py +60 -0
- gate_converter-1.1.0/src/gate_converter/domains/base.py +17 -0
- gate_converter-1.1.0/src/gate_converter/domains/digitizers.py +24 -0
- gate_converter-1.1.0/src/gate_converter/domains/dosimetry.py +48 -0
- gate_converter-1.1.0/src/gate_converter/domains/geometry.py +28 -0
- gate_converter-1.1.0/src/gate_converter/domains/imaging.py +27 -0
- gate_converter-1.1.0/src/gate_converter/domains/motion.py +22 -0
- gate_converter-1.1.0/src/gate_converter/domains/phase_space.py +31 -0
- gate_converter-1.1.0/src/gate_converter/domains/physics.py +29 -0
- gate_converter-1.1.0/src/gate_converter/domains/radiotherapy.py +43 -0
- gate_converter-1.1.0/src/gate_converter/domains/sources.py +29 -0
- gate_converter-1.1.0/src/gate_converter/domains/validators.py +21 -0
- gate_converter-1.1.0/src/gate_converter/exceptions.py +38 -0
- gate_converter-1.1.0/src/gate_converter/gui/__init__.py +30 -0
- gate_converter-1.1.0/src/gate_converter/parser/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/parser/gate10_parser.py +256 -0
- gate_converter-1.1.0/src/gate_converter/parser/gate9_parser.py +294 -0
- gate_converter-1.1.0/src/gate_converter/parser/lexer.py +147 -0
- gate_converter-1.1.0/src/gate_converter/provenance.py +28 -0
- gate_converter-1.1.0/src/gate_converter/reporting/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/reporting/report.py +71 -0
- gate_converter-1.1.0/src/gate_converter/reporting/semantic_loss.py +63 -0
- gate_converter-1.1.0/src/gate_converter/units.py +94 -0
- gate_converter-1.1.0/src/gate_converter/utils/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/utils/io.py +65 -0
- gate_converter-1.1.0/src/gate_converter/validation/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/validation/compare.py +60 -0
- gate_converter-1.1.0/src/gate_converter/validation/numerical.py +72 -0
- gate_converter-1.1.0/src/gate_converter/validation/runtime.py +35 -0
- gate_converter-1.1.0/src/gate_converter/validation/validators.py +60 -0
- gate_converter-1.1.0/src/gate_converter/version.py +3 -0
- gate_converter-1.1.0/src/gate_converter/versions/__init__.py +61 -0
- gate_converter-1.1.0/src/gate_converter/versions/actors/__init__.py +102 -0
- gate_converter-1.1.0/src/gate_converter/versions/command_registry.py +73 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v10_0.py +34 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v10_1.py +26 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_0.py +25 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_1.py +18 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_2.py +19 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_3.py +40 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_4.py +18 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_4_1.py +17 -0
- gate_converter-1.1.0/src/gate_converter/versions/profiles/v9_4_2.py +17 -0
- gate_converter-1.1.0/src/gate_converter/visualization/__init__.py +1 -0
- gate_converter-1.1.0/src/gate_converter/visualization/plots.py +70 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/PKG-INFO +176 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/SOURCES.txt +84 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/dependency_links.txt +1 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/entry_points.txt +2 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/requires.txt +30 -0
- gate_converter-1.1.0/src/gate_converter.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 GATE Converter Contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
This software is an independent migration toolkit. It is not part of,
|
|
20
|
+
affiliated with, or endorsed by the OpenGATE collaboration. GATE and
|
|
21
|
+
OpenGATE are developed by their respective contributors under their own
|
|
22
|
+
licenses (see THIRD_PARTY_NOTICES.txt).
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gate-converter
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Version-aware, loss-aware migration toolkit for GATE 9.x macros and GATE 10 / OpenGATE Python projects
|
|
5
|
+
Author-email: Rasool Safari <r.safari@shirazu.ac.ir>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/OpenGATE/gate-converter
|
|
8
|
+
Project-URL: Documentation, https://github.com/OpenGATE/gate-converter#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/OpenGATE/gate-converter
|
|
10
|
+
Keywords: gate,opengate,geant4,monte-carlo,pet,medical-physics,migration
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: packaging>=23.0
|
|
29
|
+
Requires-Dist: rich>=12.0
|
|
30
|
+
Requires-Dist: networkx>=2.8
|
|
31
|
+
Requires-Dist: numpy>=1.22
|
|
32
|
+
Requires-Dist: matplotlib>=3.5
|
|
33
|
+
Requires-Dist: python-docx>=1.1
|
|
34
|
+
Provides-Extra: gui
|
|
35
|
+
Requires-Dist: PySide6>=6.4; extra == "gui"
|
|
36
|
+
Provides-Extra: test
|
|
37
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
38
|
+
Requires-Dist: coverage>=7.0; extra == "test"
|
|
39
|
+
Requires-Dist: hypothesis>=6.0; extra == "test"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: build; extra == "dev"
|
|
42
|
+
Requires-Dist: twine; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff; extra == "dev"
|
|
44
|
+
Requires-Dist: mypy; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest; extra == "dev"
|
|
46
|
+
Requires-Dist: coverage; extra == "dev"
|
|
47
|
+
Requires-Dist: hypothesis; extra == "dev"
|
|
48
|
+
Provides-Extra: all
|
|
49
|
+
Requires-Dist: PySide6>=6.4; extra == "all"
|
|
50
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
51
|
+
Requires-Dist: coverage>=7.0; extra == "all"
|
|
52
|
+
Requires-Dist: hypothesis>=6.0; extra == "all"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# gate-converter
|
|
56
|
+
|
|
57
|
+
**Comprehensive, version-aware, loss-aware migration framework for GATE 9.x macros and GATE 10 / OpenGATE Python — covering imaging (PET/SPECT/CT), dosimetry, radiotherapy (photon/electron/proton/carbon-ion), treatment plans, phase space, motion, optical, actors, and advanced physics.**
|
|
58
|
+
|
|
59
|
+
Convert GATE simulation projects between GATE 9.x versions, migrate GATE 9.x macros to
|
|
60
|
+
GATE 10 Python, and reverse-convert structured GATE 10 code back to GATE 9 macros —
|
|
61
|
+
with a canonical intermediate representation, a real macro parser, a bidirectional
|
|
62
|
+
digitizer engine (legacy 9.0–9.2 ↔ manager 9.3+), a 23-actor registry with rich
|
|
63
|
+
actor/plan models, domain plug-ins, static validation, semantic diffs,
|
|
64
|
+
and honest loss/unsupported reporting. No GATE installation needed for conversion.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install gate-converter
|
|
70
|
+
pip install gate-converter[gui] # optional PySide6 comparison GUI
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Python ≥ 3.9. See `docs/markdown/installation.md`.
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
gateconvert inspect old_project/ --from 9.2
|
|
79
|
+
gateconvert convert old_project --from 9.2 --to 9.4.2 -o pet94 --allow-lossy
|
|
80
|
+
gateconvert convert old_project --to 10.1.1 -o pet10 --allow-lossy
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from gate_converter import convert_project
|
|
85
|
+
result = convert_project("old_project/", "9.2", "10.1.1", "pet10/", allow_lossy=True)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Supported versions
|
|
89
|
+
|
|
90
|
+
9.0, 9.1, 9.2, 9.3, 9.4, 9.4.1, 9.4.2, 10.0.0, 10.0.1, 10.0.2, 10.1, 10.1.1.
|
|
91
|
+
Full registry: `version_registry.json` / `.csv`. Non-existent tags (9.0.1, 9.1.1…) are rejected.
|
|
92
|
+
|
|
93
|
+
## Domains (only listed with matrix evidence)
|
|
94
|
+
|
|
95
|
+
* **Imaging**: PET (EXACT), SPECT/CT (PARTIAL) — `domains/imaging`
|
|
96
|
+
* **Dosimetry**: voxel dose+uncertainty, LET, fluence, TLE, Edep (supported config migration); dose rate/dose-to-water/ROI (PARTIAL); RBE/biological (UNSUPPORTED — external postprocessing) — `DOSIMETRY_SUPPORT_MATRIX.csv`
|
|
97
|
+
* **Radiotherapy**: proton PBS, carbon/generic ions, TPS plans, phase-space beams (supported config); photon/electron linac, MLC, patient CT (PARTIAL) — `RADIOTHERAPY_SUPPORT_MATRIX.csv`
|
|
98
|
+
* **Actors**: 23 discovered, 13 fully supported, 9 partial, 1 unsupported (custom) — `ACTOR_SUPPORT_MATRIX.csv`, `actor_coverage_report.md`
|
|
99
|
+
* **Phase space**: actor→file→source pipeline (PARTIAL/SUPPORTED)
|
|
100
|
+
* **Treatment plans**: generic field/layer/spot model + TPS text parsing
|
|
101
|
+
* **Motion/optical/advanced physics**: structural (PARTIAL); custom C++ (UNSUPPORTED by design)
|
|
102
|
+
|
|
103
|
+
## Conversion examples
|
|
104
|
+
|
|
105
|
+
* 9.x → 9.x: `gateconvert convert proj --from 9.2 --to 9.4.2`
|
|
106
|
+
* 9.x → 10: `gateconvert convert proj --to 10.1.1` (multi-file Python output)
|
|
107
|
+
* 10 → 9.x: `gateconvert reverse gate10_proj --to 9.2`
|
|
108
|
+
* Digitizer only: `gateconvert digitizer old.mac --to 9.3`
|
|
109
|
+
|
|
110
|
+
## Digitizer conversion
|
|
111
|
+
|
|
112
|
+
Legacy (`/gate/digitizer/Singles|Coincidences`, ≤9.2) ↔ DigitizerManager
|
|
113
|
+
(`/gate/digitizerMgr/...`, 9.3+) via a canonical digitizer graph. Spblurring and
|
|
114
|
+
coincidence pulse processors were not ported upstream → reported LOSSY/UNSUPPORTED,
|
|
115
|
+
never silently dropped. Multi-SD chains convert forward natively, merge (APPROXIMATE)
|
|
116
|
+
in reverse. Matrix: `digitizer_compatibility_matrix.csv`.
|
|
117
|
+
|
|
118
|
+
## GATE 10 migration / reverse conversion
|
|
119
|
+
|
|
120
|
+
Forward generation emits `simulation.py geometry.py materials.py sources.py physics.py
|
|
121
|
+
digitizer.py actors.py acquisition.py config.py run.py` using the target profile's API
|
|
122
|
+
(10.0.x vs 10.1.x filter API). Reverse parsing is AST-static and never executes code;
|
|
123
|
+
arbitrary Python is best-effort — see `gate10_python_conversion_capability.md`.
|
|
124
|
+
|
|
125
|
+
## CLI
|
|
126
|
+
|
|
127
|
+
`detect-version inspect validate convert digitizer reverse compare report test audit actors dosimetry radiotherapy coverage gaps validate-actor validate-dosimetry validate-radiotherapy` with
|
|
128
|
+
`--verbose --quiet --json --strict --allow-lossy --dry-run --report --validate-runtime --strict-scientific --domain imaging|dosimetry|radiotherapy|actors|all`.
|
|
129
|
+
Details: `docs/markdown/cli.md`.
|
|
130
|
+
|
|
131
|
+
## Python API
|
|
132
|
+
|
|
133
|
+
`convert_project, parse_gate_project, parse_gate10_project, inspect_project,
|
|
134
|
+
detect_gate_version, validate_project, compare_projects, convert_digitizer,
|
|
135
|
+
generate_gate10, generate_gate9, validate_imaging, validate_dosimetry,
|
|
136
|
+
validate_radiotherapy, validate_actors, CanonicalActor, TreatmentPlan,
|
|
137
|
+
parse_tps_text, actor_map, compare_profiles` — see `docs/markdown/api.md`.
|
|
138
|
+
|
|
139
|
+
## Validation
|
|
140
|
+
|
|
141
|
+
Static validation + semantic (canonical-level) diffs + round-trip hash comparison +
|
|
142
|
+
optional real-GATE execution (`--validate-runtime`, else honestly NOT AVAILABLE).
|
|
143
|
+
Runtime runs are never faked. See `docs/markdown/validation.md` and
|
|
144
|
+
`reports/GATE_Converter_Scientific_Validation_Report.docx`.
|
|
145
|
+
|
|
146
|
+
## Limitations
|
|
147
|
+
|
|
148
|
+
Custom Geant4 C++ hooks, arbitrary dynamic Python, Spblurring→9.3+, and coincidence
|
|
149
|
+
processors cannot convert exactly. Full statement: `docs/markdown/limitations.md`.
|
|
150
|
+
|
|
151
|
+
## Examples
|
|
152
|
+
|
|
153
|
+
`examples/`: basic 9.0, 9.2 PET, legacy/new digitizers, 9.4 alias PET, complex
|
|
154
|
+
multi-SD PET benchmark, GATE 10 reference.
|
|
155
|
+
|
|
156
|
+
## Development / testing
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip install -e .[dev]
|
|
160
|
+
pytest # + coverage for parser/conversion core
|
|
161
|
+
ruff check src tests
|
|
162
|
+
python -m mypy src/gate_converter --ignore-missing-imports
|
|
163
|
+
python -m build && twine check dist/*
|
|
164
|
+
python final_audit.py
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## PyPI deployment
|
|
168
|
+
|
|
169
|
+
Package `gate-converter` 1.0.0 is build-ready (`pyproject.toml`, sdist + wheel,
|
|
170
|
+
`twine check` clean). **Not auto-uploaded** — publish explicitly with
|
|
171
|
+
`twine upload dist/*` only when requested.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
Apache-2.0 (`LICENSE`); third-party notices in `THIRD_PARTY_NOTICES.txt`. Independent
|
|
176
|
+
toolkit, not affiliated with the OpenGATE collaboration.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# gate-converter
|
|
2
|
+
|
|
3
|
+
**Comprehensive, version-aware, loss-aware migration framework for GATE 9.x macros and GATE 10 / OpenGATE Python — covering imaging (PET/SPECT/CT), dosimetry, radiotherapy (photon/electron/proton/carbon-ion), treatment plans, phase space, motion, optical, actors, and advanced physics.**
|
|
4
|
+
|
|
5
|
+
Convert GATE simulation projects between GATE 9.x versions, migrate GATE 9.x macros to
|
|
6
|
+
GATE 10 Python, and reverse-convert structured GATE 10 code back to GATE 9 macros —
|
|
7
|
+
with a canonical intermediate representation, a real macro parser, a bidirectional
|
|
8
|
+
digitizer engine (legacy 9.0–9.2 ↔ manager 9.3+), a 23-actor registry with rich
|
|
9
|
+
actor/plan models, domain plug-ins, static validation, semantic diffs,
|
|
10
|
+
and honest loss/unsupported reporting. No GATE installation needed for conversion.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install gate-converter
|
|
16
|
+
pip install gate-converter[gui] # optional PySide6 comparison GUI
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Python ≥ 3.9. See `docs/markdown/installation.md`.
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gateconvert inspect old_project/ --from 9.2
|
|
25
|
+
gateconvert convert old_project --from 9.2 --to 9.4.2 -o pet94 --allow-lossy
|
|
26
|
+
gateconvert convert old_project --to 10.1.1 -o pet10 --allow-lossy
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from gate_converter import convert_project
|
|
31
|
+
result = convert_project("old_project/", "9.2", "10.1.1", "pet10/", allow_lossy=True)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Supported versions
|
|
35
|
+
|
|
36
|
+
9.0, 9.1, 9.2, 9.3, 9.4, 9.4.1, 9.4.2, 10.0.0, 10.0.1, 10.0.2, 10.1, 10.1.1.
|
|
37
|
+
Full registry: `version_registry.json` / `.csv`. Non-existent tags (9.0.1, 9.1.1…) are rejected.
|
|
38
|
+
|
|
39
|
+
## Domains (only listed with matrix evidence)
|
|
40
|
+
|
|
41
|
+
* **Imaging**: PET (EXACT), SPECT/CT (PARTIAL) — `domains/imaging`
|
|
42
|
+
* **Dosimetry**: voxel dose+uncertainty, LET, fluence, TLE, Edep (supported config migration); dose rate/dose-to-water/ROI (PARTIAL); RBE/biological (UNSUPPORTED — external postprocessing) — `DOSIMETRY_SUPPORT_MATRIX.csv`
|
|
43
|
+
* **Radiotherapy**: proton PBS, carbon/generic ions, TPS plans, phase-space beams (supported config); photon/electron linac, MLC, patient CT (PARTIAL) — `RADIOTHERAPY_SUPPORT_MATRIX.csv`
|
|
44
|
+
* **Actors**: 23 discovered, 13 fully supported, 9 partial, 1 unsupported (custom) — `ACTOR_SUPPORT_MATRIX.csv`, `actor_coverage_report.md`
|
|
45
|
+
* **Phase space**: actor→file→source pipeline (PARTIAL/SUPPORTED)
|
|
46
|
+
* **Treatment plans**: generic field/layer/spot model + TPS text parsing
|
|
47
|
+
* **Motion/optical/advanced physics**: structural (PARTIAL); custom C++ (UNSUPPORTED by design)
|
|
48
|
+
|
|
49
|
+
## Conversion examples
|
|
50
|
+
|
|
51
|
+
* 9.x → 9.x: `gateconvert convert proj --from 9.2 --to 9.4.2`
|
|
52
|
+
* 9.x → 10: `gateconvert convert proj --to 10.1.1` (multi-file Python output)
|
|
53
|
+
* 10 → 9.x: `gateconvert reverse gate10_proj --to 9.2`
|
|
54
|
+
* Digitizer only: `gateconvert digitizer old.mac --to 9.3`
|
|
55
|
+
|
|
56
|
+
## Digitizer conversion
|
|
57
|
+
|
|
58
|
+
Legacy (`/gate/digitizer/Singles|Coincidences`, ≤9.2) ↔ DigitizerManager
|
|
59
|
+
(`/gate/digitizerMgr/...`, 9.3+) via a canonical digitizer graph. Spblurring and
|
|
60
|
+
coincidence pulse processors were not ported upstream → reported LOSSY/UNSUPPORTED,
|
|
61
|
+
never silently dropped. Multi-SD chains convert forward natively, merge (APPROXIMATE)
|
|
62
|
+
in reverse. Matrix: `digitizer_compatibility_matrix.csv`.
|
|
63
|
+
|
|
64
|
+
## GATE 10 migration / reverse conversion
|
|
65
|
+
|
|
66
|
+
Forward generation emits `simulation.py geometry.py materials.py sources.py physics.py
|
|
67
|
+
digitizer.py actors.py acquisition.py config.py run.py` using the target profile's API
|
|
68
|
+
(10.0.x vs 10.1.x filter API). Reverse parsing is AST-static and never executes code;
|
|
69
|
+
arbitrary Python is best-effort — see `gate10_python_conversion_capability.md`.
|
|
70
|
+
|
|
71
|
+
## CLI
|
|
72
|
+
|
|
73
|
+
`detect-version inspect validate convert digitizer reverse compare report test audit actors dosimetry radiotherapy coverage gaps validate-actor validate-dosimetry validate-radiotherapy` with
|
|
74
|
+
`--verbose --quiet --json --strict --allow-lossy --dry-run --report --validate-runtime --strict-scientific --domain imaging|dosimetry|radiotherapy|actors|all`.
|
|
75
|
+
Details: `docs/markdown/cli.md`.
|
|
76
|
+
|
|
77
|
+
## Python API
|
|
78
|
+
|
|
79
|
+
`convert_project, parse_gate_project, parse_gate10_project, inspect_project,
|
|
80
|
+
detect_gate_version, validate_project, compare_projects, convert_digitizer,
|
|
81
|
+
generate_gate10, generate_gate9, validate_imaging, validate_dosimetry,
|
|
82
|
+
validate_radiotherapy, validate_actors, CanonicalActor, TreatmentPlan,
|
|
83
|
+
parse_tps_text, actor_map, compare_profiles` — see `docs/markdown/api.md`.
|
|
84
|
+
|
|
85
|
+
## Validation
|
|
86
|
+
|
|
87
|
+
Static validation + semantic (canonical-level) diffs + round-trip hash comparison +
|
|
88
|
+
optional real-GATE execution (`--validate-runtime`, else honestly NOT AVAILABLE).
|
|
89
|
+
Runtime runs are never faked. See `docs/markdown/validation.md` and
|
|
90
|
+
`reports/GATE_Converter_Scientific_Validation_Report.docx`.
|
|
91
|
+
|
|
92
|
+
## Limitations
|
|
93
|
+
|
|
94
|
+
Custom Geant4 C++ hooks, arbitrary dynamic Python, Spblurring→9.3+, and coincidence
|
|
95
|
+
processors cannot convert exactly. Full statement: `docs/markdown/limitations.md`.
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
`examples/`: basic 9.0, 9.2 PET, legacy/new digitizers, 9.4 alias PET, complex
|
|
100
|
+
multi-SD PET benchmark, GATE 10 reference.
|
|
101
|
+
|
|
102
|
+
## Development / testing
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install -e .[dev]
|
|
106
|
+
pytest # + coverage for parser/conversion core
|
|
107
|
+
ruff check src tests
|
|
108
|
+
python -m mypy src/gate_converter --ignore-missing-imports
|
|
109
|
+
python -m build && twine check dist/*
|
|
110
|
+
python final_audit.py
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## PyPI deployment
|
|
114
|
+
|
|
115
|
+
Package `gate-converter` 1.0.0 is build-ready (`pyproject.toml`, sdist + wheel,
|
|
116
|
+
`twine check` clean). **Not auto-uploaded** — publish explicitly with
|
|
117
|
+
`twine upload dist/*` only when requested.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
Apache-2.0 (`LICENSE`); third-party notices in `THIRD_PARTY_NOTICES.txt`. Independent
|
|
122
|
+
toolkit, not affiliated with the OpenGATE collaboration.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gate-converter"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "Version-aware, loss-aware migration toolkit for GATE 9.x macros and GATE 10 / OpenGATE Python projects"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "Rasool Safari", email = "r.safari@shirazu.ac.ir" }]
|
|
13
|
+
keywords = ["gate", "opengate", "geant4", "monte-carlo", "pet", "medical-physics", "migration"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"pyyaml>=6.0",
|
|
31
|
+
"packaging>=23.0",
|
|
32
|
+
"rich>=12.0",
|
|
33
|
+
"networkx>=2.8",
|
|
34
|
+
"numpy>=1.22",
|
|
35
|
+
"matplotlib>=3.5",
|
|
36
|
+
"python-docx>=1.1",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
gui = ["PySide6>=6.4"]
|
|
41
|
+
test = ["pytest>=7.0", "coverage>=7.0", "hypothesis>=6.0"]
|
|
42
|
+
dev = ["build", "twine", "ruff", "mypy", "pytest", "coverage", "hypothesis"]
|
|
43
|
+
all = ["PySide6>=6.4", "pytest>=7.0", "coverage>=7.0", "hypothesis>=6.0"]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://github.com/OpenGATE/gate-converter"
|
|
47
|
+
Documentation = "https://github.com/OpenGATE/gate-converter#readme"
|
|
48
|
+
Repository = "https://github.com/OpenGATE/gate-converter"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
gateconvert = "gate_converter.cli.main:main"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
gate_converter = ["data/*.json", "data/*.yaml", "data/*.csv"]
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
addopts = "-q"
|
|
62
|
+
|
|
63
|
+
[tool.coverage.run]
|
|
64
|
+
source = ["gate_converter"]
|
|
65
|
+
branch = true
|
|
66
|
+
|
|
67
|
+
[tool.coverage.report]
|
|
68
|
+
fail_under = 0
|
|
69
|
+
show_missing = true
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 110
|
|
73
|
+
target-version = "py39"
|
|
74
|
+
|
|
75
|
+
[tool.ruff.lint]
|
|
76
|
+
# UP006/UP035/UP045 modernizations are intentionally off: the package
|
|
77
|
+
# supports Python 3.9, where `X | None` is a SyntaxError at runtime.
|
|
78
|
+
# I/RUF100 (import sort/noqa hygiene) are style-only.
|
|
79
|
+
ignore = ["UP006", "UP007", "UP035", "UP045", "SIM115", "BLE001", "I", "RUF100"]
|
|
80
|
+
|
|
81
|
+
[tool.mypy]
|
|
82
|
+
python_version = "3.10"
|
|
83
|
+
ignore_missing_imports = true
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""gate-converter: version-aware, loss-aware GATE 9.x <-> GATE 10 migration toolkit.
|
|
2
|
+
|
|
3
|
+
LEVEL 1 - inspect: ``gateconvert inspect old_project/``
|
|
4
|
+
LEVEL 2 - migrate: ``gateconvert convert old_project --to 10.1.1``
|
|
5
|
+
LEVEL 3 - defensible migration: ``gateconvert convert ... --strict --report``
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .api import ( # noqa: F401
|
|
9
|
+
ActorGraph,
|
|
10
|
+
CanonicalActor,
|
|
11
|
+
ConversionResult,
|
|
12
|
+
PlanField,
|
|
13
|
+
PlanLayer,
|
|
14
|
+
PlanSpot,
|
|
15
|
+
TreatmentPlan,
|
|
16
|
+
actor_map,
|
|
17
|
+
build_actor_graph,
|
|
18
|
+
build_canonical,
|
|
19
|
+
compare_canonical,
|
|
20
|
+
compare_profiles,
|
|
21
|
+
convert_project,
|
|
22
|
+
detect_version_from_project,
|
|
23
|
+
parse_gate10_project,
|
|
24
|
+
parse_project,
|
|
25
|
+
parse_tps_text,
|
|
26
|
+
run_static_validation,
|
|
27
|
+
validate_actors,
|
|
28
|
+
validate_dosimetry,
|
|
29
|
+
validate_imaging,
|
|
30
|
+
validate_radiotherapy,
|
|
31
|
+
)
|
|
32
|
+
from .parser.gate10_parser import ( # noqa: F401
|
|
33
|
+
parse_gate10_project as parse_gate10,
|
|
34
|
+
)
|
|
35
|
+
from .parser.gate9_parser import ( # noqa: F401
|
|
36
|
+
detect_version_from_project as detect_gate_version,
|
|
37
|
+
parse_project as parse_gate_project,
|
|
38
|
+
)
|
|
39
|
+
from .validation.compare import compare_canonical as compare_projects # noqa: F401
|
|
40
|
+
from .validation.validators import ( # noqa: F401
|
|
41
|
+
run_static_validation as validate_project,
|
|
42
|
+
)
|
|
43
|
+
from .version import __version__ # noqa: F401
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def generate_gate10(*a, **k):
|
|
47
|
+
from .conversion.gate10_generator import generate_gate10_project
|
|
48
|
+
return generate_gate10_project(*a, **k)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def generate_gate9(*a, **k):
|
|
52
|
+
from .conversion.gate9_generator import generate_gate9_project
|
|
53
|
+
return generate_gate9_project(*a, **k)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
generate_gate9_version = generate_gate9
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def convert_digitizer(*a, **k):
|
|
60
|
+
from .digitizer.converter import (convert_legacy_to_manager,
|
|
61
|
+
convert_manager_to_legacy)
|
|
62
|
+
return convert_legacy_to_manager(*a, **k), convert_manager_to_legacy(*a, **k)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def inspect_project(path, source_version=None):
|
|
66
|
+
proj = parse_gate_project(path, source_version)
|
|
67
|
+
return build_canonical(proj)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def detect_version(*a, **k):
|
|
71
|
+
return detect_gate_version(*a, **k)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
__all__ = [
|
|
75
|
+
"ActorGraph",
|
|
76
|
+
"CanonicalActor",
|
|
77
|
+
"ConversionResult",
|
|
78
|
+
"PlanField",
|
|
79
|
+
"PlanLayer",
|
|
80
|
+
"PlanSpot",
|
|
81
|
+
"TreatmentPlan",
|
|
82
|
+
"__version__",
|
|
83
|
+
"actor_map",
|
|
84
|
+
"build_actor_graph",
|
|
85
|
+
"build_canonical",
|
|
86
|
+
"compare_canonical",
|
|
87
|
+
"compare_profiles",
|
|
88
|
+
"compare_projects",
|
|
89
|
+
"convert_digitizer",
|
|
90
|
+
"convert_project",
|
|
91
|
+
"detect_gate_version",
|
|
92
|
+
"detect_version",
|
|
93
|
+
"detect_version_from_project",
|
|
94
|
+
"generate_gate9",
|
|
95
|
+
"generate_gate9_version",
|
|
96
|
+
"generate_gate10",
|
|
97
|
+
"inspect_project",
|
|
98
|
+
"parse_gate10",
|
|
99
|
+
"parse_gate10_project",
|
|
100
|
+
"parse_gate_project",
|
|
101
|
+
"parse_project",
|
|
102
|
+
"parse_tps_text",
|
|
103
|
+
"run_static_validation",
|
|
104
|
+
"validate_actors",
|
|
105
|
+
"validate_dosimetry",
|
|
106
|
+
"validate_imaging",
|
|
107
|
+
"validate_project",
|
|
108
|
+
"validate_radiotherapy",
|
|
109
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""High-level convenience API (also re-exported at package root)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ..canonical.actor import ActorGraph, CanonicalActor, build_actor_graph
|
|
6
|
+
from ..canonical.builder import build_canonical
|
|
7
|
+
from ..canonical.treatment_plan import (
|
|
8
|
+
PlanField,
|
|
9
|
+
PlanLayer,
|
|
10
|
+
PlanSpot,
|
|
11
|
+
TreatmentPlan,
|
|
12
|
+
parse_tps_text,
|
|
13
|
+
)
|
|
14
|
+
from ..conversion.engine import ConversionResult, convert_project
|
|
15
|
+
from ..domains.validators import (
|
|
16
|
+
validate_actors,
|
|
17
|
+
validate_dosimetry,
|
|
18
|
+
validate_imaging,
|
|
19
|
+
validate_radiotherapy,
|
|
20
|
+
)
|
|
21
|
+
from ..parser.gate9_parser import detect_version_from_project, parse_project
|
|
22
|
+
from ..parser.gate10_parser import parse_gate10_project
|
|
23
|
+
from ..validation.compare import compare_canonical
|
|
24
|
+
from ..validation.numerical import compare_profiles
|
|
25
|
+
from ..validation.validators import run_static_validation
|
|
26
|
+
from ..versions.actors import actor_map
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"ActorGraph",
|
|
30
|
+
"CanonicalActor",
|
|
31
|
+
"ConversionResult",
|
|
32
|
+
"PlanField",
|
|
33
|
+
"PlanLayer",
|
|
34
|
+
"PlanSpot",
|
|
35
|
+
"TreatmentPlan",
|
|
36
|
+
"actor_map",
|
|
37
|
+
"build_actor_graph",
|
|
38
|
+
"build_canonical",
|
|
39
|
+
"compare_canonical",
|
|
40
|
+
"compare_profiles",
|
|
41
|
+
"convert_project",
|
|
42
|
+
"detect_version_from_project",
|
|
43
|
+
"parse_gate10_project",
|
|
44
|
+
"parse_project",
|
|
45
|
+
"parse_tps_text",
|
|
46
|
+
"run_static_validation",
|
|
47
|
+
"validate_actors",
|
|
48
|
+
"validate_dosimetry",
|
|
49
|
+
"validate_imaging",
|
|
50
|
+
"validate_radiotherapy",
|
|
51
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""gate_converter.canonical package."""
|