mahmoodlab / HIPT

Hierarchical Image Pyramid Transformer - CVPR 2022 (Oral)
Other
509 stars 89 forks source link

Getting raw patches after CLAM preprocessing #28

Closed bryanwong17 closed 1 year ago

bryanwong17 commented 1 year ago

Hi @Richarizardd,

May I know how to get raw [256 × 256] patches (as *.png format) after CLAM processing?

Richarizardd commented 1 year ago

Hi @bryanwong17

You can use create_patches.py (without fast-patching mode) to save [256 x 256] patches in CLAM.

bryanwong17 commented 1 year ago

Hi @Richarizardd, I tried using this command:

python create_patches.py --source DATA_DIRECTORY --save_dir RESULTS_DIRECTORY --patch_size 256 --seg --patch --stitch

However, I still couldn't get raw [256 x 256 patches] (as *.png format). Is there something wrong?

clemsgrs commented 1 year ago

hi @bryanwong17, my understanding is that create_patches.py will store image patches as numpy arrays under the imgs dataset in the h5py file saved to disk. You can either:

hope it was helpful

bryanwong17 commented 1 year ago

Hi @clemsgrs, I was able to extract patches in .png format. In this case, what do x and y represent? Are they representing the actual location in the slide? Does that mean we do not have to multiply again, let's say with 256?

image

clemsgrs commented 1 year ago

hi, x and y coordinates should represent the true location in the slide at level 0. if pixel spacing is 0.25 at level 0 and you extract [256, 256] patches at spacing 0.5, then it corresponds to extracting [512, 512] patches at spacing 0.25 ; thus two consecutive patches will have a 512 value difference (either in x or y coordinates).

might be better to update coordinates based on spacing, will give it a thought