Skip to content

Commit

Permalink
Deprecate apps (#700)
Browse files Browse the repository at this point in the history
* Deprecate Apps

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Fix/add tests

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Add deepedit sample app for backward version support (docs)

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Deprecate Apps

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Deprecate Apps

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Fix readme + disable auto trigger for train

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Fix readme++

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>

* Fix readme++

Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>
  • Loading branch information
SachidanandAlle committed Mar 22, 2022
1 parent f440212 commit 823398e
Show file tree
Hide file tree
Showing 98 changed files with 482 additions and 3,779 deletions.
64 changes: 47 additions & 17 deletions README.md
Expand Up @@ -9,8 +9,9 @@
[![codecov](https://codecov.io/gh/Project-MONAI/MONAILabel/branch/main/graph/badge.svg)](https://codecov.io/gh/Project-MONAI/MONAILabel)

MONAI Label is a server-client system that facilitates interactive medical image annotation by using AI. It is an
open-source and easy-to-install ecosystem that can run locally on a machine with single or multiple GPUs. Both server and client
work on the same/different machine. It shares the same principles with [MONAI](https://github.com/Project-MONAI).
open-source and easy-to-install ecosystem that can run locally on a machine with single or multiple GPUs. Both server
and client work on the same/different machine. It shares the same principles
with [MONAI](https://github.com/Project-MONAI).

[MONAI Label Demo](https://youtu.be/o8HipCgSZIw?t=1319)

Expand All @@ -23,7 +24,7 @@ work on the same/different machine. It shares the same principles with [MONAI](h
- Framework for developing and deploying MONAI Label Apps to train and infer AI models
- Compositional & portable APIs for ease of integration in existing workflows
- Customizable labelling app design for varying user expertise
- Annotation support via 3DSlicer & OHIF
- Annotation support via 3DSlicer & OHIF
- PACS connectivity via DICOMWeb

## Installation
Expand All @@ -33,27 +34,55 @@ MONAI Label supports following OS with **GPU/CUDA** enabled.
- Ubuntu
- [Windows](https://docs.monai.io/projects/label/en/latest/installation.html#windows)

### Development Release

To install the _**latest features**_ using one of the following options:
```bash
# option 1: github install (or you can install monailabel-weekly from PyPI)
pip install git+https://github.com/Project-MONAI/MONAILabel#egg=monailabel

# option 2: using docker
docker run --gpus all --rm -ti --ipc=host --net=host projectmonai/monailabel:latest

# option 2: git checkout
git clone https://github.com/Project-MONAI/MONAILabel
pip install -r MONAILabel/requirements.txt
export PATH=$PATH:`pwd`/MONAILabel/monailabel/scripts


# download radiology app and sample dataset
monailabel apps --download --name radiology --output apps
monailabel datasets --download --name Task09_Spleen --output datasets

# start server using radiology app with deepedit model enabled
monailabel start_server --app apps/radiology --studies datasets/Task09_Spleen/imagesTr --conf models deepedit
```

### Current Release (3.x)

To install the [current release](https://pypi.org/project/monailabel/), you can simply run:

```bash
pip install monailabel

# download sample apps/dataset
monailabel apps --download --name deepedit --output apps
monailabel datasets --download --name Task09_Spleen --output datasets

# run server
monailabel start_server --app apps/deepedit --studies datasets/Task09_Spleen/imagesTr
pip install monailabel

monailabel apps --download --name deepedit --output apps
monailabel datasets --download --name Task09_Spleen --output datasets

monailabel start_server --app apps/deepedit --studies datasets/Task09_Spleen/imagesTr
```

> If monailabel install path is not automatically determined, then you can provide explicit install path as:
>
More details refer docs: https://docs.monai.io/projects/label/en/stable/installation.html



> If monailabel install path is not automatically determined, then you can provide explicit install path as:
>
> `monailabel apps --prefix ~/.local`
For **_prerequisites_**, other installation methods (using the default GitHub branch, using Docker, etc.), please refer
to the [installation guide](https://docs.monai.io/projects/label/en/latest/installation.html).

> Once you start the MONAI Label Server, by default server will be up and serving at http://127.0.0.1:8000/. Open the serving URL in browser. It will provide you the list of Rest APIs available. **For this, please make sure you use the HTTP protocol. HTTPS is not implemented.**
> Once you start the MONAI Label Server, by default server will be up and serving at http://127.0.0.1:8000/. Open the serving URL in browser. It will provide you the list of Rest APIs available. **For this, please make sure you use the HTTP protocol.** _You can provide ssl arguments to run server in HTTPS mode but this functionality is not fully verified._
### 3D Slicer

Expand All @@ -65,15 +94,16 @@ Refer [3D Slicer plugin](plugins/slicer) for other options to install and run MO
### OHIF

MONAI Label comes with [pre-built plugin](plugins/ohif) for [OHIF Viewer](https://github.com/OHIF/Viewers). To use OHIF Viewer, you need to provide DICOMWeb instead of FileSystem as _studies_ when you start the server.
MONAI Label comes with [pre-built plugin](plugins/ohif) for [OHIF Viewer](https://github.com/OHIF/Viewers). To use OHIF
Viewer, you need to provide DICOMWeb instead of FileSystem as _studies_ when you start the server.
> Please install [Orthanc](https://www.orthanc-server.com/download.php) before using OHIF Viewer.
> For Ubuntu 20.x, Orthanc can be installed as `apt-get install orthanc orthanc-dicomweb`. However, you have to **upgrade to latest version** by following steps mentioned [here](https://book.orthanc-server.com/users/debian-packages.html#replacing-the-package-from-the-service-by-the-lsb-binaries)
>
> You can use [PlastiMatch](https://plastimatch.org/plastimatch.html#plastimatch-convert) to convert NIFTI to DICOM
```bash
# start server using DICOMWeb
monailabel start_server --app apps\deepedit --studies http://127.0.0.1:8042/dicom-web
monailabel start_server --app apps/radiology --studies http://127.0.0.1:8042/dicom-web
```

> OHIF Viewer will be accessible at http://127.0.0.1:8000/ohif/
Expand All @@ -83,12 +113,12 @@ MONAI Label comes with [pre-built plugin](plugins/ohif) for [OHIF Viewer](https:
> **_NOTE:_** OHIF does not yet support Multi-Label interaction for DeepEdit.
### Pathology using [Digital Slide Archive (DSA)](https://digitalslidearchive.github.io/digital_slide_archive/)

Refer [Pathology](sample-apps/pathology) for running a sample pathology use-case in MONAILabel.
> **_NOTE:_** The **Pathology App** and *DSA Plugin* are under *active development*.
![image](https://user-images.githubusercontent.com/7339051/157100606-a281e038-5923-43a8-bb82-8fccae51fcff.png)


## Contributing

For guidance on making a contribution to MONAI Label, see the [contributing guidelines](CONTRIBUTING.md).
Expand Down
11 changes: 11 additions & 0 deletions docs/source/apis.rst
Expand Up @@ -61,6 +61,17 @@ Utils
:noindex:


Client
======

.. currentmodule:: monailabel.client.client
.. autoclass:: MONAILabelClient
:members:
:noindex:
.. autoclass:: MONAILabelError
:members:
:noindex:

Modules
=======

Expand Down
4 changes: 2 additions & 2 deletions docs/source/appdeployment.rst
Expand Up @@ -14,10 +14,10 @@ The MONAI Label Server endpoints are available at startup. The user may download
.. code-block:: bash
# download a sample app
monailabel apps --name deepedit --download --output .
monailabel apps --name radiology --download --output .
# start the sample app locally
monailabel start_server --app deepedit --studies <path/to/datastore>
monailabel start_server --app radiology --studies <path/to/datastore> --conf models (deepedit|deepgrow|segmentation|segmentation_speen|all)
and navigate to `http://127.0.0.1:8000/ <http://127.0.0.1:8000/>`_ on the browser (if the server
is running on the local machine). The user may choose to use the web UI to invoke the various endpoints
Expand Down
18 changes: 11 additions & 7 deletions docs/source/installation.rst
Expand Up @@ -83,7 +83,7 @@ You can download sample apps and datasets from *monailabel* CLI.
# Download Sample Apps
monailabel apps # List sample apps
monailabel apps --download --name deepedit --output apps
monailabel apps --download --name radiology --output apps
# Download MSD Datasets
monailabel datasets # List sample datasets
Expand All @@ -95,7 +95,11 @@ Starting Server
You can start server using *monailabel* CLI
::

monailabel start_server --app apps/deepedit --studies datasets/Task09_Spleen/imagesTr
# Run Deepedit Model.
# Options can be (deepedit|deepgrow|segmentation|segmentation_spleen|all) in case of radiology app.
# You can also pass comma seperated models like --conf models deepedit,segmentation

monailabel start_server --app apps/radiology --studies datasets/Task09_Spleen/imagesTr --conf models deepedit


.. note::
Expand All @@ -115,14 +119,14 @@ Deploying MONAI Label server for production use is out of project scope. Howeve
::

# dryrun the MONAI Label CLI for pre-init and dump the env variables to .env or env.bat
monailabel start_server --app apps/deepedit --studies datasets/Task09_Spleen/imagesTr --host 0.0.0.0 --port 8000 --dryrun
monailabel start_server --app apps/radiology --studies datasets/Task09_Spleen/imagesTr --host 0.0.0.0 --port 8000 --dryrun

# Linux/Ubuntu
source .env
uvicorn monailabel.app:app \
--host 0.0.0.0 \
--port 8000 \
--log-config apps/deepedit/logs/logging.json \
--log-config apps/radiology/logs/logging.json \
--no-access-log


Expand All @@ -131,7 +135,7 @@ Deploying MONAI Label server for production use is out of project scope. Howeve
uvicorn monailabel.app:app ^
--host 0.0.0.0 ^
--port 8000 ^
--log-config apps\deepedit\logs\logging.json ^
--log-config apps\radiology\logs\logging.json ^
--no-access-log


Expand All @@ -153,7 +157,7 @@ MONAI Label comes with `pre-built plugin <https://github.com/Project-MONAI/MONAI

::

monailabel start_server --app apps/deepedit --studies http://127.0.0.1:8042/dicom-web
monailabel start_server --app apps/radiology --studies http://127.0.0.1:8042/dicom-web --conf models deepedit


If you have authentication set for dicom-web then you can pass the credentials using environment `variables <https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/config.py>`_ while running the server.
Expand All @@ -162,7 +166,7 @@ If you have authentication set for dicom-web then you can pass the credentials u

export MONAI_LABEL_DICOMWEB_USERNAME=xyz
export MONAI_LABEL_DICOMWEB_PASSWORD=abc
monailabel start_server --app apps/deepedit --studies http://127.0.0.1:8042/dicom-web
monailabel start_server --app apps/radiology --studies http://127.0.0.1:8042/dicom-web --conf models deepedit


.. note::
Expand Down
10 changes: 4 additions & 6 deletions docs/source/modules.rst
Expand Up @@ -37,17 +37,16 @@ MONAI Label currently provides three template applications which developers
may start using out of the box, or with few modifications to achieve the desired
behavior. Template applications currently available are

- `Automated Segmentation <LINKREF_GITHUB_MONAILABEL/sample-apps/segmentation>`_
- `DeepGrow AI Annotation <LINKREF_GITHUB_MONAILABEL/sample-apps/deepgrow>`_
- `DeepEdit AI Annotation <LINKREF_GITHUB_MONAILABEL/sample-apps/deepedit>`_
- `radiology <LINKREF_GITHUB_MONAILABEL/sample-apps/radiology>`_
- `pathology <LINKREF_GITHUB_MONAILABEL/sample-apps/pathology>`_

For a quickstart the developer may use

.. code-block:: bash
monailabel apps --name <desired_app> --download --output myapp
where ``desired_app`` may be any of ``segmentation``, ``deepgrow``, or ``deepedit``.
where ``desired_app`` may be any of ``pathology``, ``radiology``.

To better understand template apps, the next few sections we will go into the details of implementing

Expand All @@ -71,8 +70,7 @@ discretization.
:emphasize-lines: 7, 9, 15, 18
from monai.inferers import SimpleInferer
from monai.transforms import (LoadImaged, ToNumpyd, Activationsd
AsDiscreted, ToNumpyd)
from monai.transforms import (LoadImaged, ToNumpyd, Activationsd AsDiscreted, ToNumpyd)
from monailabel.interfaces.tasks import InferTask
Expand Down
43 changes: 23 additions & 20 deletions docs/source/quickstart.rst
Expand Up @@ -2,7 +2,10 @@
Quickstart
==========

MONAI Label server currently supports the annotation of local datasets via `3DSlicer <https://www.slicer.org/>`_, such as unlabeled images
Use Case - Radiology
====================

This example covers the annotation use-case for radiology using the sample MONAILabel App - **radiology**. MONAI Label server currently supports the annotation of local datasets via `3DSlicer <https://www.slicer.org/>`_, such as unlabeled images
residing on disk, and remote data residing on DICOMweb-enabled PACS systems via both `3DSlicer <https://www.slicer.org/>`_ and `OHIF <https://ohif.org/>`_.

* To setup a local dataset for annotation follow the instructions under :ref:`DeepEdit Annotation with 3DSlicer`.
Expand All @@ -13,29 +16,29 @@ residing on disk, and remote data residing on DICOMweb-enabled PACS systems via
DeepEdit Annotation with 3DSlicer
=================================

.. _Deploy DeepEdit on MONAI Label Server:
.. _Deploy MONAI Label Server:

Deploy DeepEdit on MONAI Label Server
-------------------------------------
Deploy MONAI Label Server
-------------------------

On the local machine follow the commands listed below to install MONAI Label, download
a sample application (DeepEdit left atrium annotation), download a sample dataset (MSD
a sample application (Radiology), download a sample dataset (MSD
heart MRI), and deploy the sample app and standard dataset on the MONAI Label server.

.. code-block:: bash
# install MONAI Label
pip install monailabel
# download DeepEdit sample app to local directory
monailabel apps --name deepedit --download --output .
# download Radiology sample app to local directory
monailabel apps --name radiology --download --output .
# download Task 2 MSD dataset
monailabel datasets --download --name Task02_Heart --output .
monailabel datasets --download --name Task09_Spleen --output .
# start the DeepEdit app in MONAI label server
# and start annotating the downloaded images
monailabel start_server --app deepedit --studies Task02_Heart/imagesTr
# start the Radiology app in MONAI label server
# and start annotating the downloaded images using deepedit model
monailabel start_server --app radiology --studies Task09_Spleen/imagesTr --conf models deepedit
Install MONAI Label Plugin in 3DSlicer
Expand Down Expand Up @@ -126,7 +129,7 @@ label storage location.
# start the DeepEdit app in MONAI label server
# on the empty dataset folder
monailabel start_server --app deepedit --studies my_dataset
monailabel start_server --app radiology --studies my_dataset --conf models deepedit
We can follow the instructions in the previous section to install and connect 3DSlicer to MONAI
Label Server, however, in this scenario we will instead load a file into MONAI Label Server *through*
Expand All @@ -153,7 +156,7 @@ the ``username`` and ``password`` for DICOM servers that require them).

If you do not have a DICOM server available for usage but would like to set one up please follow the instructions in the
:ref:`next section<Setup Development DICOM Server>`, otherwise skip to
:ref:`Deploy DeepEdit for PACS Data Annotation`.
:ref:`Deploy for PACS Data Annotation`.

.. _Setup Development DICOM Server:

Expand Down Expand Up @@ -223,21 +226,21 @@ If you do not have access to DICOM data to upload to the DICOM server you can co
sudo apt-get install plastimatch -y
# download Task 2 MSD dataset
monailabel datasets --download --name Task02_Heart --output .
monailabel datasets --download --name Task09_Spleen --output .
# convert one of the NIFTI images to DICOM
plastimatch convert --patient-id patient1 --input Task02_Heart/imagesTs/la_001.nii.gz --output-dicom la_001_dicom
plastimatch convert --patient-id patient1 --input Task09_Spleen/imagesTs/spleen_10.nii.gz --output-dicom dicom_output
Now, we can upload the DICOM series in ``la_001_dicom`` using the `upload <http://127.0.0.1:8042/app/explorer.html#upload>`_ link in Orthanc.
Now, we can upload the DICOM series in ``dicom_output`` using the `upload <http://127.0.0.1:8042/app/explorer.html#upload>`_ link in Orthanc.

You may use ``plastimatch`` to convert more NIFTI files to DICOM to keep populating the development DICOM server.

.. _Deploy DeepEdit for PACS Data Annotation:
.. _Deploy for PACS Data Annotation:

DeepEdit Annotation in OHIF
---------------------------

We follow a very similar ser of commands as in :ref:`Deploy DeepEdit on MONAI Label Server`, however, we use the DICOMweb
We follow a very similar set of commands as in :ref:`Deploy MONAI Label Server`, however, we use the DICOMweb
endpoint of our DICOM server, which based on the last section is ``http://locahost:8042/dicom-web``.

.. code-block:: bash
Expand All @@ -246,11 +249,11 @@ endpoint of our DICOM server, which based on the last section is ``http://locaho
pip install monailabel
# download DeepEdit sample app to local directory
monailabel apps --name deepedit --download --output .
monailabel apps --name radiology --download --output .
# start the DeepEdit app in MONAI label server
# and start annotating images in our DICOM server
monailabel start_server --app deepedit --studies http://locahost:8042/dicom-web --username orthanc --password orthanc
monailabel start_server --app radiology --studies http://locahost:8042/dicom-web --conf models deepedit --username orthanc --password orthanc
At this point OHIF can be used to annotate the data in the DICOM server via the MONAI Label server ``/ohif`` endpoint
Expand Down

0 comments on commit 823398e

Please sign in to comment.