Skip to content

Commit b51099e

Browse files
berombautimtreis
andauthored
Fix channel str support (#221)
* add channel str and multiscale tests * fix channel str * fix channel str for multiscale * add snapshots for channel str tests * merged & updated CHANGELOG * added images from runner * parametrised test * added images from runner * updated failing image from runner --------- Co-authored-by: Tim Treis <[email protected]>
1 parent ac062d8 commit b51099e

22 files changed

+59
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ __pycache__/
1919
/.pytest_cache/
2020
/.cache/
2121
/data/
22+
*failed-diff.png
2223

2324
# docs
2425
/docs/generated/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ and this project adheres to [Semantic Versioning][].
88
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
99
[semantic versioning]: https://semver.org/spec/v2.0.0.html
1010

11+
## [0.2.3] - tbd
12+
13+
### Fixed
14+
15+
- Fix color assignment for NaN values (#257)
16+
- Fix channel str support #221
17+
1118
## [0.2.2] - 2024-05-02
1219

1320
### Fixed
1421

1522
- Fixed `fill_alpha` ignoring `alpha` channel from custom cmap
23+
- Fix channel str support (#221)
1624

1725
## [0.2.1] - 2024-03-26
1826

src/spatialdata_plot/pl/render.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def _render_images(
442442

443443
# 1) Image has only 1 channel
444444
if n_channels == 1 and not isinstance(render_params.cmap_params, list):
445-
layer = img.sel(c=channels).squeeze()
445+
layer = img.sel(c=channels[0]).squeeze()
446446

447447
if render_params.quantiles_for_norm != (None, None):
448448
layer = _normalize(

src/spatialdata_plot/pl/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ def _multiscale_to_spatial_image(
13071307
data_var_keys = list(multiscale_image[optimal_scale].data_vars)
13081308
image = multiscale_image[optimal_scale][data_var_keys[0]]
13091309

1310-
return Labels2DModel.parse(image) if is_label else Image2DModel.parse(image)
1310+
return Labels2DModel.parse(image) if is_label else Image2DModel.parse(image, c_coords=image.coords["c"].values)
13111311

13121312

13131313
def _get_elements_to_be_rendered(
63.2 KB
Loading
63.2 KB
Loading
63.2 KB
Loading
63.2 KB
Loading
64.8 KB
Loading
64.8 KB
Loading

0 commit comments

Comments
 (0)