mlarray 0.0.53__tar.gz → 0.0.54__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.
Files changed (62) hide show
  1. {mlarray-0.0.53 → mlarray-0.0.54}/PKG-INFO +24 -2
  2. {mlarray-0.0.53 → mlarray-0.0.54}/README.md +23 -1
  3. mlarray-0.0.54/assets/banner.png +0 -0
  4. mlarray-0.0.54/bench/.gitignore +2 -0
  5. mlarray-0.0.54/bench/README.md +56 -0
  6. mlarray-0.0.54/bench/bench_convert_nii_to_mla_random_read.py +586 -0
  7. mlarray-0.0.54/bench/bench_io_blosc2_layouts.py +1178 -0
  8. mlarray-0.0.54/bench/benchmark_formats.py +527 -0
  9. mlarray-0.0.54/bench/helper/print_mla_layouts.py +85 -0
  10. {mlarray-0.0.53 → mlarray-0.0.54}/docs/api.md +2 -0
  11. mlarray-0.0.54/docs/cli.md +59 -0
  12. {mlarray-0.0.53 → mlarray-0.0.54}/docs/schema.md +30 -0
  13. {mlarray-0.0.53 → mlarray-0.0.54}/docs/usage.md +30 -0
  14. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray/__init__.py +4 -1
  15. mlarray-0.0.54/mlarray/blosc2_layout_strategies.py +766 -0
  16. mlarray-0.0.54/mlarray/cli.py +226 -0
  17. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray/meta.py +49 -9
  18. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray/mlarray.py +75 -130
  19. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/PKG-INFO +24 -2
  20. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/SOURCES.txt +11 -1
  21. mlarray-0.0.54/mlarray.egg-info/scm_file_list.json +52 -0
  22. mlarray-0.0.54/mlarray.egg-info/scm_version.json +8 -0
  23. mlarray-0.0.54/tests/test_cli.py +420 -0
  24. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_meta_safety.py +32 -0
  25. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_metadata.py +40 -1
  26. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_optimization.py +38 -0
  27. mlarray-0.0.53/assets/banner.png +0 -0
  28. mlarray-0.0.53/assets/banner.png~ +0 -0
  29. mlarray-0.0.53/docs/cli.md +0 -29
  30. mlarray-0.0.53/mlarray/cli.py +0 -60
  31. {mlarray-0.0.53 → mlarray-0.0.54}/.github/workflows/workflow.yml +0 -0
  32. {mlarray-0.0.53 → mlarray-0.0.54}/.gitignore +0 -0
  33. {mlarray-0.0.53 → mlarray-0.0.54}/LICENSE +0 -0
  34. {mlarray-0.0.53 → mlarray-0.0.54}/MANIFEST.in +0 -0
  35. {mlarray-0.0.53 → mlarray-0.0.54}/docs/index.md +0 -0
  36. {mlarray-0.0.53 → mlarray-0.0.54}/docs/optimization.md +0 -0
  37. {mlarray-0.0.53 → mlarray-0.0.54}/docs/why.md +0 -0
  38. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_asarray.py +0 -0
  39. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_bboxes_only.py +0 -0
  40. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_channel.py +0 -0
  41. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_compress_decompress.py +0 -0
  42. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_compressed_vs_uncompressed.py +0 -0
  43. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_in_memory_constructors.py +0 -0
  44. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_metadata_only.py +0 -0
  45. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_non_spatial.py +0 -0
  46. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_open.py +0 -0
  47. {mlarray-0.0.53 → mlarray-0.0.54}/examples/example_save_load.py +0 -0
  48. {mlarray-0.0.53 → mlarray-0.0.54}/mkdocs.yml +0 -0
  49. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray/utils.py +0 -0
  50. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/dependency_links.txt +0 -0
  51. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/entry_points.txt +0 -0
  52. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/requires.txt +0 -0
  53. {mlarray-0.0.53 → mlarray-0.0.54}/mlarray.egg-info/top_level.txt +0 -0
  54. {mlarray-0.0.53 → mlarray-0.0.54}/pyproject.toml +0 -0
  55. {mlarray-0.0.53 → mlarray-0.0.54}/setup.cfg +0 -0
  56. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_asarray.py +0 -0
  57. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_bboxes.py +0 -0
  58. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_compress_decompress.py +0 -0
  59. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_constructors.py +0 -0
  60. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_create.py +0 -0
  61. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_open.py +0 -0
  62. {mlarray-0.0.53 → mlarray-0.0.54}/tests/test_usage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mlarray
3
- Version: 0.0.53
3
+ Version: 0.0.54
4
4
  Summary: Array format specialized for Machine Learning with Blosc2 backend and standardized metadata.
5
5
  Author-email: Karol Gotkowski <karol.gotkowski@dkfz.de>
6
6
  License: MIT
@@ -236,10 +236,32 @@ mlarray_header sample.mla
236
236
 
237
237
  ### mlarray_convert
238
238
 
239
- Convert a NIfTI or NRRD file to MLArray and copy metadata.
239
+ Convert between MLArray and NIfTI/NRRD files.
240
+
241
+ When converting from NIfTI/NRRD to MLArray, source metadata is copied into
242
+ `meta.source`.
243
+
244
+ When converting from MLArray to NIfTI/NRRD, only `meta.source` is copied into
245
+ the output header. Spatial metadata (`spacing`, `origin`, `direction`) is set
246
+ explicitly from `meta.spatial`.
247
+
248
+ `meta.spatial.coord_system` is propagated conservatively. For NRRD input, the
249
+ CLI reads explicit NRRD space metadata when available and maps
250
+ `right-anterior-superior` to `RAS` and `left-posterior-superior` to `LPS`,
251
+ while preserving other explicit NRRD space strings verbatim. For NIfTI input,
252
+ the CLI sets `coord_system` to `LPS` based on the current
253
+ `MedVol -> SimpleITK/ITK` import path, where the imported geometry is
254
+ represented in the ITK physical-space convention. MedVol's reindexing to NumPy
255
+ layout does not change that world-space convention. On NRRD output, `RAS` and
256
+ `LPS` are written back as NRRD `space` metadata when possible; arbitrary custom
257
+ `coord_system` strings are not emitted as NRRD `space` declarations unless they
258
+ already match a supported explicit NRRD space string. NIfTI output preserves
259
+ geometry, but does not export `coord_system` as an explicit NIfTI metadata
260
+ field.
240
261
 
241
262
  ```bash
242
263
  mlarray_convert sample.nii.gz output.mla
264
+ mlarray_convert sample.mla output.nii.gz
243
265
  ```
244
266
 
245
267
  ## Contributing
@@ -202,10 +202,32 @@ mlarray_header sample.mla
202
202
 
203
203
  ### mlarray_convert
204
204
 
205
- Convert a NIfTI or NRRD file to MLArray and copy metadata.
205
+ Convert between MLArray and NIfTI/NRRD files.
206
+
207
+ When converting from NIfTI/NRRD to MLArray, source metadata is copied into
208
+ `meta.source`.
209
+
210
+ When converting from MLArray to NIfTI/NRRD, only `meta.source` is copied into
211
+ the output header. Spatial metadata (`spacing`, `origin`, `direction`) is set
212
+ explicitly from `meta.spatial`.
213
+
214
+ `meta.spatial.coord_system` is propagated conservatively. For NRRD input, the
215
+ CLI reads explicit NRRD space metadata when available and maps
216
+ `right-anterior-superior` to `RAS` and `left-posterior-superior` to `LPS`,
217
+ while preserving other explicit NRRD space strings verbatim. For NIfTI input,
218
+ the CLI sets `coord_system` to `LPS` based on the current
219
+ `MedVol -> SimpleITK/ITK` import path, where the imported geometry is
220
+ represented in the ITK physical-space convention. MedVol's reindexing to NumPy
221
+ layout does not change that world-space convention. On NRRD output, `RAS` and
222
+ `LPS` are written back as NRRD `space` metadata when possible; arbitrary custom
223
+ `coord_system` strings are not emitted as NRRD `space` declarations unless they
224
+ already match a supported explicit NRRD space string. NIfTI output preserves
225
+ geometry, but does not export `coord_system` as an explicit NIfTI metadata
226
+ field.
206
227
 
207
228
  ```bash
208
229
  mlarray_convert sample.nii.gz output.mla
230
+ mlarray_convert sample.mla output.nii.gz
209
231
  ```
210
232
 
211
233
  ## Contributing
Binary file
@@ -0,0 +1,2 @@
1
+ data/
2
+ results/
@@ -0,0 +1,56 @@
1
+ # Benchmark Scripts
2
+
3
+ This folder contains benchmarking scripts for MLArray IO/layout experiments.
4
+
5
+ ## `bench_io_blosc2_layouts.py`
6
+
7
+ Benchmarks IO throughput across:
8
+
9
+ - layout method(s) based on `comp_blosc2_params` (currently baseline copy only)
10
+ - image size tiers (`small`, `medium`, `large`, `very_large`)
11
+ - 2D / 3D / 4D-total array cases with spatial and optional non-spatial axis
12
+ - multiple patch sizes (2D and 3D patch vectors)
13
+ - `MLArray.open(...)` mode/mmap combinations
14
+ - operations:
15
+ - `read_full`
16
+ - `read_patch_random`
17
+ - `write_patch_random`
18
+ - warm and cold cache runs
19
+
20
+ Outputs are printed to console and written to:
21
+
22
+ - `bench/results/bench_io_blosc2_layouts.csv`
23
+ - `bench/results/bench_io_blosc2_layouts.json`
24
+
25
+ ### Example
26
+
27
+ ```bash
28
+ python bench/bench_io_blosc2_layouts.py \
29
+ --tiers small medium \
30
+ --runs 3 \
31
+ --cache-mode both \
32
+ --nthreads 1
33
+ ```
34
+
35
+ If you hit native segfaults in Blosc2 during long runs, isolate each measured run
36
+ in a subprocess (slower, but robust):
37
+
38
+ ```bash
39
+ python bench/bench_io_blosc2_layouts.py \
40
+ --tiers small medium \
41
+ --runs 3 \
42
+ --cache-mode both \
43
+ --nthreads 1 \
44
+ --isolate-runs
45
+ ```
46
+
47
+ ### Cold cache note (Linux)
48
+
49
+ For cold-cache read measurements, the script drops Linux page cache **after the dataset has been created on disk and immediately before measured open/read runs**.
50
+
51
+ This requires root:
52
+
53
+ - run as root, or
54
+ - run via `sudo`
55
+
56
+ If cache dropping fails, those runs are recorded with error status in results.