DIAGNijmegen / pathology-whole-slide-data

A package for working with whole-slide data including a fast batch iterator that can be used to train deep learning models.
https://diagnijmegen.github.io/pathology-whole-slide-data/
Apache License 2.0
86 stars 24 forks source link

Support qptiff? #47

Closed yuling-luo closed 7 months ago

yuling-luo commented 7 months ago

Hi all,

Thanks again for the nice work. I have been testing the create_batch_iterator function using a data.yml look like below:

training:
    - wsi: 
        path:  xyz.qptiff 
      wsa: 
        path:  xyz.xml

However, I receive a error:

File ~/anaconda3/envs/xyz/lib/python3.9/site-packages/sourcelib/file.py:49, in File._get_extension(self, path)
     [48](file:///home/u0021936/anaconda3/envs/aortic-root/lib/python3.9/site-packages/sourcelib/file.py?line=47) def _get_extension(self, path: Path) -> Extension:
---> [49](file:/anaconda3/envs/xyz/lib/python3.9/site-packages/sourcelib/file.py?line=48)     return self.EXTENSIONS[path.suffix]

KeyError: '.qptiff'

Is it because qptiff isn't supported in the WholeSlideDataset as I don't seem them in the extensions.py? Would it be possible for wholeslidedata to support .qptiff? Or is there an alternative way I can approach this issue?

martvanrijthoven commented 7 months ago

Dear @yuling-luo ,

Currently qptiff is indeed not supported. I am also not familiar with this extension. Is it possible to open that file extension with openslide or pyvips? If this is possible we can add support for this extension easily, otherwise we will need additional software that can open that extension and have to write a specific image backend for it. Alternatively, if possible, you can convert it to tiff with some external software.

Best wishes, Mart

yuling-luo commented 7 months ago

Dear @yuling-luo ,

Currently qptiff is indeed not supported. I am also not familiar with this extension. Is it possible to open that file extension with openslide or pyvips? If this is possible we can add support for this extension easily, otherwise we will need additional software that can open that extension and have to write a specific image backend for it. Alternatively, if possible, you can convert it to tiff with some external software.

Best wishes, Mart

Hi Mart,

Yes this extension could be opened via openslide. I tested it with the WholeSlideImage according to hooknet notebook and it works. Would it be possible for the team to add support for this extension then?

martvanrijthoven commented 7 months ago

Dear @yuling-luo

Thanks for testing, I added the support for qptiff files. Please let me know if you run into issues.

Best wishes,

yuling-luo commented 7 months ago

Thanks Mark. It works from my end now!