Skip to content

Commit a59ba8c

Browse files
authored
Add coordinate_space to Scene.create (#249)
Allow user to specify the scene coordinate space on creation.
1 parent 03af4a5 commit a59ba8c

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

python-spec/src/somacore/scene.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""Implementation of the SOMA scene collection for spatial data"""
22

33
import abc
4-
from typing import Generic, Optional, Sequence, TypeVar, Union
4+
from typing import Any, Generic, Optional, Sequence, TypeVar, Union
55

6-
from typing_extensions import Final
6+
from typing_extensions import Final, Self
77

88
from . import _mixin
99
from . import base
1010
from . import collection
1111
from . import coordinates
12+
from . import options
1213
from . import spatial
1314

1415
_MultiscaleImage = TypeVar("_MultiscaleImage", bound=spatial.MultiscaleImage)
@@ -90,6 +91,36 @@ class Scene(
9091
Lifecycle: experimental
9192
"""
9293

94+
@classmethod
95+
@abc.abstractmethod
96+
def create(
97+
cls,
98+
uri: str,
99+
*,
100+
coordinate_space: Optional[
101+
Union[Sequence[str], coordinates.CoordinateSpace]
102+
] = None,
103+
platform_config: Optional[options.PlatformConfig] = None,
104+
context: Optional[Any] = None,
105+
) -> Self:
106+
"""Creates a new scene at the given URI.
107+
108+
Args:
109+
uri: The URI where the collection will be created.
110+
coordinate_space: Optional coordinate space or the axis names for the
111+
coordinate space the scene is defined on. If ``None`` no coordinate
112+
system will be set at this time. Defaults to ``None``.
113+
platform_config: platform-specific configuration; keys are SOMA
114+
implementation names.
115+
context: Other implementation-specific configuration.
116+
117+
Returns:
118+
The newly created collection, opened for writing.
119+
120+
Lifecycle: experimental
121+
"""
122+
raise NotImplementedError()
123+
93124
@property
94125
@abc.abstractmethod
95126
def coordinate_space(self) -> Optional[coordinates.CoordinateSpace]:

0 commit comments

Comments
 (0)