aimio-py 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.
- aimio_py-0.1.0/.gitmodules +6 -0
- aimio_py-0.1.0/LICENSE +21 -0
- aimio_py-0.1.0/MANIFEST.in +10 -0
- aimio_py-0.1.0/PKG-INFO +144 -0
- aimio_py-0.1.0/README.md +107 -0
- aimio_py-0.1.0/aimio_py.egg-info/PKG-INFO +144 -0
- aimio_py-0.1.0/aimio_py.egg-info/SOURCES.txt +50 -0
- aimio_py-0.1.0/aimio_py.egg-info/dependency_links.txt +1 -0
- aimio_py-0.1.0/aimio_py.egg-info/not-zip-safe +1 -0
- aimio_py-0.1.0/aimio_py.egg-info/requires.txt +12 -0
- aimio_py-0.1.0/aimio_py.egg-info/top_level.txt +1 -0
- aimio_py-0.1.0/bindings/aimio_bindings.cpp +109 -0
- aimio_py-0.1.0/external/AimIO/include/AimIO/AimIO.h +208 -0
- aimio_py-0.1.0/external/AimIO/include/AimIO/DateTime.h +65 -0
- aimio_py-0.1.0/external/AimIO/include/AimIO/Definitions.h +35 -0
- aimio_py-0.1.0/external/AimIO/include/AimIO/Exception.h +141 -0
- aimio_py-0.1.0/external/AimIO/include/AimIO/IsqIO.h +205 -0
- aimio_py-0.1.0/external/AimIO/source/AimIO.cxx +717 -0
- aimio_py-0.1.0/external/AimIO/source/Compression.cxx +534 -0
- aimio_py-0.1.0/external/AimIO/source/Compression.h +56 -0
- aimio_py-0.1.0/external/AimIO/source/DateTime.cxx +105 -0
- aimio_py-0.1.0/external/AimIO/source/IsqIO.cxx +304 -0
- aimio_py-0.1.0/external/AimIO/source/PlatformFloat.h +53 -0
- aimio_py-0.1.0/external/AimIO/source/aix.cxx +256 -0
- aimio_py-0.1.0/external/AimIO/source/ctheader.cxx +178 -0
- aimio_py-0.1.0/external/n88util/include/n88util/ObjectGroup.hpp +98 -0
- aimio_py-0.1.0/external/n88util/include/n88util/TimeStamp.hpp +52 -0
- aimio_py-0.1.0/external/n88util/include/n88util/TrackingAllocator.hpp +46 -0
- aimio_py-0.1.0/external/n88util/include/n88util/array.hpp +693 -0
- aimio_py-0.1.0/external/n88util/include/n88util/arraymath.hpp +84 -0
- aimio_py-0.1.0/external/n88util/include/n88util/binhex.hpp +57 -0
- aimio_py-0.1.0/external/n88util/include/n88util/configuration.hpp +117 -0
- aimio_py-0.1.0/external/n88util/include/n88util/const_array.hpp +462 -0
- aimio_py-0.1.0/external/n88util/include/n88util/exception.hpp +132 -0
- aimio_py-0.1.0/external/n88util/include/n88util/floating_point_comparisons.hpp +452 -0
- aimio_py-0.1.0/external/n88util/include/n88util/logger.hpp +125 -0
- aimio_py-0.1.0/external/n88util/include/n88util/netcdf_templated.hpp +86 -0
- aimio_py-0.1.0/external/n88util/include/n88util/printarray.hpp +77 -0
- aimio_py-0.1.0/external/n88util/include/n88util/text.hpp +42 -0
- aimio_py-0.1.0/external/n88util/include/n88util/tuplet.hpp +829 -0
- aimio_py-0.1.0/py_aimio/__init__.py +168 -0
- aimio_py-0.1.0/py_aimio/calibration.py +56 -0
- aimio_py-0.1.0/py_aimio/header_log.py +76 -0
- aimio_py-0.1.0/pyproject.toml +3 -0
- aimio_py-0.1.0/setup.cfg +53 -0
- aimio_py-0.1.0/setup.py +107 -0
- aimio_py-0.1.0/tests/test_api_unit.py +114 -0
- aimio_py-0.1.0/tests/test_bindings.py +44 -0
- aimio_py-0.1.0/tests/test_calibration_unit.py +44 -0
- aimio_py-0.1.0/tests/test_header_log_unit.py +25 -0
- aimio_py-0.1.0/tests/test_processing_log_roundtrip.py +36 -0
aimio_py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Eric Nodwell & Steven Boyd
|
|
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,10 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
include setup.py
|
|
5
|
+
include setup.cfg
|
|
6
|
+
include .gitmodules
|
|
7
|
+
recursive-include bindings *.cpp
|
|
8
|
+
recursive-include external/AimIO/include *.h
|
|
9
|
+
recursive-include external/AimIO/source *.h *.cxx
|
|
10
|
+
recursive-include external/n88util/include *.hpp
|
aimio_py-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aimio-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python bindings for the Numerics88 AimIO C++ library
|
|
5
|
+
Home-page: https://github.com/wallematthias/aimio-py
|
|
6
|
+
Author: Matthias Walle
|
|
7
|
+
Author-email: matthias.walle@ucalgary.ca
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://github.com/wallematthias/aimio-py#readme
|
|
10
|
+
Project-URL: Source, https://github.com/wallematthias/aimio-py
|
|
11
|
+
Project-URL: Issues, https://github.com/wallematthias/aimio-py/issues
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: C++
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Intended Audience :: Science/Research
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: numpy>=1.20
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build; extra == "dev"
|
|
29
|
+
Requires-Dist: cibuildwheel; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
32
|
+
Requires-Dist: twine; extra == "dev"
|
|
33
|
+
Requires-Dist: sphinx>=7; extra == "dev"
|
|
34
|
+
Provides-Extra: docs
|
|
35
|
+
Requires-Dist: sphinx>=7; extra == "docs"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# aimio-py
|
|
39
|
+
|
|
40
|
+
[)](https://github.com/wallematthias/aimio-py/actions/workflows/tests.yml)
|
|
41
|
+
[](https://github.com/wallematthias/aimio-py/actions/workflows/build-wheels.yml)
|
|
42
|
+
[](https://pypi.org/project/aimio-py/)
|
|
43
|
+
|
|
44
|
+
Python bindings for the [Numerics88 AimIO](https://github.com/Numerics88/AimIO) C++ library.
|
|
45
|
+
|
|
46
|
+
`aimio-py` provides a small Python API to read and write AIM files as NumPy arrays, inspect metadata, and work with processing logs.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Read AIM files into NumPy arrays
|
|
51
|
+
- Write AIM files from NumPy arrays
|
|
52
|
+
- Access AIM header metadata (`aim_info`)
|
|
53
|
+
- Convert processing logs between text and dictionary formats
|
|
54
|
+
- Optional density/HU conversion helpers
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
From PyPI (recommended):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install aimio-py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
From source:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/wallematthias/aimio-py.git
|
|
68
|
+
cd aimio-py
|
|
69
|
+
git submodule update --init --recursive
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Quickstart
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from py_aimio import read_aim, write_aim
|
|
77
|
+
|
|
78
|
+
array, meta = read_aim("scan.AIM")
|
|
79
|
+
write_aim("copy.AIM", array, meta)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## API
|
|
83
|
+
|
|
84
|
+
- `aim_info(path)`
|
|
85
|
+
- `read_aim(path, density=False, hu=False) -> (array, meta)`
|
|
86
|
+
- `write_aim(path, array, meta=None, unit=None)`
|
|
87
|
+
- `get_aim_density_equation(processing_log)`
|
|
88
|
+
- `get_aim_hu_equation(processing_log)`
|
|
89
|
+
- `log_to_dict(log)`
|
|
90
|
+
- `dict_to_log(dct)`
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
Run tests:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pytest -q
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run tests with coverage:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pytest -q --cov=py_aimio --cov-report=term-missing --cov-report=xml:coverage.xml
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Build local artifacts:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m build --wheel --sdist
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Build documentation from docstrings:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install sphinx
|
|
116
|
+
make -C docs html
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Generated HTML will be in `docs/build/html/index.html`.
|
|
120
|
+
|
|
121
|
+
### Important build note
|
|
122
|
+
|
|
123
|
+
This project depends on the `external/AimIO` and `external/n88util` git submodules. If they are missing, extension builds will fail.
|
|
124
|
+
|
|
125
|
+
## Release and PyPI Publishing
|
|
126
|
+
|
|
127
|
+
Wheels and sdist are built by GitHub Actions on:
|
|
128
|
+
|
|
129
|
+
- `pull_request` to `main`/`master`
|
|
130
|
+
- pushes to `main`/`master`
|
|
131
|
+
- tags matching `v*`
|
|
132
|
+
|
|
133
|
+
When a `v*` tag is pushed, the workflow publishes to PyPI via trusted publishing (`pypa/gh-action-pypi-publish`).
|
|
134
|
+
|
|
135
|
+
See [`docs/PUBLISHING.md`](docs/PUBLISHING.md) for the release checklist and `docs/source/` for Sphinx documentation sources.
|
|
136
|
+
|
|
137
|
+
## Attribution
|
|
138
|
+
|
|
139
|
+
- `py_aimio/calibration.py` is adapted from [Bonelab/Bonelab](https://github.com/Bonelab/Bonelab/).
|
|
140
|
+
- `py_aimio/header_log.py` is by Matthias Walle.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT
|
aimio_py-0.1.0/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# aimio-py
|
|
2
|
+
|
|
3
|
+
[)](https://github.com/wallematthias/aimio-py/actions/workflows/tests.yml)
|
|
4
|
+
[](https://github.com/wallematthias/aimio-py/actions/workflows/build-wheels.yml)
|
|
5
|
+
[](https://pypi.org/project/aimio-py/)
|
|
6
|
+
|
|
7
|
+
Python bindings for the [Numerics88 AimIO](https://github.com/Numerics88/AimIO) C++ library.
|
|
8
|
+
|
|
9
|
+
`aimio-py` provides a small Python API to read and write AIM files as NumPy arrays, inspect metadata, and work with processing logs.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Read AIM files into NumPy arrays
|
|
14
|
+
- Write AIM files from NumPy arrays
|
|
15
|
+
- Access AIM header metadata (`aim_info`)
|
|
16
|
+
- Convert processing logs between text and dictionary formats
|
|
17
|
+
- Optional density/HU conversion helpers
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
From PyPI (recommended):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install aimio-py
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
From source:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/wallematthias/aimio-py.git
|
|
31
|
+
cd aimio-py
|
|
32
|
+
git submodule update --init --recursive
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quickstart
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from py_aimio import read_aim, write_aim
|
|
40
|
+
|
|
41
|
+
array, meta = read_aim("scan.AIM")
|
|
42
|
+
write_aim("copy.AIM", array, meta)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
- `aim_info(path)`
|
|
48
|
+
- `read_aim(path, density=False, hu=False) -> (array, meta)`
|
|
49
|
+
- `write_aim(path, array, meta=None, unit=None)`
|
|
50
|
+
- `get_aim_density_equation(processing_log)`
|
|
51
|
+
- `get_aim_hu_equation(processing_log)`
|
|
52
|
+
- `log_to_dict(log)`
|
|
53
|
+
- `dict_to_log(dct)`
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
Run tests:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pytest -q
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Run tests with coverage:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pytest -q --cov=py_aimio --cov-report=term-missing --cov-report=xml:coverage.xml
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Build local artifacts:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python -m build --wheel --sdist
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Build documentation from docstrings:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install sphinx
|
|
79
|
+
make -C docs html
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Generated HTML will be in `docs/build/html/index.html`.
|
|
83
|
+
|
|
84
|
+
### Important build note
|
|
85
|
+
|
|
86
|
+
This project depends on the `external/AimIO` and `external/n88util` git submodules. If they are missing, extension builds will fail.
|
|
87
|
+
|
|
88
|
+
## Release and PyPI Publishing
|
|
89
|
+
|
|
90
|
+
Wheels and sdist are built by GitHub Actions on:
|
|
91
|
+
|
|
92
|
+
- `pull_request` to `main`/`master`
|
|
93
|
+
- pushes to `main`/`master`
|
|
94
|
+
- tags matching `v*`
|
|
95
|
+
|
|
96
|
+
When a `v*` tag is pushed, the workflow publishes to PyPI via trusted publishing (`pypa/gh-action-pypi-publish`).
|
|
97
|
+
|
|
98
|
+
See [`docs/PUBLISHING.md`](docs/PUBLISHING.md) for the release checklist and `docs/source/` for Sphinx documentation sources.
|
|
99
|
+
|
|
100
|
+
## Attribution
|
|
101
|
+
|
|
102
|
+
- `py_aimio/calibration.py` is adapted from [Bonelab/Bonelab](https://github.com/Bonelab/Bonelab/).
|
|
103
|
+
- `py_aimio/header_log.py` is by Matthias Walle.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aimio-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python bindings for the Numerics88 AimIO C++ library
|
|
5
|
+
Home-page: https://github.com/wallematthias/aimio-py
|
|
6
|
+
Author: Matthias Walle
|
|
7
|
+
Author-email: matthias.walle@ucalgary.ca
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://github.com/wallematthias/aimio-py#readme
|
|
10
|
+
Project-URL: Source, https://github.com/wallematthias/aimio-py
|
|
11
|
+
Project-URL: Issues, https://github.com/wallematthias/aimio-py/issues
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: C++
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Intended Audience :: Science/Research
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: numpy>=1.20
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build; extra == "dev"
|
|
29
|
+
Requires-Dist: cibuildwheel; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
32
|
+
Requires-Dist: twine; extra == "dev"
|
|
33
|
+
Requires-Dist: sphinx>=7; extra == "dev"
|
|
34
|
+
Provides-Extra: docs
|
|
35
|
+
Requires-Dist: sphinx>=7; extra == "docs"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# aimio-py
|
|
39
|
+
|
|
40
|
+
[)](https://github.com/wallematthias/aimio-py/actions/workflows/tests.yml)
|
|
41
|
+
[](https://github.com/wallematthias/aimio-py/actions/workflows/build-wheels.yml)
|
|
42
|
+
[](https://pypi.org/project/aimio-py/)
|
|
43
|
+
|
|
44
|
+
Python bindings for the [Numerics88 AimIO](https://github.com/Numerics88/AimIO) C++ library.
|
|
45
|
+
|
|
46
|
+
`aimio-py` provides a small Python API to read and write AIM files as NumPy arrays, inspect metadata, and work with processing logs.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Read AIM files into NumPy arrays
|
|
51
|
+
- Write AIM files from NumPy arrays
|
|
52
|
+
- Access AIM header metadata (`aim_info`)
|
|
53
|
+
- Convert processing logs between text and dictionary formats
|
|
54
|
+
- Optional density/HU conversion helpers
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
From PyPI (recommended):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install aimio-py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
From source:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/wallematthias/aimio-py.git
|
|
68
|
+
cd aimio-py
|
|
69
|
+
git submodule update --init --recursive
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Quickstart
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from py_aimio import read_aim, write_aim
|
|
77
|
+
|
|
78
|
+
array, meta = read_aim("scan.AIM")
|
|
79
|
+
write_aim("copy.AIM", array, meta)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## API
|
|
83
|
+
|
|
84
|
+
- `aim_info(path)`
|
|
85
|
+
- `read_aim(path, density=False, hu=False) -> (array, meta)`
|
|
86
|
+
- `write_aim(path, array, meta=None, unit=None)`
|
|
87
|
+
- `get_aim_density_equation(processing_log)`
|
|
88
|
+
- `get_aim_hu_equation(processing_log)`
|
|
89
|
+
- `log_to_dict(log)`
|
|
90
|
+
- `dict_to_log(dct)`
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
Run tests:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pytest -q
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run tests with coverage:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pytest -q --cov=py_aimio --cov-report=term-missing --cov-report=xml:coverage.xml
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Build local artifacts:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m build --wheel --sdist
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Build documentation from docstrings:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install sphinx
|
|
116
|
+
make -C docs html
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Generated HTML will be in `docs/build/html/index.html`.
|
|
120
|
+
|
|
121
|
+
### Important build note
|
|
122
|
+
|
|
123
|
+
This project depends on the `external/AimIO` and `external/n88util` git submodules. If they are missing, extension builds will fail.
|
|
124
|
+
|
|
125
|
+
## Release and PyPI Publishing
|
|
126
|
+
|
|
127
|
+
Wheels and sdist are built by GitHub Actions on:
|
|
128
|
+
|
|
129
|
+
- `pull_request` to `main`/`master`
|
|
130
|
+
- pushes to `main`/`master`
|
|
131
|
+
- tags matching `v*`
|
|
132
|
+
|
|
133
|
+
When a `v*` tag is pushed, the workflow publishes to PyPI via trusted publishing (`pypa/gh-action-pypi-publish`).
|
|
134
|
+
|
|
135
|
+
See [`docs/PUBLISHING.md`](docs/PUBLISHING.md) for the release checklist and `docs/source/` for Sphinx documentation sources.
|
|
136
|
+
|
|
137
|
+
## Attribution
|
|
138
|
+
|
|
139
|
+
- `py_aimio/calibration.py` is adapted from [Bonelab/Bonelab](https://github.com/Bonelab/Bonelab/).
|
|
140
|
+
- `py_aimio/header_log.py` is by Matthias Walle.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.gitmodules
|
|
2
|
+
LICENSE
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
setup.cfg
|
|
7
|
+
setup.py
|
|
8
|
+
aimio_py.egg-info/PKG-INFO
|
|
9
|
+
aimio_py.egg-info/SOURCES.txt
|
|
10
|
+
aimio_py.egg-info/dependency_links.txt
|
|
11
|
+
aimio_py.egg-info/not-zip-safe
|
|
12
|
+
aimio_py.egg-info/requires.txt
|
|
13
|
+
aimio_py.egg-info/top_level.txt
|
|
14
|
+
bindings/aimio_bindings.cpp
|
|
15
|
+
external/AimIO/include/AimIO/AimIO.h
|
|
16
|
+
external/AimIO/include/AimIO/DateTime.h
|
|
17
|
+
external/AimIO/include/AimIO/Definitions.h
|
|
18
|
+
external/AimIO/include/AimIO/Exception.h
|
|
19
|
+
external/AimIO/include/AimIO/IsqIO.h
|
|
20
|
+
external/AimIO/source/AimIO.cxx
|
|
21
|
+
external/AimIO/source/Compression.cxx
|
|
22
|
+
external/AimIO/source/Compression.h
|
|
23
|
+
external/AimIO/source/DateTime.cxx
|
|
24
|
+
external/AimIO/source/IsqIO.cxx
|
|
25
|
+
external/AimIO/source/PlatformFloat.h
|
|
26
|
+
external/AimIO/source/aix.cxx
|
|
27
|
+
external/AimIO/source/ctheader.cxx
|
|
28
|
+
external/n88util/include/n88util/ObjectGroup.hpp
|
|
29
|
+
external/n88util/include/n88util/TimeStamp.hpp
|
|
30
|
+
external/n88util/include/n88util/TrackingAllocator.hpp
|
|
31
|
+
external/n88util/include/n88util/array.hpp
|
|
32
|
+
external/n88util/include/n88util/arraymath.hpp
|
|
33
|
+
external/n88util/include/n88util/binhex.hpp
|
|
34
|
+
external/n88util/include/n88util/configuration.hpp
|
|
35
|
+
external/n88util/include/n88util/const_array.hpp
|
|
36
|
+
external/n88util/include/n88util/exception.hpp
|
|
37
|
+
external/n88util/include/n88util/floating_point_comparisons.hpp
|
|
38
|
+
external/n88util/include/n88util/logger.hpp
|
|
39
|
+
external/n88util/include/n88util/netcdf_templated.hpp
|
|
40
|
+
external/n88util/include/n88util/printarray.hpp
|
|
41
|
+
external/n88util/include/n88util/text.hpp
|
|
42
|
+
external/n88util/include/n88util/tuplet.hpp
|
|
43
|
+
py_aimio/__init__.py
|
|
44
|
+
py_aimio/calibration.py
|
|
45
|
+
py_aimio/header_log.py
|
|
46
|
+
tests/test_api_unit.py
|
|
47
|
+
tests/test_bindings.py
|
|
48
|
+
tests/test_calibration_unit.py
|
|
49
|
+
tests/test_header_log_unit.py
|
|
50
|
+
tests/test_processing_log_roundtrip.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
py_aimio
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#include <pybind11/pybind11.h>
|
|
2
|
+
#include <pybind11/numpy.h>
|
|
3
|
+
#include <pybind11/stl.h>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
namespace py = pybind11;
|
|
7
|
+
|
|
8
|
+
// If AimIO headers are available (when the AimIO submodule is added), include them.
|
|
9
|
+
#include "AimIO/AimIO.h"
|
|
10
|
+
|
|
11
|
+
static py::dict aimfile_to_dict(const AimIO::AimFile &af) {
|
|
12
|
+
py::dict d;
|
|
13
|
+
d["filename"] = af.filename;
|
|
14
|
+
d["version"] = static_cast<int>(af.version);
|
|
15
|
+
d["id"] = af.id;
|
|
16
|
+
d["reference"] = af.reference;
|
|
17
|
+
d["aim_type"] = static_cast<int>(af.aim_type);
|
|
18
|
+
d["buffer_type"] = static_cast<int>(af.buffer_type);
|
|
19
|
+
d["position"] = py::make_tuple(af.position[0], af.position[1], af.position[2]);
|
|
20
|
+
d["dimensions"] = py::make_tuple(af.dimensions[0], af.dimensions[1], af.dimensions[2]);
|
|
21
|
+
d["offset"] = py::make_tuple(af.offset[0], af.offset[1], af.offset[2]);
|
|
22
|
+
d["element_size"] = py::make_tuple(af.element_size[0], af.element_size[1], af.element_size[2]);
|
|
23
|
+
d["processing_log"] = af.processing_log;
|
|
24
|
+
d["byte_offset"] = af.byte_offset;
|
|
25
|
+
return d;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
PYBIND11_MODULE(_aimio, m) {
|
|
29
|
+
m.doc() = "AimIO C++ bindings: read_aim(path) -> (ndarray, meta), write_aim(path, array, meta), aim_info(path) -> meta";
|
|
30
|
+
|
|
31
|
+
m.def("aim_info", [](const std::string &path) {
|
|
32
|
+
AimIO::AimFile af(path.c_str());
|
|
33
|
+
af.ReadImageInfo();
|
|
34
|
+
return aimfile_to_dict(af);
|
|
35
|
+
}, py::arg("path"));
|
|
36
|
+
|
|
37
|
+
m.def("read_aim", [](const std::string &path) {
|
|
38
|
+
AimIO::AimFile af(path.c_str());
|
|
39
|
+
af.ReadImageInfo();
|
|
40
|
+
|
|
41
|
+
int nx = af.dimensions[0];
|
|
42
|
+
int ny = af.dimensions[1];
|
|
43
|
+
int nz = af.dimensions[2];
|
|
44
|
+
size_t n = static_cast<size_t>(nx) * ny * nz;
|
|
45
|
+
|
|
46
|
+
if (af.buffer_type == AimIO::AimFile::AIMFILE_TYPE_CHAR) {
|
|
47
|
+
std::vector<int8_t> buf(n);
|
|
48
|
+
af.ReadImageData(reinterpret_cast<char*>(buf.data()), n);
|
|
49
|
+
// numpy shape (z,y,x)
|
|
50
|
+
py::array_t<int8_t> arr({nz, ny, nx}, {static_cast<size_t>(ny*nx), static_cast<size_t>(nx), sizeof(int8_t)}, buf.data());
|
|
51
|
+
// need to copy since buf will be freed
|
|
52
|
+
return py::make_tuple(py::array(arr), aimfile_to_dict(af));
|
|
53
|
+
} else if (af.buffer_type == AimIO::AimFile::AIMFILE_TYPE_SHORT) {
|
|
54
|
+
std::vector<int16_t> buf(n);
|
|
55
|
+
af.ReadImageData(buf.data(), n);
|
|
56
|
+
py::array_t<int16_t> arr({nz, ny, nx}, {static_cast<size_t>(ny*nx)*sizeof(int16_t), static_cast<size_t>(nx)*sizeof(int16_t), sizeof(int16_t)}, buf.data());
|
|
57
|
+
return py::make_tuple(py::array(arr), aimfile_to_dict(af));
|
|
58
|
+
} else if (af.buffer_type == AimIO::AimFile::AIMFILE_TYPE_FLOAT) {
|
|
59
|
+
std::vector<float> buf(n);
|
|
60
|
+
af.ReadImageData(buf.data(), n);
|
|
61
|
+
py::array_t<float> arr({nz, ny, nx}, {static_cast<size_t>(ny*nx)*sizeof(float), static_cast<size_t>(nx)*sizeof(float), sizeof(float)}, buf.data());
|
|
62
|
+
return py::make_tuple(py::array(arr), aimfile_to_dict(af));
|
|
63
|
+
} else {
|
|
64
|
+
throw std::runtime_error("Unsupported buffer type in AIM file");
|
|
65
|
+
}
|
|
66
|
+
}, py::arg("path"));
|
|
67
|
+
|
|
68
|
+
m.def("write_aim", [](const std::string &path, py::buffer b, py::dict meta) {
|
|
69
|
+
// Acquire buffer info
|
|
70
|
+
py::buffer_info info = b.request();
|
|
71
|
+
if (info.ndim != 3) throw std::runtime_error("Expected 3D array (z,y,x)");
|
|
72
|
+
|
|
73
|
+
int nz = static_cast<int>(info.shape[0]);
|
|
74
|
+
int ny = static_cast<int>(info.shape[1]);
|
|
75
|
+
int nx = static_cast<int>(info.shape[2]);
|
|
76
|
+
size_t n = static_cast<size_t>(nx) * ny * nz;
|
|
77
|
+
|
|
78
|
+
AimIO::AimFile af;
|
|
79
|
+
af.filename = path;
|
|
80
|
+
af.dimensions[0] = nx;
|
|
81
|
+
af.dimensions[1] = ny;
|
|
82
|
+
af.dimensions[2] = nz;
|
|
83
|
+
|
|
84
|
+
// optional metadata
|
|
85
|
+
if (meta.contains("element_size")) {
|
|
86
|
+
auto es = meta["element_size"].cast<std::vector<double>>();
|
|
87
|
+
af.element_size[0] = es[0]; af.element_size[1] = es[1]; af.element_size[2] = es[2];
|
|
88
|
+
}
|
|
89
|
+
if (meta.contains("processing_log")) {
|
|
90
|
+
// ensure we set the processing log so it is written back into the AIM header
|
|
91
|
+
if (py::isinstance<py::str>(meta["processing_log"])) {
|
|
92
|
+
af.processing_log = meta["processing_log"].cast<std::string>();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Determine dtype and call appropriate writer
|
|
97
|
+
if (info.format == py::format_descriptor<int8_t>::format()) {
|
|
98
|
+
af.WriteImageData(reinterpret_cast<const char*>(info.ptr));
|
|
99
|
+
} else if (info.format == py::format_descriptor<int16_t>::format()) {
|
|
100
|
+
af.WriteImageData(reinterpret_cast<const short*>(info.ptr));
|
|
101
|
+
} else if (info.format == py::format_descriptor<float>::format()) {
|
|
102
|
+
af.WriteImageData(reinterpret_cast<const float*>(info.ptr));
|
|
103
|
+
} else {
|
|
104
|
+
throw std::runtime_error("Unsupported array dtype for write_aim (use int8, int16, or float32)");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return aimfile_to_dict(af);
|
|
108
|
+
}, py::arg("path"), py::arg("array"), py::arg("meta") = py::dict());
|
|
109
|
+
}
|