Skip to content

Commit

Permalink
add axes to init of base, image, labels
Browse files Browse the repository at this point in the history
co-authored by: [email protected]
  • Loading branch information
melonora committed Feb 24, 2024
1 parent 9eb080b commit 6f00604
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions napari/layers/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def __init__(
experimental_clipping_planes=None,
mode='pan_zoom',
projection_mode='none',
axes_labels: tuple[str] = ()
) -> None:
super().__init__()

Expand Down
3 changes: 3 additions & 0 deletions napari/layers/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def __init__(
data,
*,
rgb=None,
axes_labels = (),
colormap='gray',
contrast_limits=None,
gamma=1.0,
Expand Down Expand Up @@ -273,6 +274,8 @@ def __init__(
trans._('Image data must have at least 2 dimensions.')
)

self.axes_labels = tuple(i for i in range(-data.ndim, 0))

# Determine if data is a multiscale
self._data_raw = data
if multiscale is None:
Expand Down
2 changes: 2 additions & 0 deletions napari/layers/labels/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def __init__(
plane=None,
experimental_clipping_planes=None,
projection_mode='none',
axes_labels = (),
) -> None:
if name is None and data is not None:
name = magic_name(data)
Expand All @@ -321,6 +322,7 @@ def __init__(
self._cached_mapped_labels = np.zeros((0, 4), dtype=np.uint8)

data = self._ensure_int_labels(data)
self.axes_labels = tuple(i for i in range(-data.ndim, 0))

super().__init__(
data,
Expand Down
1 change: 1 addition & 0 deletions napari/layers/points/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ def __init__(
antialiasing=1,
shown=True,
projection_mode='none',
axes_labels = (),
) -> None:
if ndim is None and scale is not None:
ndim = len(scale)
Expand Down

0 comments on commit 6f00604

Please sign in to comment.