Project-MONAI / Project-MONAI/MONAILabel

3D Slicer MonaiReviewer plugin fails to connect

Open
#1,599 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
891
Forks
269
Avg merge
15h 41m
Merged PRs (30d)
1

Description

Describe the bug
After making a few segmentations, I wanted to try to use the reviewer module to evaluate the segmentations. Upon trying to connect using the same Server URL as used for the labeling plugin, it fails, asking the user whether the used URL is correct.

Server Slicer logs

[Python] 2023-11-24 14:20:01.941823: Request for datastore-info failed (url: 'http://<servername>:8000//datastore/?output=all'). Response code is 404
[Python] Request for datastore-info failed.
[Python] Please check if server address is correct 
[Python] ('http://<servername>:8000/')!
Traceback (most recent call last):
  File "C:/Users/mboer41/AppData/Local/slicer.org/Slicer 5.4.0/slicer.org/Extensions-31938/MONAILabel/lib/Slicer-5.4/qt-scripted-modules/MONAILabelReviewer.py", line 450, in init_dicom_stream
    self.initUI()
  File "C:/Users/mboer41/AppData/Local/slicer.org/Slicer 5.4.0/slicer.org/Extensions-31938/MONAILabel/lib/Slicer-5.4/qt-scripted-modules/MONAILabelReviewer.py", line 471, in initUI
    self.setProgessBar()
  File "C:/Users/mboer41/AppData/Local/slicer.org/Slicer 5.4.0/slicer.org/Extensions-31938/MONAILabel/lib/Slicer-5.4/qt-scripted-modules/MONAILabelReviewer.py", line 505, in setProgessBar
    statistics = self.logic.getStatistics()
  File "C:/Users/mboer41/AppData/Local/slicer.org/Slicer 5.4.0/slicer.org/Extensions-31938/MONAILabel/lib/Slicer-5.4/qt-scripted-modules/MONAILabelReviewer.py", line 1568, in getStatistics
    return self.imageDataController.getStatistics()
  File "C:\Users\mboer41\AppData\Local\slicer.org\Slicer 5.4.0\slicer.org\Extensions-31938\MONAILabel\lib\Slicer-5.4\qt-scripted-modules\MONAILabelReviewerLib\ImageDataController.py", line 83, in getStatistics
    segmentationProgress=self.imageDataExtractor.getSegmentationProgessInPercentage(),
AttributeError: 'NoneType' object has no attribute 'getSegmentationProgessInPercentage'
[Python] Request for datastore-info failed.
[Python] Please check if server address is correct 
[Python] ('http://<servername>:8000/')!

To Reproduce
Steps to reproduce the behavior:

  1. Start a server, as usual
  2. Open 3D slicer and go to the reviewer plugin
  3. Attempt to connect to the server

Expected behavior
No error on connect, being able to inspect the segmentations.

Environment
Built using:

FROM nvcr.io/nvidia/pytorch:23.10-py3
WORKDIR /

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Amsterdam \
    CUDA_DEVICE_ORDER=PCI_BUS_ID

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    git \
    g++ \
    openslide-tools \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    && python -m pip install -U pip

RUN pip install monai monailabel

Which is then exported using docker save and built into a Singularity container with

singularity build singularity-image.sif docker-archive://docker-image.tar

Additional context

I think the main culprit here is the initial line:

[Python] 2023-11-24 14:20:01.941823: Request for datastore-info failed (url: 'http://<servername>:8000//datastore/?output=all'). Response code is 404

Note how the reported URL has two slashes after <servername>:8000. Copying this into a webbrowser does indeed give a 404 response, however, changing the URL manually to 'http://<servername>:8000/datastore/?output=all'. does work.

I've had a quick skim of the source code of the reviewer plugin, and couldn't find the bit of code that creates the url, otherwise I'd have put in a pull request instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in qt-scripted-modules/MONAILabelReviewer.py, especially init_dicom_stream, initUI, and the datastore-info connection path, then inspect how the server URL is combined with the datastore endpoint. Reproduce the connection in the reviewer plugin and verify that the request uses a single slash and successfully reaches /datastore/?output=all without the NoneType error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.