DIAGNijmegen / pathology-hooknet-tls

MIT License
6 stars 0 forks source link

Can't open tif file #4

Open Autumn-Roy opened 4 months ago

Autumn-Roy commented 4 months ago

I installed the hooknet-tls with docker build -t hooknet-tls .

Then I want to test whether it can work successfully. I downloaded the TCGA-18-5592-01Z-00-DX1.tif in https://drive.google.com/file/d/1ZgqFJomqQGNnsx7w7QBzQQMVA16lbVCA/view?pli=1

The docker start with

docker run --name=hooknet --mount type=bind,source=/tmp/tmp.0tLedWGMCS/pathology-hooknet-tls,target=/mnt -it c6929570bb73 /bin/bash

But when I run command

python3 -m hooknettls \
  hooknettls.default.image_path=/mnt/MoNuSeg_2018_Training_Data/Tissue_Images/TCGA-18-5592-01Z-00-DX1.tif  \
  hooknettls.default.mask_path=/mnt/TCGA-18-5592-01Z-00-DX1_tb_mask.tif

The error occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/user/pathology-hooknet-tls/hooknettls/__main__.py", line 8, in <module>
    objects = build_config(config_reader.read()["default"])
  File "/usr/local/lib/python3.8/dist-packages/dicfg/factory.py", line 124, in build_config
    return _ObjectFactory(deepcopy(config)).build_config()
  File "/usr/local/lib/python3.8/dist-packages/dicfg/factory.py", line 26, in build_config
    return self._build(self._configuration)
  File "/usr/lib/python3.8/functools.py", line 912, in _method
    return method.__get__(obj, cls)(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/dicfg/factory.py", line 38, in _build_dict
    config[key] = self._build_object(value)
  File "/usr/local/lib/python3.8/dist-packages/dicfg/factory.py", line 67, in _build_object
    return attribute(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/wholeslidedata/iterators/patchiterator.py", line 46, in create_patch_iterator
    commander = commander_class(
  File "/usr/local/lib/python3.8/dist-packages/wholeslidedata/buffer/patchcommander.py", line 41, in __init__
    wsi = WholeSlideImage(image_path, backend=backend)
  File "/usr/local/lib/python3.8/dist-packages/wholeslidedata/image/wholeslideimage.py", line 35, in __init__
    self._backend = get_backend(backend)(path=self._path)
  File "/usr/local/lib/python3.8/dist-packages/wholeslidedata/interoperability/asap/backend.py", line 15, in __init__
    raise ValueError(f"cant open image {path}")
ValueError: cant open image /mnt/MoNuSeg_2018_Training_Data/Tissue_Images/TCGA-18-5592-01Z-00-DX1.tif

It seems like asap can't open the tif file?

martvanrijthoven commented 4 months ago

Dear Roy_Wang,

The algorithm only works with pyramidal TIFF files. These are TIFF files that incorporate multiple layers, each containing different magnifications of the image. This feature is essential for the algorithm to function correctly. You can download such images from TGCA here: https://portal.gdc.cancer.gov/analysis_page?app=Downloads

Best wishes, Mart

wanglab1 commented 3 months ago

Could you also advise how to get the mask tif file as shown in the example code? Do we need to run background segmentation using other software? It would be helpful to have example files included in the github.

Thank you for your contribution.

martvanrijthoven commented 3 months ago

Dear Wanglab1,

You can generate the mask files with this algorithm: https://grand-challenge.org/algorithms/tissue-background-segmenation/ I agree with you that example mask files would be helpful. I will try to upload them om Zenodo, asap.

Best wishes, Mart

wanglab1 commented 3 months ago

Dear Mart, Thanks much for your quick response. I have submitted the request to access the background segmentation tool via grand challenge. Just my 2 cents, while grand challenge is a good platform, the approval of access is not instant. This seems to be a hurdle to try the great tool you have built. It may be much nicer to consider a one-stop self-contained tool, which will facilitate streamlined batch processing of many images.

Many thanks, XW