Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuPath Unsupported File Type #1799

Open
abadgerw opened this issue Dec 16, 2024 · 9 comments
Open

QuPath Unsupported File Type #1799

abadgerw opened this issue Dec 16, 2024 · 9 comments

Comments

@abadgerw
Copy link

abadgerw commented Dec 16, 2024

I have successfully downloaded Monai Label and QuPath. I had large .svs files and extracted regions of interest as .tif files. When trying out nuclei segmentation on those images, I got the following error:

The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
[2024-12-16 12:58:42,829] [74427] [MainThread] [INFO] (main:175) - +++ Adding Trainer:: segmentation_nuclei => <lib.trainers.segmentation_nuclei.SegmentationNuclei object at 0x177fc7110>
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (main:196) - Active Learning Strategies:: ['wsi_random']
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (monailabel.utils.sessions:51) - Session Path: /Users/waldmanad/.cache/monailabel/sessions
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (monailabel.utils.sessions:52) - Session Expiry (max): 3600
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (monailabel.interfaces.app:469) - App Init - completed
[2024-12-16 12:58:42,830] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 12:58:42,830] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (timeloop:60) - Starting Timeloop..
[2024-12-16 12:58:42,830] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x177e68c20>
[2024-12-16 12:58:42,830] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x177e68c20>
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (timeloop:42) - Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x177e68c20>
[2024-12-16 12:58:42,830] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 12:58:42,830] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (timeloop:63) - Timeloop now started. Jobs will run based on the interval set
[2024-12-16 12:58:42,830] [74427] [MainThread] [INFO] (uvicorn.error:62) - Application startup complete.
[2024-12-16 12:58:42,831] [74427] [MainThread] [INFO] (uvicorn.error:215) - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
[2024-12-16 12:58:51,896] [74427] [MainThread] [INFO] (monailabel.endpoints.activelearning:44) - Active Learning Request: {'strategy': 'wsi_random', 'image': '', 'patch_size': [1024, 1024], 'image_size': [0, 0]}
[2024-12-16 12:58:51,897] [74427] [MainThread] [INFO] (monailabel.tasks.activelearning.random:47) - Random: Selected Image: MS073_SC_C_ACST_L_2; Weight: 1734371931
[2024-12-16 12:58:51,900] [74427] [MainThread] [INFO] (monailabel.endpoints.activelearning:60) - Next sample: {'id': 'MS073_SC_C_ACST_L_2', 'weight': 1734371931, 'path': '/Users/waldmanad/datasets/MS073_SC_C_ACST_L_2.tif', 'ts': 1734371662, 'name': 'MS073_SC_C_ACST_L_2.tif'}
[2024-12-16 12:59:11,000] [74427] [MainThread] [INFO] (monailabel.endpoints.wsi_infer:109) - WSI Infer Request: {'model': 'segmentation_nuclei', 'image': 'MS073_SC_C_ACST_L_2', 'output': 'asap', 'level': 0, 'location': [0, 0], 'size': [1433, 1072], 'tile_size': [1024, 1024], 'min_poly_area': 30, 'foreground': [], 'background': [], 'max_workers': 1}
[2024-12-16 12:59:11,005] [74427] [MainThread] [ERROR] (uvicorn.error:408) - Exception in ASGI application
Traceback (most recent call last):
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 132, in api_run_wsi_inference
return run_wsi_inference(background_tasks, model, image, session_id, None, wsi, output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 111, in run_wsi_inference
result = instance.infer_wsi(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/interfaces/app.py", line 643, in infer_wsi
infer_tasks = create_infer_wsi_tasks(request, image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/interfaces/utils/wsi.py", line 44, in create_infer_wsi_tasks
with openslide.OpenSlide(image) as slide:
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/openslide/init.py", line 207, in init
self._osr = lowlevel.open(filename)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/openslide/lowlevel.py", line 258, in _check_open
raise OpenSlideUnsupportedFormatError("Unsupported or missing image file")
openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file

Can I not perform the segmentation on my .tif images?

@SachidanandAlle
Copy link
Collaborator

you can. tiff support is there. possibly u need to install and configure openslide by yourself. the library files might be missing in your setup.

https://github.com/Project-MONAI/MONAILabel/tree/main/sample-apps/pathology#installation-requirements

@abadgerw
Copy link
Author

Thanks, @SachidanandAlle. I do have openslide installed in my environment (screenshot attached). I am using a Mac M1.

Screenshot 2024-12-16 at 1 14 41 PM

Therefore, I think I am a bit confused as to why I am getting the error since I believe all has been downloaded correctly?

@abadgerw
Copy link
Author

Interestingly, I tried with the whole slide scan image which is an .svs file and I get a different error:

The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (main:175) - +++ Adding Trainer:: segmentation_nuclei => <lib.trainers.segmentation_nuclei.SegmentationNuclei object at 0x16fbde8d0>
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (main:196) - Active Learning Strategies:: ['wsi_random']
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.utils.sessions:51) - Session Path: /Users/waldmanad/.cache/monailabel/sessions
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.utils.sessions:52) - Session Expiry (max): 3600
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.interfaces.app:469) - App Init - completed
[2024-12-16 13:21:21,268] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 13:21:21,268] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:60) - Starting Timeloop..
[2024-12-16 13:21:21,268] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:42) - Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:63) - Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (uvicorn.error:62) - Application startup complete.
[2024-12-16 13:21:21,269] [89837] [MainThread] [INFO] (uvicorn.error:215) - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
[2024-12-16 13:21:21,280] [89837] [Thread-1] [INFO] (monailabel.datastore.local:577) - Invalidate count: 0
[2024-12-16 13:21:41,890] [89837] [MainThread] [INFO] (monailabel.endpoints.activelearning:44) - Active Learning Request: {'strategy': 'wsi_random', 'image': '', 'patch_size': [1024, 1024], 'image_size': [0, 0]}
[2024-12-16 13:21:41,891] [89837] [MainThread] [INFO] (monailabel.tasks.activelearning.random:47) - Random: Selected Image: MS126_SC_C_Palmgren_40X_Aperio_Old; Weight: 1734373301
[2024-12-16 13:21:41,893] [89837] [MainThread] [INFO] (monailabel.endpoints.activelearning:60) - Next sample: {'id': 'MS126_SC_C_Palmgren_40X_Aperio_Old', 'weight': 1734373301, 'path': '/Users/waldmanad/datasets/MS126_SC_C_Palmgren_40X_Aperio_Old.svs', 'ts': 1734373281, 'name': 'MS126_SC_C_Palmgren_40X_Aperio_Old.svs'}
[2024-12-16 13:22:02,154] [89837] [MainThread] [INFO] (monailabel.endpoints.wsi_infer:109) - WSI Infer Request: {'model': 'segmentation_nuclei', 'image': 'MS126_SC_C_Palmgren_40X_Aperio_Old', 'output': 'asap', 'level': 0, 'location': [8129, 36362], 'size': [616, 467], 'tile_size': [1024, 1024], 'min_poly_area': 30, 'foreground': [], 'background': [], 'max_workers': 1}
[2024-12-16 13:22:02,183] [89837] [MainThread] [ERROR] (uvicorn.error:408) - Exception in ASGI application
Traceback (most recent call last):
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 132, in api_run_wsi_inference
return run_wsi_inference(background_tasks, model, image, session_id, None, wsi, output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 111, in run_wsi_inference
result = instance.infer_wsi(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/interfaces/app.py", line 664, in infer_wsi
else device_ids[random.randint(0, len(device_ids) - 1)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/random.py", line 362, in randint
return self.randrange(a, b+1)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/random.py", line 345, in randrange
raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0, 0, 0)

@SachidanandAlle
Copy link
Collaborator

I didn't try with openslide-bin. it was not released at that time.
to debug further, i suggest to run a simple snippet (load tiff image via openslide and extract some patch) outside monailabel..

that will help to know if it's env issue or something to do with monailabel.

Generated by Gemini AI

import openslide

# Path to your TIFF file
slide_path = 'path/to/your/slide.tif'

# Open the slide
slide = openslide.OpenSlide(slide_path)

# Get the dimensions of the slide at level 0 (highest resolution)
width, height = slide.dimensions

# Read a region of the slide at level 0
# (x, y) coordinates of the top-left corner, and (width, height) of the region
region = slide.read_region((0, 0), level=0, size=(500, 500))

# Display the region
region.show()

# Close the slide
slide.close()

@abadgerw
Copy link
Author

@SachidanandAlle I got the following error:

Traceback (most recent call last):
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 76, in try_load
return cdll.LoadLibrary(names[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/ctypes/init.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(libopenslide.1.dylib, 0x0006): tried: 'libopenslide.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibopenslide.1.dylib' (no such file), '/opt/anaconda3/envs/test/lib/python3.11/lib-dynload/../../libopenslide.1.dylib' (no such file), '/opt/anaconda3/envs/test/bin/../lib/libopenslide.1.dylib' (no such file), '/usr/lib/libopenslide.1.dylib' (no such file, not in dyld cache), 'libopenslide.1.dylib' (no such file), '/usr/local/lib/libopenslide.1.dylib' (no such file), '/usr/lib/libopenslide.1.dylib' (no such file, not in dyld cache)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 99, in _load_library
return try_load(['libopenslide.1.dylib', 'libopenslide.0.dylib'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 82, in try_load
return try_load(remaining)
^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 76, in try_load
return cdll.LoadLibrary(names[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/ctypes/init.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(libopenslide.0.dylib, 0x0006): tried: 'libopenslide.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibopenslide.0.dylib' (no such file), '/opt/anaconda3/envs/test/lib/python3.11/lib-dynload/../../libopenslide.0.dylib' (no such file), '/opt/anaconda3/envs/test/bin/../lib/libopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache), 'libopenslide.0.dylib' (no such file), '/usr/local/lib/libopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache)

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

Traceback (most recent call last):
File "/Users/waldmanad/Desktop/test.py", line 1, in
import openslide
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/init.py", line 35, in
from openslide import lowlevel
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 125, in
_lib = _load_library()
^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 108, in _load_library
raise ModuleNotFoundError(
ModuleNotFoundError: Couldn't locate OpenSlide dylib. Try pip install openslide-bin. https://openslide.org/api/python/#installing

Then I installed openslide-bin as requested and got the following error:

Traceback (most recent call last):
File "/Users/waldmanad/Desktop/test.py", line 7, in
slide = openslide.OpenSlide(slide_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/init.py", line 207, in init
self._osr = lowlevel.open(filename)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/test/lib/python3.11/site-packages/openslide/lowlevel.py", line 258, in _check_open
raise OpenSlideUnsupportedFormatError("Unsupported or missing image file")
openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file

Interestingly, I tried using monai-label with the whole slide scan image which is an .svs file and I get a different error:

The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (main:175) - +++ Adding Trainer:: segmentation_nuclei => <lib.trainers.segmentation_nuclei.SegmentationNuclei object at 0x16fbde8d0>
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (main:196) - Active Learning Strategies:: ['wsi_random']
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.utils.sessions:51) - Session Path: /Users/waldmanad/.cache/monailabel/sessions
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.utils.sessions:52) - Session Expiry (max): 3600
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (monailabel.interfaces.app:469) - App Init - completed
[2024-12-16 13:21:21,268] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 13:21:21,268] [timeloop] [INFO] Starting Timeloop..
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:60) - Starting Timeloop..
[2024-12-16 13:21:21,268] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:42) - Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x30b0afc40>
[2024-12-16 13:21:21,268] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (timeloop:63) - Timeloop now started. Jobs will run based on the interval set
[2024-12-16 13:21:21,268] [89837] [MainThread] [INFO] (uvicorn.error:62) - Application startup complete.
[2024-12-16 13:21:21,269] [89837] [MainThread] [INFO] (uvicorn.error:215) - Uvicorn running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
[2024-12-16 13:21:21,280] [89837] [Thread-1] [INFO] (monailabel.datastore.local:577) - Invalidate count: 0
[2024-12-16 13:21:41,890] [89837] [MainThread] [INFO] (monailabel.endpoints.activelearning:44) - Active Learning Request: {'strategy': 'wsi_random', 'image': '', 'patch_size': [1024, 1024], 'image_size': [0, 0]}
[2024-12-16 13:21:41,891] [89837] [MainThread] [INFO] (monailabel.tasks.activelearning.random:47) - Random: Selected Image: MS126_SC_C_Palmgren_40X_Aperio_Old; Weight: 1734373301
[2024-12-16 13:21:41,893] [89837] [MainThread] [INFO] (monailabel.endpoints.activelearning:60) - Next sample: {'id': 'MS126_SC_C_Palmgren_40X_Aperio_Old', 'weight': 1734373301, 'path': '/Users/waldmanad/datasets/MS126_SC_C_Palmgren_40X_Aperio_Old.svs', 'ts': 1734373281, 'name': 'MS126_SC_C_Palmgren_40X_Aperio_Old.svs'}
[2024-12-16 13:22:02,154] [89837] [MainThread] [INFO] (monailabel.endpoints.wsi_infer:109) - WSI Infer Request: {'model': 'segmentation_nuclei', 'image': 'MS126_SC_C_Palmgren_40X_Aperio_Old', 'output': 'asap', 'level': 0, 'location': [8129, 36362], 'size': [616, 467], 'tile_size': [1024, 1024], 'min_poly_area': 30, 'foreground': [], 'background': [], 'max_workers': 1}
[2024-12-16 13:22:02,183] [89837] [MainThread] [ERROR] (uvicorn.error:408) - Exception in ASGI application
Traceback (most recent call last):
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 132, in api_run_wsi_inference
return run_wsi_inference(background_tasks, model, image, session_id, None, wsi, output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/endpoints/wsi_infer.py", line 111, in run_wsi_inference
result = instance.infer_wsi(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/site-packages/monailabel/interfaces/app.py", line 664, in infer_wsi
else device_ids[random.randint(0, len(device_ids) - 1)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/random.py", line 362, in randint
return self.randrange(a, b+1)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/monai/lib/python3.11/random.py", line 345, in randrange
raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0, 0, 0)

So it seems two separate problems are going on?

@SachidanandAlle
Copy link
Collaborator

OSError: dlopen(libopenslide.1.dylib, 0x0006): tried: 'libopenslide.1.dylib' (no such file),

For this, try to set your DYLD_LIBRARY_PATH etc.. and see if you can fix this issue without monailabel.
If you can run the snippet in the same env then monailabel will work as well.

Interestingly, I tried using monai-label with the whole slide scan image which is an .svs file and I get a different error:

it might be because of not able to create infer (sub) requests for wsi. And it apparently zero sub infer tasks.
If you fix the first issue, then you might not hit this problem.

@abadgerw
Copy link
Author

Thanks, @SachidanandAlle! I'm quite new to coding so would you be able to provide a little more guidance on setting the DYLD_LIBRARY_PATH? What steps would I need to take to do this correctly?

@abadgerw
Copy link
Author

@SachidanandAlle I have now gotten the .tif file to work but the .svs file still throws the ValueError: empty range for randrange() (0, 0, 0).

@abadgerw
Copy link
Author

I did some more testing:

To get around needing to use the .svs image, is there a way to run the segmentation model on the .tif image without having to draw and annotation that encompasses the whole image? As a reminder, my .tif images are just annotations exported from the .svs image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants