Skip to content

Images with alpha channel being plotted incorrectly #406

Open
@ivirshup

Description

@ivirshup

Hey! I've come across an issue when trying to plot some images where one of the channels is an alpha level. This is a visium image that was submitted to cellxgene.

sdata.pl.render_images().pl.show("d551b400-b2e5-454d-b5a9-ece03e6b4739")

Image

As you can see, this looks quite funny. I don't think it's an issue with the image, since plotting it through other routes appears normal:

Plotting with matplotlib

import matplotlib.pyplot as plt
img = sdata.images["d551b400-b2e5-454d-b5a9-ece03e6b4739_library"].compute()
plt.imshow(img.transpose("y", "x", "c"))

Image

Plotting with squidpy

from spatialdata_io.experimental import from_legacy_anndata, to_legacy_anndata
import squidpy as sq

adata = to_legacy_anndata(sdata, include_images=True)
sq.pl.spatial_scatter(adata)

Image

It seems to me like the alpha level is being misinterpreted in spatialdata_plot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions