---
title: "2026-09-18 NanoVirDx DiffSim inference demo"
description: "Implemented and ran a path-backed DiffSim inference flow from a real vxData histology domain representation."
image: "https://docs.virdx.dev/img/virdx-social-card.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.virdx.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 2026-09-18 NanoVirDx DiffSim inference demo

## Work Done

- Compared the new `packages/nanovirdx` skeleton with Factory, eval-service, and DiffSim's `gen4ve2e` application.
- Kept DiffSim sourced from the internal Artifactory channel and updated NanoVirDx to `diffsim >=0.1.98,<0.2` on Python 3.12 for macOS ARM and Linux.
- Implemented `DomainRepresentationBatch.from_vxdata`: it retrieves each domain representation, resolves its linked tissue, cell, Gleason, and structure-tensor maps, and downloads those S3 resources through the real vxData SDK.
- Implemented `DiffsimSimulator` with lazy setup, CPU/CUDA/MPS selection, histology-domain loading compatible with current OME-Zarr domain representations, DWI b100/b1000 and T2 simulation, deterministic postprocessing, NIfTI output, and derived ADC output.
- Ran the end-to-end adapter and simulator on `histodomainrep/EZ01050/6E.1_4_17_175003/preprocessed/component_0/v2.0` on macOS Metal. A fast demo used 1,000 walkers and 128x histology downsampling and returned a valid `BPMRIBatch`.

## Lessons Learned: Pitfalls

- Artifactory `diffsim 0.1.98` predates the `gen4ve2e` branch's newer `domain_from_histo` API. A downstream Git dependency is not appropriate; the small missing adapter can be implemented against the released `Domain` API.
- `virdx_ome.ZarrImage.resolution` for current histology domain representations is in micrometers per pixel. DiffSim domain voxel sizes are SI meters, so the adapter must multiply by `1e-6`.
- Current v2.0 domain representations use the fine28 taxonomy plus graded IDs 128-139, while the reference app's old mapping only covers 13 labels. A current mapping is required before simulation.
- PyTorch MPS does not implement `adaptive_max_pool3d`; foreground-mask pooling must run on CPU and move back to the selected device.

## Lessons Learned: Improvements

- DiffSim should publish its current histology-domain adapter and a documented tissue-taxonomy mapping so downstream inference code does not duplicate scientific policy.
- The knowledge base needs a DiffSim inference SOP that records supported package versions, OME resolution units, current tissue label IDs, standard sequence settings, and a small smoke-test configuration.
- NanoVirDx needs explicit package targets/tests once its skeleton allows additional project files; the current package has no `project.json` or test files.

Source: https://docs.virdx.dev/knowledge/inbox/2026-09-18-diffsim-nanovirdx-inference-demo/index.mdx
