binli123 / dsmil-wsi

DSMIL: Dual-stream multiple instance learning networks for tumor detection in Whole Slide Image
MIT License
358 stars 88 forks source link

Magnification vs Resolution (Histology) #66

Closed GeorgeBatch closed 7 months ago

GeorgeBatch commented 1 year ago

Hi Bin,

Thanks for updating the deepzoom_tiler.py so that it now can process a dataset with slides scanned at 20x and at 40x (with the --base_mag option). It has already been highlighted () that sometimes you can have a slide scanned at 20x with similar microns per pixel value as another 40x slide.

The --base_mag option solves the problem of choosing levels for 2 slides with properly corresponding magnification and resolution:

And if you want to have a combination of 2 magnifications:

For both slides, A and B, the patches will be extracted at the same magnifications and at the same resolution of mu per pixel.


But if you have:

I don't know why this can happen (different scanners?). Maybe the tussie sample on slice C is much smaller than on slide A so that when scanning, the scanner was positioned much closer to the tissue for slice C and even though the lens was only 20x, the resulting resolution is the same as for slide A for which the 40x lens was positioned much further to capture the whole tissue? I am not sure if this even makes sense. Please let me know what you think.

Then for the same resolutions, you would need to give different levels for slides A and C. The --base_mag option would not solve your problem here like in the case with slides A and B.

What do you think should be the solution to this? Just patching different portions of the dataset differently so the resolutions match? Or maybe we need to move away from using magnifications and use resolution (mu per pixel) to standardize the tiling?

Many thanks, George

MichaelSNelson commented 1 year ago

"I don't know why this can happen (different scanners?)."

Hi @GeorgeBatch, quick note there, the size of a pixel is not really related to the magnification of the microscope. Without going into the details, which you can look up if you want, the pixel size is usually based on the NA of the objective, but can also be limited by the pixel size of the camera itself. So if one scanner has a worse objective, or worse camera, you could easily end up with similar pixel sizes despite being "40x" and "20x". It's one way for a company to use cheap optics and still claim to provide 40x "magnification" while still really only providing the same resolution as a good 20x objective.

https://www.photometrics.com/learn/camera-basics/camera-resolution https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3779393/#:~:text=If%20we%20consider%20a%20sensor,of%20the%20objective%20lens%20magnification.

Ideally, if you are comparing images, you want the "effective pixel size" to be the same, though this may require downsampling one of the images. And if the two images are not perfectly double the pixel size, any attempt to match will result in degradation and blurring in one of the images. At a certain point, mismatching images cannot be "fixed in post".

GeorgeBatch commented 1 year ago

Thank you very much for the explanation, @MichaelSNelson!