manuel-munoz-aguirre / PyHIST

A pipeline to segment tissue from the background in histological images
GNU General Public License v3.0
56 stars 13 forks source link

Out put much clear patches #25

Closed duernaT closed 3 years ago

duernaT commented 3 years ago

First, thank you for this wonderful work.

I just have a very naive question (as a beginner of python), I followed your tutorial and everything goes well. the issue I noticed is the output images (patches), it seems less clear then I expected. I mean when I compare the patches with the original svs ( I zoom the svs use a .svs viewer).

Here is how I use the pyhist.py.

python pyhist.py --method "otsu" --output-downsample 1 (I am using the level 0 WSI) --content-threshold 0.1 --patch-size 1024 --save-patches --save-mask --save-tilecrossed-image --info "verbose" /test.svs


Is there some settings I can gather the high (original pixel)-resolution patches?

Thanks. Duerna

manuel-munoz-aguirre commented 3 years ago

Hi Duerna, Thanks for your comment. In principle, the settings you are using should be retrieving the original resolution (image encoding loss should happen when using --format jpg only). I couldn't reproduce this issue. To try to debug this, can you give more information about what slide viewer you're using, or maybe post a screenshot comparing a tile with the output from the SVS viewer? Is the SVS you are using publicly available so that we can test it?

duernaT commented 3 years ago

Hi, thank you for your reply. I am really appreciate your quick response.

I use the web viewer provide by GTEx, here is the link: https://brd.nci.nih.gov/brd/specimen/GTEX-11TT1-1826 And I also print my screen to you as below:

left: the PyHIST patches, middle: the similar area I zoom with the webview, right: my progress screenshot. [image: Screenshot from 2021-04-23 16-55-49.png]

Both the blue and pink staining are slightly fuzzy in the left patches.

Thank you for the support.

Best regards, Duerna

2021年4月23日(金) 16:35 Manuel Muñoz Aguirre @.***>:

Hi Duerna, Thanks for your comment. In principle, the settings you are using should be retrieving the original resolution (image encoding loss should happen when using --format jpg only). I couldn't reproduce this issue. To try to debug this, can you give more information about what slide viewer you're using, or maybe post a screenshot comparing a tile with the output from the SVS viewer? Is the SVS you are using publicly available so that we can test it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manuel-munoz-aguirre/PyHIST/issues/25#issuecomment-825458585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDQHQ66UORN53FLLFOGTO3TKEPMPANCNFSM43N2QLEQ .

manuel-munoz-aguirre commented 3 years ago

It seems that the screenshot wasn't posted correctly. Can you retry uploading it?

duernaT commented 3 years ago

It seems that the screenshot wasn't posted correctly. Can you retry uploading it?

Sorry I directly replied the email before.

Now I shift to web and try to load the screen pic. Could you please kindly help to see wether I have successfully loaded? ![Uploading 85ACEBFA-CD87-41D3-9BEA-EACC5BF68737.png…]() A8AE7529-6A9C-41D3-989F-3097404CA878

manuel-munoz-aguirre commented 3 years ago

Thanks. It would seem that you're comparing two different images: the patches are generated on GTEX-1117F-2926 while the image you're comparing to in the viewer is a different one, GTEX-11TT1-1826). I generated the tiles on the same slide you're testing (GTEX-1117F-2926) and compared it with the browser viewer at its maximal resolution. I think this is just a matter of the zoom setting in the image viewer: the zoom you're using goes to 154%. If you compare the browser viewer with the tile at its native resolution (i.e. 100%), they seem to be the same:

GTEX-1117F-2926_comparison

duernaT commented 3 years ago

Thank you for your explanation.

When use the 100% view, the tiles looks good.amazing!! And now I understand what’s going on with PyHIST.

Just one more asking, assume I use the web viewer and zoom the svs file to the max (I mean zoom largest until pic no change) then can PyHIST out put the similar zoom effect pictures as tiles?

2021年4月23日(金) 18:16 Manuel Muñoz Aguirre @.***>:

Thanks. It would seem that you're comparing two different images: the patches are generated on GTEX-1117F-2926 while the image you're comparing to in the viewer is a different one, GTEX-11TT1-1826). I generated the tiles on the same slide you're testing (GTEX-1117F-2926) and compared it with the browser viewer at its maximal resolution. I think this is just a matter of the zoom setting in the image viewer: the zoom you're using goes to 154%. If you compare the browser viewer with the tile at its native resolution (i.e. 100%), they seem to be the same:

[image: GTEX-1117F-2926_comparison] https://user-images.githubusercontent.com/5576458/115848756-801b9000-a424-11eb-995b-8f8c8c49072f.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manuel-munoz-aguirre/PyHIST/issues/25#issuecomment-825522344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDQHQ2KIEJTNXGQ3P6DFXLTKE3FBANCNFSM43N2QLEQ .

manuel-munoz-aguirre commented 3 years ago

I'm not sure I understand the question: if you use --output-downsample 1, the tiles will be generated at the maximal resolution, which should be the same as the maximal zoom of the web viewer. PyHIST cannot output tiles with more zoom than the native resolution. If you want to output the tiles with less zoom, you would need to use a larger scaling factor (for example, 2, 4, or 8).

duernaT commented 3 years ago

Sorry for my bad expression. I totally understand the (—output-downsample 1) could gather the maximal resolution.

And I am not sure wether I compare the output in the right way.

What I have done was :

  1. I zoom the web viewer of a svs file to the max, and check the cell size, more detailed, the nucleus size. Here I name it as “web-cell size”.

  2. then I opened one tile picture and zoom the tile pic based on the “web-cell size”, and make the tile-cell size similarly to the web.

  3. Last, I compared those two pics.

If I am doing the wrong thing please kindly forgive me.

Thank you again. Duerna

2021年4月23日(金) 18:43 Manuel Muñoz Aguirre @.***>:

I'm not sure I understand the question: if you use --output-downsample 1, the tiles will be generated at the maximal resolution, which should be the same as the maximal zoom of the web viewer. PyHIST cannot output tiles with more zoom than the native resolution. If you want to output the tiles with less zoom, you would need to use a larger scaling factor (for example, 2, 4, or 8).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manuel-munoz-aguirre/PyHIST/issues/25#issuecomment-825537890, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDQHQ6UQIP7QIZKSWJ4UQDTKE6KHANCNFSM43N2QLEQ .

manuel-munoz-aguirre commented 3 years ago

If you compare the tile image with the viewer at 100% and the web viewer at the maximal resolution, they should be similar.

duernaT commented 3 years ago

Thank you very much. Again, very nice work.

2021年4月23日(金) 19:13 Manuel Muñoz Aguirre @.***>:

If you compare the tile image with the viewer at 100% and the web viewer at the maximal resolution, they should be similar.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manuel-munoz-aguirre/PyHIST/issues/25#issuecomment-825555558, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDQHQZ6O7B2PNUOZF5TWVLTKFB6LANCNFSM43N2QLEQ .