mlarray 0.0.29__tar.gz → 0.0.32__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.
- {mlarray-0.0.29 → mlarray-0.0.32}/PKG-INFO +1 -1
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/api.md +4 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/schema.md +39 -9
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray/meta.py +4 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/PKG-INFO +1 -1
- {mlarray-0.0.29 → mlarray-0.0.32}/.github/workflows/workflow.yml +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/.gitignore +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/LICENSE +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/MANIFEST.in +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/README.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/assets/banner.png +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/assets/banner.png~ +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/cli.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/index.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/optimization.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/usage.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/docs/why.md +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/examples/example_channel.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/examples/example_metadata_only.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/examples/example_open.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/examples/example_save_load.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mkdocs.yml +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray/__init__.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray/cli.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray/mlarray.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray/utils.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/SOURCES.txt +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/dependency_links.txt +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/entry_points.txt +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/requires.txt +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/mlarray.egg-info/top_level.txt +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/pyproject.toml +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/setup.cfg +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/tests/test_metadata.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/tests/test_optimization.py +0 -0
- {mlarray-0.0.29 → mlarray-0.0.32}/tests/test_usage.py +0 -0
|
@@ -11,6 +11,10 @@ The schema is designed around a few core goals:
|
|
|
11
11
|
|
|
12
12
|
All fields in the schema are **JSON-serializable** unless otherwise noted. Fields marked as `Optional[...]` may be omitted if unknown or not applicable.
|
|
13
13
|
|
|
14
|
+
### Representation notes
|
|
15
|
+
|
|
16
|
+
Many namespaces are implemented as **single-key dataclasses** (subclasses of `SingleKeyBaseMeta`). In Python, these behave like their wrapped value (e.g., `meta.is_seg` is a `bool`, `meta.original` is a `dict`). When serialized via `Meta.to_mapping()`, they appear as a one-field object keyed by their internal field name (e.g., `is_seg: {"is_seg": true}` or `original: {"data": {...}}`). `Meta.from_mapping()` accepts either the one-field object or the raw value and will coerce it to the correct class.
|
|
17
|
+
|
|
14
18
|
---
|
|
15
19
|
|
|
16
20
|
## Meta
|
|
@@ -19,7 +23,7 @@ Top-level metadata container.
|
|
|
19
23
|
|
|
20
24
|
### Overview
|
|
21
25
|
|
|
22
|
-
`Meta` is the root object that groups all metadata into well-defined namespaces. Some namespaces are **standardized** (e.g., `spatial`, `stats`), while others are intentionally **free-form** (`original`, `extra`) to support arbitrary metadata and long-term extensibility.
|
|
26
|
+
`Meta` is the root object that groups all metadata into well-defined namespaces. Some namespaces are **standardized** (e.g., `spatial`, `stats`), while others are intentionally **free-form** (`original`, `extra`) to support arbitrary metadata and long-term extensibility. Several entries are single-key dataclasses that wrap a primitive value while still allowing schema-aware validation.
|
|
23
27
|
|
|
24
28
|
---
|
|
25
29
|
|
|
@@ -28,7 +32,11 @@ Top-level metadata container.
|
|
|
28
32
|
* **Description:** Arbitrary JSON-serializable dictionary for metadata from the original image source.
|
|
29
33
|
Stores information from image sources such as DICOM, NIfTI, NRRD,
|
|
30
34
|
or other imaging formats.
|
|
31
|
-
* **Dataclass:**
|
|
35
|
+
* **Dataclass:** `MetaOriginal` (single-key wrapper).
|
|
36
|
+
|
|
37
|
+
| field | type | description |
|
|
38
|
+
| ----- | --------------------- | -------------------------------------------- |
|
|
39
|
+
| data | Dict[str, Any] | JSON-serializable metadata from the source. |
|
|
32
40
|
|
|
33
41
|
---
|
|
34
42
|
|
|
@@ -37,7 +45,11 @@ Top-level metadata container.
|
|
|
37
45
|
* **Description:** Flexible container for arbitrary, JSON-serializable metadata
|
|
38
46
|
when no schema exists. Intended for experimental or application-specific
|
|
39
47
|
fields that are not part of the standard.
|
|
40
|
-
* **Dataclass:**
|
|
48
|
+
* **Dataclass:** `MetaExtra` (single-key wrapper).
|
|
49
|
+
|
|
50
|
+
| field | type | description |
|
|
51
|
+
| ----- | -------------- | -------------------------------------------- |
|
|
52
|
+
| data | Dict[str, Any] | JSON-serializable metadata for extra fields. |
|
|
41
53
|
|
|
42
54
|
---
|
|
43
55
|
|
|
@@ -53,7 +65,7 @@ This section stores the information needed to interpret the array in physical sp
|
|
|
53
65
|
| spacing | Optional[List[float]] | Voxel spacing per spatial axis, length = `ndims`. |
|
|
54
66
|
| origin | Optional[List[float]] | Origin per spatial axis, length = `ndims`. |
|
|
55
67
|
| direction | Optional[List[List[float]]] | Direction matrix, shape `[ndims][ndims]`. |
|
|
56
|
-
| shape | Optional[List[int]]
|
|
68
|
+
| shape | Optional[List[int]] | Array shape. If `channel_axis` is set, length = `ndims + 1`, otherwise length = `ndims`. |
|
|
57
69
|
| channel_axis | Optional[int] | Index of channel dimension in the full array, if present. |
|
|
58
70
|
|
|
59
71
|
---
|
|
@@ -77,13 +89,15 @@ This section stores precomputed global statistics for the array, which can be us
|
|
|
77
89
|
| percentile_mean | Optional[float] | Mean within a selected percentile range. |
|
|
78
90
|
| percentile_median | Optional[float] | Median within a selected percentile range. |
|
|
79
91
|
| percentile_std | Optional[float] | Standard deviation within a selected percentile range. |
|
|
92
|
+
| percentile_min_key | Optional[float] | Minimum percentile key used to determine percentile_min (for example 0.05). |
|
|
93
|
+
| percentile_max_key | Optional[float] | Maximum percentile key used to determine percentile_max (for example 0.95). |
|
|
80
94
|
|
|
81
95
|
---
|
|
82
96
|
|
|
83
97
|
### bbox
|
|
84
98
|
|
|
85
99
|
* **Description:** Bounding boxes for objects/regions in the image.
|
|
86
|
-
* **Dataclass:** `MetaBbox
|
|
100
|
+
* **Dataclass:** `MetaBbox` (single-key wrapper).
|
|
87
101
|
* **Structure:** List of bboxes, each bbox is a list with length equal to image `ndims`,
|
|
88
102
|
and each entry is `[min, max]`.
|
|
89
103
|
|
|
@@ -98,7 +112,11 @@ Bounding boxes are stored in a normalized, axis-aligned representation that work
|
|
|
98
112
|
### is_seg
|
|
99
113
|
|
|
100
114
|
* **Description:** Whether the image is a segmentation mask.
|
|
101
|
-
* **Dataclass:**
|
|
115
|
+
* **Dataclass:** `MetaIsSeg` (single-key wrapper).
|
|
116
|
+
|
|
117
|
+
| field | type | description |
|
|
118
|
+
| ------ | -------------- | ----------------------------------------------- |
|
|
119
|
+
| is_seg | Optional[bool] | True/False when known, None when unknown. |
|
|
102
120
|
|
|
103
121
|
---
|
|
104
122
|
|
|
@@ -120,7 +138,11 @@ This section records how the array was laid out on disk (chunking, blocking, pat
|
|
|
120
138
|
### _has_array
|
|
121
139
|
|
|
122
140
|
* **Description:** Whether this metadata instance represents an on-disk array.
|
|
123
|
-
* **Dataclass:**
|
|
141
|
+
* **Dataclass:** `MetaHasArray` (single-key wrapper).
|
|
142
|
+
|
|
143
|
+
| field | type | description |
|
|
144
|
+
| --------- | ---- | ------------------------------------- |
|
|
145
|
+
| has_array | bool | True when an array payload is stored. |
|
|
124
146
|
|
|
125
147
|
---
|
|
126
148
|
|
|
@@ -128,11 +150,19 @@ This section records how the array was laid out on disk (chunking, blocking, pat
|
|
|
128
150
|
|
|
129
151
|
* **Description:** Source format identifier for the `image` metadata (e.g., "dicom",
|
|
130
152
|
"nifti", "nrrd"). This is advisory and application-defined.
|
|
131
|
-
* **Dataclass:**
|
|
153
|
+
* **Dataclass:** `MetaImageFormat` (single-key wrapper).
|
|
154
|
+
|
|
155
|
+
| field | type | description |
|
|
156
|
+
| ----------------- | -------------- | --------------------------------------------- |
|
|
157
|
+
| image_meta_format | Optional[str] | Identifier for the original metadata format. |
|
|
132
158
|
|
|
133
159
|
---
|
|
134
160
|
|
|
135
161
|
### _mlarray_version
|
|
136
162
|
|
|
137
163
|
* **Description:** MLArray version string used to write the file.
|
|
138
|
-
* **Dataclass:**
|
|
164
|
+
* **Dataclass:** `MetaVersion` (single-key wrapper).
|
|
165
|
+
|
|
166
|
+
| field | type | description |
|
|
167
|
+
| --------------- | -------------- | ------------------------------------ |
|
|
168
|
+
| mlarray_version | Optional[str] | Version string for the writer. |
|
|
@@ -550,6 +550,8 @@ class MetaStatistics(BaseMeta):
|
|
|
550
550
|
percentile_mean: Mean percentile value.
|
|
551
551
|
percentile_median: Median percentile value.
|
|
552
552
|
percentile_std: Standard deviation of percentile values.
|
|
553
|
+
percentile_min_key: Minimum percentile key used to determine percentile_min (for example 0.05).
|
|
554
|
+
percentile_max_key: Maximum percentile key used to determine percentile_max (for example 0.95).
|
|
553
555
|
"""
|
|
554
556
|
min: Optional[float] = None
|
|
555
557
|
max: Optional[float] = None
|
|
@@ -561,6 +563,8 @@ class MetaStatistics(BaseMeta):
|
|
|
561
563
|
percentile_mean: Optional[float] = None
|
|
562
564
|
percentile_median: Optional[float] = None
|
|
563
565
|
percentile_std: Optional[float] = None
|
|
566
|
+
percentile_min_key: Optional[float] = None
|
|
567
|
+
percentile_max_key: Optional[float] = None
|
|
564
568
|
|
|
565
569
|
def _validate_and_cast(self, **_: Any) -> None:
|
|
566
570
|
"""Validate that all stats are numeric when provided."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|