Skip to content

Commit 1ce2539

Browse files
committed
add get_image and get_image_labels
1 parent d427a23 commit 1ce2539

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/astro_image_display_api/interface_definition.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,49 @@ def load_image(self, data: Any, image_label: str | None = None) -> None:
4747
raise NotImplementedError
4848

4949
# Setting and getting image properties
50+
@abstractmethod
51+
def get_image(
52+
self,
53+
image_label: str | None = None,
54+
) -> Any:
55+
"""
56+
Parameters
57+
----------
58+
image_label : optional
59+
The label of the image to set the cuts for. If not given and there is
60+
only one image loaded, that image is returned.
61+
62+
Raises
63+
------
64+
ValueError
65+
If the `image_label` is not provided when there are multiple images loaded,
66+
or if the `image_label` does not correspond to a loaded image.
67+
68+
Returns
69+
-------
70+
image_data : Any
71+
The data of the loaded image. The exact type of the data is not specified,
72+
and different backends may return different types. A return type compatible
73+
with `astropy.nddata.NDData` is preferred, but not required. It is expected
74+
that the returned data can be re-loaded into the viewer using
75+
`load_image`, however.
76+
"""
77+
raise NotImplementedError
78+
79+
@abstractmethod
80+
def get_image_labels(
81+
self,
82+
) -> list[str]:
83+
"""
84+
Get the labels of the loaded images.
85+
86+
Returns
87+
-------
88+
image_labels: list of str
89+
The labels of the loaded images.
90+
"""
91+
raise NotImplementedError
92+
5093
@abstractmethod
5194
def set_cuts(
5295
self,

0 commit comments

Comments
 (0)