spatialdata-plot icon indicating copy to clipboard operation
spatialdata-plot copied to clipboard

render_images rescaling issue with unit16 data

Open sophiamaedler opened this issue 2 months ago • 2 comments

I am trying to render an image layer using spatialdata plot:

from spatialdata import read_zarr
import spatialdata_plot 
import matplotlib.pyplot as plt

sdata = read_zarr("test_sdata.zarr")

fig, axs = plt.subplots(1, 2, figsize=(10, 5))
sdata.pl.render_images("input_image", channel=["Hoechst", "Alexa488"]).pl.show(ax = axs[0])
sdata.pl.render_images("input_image", channel="Hoechst").pl.show(ax = axs[1])

Single-channel images work as expected but on multi-channel overviews the scaling of my data is changed. I suspect this is a result of my data being stored as unit16.

Image

I previously plotted the same data (its part of our testing data) without issues in older spatialdata plot versions (0.2.11) and got expected visual outputs. I am seeing the issues in the newer releases (currently on 0.2.13).

Image

Happy to send the test object, I can't seem to upload it unfortunately (I guess its too large).

sophiamaedler avatar Nov 07 '25 12:11 sophiamaedler

Just double checked: the issue occurs both on 0.2.12 and 0.2.13. Works as expected on 0.2.11.

sophiamaedler avatar Nov 07 '25 12:11 sophiamaedler

I have the same problem with an image that I plotted a couple of months ago, rolling back to 0.2.11 helped.

I used to have:

Image

Now I have this by running the same command:

Image

namsaraeva avatar Nov 26 '25 09:11 namsaraeva