Skip to content

Commit

Permalink
Add add_new_level to Image2D
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark committed Jul 30, 2024
1 parent edf6e0c commit 92d62cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions python-spec/src/somacore/ephemeral/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
MutableMapping,
NoReturn,
Optional,
Sequence,
TypeVar,
Union,
)

import pyarrow as pa
Expand Down Expand Up @@ -169,6 +171,17 @@ class Image2D( # type: ignore[misc] # __eq__ false positive

__slots__ = ()

def add_new_level(
self,
key: str,
*,
uri: Optional[str] = None,
type: pa.DataType,
shape: Sequence[int],
axes: Union[str, Sequence[str]],
) -> data.DenseNDArray:
raise NotImplementedError()

@property
def level_count(self) -> int:
raise NotImplementedError()
Expand Down
14 changes: 13 additions & 1 deletion python-spec/src/somacore/images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Implementation of the SOMA image collection for spatial data"""

import abc
from typing import Generic, Optional, Tuple, TypeVar
from typing import Generic, Optional, Sequence, Tuple, TypeVar, Union

import pyarrow as pa
from typing_extensions import Final, Protocol
Expand Down Expand Up @@ -58,6 +58,18 @@ def name(self) -> str:
def shape(self) -> Tuple[int, ...]:
"""Number of pixels for each dimension of the image."""

@abc.abstractmethod
def add_new_level(
self,
key: str,
*,
uri: Optional[str] = None,
type: pa.DataType,
shape: Sequence[int],
axes: Union[str, Sequence[str]],
) -> data.DenseNDArray:
raise NotImplementedError()

@property
@abc.abstractmethod
def level_count(self) -> int:
Expand Down

0 comments on commit 92d62cd

Please sign in to comment.