TIO-IKIM / CellViT

CellViT: Vision Transformers for Precise Cell Segmentation and Classification
https://doi.org/10.1016/j.media.2024.103143
Other
217 stars 33 forks source link

Issue with downsampling #47

Closed pkeller00 closed 4 months ago

pkeller00 commented 4 months ago

Describe the bug Preprocessing code fails for images with an odd number of levels. To Reproduce Steps to reproduce the behavior:

  1. Select image from TCGA with odd number of levels e.g. TCGA-AA-3673-01Z-00-DX1.a80676fa-5481-4b63-9639-dbeb31ae82d8.svs (17 levels)
  2. Run python3 ./preprocessing/patch_extraction/main_extraction.py --config ./example/preprocessing_example.yamlwith the default processing file provided in GitHub. (Default downsample of 1)
  3. "Requested level does not exist. Number of slide levels: 17"

Expected behavior This occurs as level = tiles.level_count - self.config.downsample.bit_length() set level to 17 rather than 16 which is not correct.

pkeller00 commented 4 months ago

After further investigation it seems the issue is because the slide does not have power information. Adding a value for target_mpp solved the issue.

FabianHoerst commented 4 months ago

I am going to investigate this, as it is more or less a preprocessing problem. Either way, the preprocessing should terminate with an error message when the target_mpp cannot be loaded and needs to be specific explicitly.

FabianHoerst commented 4 months ago

It seems like the slide has a kind of "odd" setting. It is scanned with a magnification of x20, but has 0.2325 mpp as resolution. We are going to improve the code soon. Thanks for reporting!