-
Notifications
You must be signed in to change notification settings - Fork 472
Add setting the objective magnification when patching #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
in fact, i am not sure why CLAM doesn't directly support patching at different magnification. For example, when i download wsi from TCGA, some wsi has no patch level corresponds to 20X magnification, but UNI/CONCH/Prov-Gigapath/TITAN all utilize 20X magnification |
For example, if the maximum objective magnification of WSI is 20x, slices can be directly performed at patch_level 0, but when the maximum magnification is 40x, slices need to be performed at 2 times the downsample rate. |
you are right. the other issue also point out this problem |
|
i find out that #259 (comment) seems to be a compromise approach without set magnification level by Ming Yang. Therefore, it seems to be not a problem of magnification now, i will try it soon. |
But you will encounter problems when the magnification of WSIs at level 0 in your data is inconsistent. |
Yes, I have to make some modifications to support varying patch sizes across different magnifications of the level 0. I discovered that TRIDENT[https://github.com/mahmoodlab/TRIDENT] is designed to address this exact issue, though I'm not particularly keen on its codebase. It also appears the CLAM repository is no longer actively maintained. Furthermore, this codebase has several areas for potential improvement, such as incorporating torch.compile support and optimizing file saving (for instance, by avoiding simultaneous H5 and PT file creation). |
The current code only supports patching at a specified 'patch_level' of the WSI. However, in actual research, the objective magnification is usually specified for patching.
Therefore, I added functionality to the fast patching pipeline to allow specifying the objective magnification during patching. The objective magnification attribute is set to 'None' by default. When the objective magnification is specified, the 'patch_level' will be ignored, and the code will automatically select an appropriate 'patch_level' and corresponding 'custom_downsample' based on the WSI. Additionally, I made corresponding modifications to 'dataset_h5.py' to enable custom downsampling during feature extraction.