scverse / scverse/squidpy

sq.im.calculate_image_features() - scale factors for cropped image

Open
#676 1 comment 1 reaction 1 assignee View on GitHub

@michalk8 is already working on this.

Since Apr 13, 2023.

image :microscope:
Dominant language
Python
Stars
598
Forks
121
Avg merge
3d 11h
Merged PRs (30d)
3

Description

Description

Hi,
Thank you for the great package. I am having an issue with sq.im.calculate_image_features(), as previously mentioned in #399.
I provide the scale factor when initialising the ImageContainer, as mentioned in #399.
When using an uncropped tif image, I can successfully use sq.im.calculate_image_features(). However, with a cropped image I get the same error as mentioned previously (below).
I'd thought that I may need to re-provide scale factors for the cropped image. Do you have any suggestions about how I'd do this?
Many thanks.

scale = adata.uns['spatial'][f'{SAMPLE_NAME}']['scalefactors']['tissue_hires_scalef']
img = sq.im.ImageContainer('/path_to_tif/img.tif', scale = scale)
crop = img.crop_corner(5000, 3000, size=500)
sq.im.segment(img=crop, 
              layer="image", 
              layer_added="segmented_watershed", 
              method="watershed", 
              channel=0,
              qeq=False)
sq.im.calculate_image_features(
    adata,
    crop,
    layer='image',
    features="segmentation",
    key_added="segmentation_features",
    mask_circle=True)

ValueError: Expected 'height' to be in interval '[0, 500]', found '-4390'.

Version

1.2.3

...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.