Project-MONAI / MONAILabel

MONAI Label is an intelligent open source image labeling and learning tool.
https://docs.monai.io/projects/label
Apache License 2.0
598 stars 193 forks source link

Scribble Functionality with OHIF is not working #895

Closed ajayraj04 closed 2 years ago

ajayraj04 commented 2 years ago

Describe the bug While performing the scribble on CT Abd data. It is a CT image which is NIFTI to DICOM converted for the datasets from Task09_Spleen of MonaiLabel.

To Reproduce Steps to reproduce the behavior: Go to OHIF Viewer. Select the CT study as mentioned above Go Monai Extension Select a spleen label. Select scribble and choose Historgram+Graphcut and draw for boundaries. Apply run on scribble.

Expected behavior Scribble should create boundaries as per the label and should be possible to provide label.

Screenshots Scribble fails. In monailabel below error is happening

File "C:\python\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 366, in run_asgi result = await app(self.scope, self.receive, self.send) File "C:\python\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 75, in call return await self.app(scope, receive, send) File "C:\python\lib\site-packages\fastapi\applications.py", line 212, in call await super().call(scope, receive, send) File "C:\python\lib\site-packages\starlette\applications.py", line 112, in call await self.middleware_stack(scope, receive, send) File "C:\python\lib\site-packages\starlette\middleware\errors.py", line 181, in call raise exc File "C:\python\lib\site-packages\starlette\middleware\errors.py", line 159, in call await self.app(scope, receive, _send) File "C:\python\lib\site-packages\starlette\middleware\cors.py", line 84, in call await self.app(scope, receive, send) File "C:\python\lib\site-packages\starlette\exceptions.py", line 82, in call raise exc File "C:\python\lib\site-packages\starlette\exceptions.py", line 71, in call await self.app(scope, receive, sender) File "C:\python\lib\site-packages\starlette\routing.py", line 656, in call await route.handle(scope, receive, send) File "C:\python\lib\site-packages\starlette\routing.py", line 259, in handle await self.app(scope, receive, send) File "C:\python\lib\site-packages\starlette\routing.py", line 61, in app response = await func(request) File "C:\python\lib\site-packages\fastapi\routing.py", line 226, in app raw_response = await run_endpoint_function( File "C:\python\lib\site-packages\fastapi\routing.py", line 159, in run_endpoint_function return await dependant.call(**values) File "D:\monai_install\MONAILabel\monailabel\endpoints\infer.py", line 177, in api_run_inference return run_inference(background_tasks, model, image, session_id, params, file, label, output) File "D:\monai_install\MONAILabel\monailabel\endpoints\infer.py", line 160, in run_inference result = instance.infer(request) File "D:\monai_install\MONAILabel\monailabel\interfaces\app.py", line 256, in infer result_file_name, result_json = task(request) File "D:\monai_install\MONAILabel\monailabel\interfaces\tasks\infer.py", line 278, in call data = self.run_inferer(data, device=device) File "D:\monai_install\MONAILabel\monailabel\interfaces\tasks\infer.py", line 418, in run_inferer data = run_transforms(data, inferer, log_prefix="INF", log_name="Inferer") File "D:\monai_install\MONAILabel\monailabel\interfaces\utils\transform.py", line 92, in run_transforms data = t(data) File "D:\monai_install\MONAILabel\monailabel\scribbles\transforms.py", line 319, in call unary_term = make_iseg_unary( File "D:\monai_install\MONAILabel\monailabel\scribbles\utils.py", line 62, in make_iseg_unary mask = np.concatenate([scribbles == scribbles_bg_label, scribbles == scribbles_fg_label], axis=1) File "<__array_function__ internals>", line 180, in concatenate ValueError: zero-dimensional arrays cannot be concatenated

Environment

Windows environment Monai Label is run running python 3.10 OHIF viewer is build after placing the Monai extension. Orthanc is used as DICOM web server. monailabel start_server --app apps/radiology --studies http://localhost/dicom-web --conf models all -p 9300 or monailabel start_server --app apps/radiology --studies http://localhost/dicom-web --conf models segmentation -p 9300

SachidanandAlle commented 2 years ago

@masadcv have you tried running scribbles over DICOM (converted to nifti images)

@ajayraj04 have you tried running other functions like basic segmentation on that image? if basic segmentation works and only scribble doesn't, then possibly @masadcv can look into this.. otherwise I say it might have happened due to conversion errors (from DICOM to NIFTI)

as we know some DICOM files (due to some missing header/info) the ITK tools fail to convert it correctly..

masadcv commented 2 years ago

@SachidanandAlle

Me and @diazandr3s already communicated with @ajayraj04 over emails and asked him to add this as a ticket. It would be good to make sure that this is not coming from any conversion issues... On scribbles side, I suspect the following but need to run the apps to verify it on my end...

This may be a result of recent changes on multi-label scribbles (both in server and 3D slicer side). I believe the changes on server app breaks compatibility with existing OHIF implementation for scribbles (I dont recall updating OHIF myself). If this is the problem then it needs to be looked into and addressed. I will pick this up sometime next week, if this is urgent and can have a quick fix, then I would say go for it. Otherwise, I will pick it up next week.

diazandr3s commented 2 years ago

Thanks for opening this issue, @ajayraj04.

@SachidanandAlle, I've just tested the latest MONAI Label version + OHIF and the segmentation is working fine. I've also experienced the same issue when using scribbles as @ajayraj04 reported, though.

@masadcv thanks for your help with this.