tiatoolbox icon indicating copy to clipboard operation
tiatoolbox copied to clipboard

Cannot visualize DICOM WSI series: `wsidicom.errors.WsiDicomNotFoundError: Level files not found in provided files`

Open fedorov opened this issue 6 months ago • 2 comments

This is follow-up on #933 (I am unable to reopen that issue).

#934 added .dcm to the list of recognizable files to reportedly fix visualization of slides in DICOM format.

I installed tiatoolbox from current hash, and trying to open a DICOM WSI pyramid results using this command tiatoolbox visualize --slides . --overlays . results in the following error.

Note that I had to downgrade to "numcodecs<0.16.0" as discussed in #941 to be resolve another unrelated runtime error.

You can access the sample that I was using in testing as follows:

$ pip install --upgrade idc-index
$ idc download --dir-template="" 2.25.37411452242028229091597727833436758051
|2025-06-11|12:30:09.339| [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
|2025-06-11|12:30:09.340| [INFO] Press CTRL+C to quit
2025-06-11 12:30:10,178 /Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/albumentations/__init__.py:24: UserWarning: A new version of Albumentations is available: 2.0.8 (you have 1.4.21). Upgrade using: pip install -U albumentations. To disable automatic update checks, set the environment variable NO_ALBUMENTATIONS_UPDATE to 1.
  check_for_updates()

2025-06-11 12:30:16,145 get_frame_offsets is deprecated and will be removed in v4.0
2025-06-11 12:30:16,311 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x1096260f0>: Level files not found in provided files
File 'wsidicom_file_source.py', line 89, in __init__:
raise WsiDicomNotFoundError("Level files", "provided files") Traceback (most recent call last):
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/bokeh/application/handlers/code_runner.py", line 229, in run
    exec(self._code, module.__dict__)
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/tiatoolbox/visualization/bokeh_app/main.py", line 2145, in <module>
    slide_wins, control_tabs = doc_config.setup_doc(doc)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/tiatoolbox/visualization/bokeh_app/main.py", line 2117, in setup_doc
    win_dicts.append(make_window(ViewerState(first_slide_path)))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/tiatoolbox/visualization/bokeh_app/main.py", line 616, in __init__
    self.wsi = WSIReader.open(slide_path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/tiatoolbox/wsicore/wsireader.py", line 377, in open
    return DICOMWSIReader(input_path, mpp=mpp, power=power)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/tiatoolbox/wsicore/wsireader.py", line 4563, in __init__
    self.wsi = WsiDicom.open(input_img)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/wsidicom/wsidicom.py", line 108, in open
    source = WsiDicomFileSource.open(files, file_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/wsidicom/file/wsidicom_file_source.py", line 180, in open
    return cls(streams)
           ^^^^^^^^^^^^
  File "/Users/af61/venvs/tiatoolbox/lib/python3.12/site-packages/wsidicom/file/wsidicom_file_source.py", line 89, in __init__
    raise WsiDicomNotFoundError("Level files", "provided files")
wsidicom.errors.WsiDicomNotFoundError: Level files not found in provided files

fedorov avatar Jun 11 '25 16:06 fedorov

A quick fix could be to rename your "folders" to have a ".dcm" extension. Adding a fix to handle folders will take a bit longer to merge as this will need additional checks for "try/catch" statements.

shaneahmed avatar Jun 13 '25 10:06 shaneahmed

A quick fix could be to rename your "folders" to have a ".dcm" extension.

Nice workaround - I confirm this works.

fedorov avatar Jun 13 '25 14:06 fedorov