Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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 2 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 2 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 7 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.