|
13 | 13 |
|
14 | 14 | import tiledb |
15 | 15 |
|
| 16 | +from . import ATTR_NAME |
16 | 17 | from .converters.axes import Axes |
17 | 18 | from .helpers import open_bioimg |
18 | 19 |
|
19 | 20 |
|
20 | 21 | class TileDBOpenSlide: |
21 | 22 | @classmethod |
22 | | - def from_group_uri(cls, uri: str) -> TileDBOpenSlide: |
| 23 | + def from_group_uri(cls, uri: str, attr: str = ATTR_NAME) -> TileDBOpenSlide: |
23 | 24 | warnings.warn( |
24 | 25 | "This method is deprecated, please use TileDBOpenSlide() instead", |
25 | 26 | DeprecationWarning, |
26 | 27 | stacklevel=2, |
27 | 28 | ) |
28 | | - return cls(uri) |
| 29 | + return cls(uri, attr=attr) |
29 | 30 |
|
30 | | - def __init__(self, uri: str): |
| 31 | + def __init__(self, uri: str, *, attr: str = ATTR_NAME): |
31 | 32 | """Open this TileDBOpenSlide. |
32 | 33 |
|
33 | 34 | :param uri: uri of a tiledb.Group containing the image |
34 | 35 | """ |
35 | 36 | self._group = tiledb.Group(uri) |
36 | 37 | pixel_depth = self._group.meta.get("pixel_depth", 1) |
37 | 38 | self._levels = sorted( |
38 | | - (TileDBOpenSlideLevel(o.uri, pixel_depth) for o in self._group), |
| 39 | + (TileDBOpenSlideLevel(o.uri, pixel_depth, attr=attr) for o in self._group), |
39 | 40 | key=attrgetter("level"), |
40 | 41 | ) |
41 | 42 |
|
@@ -154,8 +155,8 @@ def _read_image( |
154 | 155 |
|
155 | 156 |
|
156 | 157 | class TileDBOpenSlideLevel: |
157 | | - def __init__(self, uri: str, pixel_depth: int): |
158 | | - self._tdb = open_bioimg(uri) |
| 158 | + def __init__(self, uri: str, pixel_depth: int, *, attr: str): |
| 159 | + self._tdb = open_bioimg(uri, attr=attr) |
159 | 160 | self._pixel_depth = pixel_depth |
160 | 161 |
|
161 | 162 | @property |
|
0 commit comments