squidpy
squidpy copied to clipboard
Error "height out of expected interval" in sq.im.calculate_image_features
I am new to this area: trying to load visium data preprocessed by spaceranger, and test the sq.im.calculate_image_features function.
Unfortunately, I got an "ValueError: Expected height to be in interval [0, 2000], found 5935. Did I miss something here?
adata_squidpy = sq.read.visium('/media/hpc/grid/wip_drm_targetsciences/projects/p051_senescence_esf/p03_mouse_20230502/Project_034_visium/Analysis/f01_raw/spaceranger_V12N30-107_A1')
sq.pl.spatial_scatter(adata_squidpy)
arr = adata_squidpy.uns['spatial']['spaceranger_V12N30-107_A1']['images']['hires']
img = sq.im.ImageContainer(arr, layer="img1")
# calculate features for different scales (higher value means more context)
for scale in [1.0, 2.0]:
feature_name = f"features_summary_scale{scale}"
sq.im.calculate_image_features(
adata_squidpy,
img.compute(),
features="summary",
key_added=feature_name,
n_jobs=4,
scale=scale,
)
...