bowang-lab / MedSAMSlicer

3D Slicer Plugin for Segment anything in medical images
https://www.nature.com/articles/s41467-024-44824-z
102 stars 14 forks source link

Clicking send Image results in an error, returning a null value,how to resolve it #26

Open lcgmu opened 2 weeks ago

lcgmu commented 2 weeks ago

This is a great project that provides a generic solution to the medical research segmentation problem and facilitates the training of your own segmentation models. After installing it and then clicking on send Image I get an error, I tried to read the error and it probably starts at [FD] INFO: Uvicorn running on http://0.0.0.0:5555 (Press CTRL+C to quit) sending setImage request... Response from setImage: null. A null is returned from setImage, what is the reason for the error and how should I resolve it.

Terminating possible server duplicates... Running server... [FD] E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\tiny_vit_sam.py:662: UserWarning: Overwriting tiny_vit_5m_224 in registry with tiny_vit_sam.tiny_vit_5m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected. [FD] return register_model(fn_wrapper) [FD] E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\tiny_vit_sam.py:662: UserWarning: Overwriting tiny_vit_11m_224 in registry with tiny_vit_sam.tiny_vit_11m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected. [FD] return register_model(fn_wrapper) [FD] E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\tiny_vit_sam.py:662: UserWarning: Overwriting tiny_vit_21m_224 in registry with tiny_vit_sam.tiny_vit_21m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected. [FD] return register_model(fn_wrapper) [FD] E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\tiny_vit_sam.py:662: UserWarning: Overwriting tiny_vit_21m_384 in registry with tiny_vit_sam.tiny_vit_21m_384. This is because the name being registered conflicts with an existing name. Please check if this is not expected. [FD] return register_model(fn_wrapper) [FD] E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\tiny_vit_sam.py:662: UserWarning: Overwriting tiny_vit_21m_512 in registry with tiny_vit_sam.tiny_vit_21m_512. This is because the name being registered conflicts with an existing name. Please check if this is not expected. [FD] return register_model(fn_wrapper) [FD] INFO: Started server process [17284] [FD] INFO: Waiting for application startup. [FD] INFO: Application startup complete. [FD] INFO: Uvicorn running on http://0.0.0.0:5555 (Press CTRL+C to quit) sending setImage request... Response from setImage: null sending numpy array: Traceback (most recent call last): File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\requests\models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred: . . .

[FD] await app(scope, receive, sender) [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\starlette\routing.py", line 72, in app [FD] response = await func(request) [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\fastapi\routing.py", line 278, in app [FD] raw_response = await run_endpoint_function( [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function [FD] return await run_in_threadpool(dependant.call, *values) [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\starlette\concurrency.py", line 42, in run_in_threadpool [FD] return await anyio.to_thread.run_sync(func, args) [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync [FD] return await get_async_backend().run_sync_in_worker_thread( [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\anyio_backends_asyncio.py", line 2177, in run_sync_in_worker_thread [FD] return await future [FD] File "C:\ProgramData\slicer.org\Slicer 5.6.2\lib\Python\Lib\site-packages\anyio_backends_asyncio.py", line 859, in run [FD] result = context.run(func, *args) [FD] File "E:\sci_projects\sammed\MedSAMSlicer-master\install\server_essentials\server.py", line 298, in get_progress [FD] return json.dumps({'layers': image.shape[0], 'generated_embeds': len(embeddings)}) [FD] AttributeError: 'NoneType' object has no attribute 'shape'

lcgmu commented 2 weeks ago

The window keeps on preparing Image embedding...

rasakereh commented 1 week ago

We have released a new version majorly different from the older one to address such issues. Would you please try now with the latest released version? thanks!