I have a problem importing an image into an Image Container and then plotting it using sc.pl.spatial
.
What I did is:
hi
is the the path to .png
file, and scale
is 0.048109304
, which is tissue_hires_scalef
.
imag_hi = sq.im.ImageContainer(hi, scale = 0.048109304, layer = 'hires')
imag_hi.compute()
print(type(imag_hi["hires"].data))
img_array = imag_hi['hires'].data
data_r.uns[spatial_key][library_id]["images"] = {"hires": img_array}
sc.pl.spatial(data_r, color='leiden', scale_factor = 0.048109304)
I get an error: TypeError: Invalid shape (1335, 2000, 1, 3) for image data
Help would be appreciated. Thank you!!