imi-bigpicture / wsidicomizer

Python library for converting WSI files to DICOM
Apache License 2.0
54 stars 7 forks source link

Problem when converting and uploading in orthanc #104

Closed LuisOtavioSantos closed 4 months ago

LuisOtavioSantos commented 4 months ago

Hello everyone,

Firstly I would like to thank you for this awesome project. I'm using it to convert czi files to dicom, but the output dicom images are getting with this grid-lines between the tiles in orthanc wsi-viewer, can you help me with this?

I've attempted to address this by using the '--offset-table' option with the value 'empty', but it hasn't yielded satisfactory results.

wsidicomizer --offset-table 'empty' --no-confidential -i '/home/user/files/czi_file.czi' -o '/home/user/files/dicom_output'

Screenshot from 2024-04-22 13-03-56

Additionally, I've tried setting the block size to 1024 with the command:

wsidicomizer -t 1024 --offset-table 'empty' --no-confidential -i '/home/user/files/czi_file.czi' -o '/home/user/files/dicom_output'

Screenshot from 2024-04-22 13-03-56

Thanks in advance

erikogabrielsson commented 4 months ago

Hi @LuisOtavioSantos Thanks for reporting this issue. I observe the same problem when converting my test czi-file. I will investigate.

LuisOtavioSantos commented 4 months ago

@erikogabrielsson, thanks for replying,

I've managed to come up with a temporary solution, lowering the tile resolution, see the full command below:

wsidicomizer --offset-table 'bot' -t 256 --format 'jpeg' --quality 80 --subsampling '420' -i '/path/to/file.czi' -o '/path/to/dicom/output/folder'

Hope it helps you...

erikogabrielsson commented 4 months ago

I have found the bug in how the tile directory, specifying what czi blocks (overlapping images in the czi file) covers what tile. The bug resulted in some czi blocks not being recorded as covering a tile, resulting in white spaces.

Your workaround likely works because the change in tile size better matches the czi block organization.

I will make a bug-fix-release as soon as possible.

erikogabrielsson commented 4 months ago

@LuisOtavioSantos I have committed two fixes for czi files to this branch:

You can test the branch with:

pip install git+https://github.com/imi-bigpicture/wsidicomizer.git@czi-fixes

Please let me know if this fixes the issue for you (using the larger tile size).

LuisOtavioSantos commented 4 months ago

Hi @erikogabrielsson!

Thank you for addressing the bug, the fixes you did improved my results. The file is taking less time for converting and opening in orthanc.

wsidicomizer --offset-table 'bot' -t 2048 --format 'jpeg' --quality 80 --subsampling '420' -i '/path/to/file.czi' -o '/path/to/dicom/output/folder'

Screenshot from 2024-04-27 22-15-46

Thanks a lot!

erikogabrielsson commented 4 months ago

Good that it works for you to now.

Please not that the czi source only reads the base pyramid layer, and if you don't add `--add_missing_levels to your command you will only get the base level converted. I'm not sure how Orthanc handles DICOM WSIs without pyramid, but it is likely that it is better that you add the pyramid creation.

erikogabrielsson commented 4 months ago

Closed with #105