A web UI for running MRtwo reconstructions. Upload data, pick an algorithm, get results. Uses Huey for background jobs so you can queue up work and come back later.
# Everything (API + worker + frontend)
uv run dev
# Just API + worker (no frontend dev server)
uv run prodThen open http://localhost:5173 (dev) or http://localhost:8000 (prod).
![]() |
![]() |
| New job | Result |
You POST a file to /api/jobs with algorithm parameters. The backend:
- Saves your input file
- Creates a job record (JSON on disk)
- Enqueues it with Huey
- Returns a job ID
The worker picks it up, runs the reconstruction, writes an H5 file, and updates the job status. The frontend polls job status and displays results.
Key files:
mrui/main.py- HTTP APImrui/jobs.py- Worker task that runs reconstructionsmrui/algorithms/- Algorithm definitions and registrymrui/storage.py- Reading/writing job metadata
Add your reconstruction to mrui/algorithms/:
- Pick an ID in
mrui/algorithms/base.py(AlgorithmIdenum) - Create
mrui/algorithms/yours.py:class YourParams(AlgorithmParamsBase): algorithm: Literal[AlgorithmId.YOURS] = AlgorithmId.YOURS your_param: float = 0.5 class YourAlgorithm(ReconstructionAlgorithm[YourParams]): id = AlgorithmId.YOURS name = "Your Reconstruction" description = "Does the thing" params_model = YourParams def run(self, task, kdata, params): # Reconstruct here, return IData ...
- Register it in
mrui/algorithms/__init__.py:ALGORITHMS = ( ... YourAlgorithm(), )
- Add frontend UI in
frontend/src/components/algorithms/YoursForm.tsxand register inregistry.ts - Run
npm run typegeninfrontend/to update types from the backend schema
All env vars start with MRUI_:
| Variable | Default | What it does |
|---|---|---|
MRUI_HOST |
0.0.0.0 |
API bind address |
MRUI_PORT |
8000 |
API port |
MRUI_INPUTS_DIR |
/tmp/mrui/inputs |
Where uploaded files go |
MRUI_RESULTS_DIR |
/tmp/mrui/results |
Where results and job metadata go |
MRUI_QUEUE_DB_PATH |
/tmp/mrui/queue/huey.db |
Huey SQLite database |
MRUI_API_WORKERS |
1 (dev) / 2 (prod) |
Uvicorn workers |
Backend:
uv run ruff check . # Lint
uv run pyright mrui # Type check
uv run pytest # Run testsFrontend:
cd frontend
npm run typegen # Regenerate API types from backend
npm run lint # ESLint
npm run build # Production build
