LabelStack is a prototype medical image annotation platform that helps healthcare professionals and researchers analyze and manually label medical images. It provides tools for viewing different types of medical images (like X-rays, CT scans, and MRIs), adding detailed annotations, and managing annotation tasks within a team. The platform makes it easy to store, access, and work with medical images while keeping track of all labeling work in an organized way.
The platform enables administrators to assign and monitor tasks while annotators focus on labeling work. Key features include image manipulation tools, annotation capabilities, and task management. This prototype demonstrated core functionality but is no longer actively maintained.
LabelStack provides medical image viewing capabilities that support most of DICOM modalities including X-Ray (CR, DR), Computed Tomography (CT), Magnetic Resonance Imaging (MRI) and Ultrasound. Users can view images in multiple configurations with single, two, or three slice views, as well as 3D visualization. The viewer includes image manipulation tools such as window/level adjustment for optimal contrast, pan, zoom, slice navigation and image inversion.
The platform offers a set of annotation tools designed for precise medical image marking. Users can create annotations using a brush tool for freehand marking, a polygon tool, or a spline tool for curved structure annotation. To ensure work is never lost, the system includes an auto-save feature.
The platform has a simple management application where admins can manage tasks, labels, users and images. Regular users with "annotator" role can manage and launch assigned tasks.
The main screen shows a list of all tasks where admins can create and assign them to users through a simple form. They can edit multiple tasks at the same time and see how each task is progressing. The system allows setting task importance and due dates, and users can find specific tasks using search boxes and filters.
Users can create new labels and assign them directly to selected images. Administrators can add new users to the system and set what they're allowed to do. Admins can see what work users are doing and track how much work each person completes. The management screen uses clear menus that are easy to understand.
The platform integrates with DICOM systems through DICOMweb support, providing native compatibility with medical imaging standards. It includes built-in integration with the Orthanc PACS server for efficient image storage and retrieval. Users can view and access DICOM metadata directly within the interface, while the system maintains efficient image loading and caching mechanisms to ensure smooth performance.
- DICOM images are uploaded to the Orthanc PACS server
- Images are stored with their metadata and can be accessed within the application
- Task administrator creates a labeling task and assigns it using annotation application or assings a label directly to selected group of images
- Label assignments are created for:
- Specific image instances
- Image series
- Label task workflow:
- Unassigned → Open → In Progress → Done
- Tasks can be cancelled at any stage
- Each label assignment includes:
- Reference to the image instance
- Label definition
- Task administrator creates an annotation task
- Task is assigned to one annotator
- Task status follows the workflow:
- Unassigned → Open → In Progress → Done
- Tasks can be cancelled at any stage
- Each task includes:
- Task metadata (name, description, priority)
- Assigned user
- Associated image instances or previously created label assignments
- Annotator opens the task in the viewer interface
- Available tools for annotation:
- Brush tool for freehand annotations
- Polygon tool for precise boundary marking
- Spline tool for curved annotations
- Annotations are saved with:
- Version control
- Time tracking
- Author information
- Associated metadata
- Auto-save feature ensures work is not lost
- Task administrator creates a review task for completed annotations
- Review task workflow:
- Unassigned → Open → In Progress → Done
- Each annotation requires review
- Reviewers can:
- Accept annotations as is
- Request corrections
- Add comments
- Review results:
- Accepted annotations are marked as final
- Denied annotations require correction and new version
- Review history is maintained with sequence numbers
React.js | TypeScript | VTK.js | Cornerstone.js | TailwindCSS | Webpack
FastAPI (Python) | PostgreSQL + SQLAlchemy | Orthanc
Docker Compose | Traefik
labelstack/
├── backend/ # FastAPI backend service
│ └── app/
│ ├── api/ # API endpoints and routes
│ ├── core/ # Core configurations and business logic
│ ├── crud/ # Database CRUD operations
│ ├── models/ # Database models
│ ├── schemas/ # Pydantic schemas for data validation
│ ├── resources/ # Static resources and constants
│ └── utils/ # Utility functions
├── webapp/ # Frontend monorepo
│ └── packages/
│ ├── app/ # Main application package
│ ├── viewer/ # Medical image viewer component
│ ├── annotator/ # Annotation tools and functionality
│ └── api/ # Frontend API client
├── pacs/ # Orthanc PACS server configuration
├── database/ # Database initialization utilities
└── docker-compose.yml # Container orchestration
The frontend is organized as a monorepo using Lerna, with the following key components:
- App Package: Core application package handling routing and main application logic
- Viewer Package: Medical image viewer component with:
- Multiple view modes (slice, volume)
- Image manipulation tools
- DICOM image handling
- Annotator Package: Extends Viewer with tools and features required for doing tasks
- API Package: Frontend API client for backend communication
The backend follows a clean architecture pattern with:
- API Layer: FastAPI endpoints and route handlers
- Service Layer: Business logic and data processing
- Data Layer: Database models and CRUD operations
- Core Layer: Application configuration and shared utilities
- Docker and Docker Compose
- Node.js and Yarn
- Python 3.x
To set up the development environment:
-
Clone the repository and set up environment variables:
cp .env.example .env # Modify .env with your configuration
-
Launch the development containers using VSCode:
- Run the
[DEV] Launch dev containers
task - This will start all required services
- Run the
-
Initialize the database:
- Run
[DEV] Migrate database
task to create schema - Run
[DEV] Wipe and init database
task to populate initial data
- Run
The following services will be available:
Service | URL | Description |
---|---|---|
Web UI | https://localhost |
Main application interface |
API Docs | https://localhost/api/v1/docs |
Swagger API documentation |
PACS UI | https://localhost/pacs/app/explorer.html |
Orthanc DICOM server interface |
Traefik | http://localhost:8080/dashboard#/ |
Reverse proxy dashboard |
There is support for a production setup, but it was not tested. [PROD] Launch prod containers
will build webapp and serve with nginx and start backend using uvicorn.
Ctrl+Z
: UndoCtrl+Y
orCtrl+Shift+Z
: RedoAlt+=
: Increase tool sizeAlt+-
: Decrease tool sizeD
: Draw modeE
: Erase modeAlt+S
: Save→
: Next image←
: Previous imageI
: Invert colorsB
: Activate brush toolP
: Activate polygon toolS
: Activate spline tool