Data Center / Cloud

Taking AI into Clinical Production with MONAI Deploy

With a wide breadth of open source, accelerated AI frameworks at their fingertips, medical AI developers and data scientists are introducing new algorithms for clinical applications at an extraordinary rate. Many of these models are nothing short of groundbreaking, yet 87% of data science projects never make it into production.

In most data science teams, model developers lack a fast, consistent, easy-to-use, and scalable way to develop and package trained AI models into market-ready medical AI applications. These applications can help clinicians streamline imaging workflows, uncover hidden insights, improve productivity, and connect multi-modal patient information for deeper patient understanding.

MONAI, the Medical Open Network for AI, is bridging this gap from development to clinical deployment with MONAI Deploy. MONAI Deploy provides a set of open source tools for developing, packaging, testing, deploying, and running medical AI applications. It allows developers to build AI applications, orchestrate clinical AI workflows, and interoperate with medical imaging systems like PACS (picture archiving and communication systems) over standards like DICOM, FHIR, and HL7.

Medical AI applications built with MONAI

With MONAI, developers, researchers, and data scientists are building applications for a wide range of medical AI applications, including:

  • Classifying medical imaging studies for the presence of a disease or condition
  • Segmenting organs, lesions, and other structures
  • Creating markups to highlight areas of concern with arrows or heatmaps
  • Deriving insights for radiologist review for inclusion in a medical report
  • Batch processing medical imaging exams during long-term storage or for DICOM migrations
  • Processing live streams of data to ensure the patient is positioned properly prior to image acquisition
  • Identifying QA issues during the acquisition process to streamline departmental workflows
  • Identifying trends in data for population health assessments 

MONAI Model Zoo is a curated library of more than 15 pretrained models (CT, MR, Pathology, Endoscopy) that can be transformed into MONAI AI applications, jump-starting AI application development.

MONAI Deploy applications

One of the key components of MONAI Deploy is the MONAI Deploy App SDK, which helps researchers and developers take one or more trained models and build an application with a few lines of code in under 20 minutes. The application is created as a MAP (MONAI Application Package). As a portable containerized application, it can be deployed and run in clinical production anywhere that has a Docker engine. 

Screenshot of a clinical review user interface of a MAP for segmenting a stroke lesion in a brain scan. Three patient records appear on the left with subsequent scans, segmentations, and metadata in the viewer.
Figure 1. An example of a MONAI Application Package (MAP) for stroke lesion segmentation in a brain scan developed by the AI Centre for Value Based Healthcare

The MONAI Deploy App SDK provides predefined operators that can be reused and connected in an application development workflow, or you can create custom ones. These operators parse DICOM studies, select specific series with application-defined rules, and convert the selected DICOM series into required image formats along with metadata representing the pertinent DICOM attributes. 

The image is then further processed in the preprocessing stage to normalize spacing, orientation, intensity, and more, before pixel data as Tensors are used for inference. It also includes DICOM writers such as DICOM Segmentation (SEG), DICOM Structured Reports (SR), and DICOM encapsulated Stereolithography (STL). 

The resulting MAP includes one or more trained models, associated metadata, and the necessary interoperability (preprocessing and postprocessing) to do clinical inference in a single container.

Diagram showing the medical imaging workflow starting with DICOM input and through the Load DICOM data, Segment lung, and Classify steps, and ending with Write DICOM output.
Figure 2. A typical medical imaging AI app development workflow from DICOM input to DICOM output

Creating and deploying your MAP

The first step in building a MAP is to write the application itself. This consists of designing a workflow, creating operator classes, implementing an application class, and executing the application locally. The application class brings together tasks in a workflow graph with the operators that can be debugged locally in a Jupyter notebook or through Command Line Interface (CLI).

The following code shows an application class definition example:

 from monai.deploy.core import Application, env, resource
 @resource(cpu=1, gpu=1, memory="2Gi")
 # pip_packages can be a string that is a path(str) to requirements.txt file or a list of packages.
 @env(pip_packages=["scikit-image >= 0.17.2"])
 class App(Application):
     """This is a very basic application.
    This showcases the MONAI Deploy application framework.

    # App's name. <class name>('App') if not specified.
    name = "my_app"
    # App's description. <class docstring> if not specified.
    description = "This is a reference application."
    # App's version. <git version tag> or '0.0.0' if not specified.
    version = "0.1.0"

    def compose(self):
        # Execute `self.add_flow()` or `self.add_operator()` methods here.

if __name__ == "__main__":

The output of the application class is an application graph, which defines the flow of operators or tasks (Figure 3).

Flow diagram showing a series of operators in an application graph from DICOMDataLoader to DICOMSeriesSelector to DICOM SegmentationWriter
Figure 3. An example of an application graph that defines the flow of operators with the MONAI Deploy App SDK

After the application has been tested and verified, the application is packaged and deployed locally. The MONAI Deploy Application Packager converts an application into a deployable Docker image that can be executed locally, following the MAP specification.

To package an application to create a Docker image tagged my_app:latest use the following command:

$ monai-deploy package ./my_app -t my_app:latest --model ./

Building MONAI Application Package...
Successfully built my_app:latest

MONAI Deploy App SDK makes running and testing MAPs locally an easy process. The command-line Application Runner allows users to specify the input and output paths of the local file system to the input and output of the MAP during execution. It does not require an understanding of the internal details of the MAP.

MAPs can be deployed in multiple ways, each with different levels of integration with a hosting platform. Learn more about these options in the Deploying and Hosting MONAI App Package documentation. You can also see the list of platforms supporting MAPs.

Accelerating the MAP validation lifecycle with MONAI Deploy Express

For initial local testing of MAPs, the Application Runner within the MONAI Deploy App SDK is fast, simple, and recommended. However, the journey from development to production usually requires multiple steps across different environments, operated by different teams and with different requirements.

MONAI Deploy Express is designed to facilitate the testing and validation of MAPs in the early stages of this pipeline (or workstation environment), where ease of use and time to get started are most important. 

Using straightforward technologies like Docker and Docker Compose, MONAI Deploy Express can be installed in about 30 minutes. It allows users to quickly run MAPs, connect to a test PACS or their own test/research PACS for further validation, and confidently take steps towards production.

Reusing the same essential core services for DICOM I/O and AI workflow orchestration that could be used in a production environment provides the same functionality and consistent experience independent of where and how the applications are run, with minimal changes for the end user.

Diagram showing the MONAI Deploy Express end-to-end clinical data pipeline that includes the MONAI Informatics Gateway, MONAI Workflow Manager, and MONAI App SDK.
Figure 4. MONAI Deploy Express accelerates the validation of MAPs with an end-to-end clinical data pipeline that includes the MONAI Informatics Gateway, MONAI Workflow Manager, and MONAI App SDK

Bridging the gap from research innovation to clinical production

MONAI Deploy was designed to shorten the time-to-clinic for AI models. With the SDK, medical AI application developers and translational researchers can build AI applications that can run anywhere and accelerate the testing and validation of these models for clinical deployment.

To see real-world use cases for building MAPs with MONAI Deploy and explore clinical inference capabilities within the SDK, watch the on-demand lab, Creating Inference Applications for the Medical AI Project Lifecycle Using MONAI Deploy.

To get started with MONAI Deploy, install the MONAI Deploy App SDK using the following command: 

$ pip install monai-deploy-app-sdk

Numerous MONAI Deploy tutorials are available to help you create simple image processing apps, MedNIST classifier apps, and segmentation apps. Explore more MONAI Deploy resources to support your journey from development to deployment.

To validate your MAPs, download the latest release of MONAI Deploy Express and follow the README instructions. Sample workflows and MAPs for lung and liver segmentation are available, including validation datasets. Execution results can be visualized on Kibana.

Review, adopt, and help further improve the MAP specification. To review designs and requirements or open an issue, visit the monai-deploy-app-sdk GitHub repository.

Discuss (0)