Project-MONAI/MONAILabel

3D Slicer MonaiReviewer plugin fails to connect

Opened this issue · 1 comments

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.

Welp, I was the bug, I suppose. Removing the trailing / from the Server URL input made it work.

Behaviour is a little different between MonaiLabel and MonaiReviewer. Whereas a trailing / isfine for Label, it is not for Reviewer, causing it to fail.