baidu-research / NCRF

Cancer metastasis detection with neural conditional random field (NCRF)
Apache License 2.0
757 stars 184 forks source link

generate the corresponding patches #8

Closed mxj-aoyun closed 6 years ago

mxj-aoyun commented 6 years ago

I got error when I ran this command to generate the corresponding patches how can I solve it? thank you!

[123@533 bin]$ python patch_gen.py /home/tom/CAMELYON16/training/WSI_TRAIN  /home/tom/Downloads/NCRF/coords/tumor_train.txt /home/tom/CAMELYON16/PATCHES_TUMOR_TRAIN
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib64/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib64/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "patch_gen.py", line 38, in process
    slide = openslide.OpenSlide(wsi_path)
  File "/usr/local/lib64/python3.6/site-packages/openslide/__init__.py", line 153, in __init__
    self._osr = lowlevel.open(filename)
  File "/usr/local/lib64/python3.6/site-packages/openslide/lowlevel.py", line 137, in _check_open
    "Unsupported or missing image file")
openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "patch_gen.py", line 81, in <module>
    main()
  File "patch_gen.py", line 77, in main
    run(args)
  File "patch_gen.py", line 72, in run
    pool.map(process, opts_list)
  File "/usr/lib64/python3.6/multiprocessing/pool.py", line 266, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib64/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file
yil8 commented 6 years ago

@mxj-aoyun can you type the following command?

ls -lh /home/tom/CAMELYON16/training/WSI_TRAIN

It seems some tif files are missing, and I'd like to take a look. It may just be the case that the file prefix is different.

mxj-aoyun commented 6 years ago

@yil8

[root@dft533 build]# ls -lh /home/tom/CAMELYON16/training/WSI_TRAIN
total 496G
-rwxrwxrwx. 1 tom tom  1.2G Jun 15 19:44 normal_001.tif
-rwxrwxrwx. 1 tom tom  1.5G Jun  7 11:26 normal_002.tif
-rwxrwxrwx. 1 tom tom  2.1G Jun  7 11:47 normal_003.tif
-rwxrwxrwx. 1 tom tom  945M Jun  6 15:31 normal_004.tif
-rwxrwxrwx. 1 tom tom  1.5G Jun  6 19:04 normal_005.tif
-rwxrwxrwx. 1 tom tom  1.2G Jun  7 11:02 normal_006.tif
-rwxrwxrwx. 1 tom tom  1.6G Jun  7 11:37 normal_007.tif
-rwxrwxrwx. 1 tom tom  1.2G Jun  6 16:06 normal_008.tif
-rwxrwxrwx. 1 tom tom  1.6G Jun  8 11:36 normal_009.tif
  ......
yil8 commented 6 years ago

@mxj-aoyun yeah, that's what I was guessing... Can you rename all the 'normal_XXX.tif' to 'Normal_XXX.tif', all the 'tumor_XXX.tif' to 'Tumor_XXX.tif', all the 'test_XXX.tif' to 'Test_XXX.tif'? The code assuming that way as documented in README. The organizers used to name all the files with first letter upper case.

mxj-aoyun commented 6 years ago

@yil8 The problem is solved. Thank you so much!