nnU-Net 3D Medical Image Segmentation
Open source Next.js and FastAPI sample that runs real nnU-Net 3D medical-image segmentation on CT/MRI volumes and stores raw volumes, preprocessed tensors, masks, and the trained model checkpoint on Backblaze B2 over the S3-compatible API.
Built for: Developers and AI coding agents evaluating Backblaze B2 as the storage backbone for a 3D medical-imaging or segmentation pipeline.

What it's built with
Each piece of the stack, and the job it does in this project.
- Next.js 16 + React 19
- Web application and dashboard UI
- Tailwind CSS v4 + shadcn/ui
- Design tokens and reusable interface primitives
- TanStack Query
- Client-side data fetching, caching, and retry
- FastAPI + Pydantic v2
- Typed Python API and configuration validation
- nnU-Net v2 (nnunetv2) + PyTorch
- The real 3D segmentation engine
- nibabel / pydicom / SimpleITK + Pillow
- Volume I/O and mid-slice rendering
- boto3 + Backblaze B2
- S3-compatible object storage access
- pnpm workspaces
- TypeScript and Python monorepo workflow
Core capabilities
What the project does out of the box, before you write any code of your own.
Real nnU-Net segmentation
Pick an ingested volume, run real nnunetv2 inference, and get a NIfTI mask plus a mid-axial-slice overlay preview. There is no thresholding or mock fallback: an empty or missing model fails the run rather than faking a mask.
The model lives on B2
A genuine short nnU-Net training run at seed time mints the checkpoint, which is archived to B2 and pulled on demand so any host can serve inference without re-training.
Every artifact on B2 over the S3 API
Raw volumes, preprocessed tensors, masks, and the checkpoint all land on Backblaze B2 through the S3-compatible API with a custom user agent. B2 is the only store, with no separate database.
Two explorers and a dashboard
A domain-scoped Volumes view with server-rendered mid-slice thumbnails, a full-bucket file browser, and a dashboard of cohort metrics and storage by artifact type.
Full segmentation-job lifecycle
Create, read, edit, delete, and re-run segmentation jobs, each stored as a B2 JSON record, with honest staged progress reported during the run.
A closer look
More screens from the running project.



Choose it for the right job
nnU-Net 3D Medical Image Segmentation is a head start for a specific shape of project, not a supported, general-purpose product.
Use it when
- You want to evaluate Backblaze B2 as the single store for a write-amplifying imaging pipeline that ingests, preprocesses, trains, segments, and serves.
- You need a working end-to-end example of real nnU-Net 3D CT/MRI inference producing a NIfTI mask and a mid-slice overlay, not a mock.
- You want the trained model checkpoint to live on object storage so any host can serve inference without re-training.
- You are scaffolding a segmentation app with an AI coding agent and value a CPU-only demo that trains and infers in minutes.
Choose another path when
- You need a hosted, validated clinical product: this has no authentication, no tenant isolation, and no clinical validation or regulatory clearance.
- You want to point it at real patient data as-is; the demo segments a synthetic lesion and you must add auth, per-tenant scoping, and PHI governance first.
- You need the nnU-Net API to run serverless; torch and nnU-Net exceed serverless size and RAM limits and need real, optionally GPU, compute.
- You only need generic file uploads and object storage without any ML, in which case the Vibe Coding Starter Kit is a simpler fit.
Project status and support
Report defects through the repository's GitHub Issues; this open source sample has no service-level agreement and no guaranteed support.