cvlab-stonybrook / local_learning_wsi

Repository for "Gigapixel Whole-Slide Images Classification using Locally Supervised Learning"
27 stars 4 forks source link

Inquiry about WSI inputs #3

Open bryanwong17 opened 5 months ago

bryanwong17 commented 5 months ago

Thank you for the great work! It seems like the inputs (x) are WSI images in the .jpg format. How are they transformed into the .jpg format from the original slide? Additionally, what would be their input size (after in .jpg format)? Thank you!

jingweizhang-xyz commented 5 months ago

We first extract the entire WSI at 5X and save it as a jpg file. Then, to reduce the image size, crop out the non-tissue boundary of each image. As different WSI have different sizes, the input size is not fixed. We used an attention pooling layer to allow our network adapt to various sizes.

bryanwong17 commented 5 months ago

Based on my understanding, the inputs remain large (gigapixel-sized) even in .jpg format because the original WSI size is retained after downscaling to 5x magnification and cropping non-tissue regions. Subsequently, these images are sampled into patches of sizes such as 128x128, 64x64, or 32x32 pixels, depending on the module, which are used for RFR. Is my understanding correct?

I was also wondering if you could share the preprocessing code to transform the original slide format into .jpg format after downscaling to 5x magnification and cropping non-tissue region.

Thank you!

jingweizhang-xyz commented 5 months ago

Yes, your understanding is correct.

I will try to find the script. The entire idea is very simple, convert the image into HSV space. Use the saturation channel to determine if the pixel is the tissue/non-tissue pixel. Count the number of tissue pixels along x/y axis and set a threshold. Finally, remove the non-tissue x and y.

I remembered for one or two dataset, I process some slides manually as some cases are tricky.

bryanwong17 commented 5 months ago

Thank you for the clarification and explanation about the process! It would be much appreciated if you could share the code. Thank you once again!

bryanwong17 commented 5 months ago

Hi @jingweizhang-xyz , is it possible for you to provide me with your WSI inputs in .jpg format so that I can play around with them?