A comprehensive system for DICOM classification, sorting, anonymization, and BIDS export
Developed at Karolinska Institutet
Department of Clinical Neuroscience, Neuroradiology
NILS classifies MRI series using six orthogonal axes, each backed by its own YAML-driven detector:
| Axis | Description | Examples |
|---|---|---|
| Base | Contrast weighting | T1w, T2w, PD, DWI, BOLD, SWI |
| Technique | Pulse sequence family | MPRAGE, TSE, FLASH, EPI, GRASE |
| Modifier | Acquisition enhancements | FLAIR, FatSat, MT, IR, PhaseContrast |
| Construct | Derived/map type | ADC, FA, T1Map, QSM, CBF, MyelinMap |
| Provenance | Processing pipeline | SyMRI, SWIRecon, DTIRecon, EPIMix |
| Acceleration | Parallel imaging | GRAPPA, SMS, CAIPIRINHA, CompressedSensing |
Specialized branch pipelines handle multi-output acquisitions (SWI, SyMRI, EPIMix/NeuroMix, MP2RAGE) — provenance detection runs first and routes to the correct branch.
- Extraction — Import DICOM metadata with adaptive batching and per-instance stack creation
- Sorting — 4-step pipeline: Checkup → Stack Fingerprint → Classification → Completion
- QC Review — Draft-based quality control with Cornerstone.js DICOM viewer and rules engine
- Anonymization — De-identify with configurable ID strategies and compression
- BIDS Export — Self-describing filenames, cross-cohort resolution, field strength filtering
- CSV import for subjects, events, diseases, observation types, and identifiers
- Longitudinal tracking: link imaging sessions to diagnoses and clinical timelines
- Preview/validate before applying any import
- Docker & Docker Compose
- 4GB RAM minimum (8GB recommended)
# Clone the repository
git clone https://github.com/NeuroGranberg/NILS.git
cd NILS
# Start services with your DICOM data
./scripts/manage.sh start --data /path/to/your/dicom/data
# Access the web interface
open http://localhost:5173| Mode | Command | Access |
|---|---|---|
| Default | start |
Localhost only (secure) |
| External | start --forward |
Network/Tailscale accessible |
Full documentation available at: neurogranberg.github.io/NILS
- Concepts - Core data models and terminology
- Cohort Operations - Extraction, Sorting, Anonymization, Export
- Classification - The six-axis detection system
- QC & Viewer - Quality control and image review
| Option | Description |
|---|---|
--data PATH |
Mount DICOM directory (can specify multiple) |
--forward |
Expose ports externally (default: localhost only) |
--clean |
Remove containers and volumes before starting |
--db-dir PATH |
Override database storage directory |
--podman |
Use Podman instead of Docker (adds :Z SELinux labels) |
# Start with localhost access (default - secure)
./scripts/manage.sh start --data /srv/dicom
# Mount multiple data directories
./scripts/manage.sh start \
--data /srv/dicom/ct \
--data /srv/dicom/mr
# Clean start with network access
./scripts/manage.sh start --clean --forward --data /srv/dicom
# Stop services
./scripts/manage.sh stopSSH tunnel (recommended for default mode):
ssh -L 5173:localhost:5173 user@server
# Then open http://localhost:5173 locallyTailscale (with --forward mode):
http://your-server.ts.net:5173
Environment variables in .env:
| Variable | Description |
|---|---|
APP_ACCESS_TOKEN |
Secret key for login protection |
DB_DATA_DIR |
Database storage directory |
METADATA_DB_DATA_DIR |
Metadata database directory |
┌───────────────────────────────────────────────────────┐
│ Docker Network │
│ ┌──────────┐ ┌───────────┐ ┌───────────────────┐ │
│ │ db │ │ metadata │ │ backend │ │
│ │ postgres │ │ db │ │ FastAPI + Async │ │
│ └──────────┘ └───────────┘ └───────────────────┘ │
│ │ │ ▲ │
│ │ │ ┌────────┴────────┐ │
│ └──────────────┘ │ frontend │ │
│ Dual Database System │ Vite + React │ │
│ (app state + DICOM metadata)│ + Cornerstone │ │
│ └─────────────────┘ │
└───────────────────────────────────────────────────────┘
# Frontend unit tests
./scripts/manage.sh test-frontend
# Backend unit tests
./scripts/manage.sh test-backendMIT License - see LICENSE file.
If you use NILS in your research, please cite:
Chamyani, N. (2025-2026). NILS - Neuroimaging Intelligent Linked System. Karolinska Institutet, Department of Clinical Neuroscience. https://github.com/NeuroGranberg/NILS
Karolinska Institutet, Department of Clinical Neuroscience, Neuroradiology