Skip to content

update comments for image data shapes #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastplotlib/graphics/_features/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _fix_data(self, data):
if data.ndim not in (2, 3):
raise ValueError(
"image data must be 2D with or without an RGB(A) dimension, i.e. "
"it must be of shape [x, y], [x, y, 3] or [x, y, 4]"
"it must be of shape [rows, cols], [rows, cols, 3] or [rows, cols, 4]"
)

# let's just cast to float32 always
Expand Down
2 changes: 1 addition & 1 deletion fastplotlib/graphics/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
----------
data: array-like
array-like, usually numpy.ndarray, must support ``memoryview()``
| shape must be ``[x_dim, y_dim]``
| shape must be ``[n_rows, n_cols]``, ``[n_rows, n_cols, 3]`` for RGB or ``[n_rows, n_cols, 4]`` for RGBA

vmin: int, optional
minimum value for color scaling, calculated from data if not provided
Expand Down
7 changes: 4 additions & 3 deletions fastplotlib/widgets/image_widget/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
from ._sliders import ImageWidgetSliders


# Number of dimensions that represent one image/one frame. For grayscale shape will be [x, y], i.e. 2 dims, for RGB(A)
# shape will be [x, y, c] where c is of size 3 (RGB) or 4 (RGBA)
# Number of dimensions that represent one image/one frame
# For grayscale shape will be [n_rows, n_cols], i.e. 2 dims
# For RGB(A) shape will be [n_rows, n_cols, c] where c is of size 3 (RGB) or 4 (RGBA)
IMAGE_DIM_COUNTS = {"gray": 2, "rgb": 3}

# Map boolean (indicating whether we use RGB or grayscale) to the string. Used to index RGB_DIM_MAP
Expand Down Expand Up @@ -162,7 +163,7 @@ def ndim(self) -> int:
def n_scrollable_dims(self) -> list[int]:
"""
list indicating the number of dimenensions that are scrollable for each data array
All other dimensions are frame/image data, i.e. [x, y] or [x, y, c]
All other dimensions are frame/image data, i.e. [rows, cols] or [rows, cols, rgb(a)]
"""
return self._n_scrollable_dims

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy