Open Science · Diffusion MRI · Microstructure Imaging

Physics is
the specification.
Code is the proof.

Diffusion MRI can see inside living tissue without a scalpel — inferring axon diameters, membrane densities, soma permeability from the motion of water molecules. dmrai-lab is building the infrastructure this field deserves: open, validated, reproducible, from simulation to compendium.

Brain dissolving into diffusion MRI microstructure geometry

Packages

Active
dmipy-fit
JAX-native model inference across the full landscape of compartment models. Amortized inference, Rician noise floor modeling, and explicit scope boundaries characterized against Monte Carlo ground truth.
JAX amortized inference Rician noise T1/T2 relaxation
Active
dmipy-sim
Monte Carlo diffusion MRI simulator validated against Disimpy and MISST. Substrate generation, gradient waveforms, and synthetic signal output for ground-truth benchmarking.
Monte Carlo substrates Disimpy validated MISST validated
Active
dmipy-design
Acquisition waveform optimization that closes the loop between what we can measure and what we claim to measure — incorporating both analytical sensitivity and Monte Carlo-derived bias simultaneously.
waveform optimization sensitivity analysis bias characterization b-tensor
In development
dmipy-compendium
A living, machine-readable knowledge graph of validated diffusion MRI protocols, models, and results. Every node carries its physical assumptions, scope boundaries, and Monte Carlo evidence.
knowledge graph reproducibility SANDI machine-readable

Vision

The goal is not a faster fitting tool — it is the living compendium of everything diffusion microstructure imaging knows.

dmrai-lab is the revival and extension of dmipy, originally published in Frontiers in Neuroinformatics (2019). We are rebuilding it from the ground up: a JAX fitting engine grounded in biophysical compartment models, a Monte Carlo simulator for ground-truth validation, an acquisition design tool that closes the loop between measurement and claim, and a compendium that makes every validated protocol and result machine-readable and citable.

Our north star: a scientist anywhere in the world should be able to describe a tissue model, find the canonical validated protocol for it, simulate it, fit it, and reproduce the result — in a single afternoon.

The bottleneck was never intelligence. It was infrastructure.

Physics is the Specification  ·  A manifesto for machine-verifiable diffusion MRI science  ·  dmrai-lab  ·  May 2026  ·  v0.1

Diffusion MRI can see inside living tissue without a scalpel. It can infer the diameter of an axon, the density of cell membranes, the permeability of a soma wall — all from the way water molecules move. This is one of the most remarkable capabilities in modern medicine.

And the field has been working without the infrastructure it deserves.

Not for lack of trying. The scientists who built this field are rigorous, inventive, and deeply committed to getting it right. Validation has happened — but bespoke, each group building its own simulation, its own ground truth, its own interpretation of what the model should recover. Brilliant work, done in isolation, with tools that were difficult to build and harder to share. The supporting code is often unpublished, the methodology unreproducible not by choice but by circumstance. What survives in the literature is the claim. What does not survive is the chain of evidence behind it.

The result is a field where the same model can be validated six times in six different ways, with six different simulators, producing six subtly different answers — and no shared language to reconcile them. Where scope boundaries exist in the author's intuition but not in the publication. Where a protocol validated for one tissue type migrates quietly into another without anyone having established whether it should.

This is not a failure of the people. It is a failure of infrastructure. And infrastructure is exactly what has become possible to build.

The solution is not more papers. The solution is infrastructure.

The specification exists.

Physics governs water diffusion in biological tissue completely and without ambiguity. The Bloch-Torrey equation is not a hypothesis. Brownian motion in restricted geometries is not a conjecture. These are the specification. Everything else — every model, every protocol, every clinical claim — is an implementation that either satisfies the specification or does not.

Monte Carlo simulation is the compiler. Given a substrate geometry, a permeability, a relaxation time, and an acquisition waveform, simulation produces ground truth signal with no approximation beyond the physical assumptions themselves. It does not negotiate with analytical convenience. It does not care about publication deadlines.

A claim that cannot survive Monte Carlo validation within its stated scope is not a validated claim. It is a hypothesis.

dmrai-lab is building the infrastructure to make this distinction enforceable.

dmipy implements three nodes of one closed loop: simulation — Monte Carlo substrate generation and signal synthesis, grounded in biologically cited parameter distributions; fitting — JAX-native model inference with explicit scope boundaries and bias characterization against ground truth; and design — acquisition waveform optimization that incorporates both analytical sensitivity and Monte Carlo-derived bias simultaneously, closing the loop between what we can measure and what we claim to measure.

This is not three tools. It is one pipeline. The same substrate that generates training data also validates the model that fits it and constrains the waveform that acquires it.

The compendium is the output.

Every validated result produced by this pipeline becomes a node in a public, machine-readable knowledge graph. Each node carries its physical assumptions, its scope boundaries, its Monte Carlo evidence, and its dependency on every node above it in the chain. A reader can trace any claim backward to the physics that supports it — or discover that no such chain exists.

This is not a database. It is a formal epistemological framework. The first one this field has had.

This is what the AI era makes possible.

A single researcher with the right stack can now implement, simulate, validate, and publish results that previously required a laboratory, a cluster, and a team. The bottleneck was never intelligence. It was infrastructure.

dmrai-lab is one researcher and a physics engine. The physics does not care about affiliation. We are building in the open. The code is public. The compendium is public. The validation pipeline is reproducible by anyone with a GPU and a pip install.

If your model survives the compiler, it survives. If it does not, the compiler tells you exactly why, and you can fix it. That is how software has worked for fifty years. It is time for science to catch up.

Physics-Grounded Agent Development  ·  How dmipy is built  ·  dmrai-lab

The hallucination problem has a physical solution.

dmipy is built agent-first: the majority of implementation work is done by AI agents operating autonomously across simulation, fitting, and design. This makes extraordinary velocity possible — but it introduces a failure mode that cannot be ignored. An agent can write code that is internally consistent, passes its own tests, and is completely wrong. The fix is not better prompts. The fix is physics.

Every feature in the dmipy ecosystem must satisfy success conditions stated entirely in physical terms — conditions that can be verified from two completely independent directions. Agreement between those directions is not a unit test. It is a proof.

Two paths to the same answer, derived from different first principles. If they agree, the implementation is correct. If they disagree, the physics tells you exactly where to look.

Direction one: the analytical equation.

For every physical phenomenon modelled in dmipy, the field has derived closed-form solutions under well-defined assumptions. The Kärger model gives the exchange signal for permeable membranes as a function of permeability κ and diffusion time. The van Gelderen / Neuman solutions give the restricted diffusion signal inside cylinders and spheres as a function of radius, intrinsic diffusivity, and the acquisition parameters δ, Δ, and q derived from the gradient waveform. These equations encode decades of physical intuition. They are exact — within the regime for which they were derived.

An agent implementing, say, the cylinder restriction model receives the analytical signal equation as its specification. The implementation must reproduce it. If it does not, the agent has hallucinated something — regardless of how plausible the code looks.

Direction two: Monte Carlo from G(t).

The second direction makes no approximations beyond the physical substrate itself. Given a geometry — a packed array of cylinders, a sphere, a permeable membrane — and a free gradient waveform G(t), Monte Carlo simulation propagates thousands of spins through that geometry via Brownian motion, accumulates their phase under the applied field, and reads out the echo signal. No analytical shortcuts. No assumption about pulse shape. G(t) is the input in full.

This is a completely different computational path. It does not know the analytical equation exists. It does not care whether δ and Δ are well-defined for the waveform being tested. It just runs the physics.

Convergence is correctness. Divergence is knowledge.

When the analytical equation and Monte Carlo agree — across substrate geometries, diffusion times, b-values, and waveform shapes — the implementation is validated. Not just tested: validated against physical ground truth from two independent directions. Any AI-introduced error that survives one direction is extremely unlikely to survive both.

When they diverge, something more valuable than a passing test emerges: a precise characterisation of the analytical equation's scope boundary. The Kärger model breaks down at short exchange times. The Neuman cylinder solution breaks down at high b-values and non-PGSE waveforms. Monte Carlo does not break down — it simply reflects the physics of that regime. Mapping where the analytical solution departs from Monte Carlo ground truth is not a validation failure. It is a scientific result: the exact envelope within which a published model is trustworthy, encoded directly into the compendium.

This is the architecture that makes agent development safe.

Each feature ships with a physics-grounded benchmark: a set of parameter regimes where analytical and Monte Carlo must agree to within a stated tolerance, and a set of departure curves that characterise the boundary beyond it. An agent that hallucinates an implementation will fail the benchmark. An agent that ships a correct implementation extends the compendium. The physics enforces the standard. The agents do the work.

In practice, the heavy lifting across the entire dmipy ecosystem — simulation engine, fitting framework, acquisition design, tractography, preprocessing, and compendium pipeline — has been done by agent teams running Anthropic's Claude Sonnet 4.6. The role of the human researcher is to set direction, state the physics, and hold the agents accountable to it. This is not a workflow where AI assists. It is a workflow where AI builds and physics audits.


About

Dr. Rutger Fick

dmrai-lab is a one-person project. The researcher behind it has spent a decade publishing in diffusion MRI microstructure imaging — acquisition design, compartment modelling, Monte Carlo validation — and a parallel decade building AI products. dmrai-lab is where those two trajectories converge: the domain knowledge to know what the physics requires, and the engineering background to build the infrastructure that enforces it.


Collaborators

Technical University of Denmark · Copenhagen