tiamat-python 0.1.8__py3-none-any.whl
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.
- tiamat/__init__.py +5 -0
- tiamat/array.py +221 -0
- tiamat/cache.py +138 -0
- tiamat/cli.py +15 -0
- tiamat/constants.py +34 -0
- tiamat/errors.py +27 -0
- tiamat/io.py +85 -0
- tiamat/metadata/__init__.py +2 -0
- tiamat/metadata/dimensions.py +18 -0
- tiamat/metadata/metadata.py +118 -0
- tiamat/pipeline.py +144 -0
- tiamat/readers/__init__.py +31 -0
- tiamat/readers/factory.py +106 -0
- tiamat/readers/generic.py +150 -0
- tiamat/readers/memory.py +223 -0
- tiamat/readers/nifti.py +94 -0
- tiamat/readers/pipeline.py +98 -0
- tiamat/readers/processing.py +509 -0
- tiamat/readers/protocol.py +59 -0
- tiamat/readers/stack.py +851 -0
- tiamat/readers/zarr.py +353 -0
- tiamat/serialization.py +153 -0
- tiamat/transformers/__init__.py +0 -0
- tiamat/transformers/access.py +216 -0
- tiamat/transformers/affine.py +341 -0
- tiamat/transformers/axes.py +418 -0
- tiamat/transformers/color.py +304 -0
- tiamat/transformers/coordinates.py +54 -0
- tiamat/transformers/dfield.py +432 -0
- tiamat/transformers/metadata.py +88 -0
- tiamat/transformers/normalization.py +77 -0
- tiamat/transformers/protocol.py +84 -0
- tiamat/transformers/view.py +197 -0
- tiamat_python-0.1.8.dist-info/METADATA +382 -0
- tiamat_python-0.1.8.dist-info/RECORD +39 -0
- tiamat_python-0.1.8.dist-info/WHEEL +5 -0
- tiamat_python-0.1.8.dist-info/entry_points.txt +2 -0
- tiamat_python-0.1.8.dist-info/licenses/LICENSE +202 -0
- tiamat_python-0.1.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Protocol for readers.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Protocol
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
from ..io import ImageAccessor
|
|
10
|
+
from ..metadata import ImageMetadata
|
|
11
|
+
|
|
12
|
+
CheckResult = bool | int | float
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ImageReader(Protocol):
|
|
16
|
+
"""
|
|
17
|
+
Protocol for reading image data and metadata from a source.
|
|
18
|
+
|
|
19
|
+
Expected call order in a pipeline:
|
|
20
|
+
1. `read_metadata` → supplies metadata to the first transformer's `transform_metadata`
|
|
21
|
+
2. `read_image` → supplies image data to the first transformer's `transform_image`
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def read_image(self, accessor: ImageAccessor) -> np.ndarray:
|
|
25
|
+
"""
|
|
26
|
+
Read and return the image content.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
accessor (ImageAccessor): Accessor defining which part of the image to read.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
np.ndarray: The resulting image data as a Numpy array.
|
|
33
|
+
"""
|
|
34
|
+
raise NotImplementedError
|
|
35
|
+
|
|
36
|
+
def read_metadata(self) -> ImageMetadata:
|
|
37
|
+
"""
|
|
38
|
+
Read and return metadata associated with the image.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
ImageMetadata: The metadata of the image containing shape, spatial and channel dimensions, spacing,
|
|
42
|
+
and other properties.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
raise NotImplementedError
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def check_file(cls, fname: str) -> bool | int | float:
|
|
49
|
+
"""
|
|
50
|
+
Check if the reader is compatible with the given file.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
fname (str): The file path or identifier.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Truthy value if the file is supported. Can return a numeric
|
|
57
|
+
score indicating priority among multiple readers.
|
|
58
|
+
"""
|
|
59
|
+
raise NotImplementedError
|