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
610 stars 196 forks source link

"Failed to post process label on MONAI Label Server using Histogram+GraphCut" error when updating scribbles #958

Closed lukasvdstricht closed 2 years ago

lukasvdstricht commented 2 years ago

Hi

We are exploring the MONAILabel extension in Slicer 5.0.3 and stumbled upon a problem. We got through the installation and were able to make a connection between the MONAILabel server on the local host and the Slicer application. To explore the functionality of the plug-in, we first decided to work a bit with the exemplary server from the MONAILabel documentation: monailabel start_server --app radiology --studies Task09_Spleen/imagesTr --conf models deepedit

Problem description

This seems to work fine until we try to draw scribbles. The drawing of the scribbles works fine. But as soon as we click the update button in the Scribbles section, the following error pops up:

Failed to post process label on MONAI Label Server using Histogram+GraphCut

The details of this error are the following:

Traceback (most recent call last):
  File "C:/Users/lukas/AppData/Local/NA-MIC/Slicer 5.0.3/NA-MIC/Extensions-30893/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabel.py", line 1867, in onUpdateScribbles
    result_file, params = self.logic.infer(
  File "C:/Users/lukas/AppData/Local/NA-MIC/Slicer 5.0.3/NA-MIC/Extensions-30893/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabel.py", line 2152, in infer
    result_file, params = client.infer(model, image_in, params, label_in, file, session_id)
  File "C:\Users\lukas\AppData\Local\NA-MIC\Slicer 5.0.3\NA-MIC\Extensions-30893\MONAILabel\lib\Slicer-5.0\qt-scripted-modules\MONAILabelLib\client.py", line 192, in infer
    raise MONAILabelException(
MONAILabelLib.client.MONAILabelException: (2, "Status: 500; Response: b'Internal Server Error'")

The terminal logs are given below

$ monailabel start_server --app radiology --studies Task09_Spleen/imagesTr --conf models deepedit
Using PYTHONPATH=/opt:
[2022-08-31 07:08:08,899] [26756] [MainThread] [INFO] (__main__:269) - USING:: app = /home/lukas/radiology
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: studies = /home/lukas/Task09_Spleen/imagesTr
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: verbose = INFO
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: conf = [['models', 'deepedit']]
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: host = 0.0.0.0
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: port = 8000
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: uvicorn_app = monailabel.app:app
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: ssl_keyfile = None
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: ssl_certfile = None
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: ssl_keyfile_password = None
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: ssl_ca_certs = None
[2022-08-31 07:08:08,900] [26756] [MainThread] [INFO] (__main__:269) - USING:: workers = None
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:269) - USING:: limit_concurrency = None
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:269) - USING:: access_log = False
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:269) - USING:: log_config = None
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:269) - USING:: dryrun = False
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:269) - USING:: action = start_server
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_API_STR =
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_PROJECT_NAME = MONAILabel
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_APP_DIR =
[2022-08-31 07:08:08,901] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_STUDIES =
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_AUTH_ENABLE = False
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_AUTH_DB =
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_APP_CONF = '{}'
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_TASKS_TRAIN = True
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_TASKS_STRATEGY = True
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_TASKS_SCORING = True
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_TASKS_BATCH_INFER = True
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE =
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_USERNAME =
[2022-08-31 07:08:08,902] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_PASSWORD =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_API_KEY =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_CACHE_PATH =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_PROJECT =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_ASSET_PATH =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_DSA_ANNOTATION_GROUPS =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DICOMWEB_USERNAME =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DICOMWEB_PASSWORD =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DICOMWEB_CACHE_PATH =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_QIDO_PREFIX =
[2022-08-31 07:08:08,903] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_WADO_PREFIX =
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_STOW_PREFIX =
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DICOMWEB_FETCH_BY_FRAME = False
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_AUTO_RELOAD = True
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_DATASTORE_FILE_EXT = '["*.nii.gz", "*.nii", "*.nrrd", "*.jpg", "*.png", "*.tif", "*.svs", "*.xml"]'
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_SERVER_PORT = 8000
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_CORS_ORIGINS = '[]'
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_SESSIONS = True
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_SESSION_PATH =
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_SESSION_EXPIRY = 3600
[2022-08-31 07:08:08,904] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_INFER_CONCURRENCY = -1
[2022-08-31 07:08:08,905] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_INFER_TIMEOUT = 600
[2022-08-31 07:08:08,905] [26756] [MainThread] [INFO] (__main__:273) - ENV SETTINGS:: MONAI_LABEL_AUTO_UPDATE_SCORING = True
[2022-08-31 07:08:08,905] [26756] [MainThread] [INFO] (__main__:274) -
Allow Origins: ['*']
[2022-08-31 07:08:09,616] [26756] [MainThread] [INFO] (uvicorn.error:75) - Started server process [26756]
[2022-08-31 07:08:09,617] [26756] [MainThread] [INFO] (uvicorn.error:45) - Waiting for application startup.
[2022-08-31 07:08:09,617] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.app:38) - Initializing App from: /home/lukas/radiology; studies: /home/lukas/Task09_Spleen/imagesTr; conf: {'models': 'deepedit'}
[2022-08-31 07:08:09,621] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for MONAILabelApp Found: <class 'main.MyApp'>
[2022-08-31 07:08:09,627] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for TaskConfig Found: <class 'lib.configs.segmentation.Segmentation'>
[2022-08-31 07:08:09,627] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for TaskConfig Found: <class 'lib.configs.deepgrow_3d.Deepgrow3D'>
[2022-08-31 07:08:09,630] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for TaskConfig Found: <class 'lib.configs.deepedit.DeepEdit'>
[2022-08-31 07:08:09,630] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for TaskConfig Found: <class 'lib.configs.segmentation_spleen.SegmentationSpleen'>
[2022-08-31 07:08:09,631] [26756] [MainThread] [INFO] (monailabel.utils.others.class_utils:36) - Subclass for TaskConfig Found: <class 'lib.configs.deepgrow_2d.Deepgrow2D'>
[2022-08-31 07:08:09,631] [26756] [MainThread] [INFO] (main:83) - +++ Adding Model: deepedit => lib.configs.deepedit.DeepEdit
[2022-08-31 07:08:10,697] [26756] [MainThread] [INFO] (lib.configs.deepedit:144) - EPISTEMIC Enabled: 0; Samples: 5
[2022-08-31 07:08:10,697] [26756] [MainThread] [INFO] (lib.configs.deepedit:148) - TTA Enabled: 0; Samples: 5
[2022-08-31 07:08:10,697] [26756] [MainThread] [INFO] (main:87) - +++ Using Models: ['deepedit']
[2022-08-31 07:08:10,698] [26756] [MainThread] [INFO] (monailabel.interfaces.app:128) - Init Datastore for: /home/lukas/Task09_Spleen/imagesTr
[2022-08-31 07:08:10,698] [26756] [MainThread] [INFO] (monailabel.datastore.local:125) - Auto Reload: True; Extensions: ['*.nii.gz', '*.nii', '*.nrrd', '*.jpg', '*.png', '*.tif', '*.svs', '*.xml']
[2022-08-31 07:08:10,705] [26756] [MainThread] [INFO] (monailabel.datastore.local:540) - Invalidate count: 0
[2022-08-31 07:08:10,705] [26756] [MainThread] [INFO] (monailabel.datastore.local:145) - Start observing external modifications on datastore (AUTO RELOAD)
[2022-08-31 07:08:10,706] [26756] [MainThread] [INFO] (main:112) - +++ Adding Inferer:: deepedit => <lib.infers.deepedit.DeepEdit object at 0x7f0529ae6810>
[2022-08-31 07:08:10,706] [26756] [MainThread] [INFO] (main:112) - +++ Adding Inferer:: deepedit_seg => <lib.infers.deepedit.DeepEdit object at 0x7f051f8f2810>
[2022-08-31 07:08:10,707] [26756] [MainThread] [INFO] (main:161) - +++ Adding Trainer:: deepedit => <lib.trainers.deepedit.DeepEdit object at 0x7f051f8f29d0>
[2022-08-31 07:08:10,707] [26756] [MainThread] [INFO] (monailabel.utils.sessions:51) - Session Path: /home/lukas/.cache/monailabel/sessions
[2022-08-31 07:08:10,707] [26756] [MainThread] [INFO] (monailabel.utils.sessions:52) - Session Expiry (max): 3600
[2022-08-31 07:08:10,707] [26756] [MainThread] [INFO] (monailabel.interfaces.app:460) - App Init - completed
[2022-08-31 07:08:10,708] [timeloop] [INFO] Starting Timeloop..
[2022-08-31 07:08:10,708] [26756] [MainThread] [INFO] (timeloop:60) - Starting Timeloop..
[2022-08-31 07:08:10,708] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete.<locals>.run_scheduler at 0x7f051fcb0320>
[2022-08-31 07:08:10,708] [26756] [MainThread] [INFO] (timeloop:42) - Registered job <function MONAILabelApp.on_init_complete.<locals>.run_scheduler at 0x7f051fcb0320>
[2022-08-31 07:08:10,708] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set
[2022-08-31 07:08:10,708] [26756] [MainThread] [INFO] (timeloop:63) - Timeloop now started. Jobs will run based on the interval set
[2022-08-31 07:08:10,709] [26756] [MainThread] [INFO] (uvicorn.error:59) - Application startup complete.
[2022-08-31 07:08:10,709] [26756] [MainThread] [INFO] (uvicorn.error:211) - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
[2022-08-31 07:09:24,061] [26756] [MainThread] [INFO] (monailabel.endpoints.activelearning:43) - Active Learning Request: {'strategy': 'first', 'client_id': 'user-xyz'}
[2022-08-31 07:09:24,061] [26756] [MainThread] [INFO] (lib.activelearning.first:36) - First: Selected Image: spleen_12
[2022-08-31 07:09:24,066] [26756] [MainThread] [INFO] (monailabel.endpoints.activelearning:59) - Next sample: {'id': 'spleen_12', 'ts': 1661860065, 'name': 'spleen_12.nii.gz', 'strategy': {'first': {'ts': 1661929764, 'client_id': 'user-xyz'}}, 'path': '/home/lukas/Task09_Spleen/imagesTr/spleen_12.nii.gz'}
[2022-08-31 07:10:20,139] [26756] [MainThread] [INFO] (monailabel.endpoints.infer:160) - Infer Request: {'model': 'Histogram+GraphCut', 'image': 'spleen_12', 'label': '/tmp/tmp4_1nv6jh.nii.gz', 'num_bins': 64, 'lamda': 1.0, 'sigma': 0.1, 'roi': [], 'label_info': [{'name': 'background', 'id': 1}, {'name': 'spleen', 'id': 2}, {'name': 'right kidney', 'id': 3}, {'name': 'left kidney', 'id': 4}, {'name': 'liver', 'id': 5}, {'name': 'stomach', 'id': 6}, {'name': 'aorta', 'id': 7}, {'name': 'inferior vena cava', 'id': 8}, {'name': 'background_scribbles', 'id': 9}, {'name': 'foreground_scribbles', 'id': 10}], 'selected_label_name': 'spleen', 'result_extension': '.nrrd', 'result_dtype': 'uint8', 'client_id': 'user-xyz'}
[2022-08-31 07:10:20,140] [26756] [MainThread] [INFO] (monailabel.interfaces.tasks.infer:265) - Infer Request (final): {'num_bins': 64, 'lamda': 1.0, 'sigma': 0.1, 'model': 'Histogram+GraphCut', 'image': '/home/lukas/Task09_Spleen/imagesTr/spleen_12.nii.gz', 'label': '/tmp/tmp4_1nv6jh.nii.gz', 'roi': [], 'label_info': [{'name': 'background', 'id': 1}, {'name': 'spleen', 'id': 2}, {'name': 'right kidney', 'id': 3}, {'name': 'left kidney', 'id': 4}, {'name': 'liver', 'id': 5}, {'name': 'stomach', 'id': 6}, {'name': 'aorta', 'id': 7}, {'name': 'inferior vena cava', 'id': 8}, {'name': 'background_scribbles', 'id': 9}, {'name': 'foreground_scribbles', 'id': 10}], 'selected_label_name': 'spleen', 'result_extension': '.nrrd', 'result_dtype': 'uint8', 'client_id': 'user-xyz', 'description': 'A post processing step with histogram-based GraphCut for Generic segmentation', 'device': 'cpu'}
[2022-08-31 07:10:20,142] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:63) - PRE - Run Transform(s)
[2022-08-31 07:10:20,142] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:64) - PRE - Input Keys: ['num_bins', 'lamda', 'sigma', 'model', 'image', 'label', 'roi', 'label_info', 'selected_label_name', 'result_extension', 'result_dtype', 'client_id', 'description', 'device', 'image_path']
[2022-08-31 07:10:22,780] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:108) - PRE - Transform (LoadImaged): Time: 2.6368; image: (512, 512, 168)(torch.float32); label: (512, 512, 168)(torch.float32)
[2022-08-31 07:10:22,781] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:108) - PRE - Transform (EnsureChannelFirstd): Time: 0.0006; image: (1, 512, 512, 168)(torch.float32); label: (1, 512, 512, 168)(torch.float32)
[2022-08-31 07:10:22,781] [26756] [MainThread] [INFO] (root:74) - Loading background scribbles labels from: background_scribbles with index: 9
[2022-08-31 07:10:22,781] [26756] [MainThread] [INFO] (root:79) - Loading foreground scribbles labels from: foreground_scribbles with index: 10
[2022-08-31 07:10:22,781] [26756] [MainThread] [INFO] (monailabel.scribbles.transforms:111) - Scribbles: (1, 512, 512, 168)
[2022-08-31 07:10:22,782] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:108) - PRE - Transform (AddBackgroundScribblesFromROId): Time: 0.0009; image: (1, 512, 512, 168)(torch.float32); label: (1, 512, 512, 168)(float32)
`data_array` is not of type MetaTensor, assuming affine to be identity.
[2022-08-31 07:10:23,213] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:108) - PRE - Transform (Spacingd): Time: 0.4306; image: (1, 155, 155, 51)(torch.float32); label: (1, 205, 205, 34)(torch.float32)
[2022-08-31 07:10:23,218] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:108) - PRE - Transform (ScaleIntensityRanged): Time: 0.0049; image: (1, 155, 155, 51)(torch.float32); label: (1, 205, 205, 34)(torch.float32)
[2022-08-31 07:10:23,219] [26756] [MainThread] [INFO] (monailabel.interfaces.tasks.infer:400) - Inferer:: cpu => Compose => {'transforms': (<monailabel.scribbles.transforms.MakeLikelihoodFromScribblesHistogramd object at 0x7f051d8b0590>,), 'map_items': True, 'unpack_items': False, 'log_stats': False, 'R': RandomState(MT19937) at 0x7F0580FE67C0}
[2022-08-31 07:10:23,219] [26756] [MainThread] [INFO] (monailabel.interfaces.tasks.infer:352) - Infer model path: None
[2022-08-31 07:10:23,220] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:63) - INF - Run Inferer(s)
[2022-08-31 07:10:23,220] [26756] [MainThread] [INFO] (monailabel.interfaces.utils.transform:64) - INF - Input Keys: ['num_bins', 'lamda', 'sigma', 'model', 'image', 'label', 'roi', 'label_info', 'selected_label_name', 'result_extension', 'result_dtype', 'client_id', 'description', 'device', 'image_path', 'image_meta_dict', 'label_meta_dict', 'latencies']
[2022-08-31 07:10:23,220] [26756] [MainThread] [INFO] (root:74) - Loading background scribbles labels from: background_scribbles with index: 9
[2022-08-31 07:10:23,220] [26756] [MainThread] [INFO] (root:79) - Loading foreground scribbles labels from: foreground_scribbles with index: 10
[2022-08-31 07:10:23,227] [26756] [MainThread] [ERROR] (uvicorn.error:369) - Exception in ASGI application
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/opt/conda/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/fastapi/applications.py", line 269, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/opt/conda/lib/python3.7/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/exceptions.py", line 93, in __call__
    raise exc
  File "/opt/conda/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "/opt/conda/lib/python3.7/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/opt/conda/lib/python3.7/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.7/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/opt/conda/lib/python3.7/site-packages/fastapi/routing.py", line 228, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/opt/conda/lib/python3.7/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/endpoints/infer.py", line 179, in api_run_inference
    return run_inference(background_tasks, model, image, session_id, params, file, label, output)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/endpoints/infer.py", line 161, in run_inference
    result = instance.infer(request)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/interfaces/app.py", line 289, in infer
    result_file_name, result_json = task(request)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/interfaces/tasks/infer.py", line 278, in __call__
    data = self.run_inferer(data, device=device)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/interfaces/tasks/infer.py", line 419, in run_inferer
    data = run_transforms(data, inferer, log_prefix="INF", log_name="Inferer")
  File "/opt/conda/lib/python3.7/site-packages/monailabel/interfaces/utils/transform.py", line 93, in run_transforms
    data = t(data)
  File "/opt/conda/lib/python3.7/site-packages/monailabel/scribbles/transforms.py", line 201, in __call__
    return_label=False,
  File "/opt/conda/lib/python3.7/site-packages/monailabel/scribbles/utils.py", line 155, in make_likelihood_image_histogram
    image, scrib, scribbles_bg_label, scribbles_fg_label, alpha_bg=1, alpha_fg=1, bins=num_bins
  File "/opt/conda/lib/python3.7/site-packages/monailabel/scribbles/utils.py", line 121, in make_histograms
    values = image[scrib == scribbles_bg_label]
IndexError: boolean index did not match indexed array along dimension 1; dimension is 155 but corresponding boolean dimension is 205

The other features of the MONAILabel module seem to be working perfectly: autosegmentation, growing from seeds, SmartEditing, submitting labels... It's only the Scribbles functionality that we are having trouble with.

Specifications

We are actually working on a Google Cloud Virtual Machine: we are running the MONAILabel server on this VM and via SSH forward it through to our local host. On this local host, we are running Slicer 5.0.3. To give some more context, here are some specifications about both the local machine and the VM: Local machine:

Virtual machine:

I hope this helps!

Thanks in advance!

SachidanandAlle commented 2 years ago

@masadcv can you please check on this..

diazandr3s commented 2 years ago

Hi @lukasvdstricht,

Thanks for opening this issue. I've tested version 0.4.2 and I've experienced the same issue as @MrMarkusJ did: https://github.com/Project-MONAI/MONAILabel/discussions/957#discussioncomment-3516907

We'll fix this ASAP.

In the meantime, I suggest you use version 0.4.1 (pip install monailabel==0.4.1) - I've tested and it's working fine.

lukasvdstricht commented 2 years ago

Hi @diazandr3s

Thank you! Downgrading MONAILabel to version 0.4.1 indeed does the trick.

Kind regards

Lukas

masadcv commented 2 years ago

Hi @SachidanandAlle, @diazandr3s and @lukasvdstricht

This is related to the fix I had for MetaTensor (https://github.com/Project-MONAI/MONAILabel/pull/915) Can you try again with latest from main and let me know if the problem still persists?

@SachidanandAlle , we may want to release a version of MONAI Label with this fix to avoid any similar issues for others

masadcv commented 2 years ago

Duplicate of https://github.com/Project-MONAI/MONAILabel/issues/908

masadcv commented 2 years ago

Closing this in favor of #908 which has already been addressed. Please reopen if you see this is not resolved with latest main.