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

PyHist docker version is not working #17

Closed Sadegh-Saberian closed 4 years ago

Sadegh-Saberian commented 4 years ago

Hi,

I just wanted to use the great pipeline that you created here, but I could not make it work. I am using the docker and when I try to reproduce your test i get the following error:

  File "pyhist.py", line 78, in check_arguments
    _ = openslide.OpenSlide(args.svs)
  File "/usr/lib/python3/dist-packages/openslide/__init__.py", line 154, in __init__
    self._osr = lowlevel.open(filename)
  File "/usr/lib/python3/dist-packages/openslide/lowlevel.py", line 174, in _check_open
    "Unsupported or missing image file")
openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pyhist.py", line 142, in <module>
    main()
  File "pyhist.py", line 93, in main
    check_arguments(args)
  File "pyhist.py", line 80, in check_arguments
    raise TypeError("Unsupported format, or file not found.")
TypeError: Unsupported format, or file not found.

Although I am using the exact same file as yours in the test. I would appreciate if you could help me.

manuel-munoz-aguirre commented 4 years ago

Hi, can you post the exact command you're using to run the pipeline?

Sadegh-Saberian commented 4 years ago

here is the command that I am using:

docker run pyhist --patch-size 64 --output-downsample 16 --test-mode GTEX-1117F-0126.svs
manuel-munoz-aguirre commented 4 years ago

You have to mount the folder in your local workstation inside the docker container (see the quickstart example in the README). The first part of the -v argument is the absolute path to the folder containing the image, while the second part is the folder inside the docker container. In the --output flag, we write to the images/ folder so that it is written outside the container. For example:

docker run -v /absolute/path/to/folder/with/image/:/pyhist/images pyhist --patch-size 64 --output-downsample 16 --test-mode --output images/ images/GTEX-1117F-0126.svs

We will add an example on the tutorial to clarify this.

Sadegh-Saberian commented 4 years ago

Thanks for your reply. It appears that it solved the problem for finding the file. but now i am facing another error here :(

== Step 1: Producing edge image... ==

== Step 2: Segmentation over the mask ==
Traceback (most recent call last):
  File "pyhist.py", line 142, in <module>
    main()
  File "pyhist.py", line 120, in main
    args)
  File "/pyhist/src/utility_functions.py", line 161, in produce_segmented_image
    process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: 'src/graph_segmentation/segment'

Do you have any idea what this is about? many thanks!

manuel-munoz-aguirre commented 4 years ago

What OS are you using? I couldn't reproduce this on Ubuntu/Mac. I changed some permission bits in the segmentation executable, just in case it helps. Can you try the following:

  1. Pull the docker image: docker pull mmunozag/pyhist
  2. Download the test file: curl 'https://brd.nci.nih.gov/brd/imagedownload/GTEX-1117F-0126' --output 'GTEX-1117F-0126.svs'
  3. Run: docker run -v $PWD:/pyhist/images mmunozag/pyhist --patch-size 64 --output-downsample 16 --test-mode --output images/ images/GTEX-1117F-0126.svs

An output folder should be created containing the test image.

Sadegh-Saberian commented 4 years ago

it worked! I am using mac OS 10.14. but the docker is now working! thanks for your help.