How vendenix/brainmetasegmentatorui-front works
The SegmentationUI project is the front-end part of a system designed to empower an OHIF Viewer–based interface to drive a deep learning model (built on UNETR) for the segmentation of brain metastases. The overall architecture enables radiotherapists to interact with DICOM data in a web-based viewer, launch segmentation processes via backend APIs, and then view and manage segmentation outputs and patient tracking results.
Main Components
• Client (Web Browser/UI):
– The OHIF Viewer-based interface (the “Viewers-3.7.0” folder contains the editor, extensions, patient tracking and measurement modules).
– Custom extensions such as the MetIA extension, segmentation modules (e.g., for RTStruct creation or modification), patient tracking interface, and deep learning launch control.
• API Integration Layer in Front-end:
– Modules (often under “platform/app” and “extensions”) abstract communication with the back-end REST endpoints.
• Back-end API (external component – note that its repository is linked in the README):
– A REST API (likely built with Flask) to process DICOM data and control the deep learning segmentation.
– A PACS / Orthanc DICOM Web Server backend (possibly deployed via Docker, as described).
• Supporting Infrastructure:
– Node.js server-side code (in server.js) that can serve a production build (from “platform/app/dist”).
– Build and configuration tools (yarn/npm, webpack, Docker configuration files, CI/CD scripts, etc.).
Relationships and Interactions
– The Client (browser) interacts with the OHIF Viewer and its embedded custom segmentation modules. When the user initiates segmentation of a study or selects a patient for tracking, the front-end modules make API calls to the back-end.
– The API integration layer in the front-end handles these calls – retrieving DICOM studies, initiating deep learning inference, and receiving segmentation results (such as RTStruct data).
– The back-end completes the heavy lifting by running the UNETR segmentation algorithm on DICOM images. It then returns results that the front-end uses to update the viewer.
– The server.js component acts as the gateway for production deployments to serve static assets and handle any express-based routing for development.
– Additional modules in “platform” and “extensions” likely facilitate configuration management, routing in different “modes” (e.g., segmentation, longitudinal studies, microscopy) and the integration of patient tracking features.
Architectural Patterns & Principles
– Modular Design: The project is divided into well-defined directories for “extensions”, “modes”, “platform/core” and “platform/ui”. This suggests a component-based and plugin-oriented architecture where new functionalities (for example deep learning segmentation, patient tracking) are added as extensions.
– Separation of Concerns: The front-end strictly deals with visualization and user interactions while delegating segmentation computations and data persistence to external back-end services.
– API-Driven Integration: Calls from the web client via REST APIs ensure a clean decoupling between the UI and backend services (Orthanc server, Flask API).
Technologies & Frameworks
– OHIF Viewer (customized): Built on React, with many components in the “platform/ui” and “extensions”. It is enhanced with extensions to support segmentation, measurement, and patient tracking.
– Node.js with npm/yarn for dependency and build management.
– Docker (in the backend documentation) to deploy Orthanc, nginx, and the Flask API.
– Deep learning model based on UNETR implemented in PyTorch (though that resides on the backend side).
• Clear labels for each major component (Client/UI, API Integration, Back-end API, DICOM Web Server).
– User actions initiating API calls from the viewer.
– API responses updating state and UI components.
– Client-side components (React/JavaScript modules)
– Server-side services (Node.js, Express)
– External services (DICOM Web Server, Dockerized back-end API)