Skip to content

Conversation

yang-ze-kang
Copy link

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.

@iamownt
Copy link

iamownt commented Jan 6, 2025

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

@yang-ze-kang
Copy link
Author

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.

@iamownt
Copy link

iamownt commented Jan 6, 2025

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

@iamownt iamownt mentioned this pull request Jan 13, 2025
invisprints added a commit to invisprints/CLAM that referenced this pull request Feb 2, 2025
@iamownt
Copy link

iamownt commented Feb 26, 2025

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.

@yang-ze-kang
Copy link
Author

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.

@iamownt
Copy link

iamownt commented May 23, 2025

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants