clemsgrs / hs2p

Histopathology Slides Preprocessing Pipeline
30 stars 7 forks source link

Error when running #5

Closed bryanwong17 closed 1 year ago

bryanwong17 commented 1 year ago

Hi @clemsgrs, could you let me know how to fix this error? When I print out self.wsi.properties, there is no "tiff.XResolution"

Also, should I modify filter_params.ref_patch_size (512) in default.yaml if I want to extract [4096,4096] patches with spacing 0.5?

image

clemsgrs commented 1 year ago

hi, I've merged some changes I had made and forgot to add here. the overall use should be more user-friendly (see new README.md)

also, I've added comments to the config file describing what's the purpose of each parameter. you can leave filter_params.ref_patch_size to 512, it doesn't influence patch sizes at a given spacing.

if the issue with tiff.XResolution persists, it might be because the spacing / resolution is missing for a few TCGA slides. I'll try to add some code to show how one can force a given spacing at a given level.

bryanwong17 commented 1 year ago

Hi @clemsgrs, I tried to rerun again. and the issue with tiff.XResolution still exists

Could you please let me know if you have already fixed it? FYI, I'm using Camelyon16. Does it work with TCGA slides?

clemsgrs commented 1 year ago

forcing a given spacing at a given level is a bit more complex than I anticipated.

if your TCGA slides are .svs slides, you need to replace:

x_res = float(self.wsi.properties["tiff.XResolution"]) / 10000
y_res = float(self.wsi.properties["tiff.YResolution"]) / 10000
x_spacing, y_spacing = 1 / x_res, 1 / y_res

by:

x_spacing = float(self.wsi.properties["openslide.mpp-x"])
y_spacing =  float(self.wsi.properties["openslide.mpp-y"])

for the slides this property is missing, there is no easy workaround.

bryanwong17 commented 1 year ago

Hi @clemsgrs, thanks for the answer. Now I can extract patches, but I receive a warning like this:

WARNING: target spacing and actual spacing are more than 15% apart!

Is it a big deal?

Thanks!

clemsgrs commented 1 year ago

not a big deal at all if you pull latest version of master, this warning should be removed

did it end up working for CAMELYON16?

bryanwong17 commented 1 year ago

Only a few slides of CAMELYON16 have been tested, and they all worked perfectly!

I will close this issue now. Thanks again for your help!