---
title: "2026-09-08 HistoDomainRep v2 taxonomy mismatch in diffsim"
description: "The v2 fine28 sparse label taxonomy is incompatible with gen4ve2e's 13-entry tissue mapping and the dense-ID assumption in domain loading."
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-08 HistoDomainRep v2 taxonomy mismatch in diffsim

## Work Done

- Traced the gen4ve2e failure `tissue mapping length (13) does not match the number of region classes (40)` through `SimStateBuilder` and `domain_from_histo`.
- Inspected two downloaded v2.0 domain representations. Their tissue metadata contains 40 declared classes: 28 base taxonomy IDs `0..27` and 12 grade-specific IDs `128..139`.
- Inspected the failing EE00009 segmentation. It contains 30 active values, including sparse IDs `129`, `131`, `132`, and `133`; the error reports all 40 declared metadata classes, not only active values.
- Verified with git blame that Cedrik added the 13-entry `_tissue_mapping()` in commit `4f84c0c3` on 2026-08-14.

## Lessons Learned: Pitfalls

- Increasing `downsampling_step` cannot repair taxonomy metadata, so the runner's generic retry repeats this deterministic failure.
- Extending `_tissue_mapping()` from 13 to 40 entries is insufficient: `domain_from_histo` indexes the tensor by stored pixel ID, while v2 uses sparse IDs up to 139. The current region-info reader ignores the accompanying `region_ids` metadata and assumes dense IDs aligned with `region_classes`.

## Lessons Learned: Improvements

- Extend `ZarrRegionInfo` to read `region_ids`, validate a lookup table against those IDs, and construct composite names using `mapping[region_id]` rather than zipping class names with the mapping tensor.
- Define and review a semantic mapping from all fine28 base and grade-specific classes into diffsim's six tissue-characteristic groups. Do not assign new anatomy/artifact classes arbitrarily.
- Treat taxonomy incompatibility as non-retryable so a resolution fallback is not attempted.

Source: https://docs.virdx.dev/knowledge/inbox/2026-09-08-diffsim-histodomainrep-v2-taxonomy-mismatch/index.mdx
