Cartoon-started generation and lumen locking (7 September 2026)
Question
Every earlier approach improved cellular detail but never controlled tissue geometry: generated intestinal-metaplasia glands came out solid instead of hollow, and the layout was inherited from whichever real field supplied the conditioning tokens. Two annotation experiments the same day (H01 scaffold repaint, H04 learned three-layer adapter) ended the same way: a rotated mask still produced the reference's arrangement, so appearance conditioning dominated spatial control.
Two mechanisms were tested here: starting generation from a procedural cartoon of the tissue, and forcing the lumen to stay empty by pinning its latent at every denoising step.
Method
- A procedural 3D model of gastric mucosa (
tissue3d.py) lays out gland tubes with hollow lumens, one-cell-thick walls, basal nuclei, goblet vacuoles, stroma and capillaries, then slices the slab at a chosen angle: across gives rings with central holes, along gives paired walls with a channel. It emits a flat H&E-like cartoon plus an exact label map at 0.25 um/px, 4096x2048. pixcell_generate.pygainedregion_img2img. The cartoon supplies the start latent; a real intestinal-metaplasia field supplies only the UNI2-h appearance tokens (token_reference); and after every scheduler step the latent cells labelledlumenare pinned back to the re-noised start latent.- 31 outputs at 4096x2048 across a start-index ladder (12, 9, 6, 3, 0) with and without the lock, plus three different cartoons against one appearance donor, and the same arms with the 2000-step 0.25 um/px LoRA.
Results
Ring-with-lumen fraction: the share of closed epithelial contours that actually enclose a pale lumen, measured with the classical metric built for the two-scale study at matched resolution.
| Start index | Steps | No lock | Lock | Delta |
|---|---|---|---|---|
| 12 | 8 | 0.764 | 0.762 | -0.002 |
| 9 | 11 | 0.922 | 0.894 | -0.028 |
| 6 | 14 | 0.860 | 0.851 | -0.009 |
| 3 | 17 | 0.660 | 0.730 | +0.070 |
| 0 | 20 | 0.579 | 0.680 | +0.101 |
Comparators: real held-out intestinal-metaplasia fields 0.710; the cartoons themselves 0.852; native generation from a real field in the earlier programme 0.592.
The cartoon start, not the lock, is what fixes the topology. Every cartoon-started arm beats the
0.592 of native generation, and the lock adds nothing until the model is regenerating so heavily
(start index 3 and 0) that the cartoon's influence has nearly decayed. Where the lock does help on
the number, it hurts on the eye: it pins the lumen to the cartoon's flat white latent, so the output
carries a hard-edged white oval that reads as a hole punched into tissue rather than a lumen
(ladder-compare.png, panels 2 and 4).
Layout control is established. Three different cartoons rendered against the same appearance
donor produce three structurally different fields, each following its own cartoon's gland positions
(layout-control.png). This is the result H04 could not obtain, and because no real field supplies
the layout, the structure-inheritance problem that blocks the finalist stage does not arise.
The metric and the eye disagree, and the eye is right. Start index 9 scores highest (0.92) but its cells are washed out; start index 0 and 3 score lowest (0.58 to 0.73) and have by far the best cell realism, with crisp basal nuclei and defined epithelial walls. The ring metric rewards pale interiors, so a washed-out image scores well. Treat it as a topology check only, never as quality.
This leaves a real tradeoff: a high start index keeps the cartoon's geometry but produces weak cells; a low start index produces convincing cells but lets the appearance tokens reassert the layout. A follow-up run tests releasing the lock for the last fraction of steps, so geometry is imposed while the layout is being decided and the boundary is finished by the model.
The LoRA hurts here. Fine-tuned arms score 0.68 against 0.76 for the base model at the same setting: trained on real fields, it reproduces the fill-in failure it was trained on.
Boundaries
Engineering evidence only. The ring metric measures topology, not realism. No pathologist has seen these images. The organism stage, rights position and qualification gate are unchanged.
Two-pass generation: the recipe that works (added after the controls)
The tradeoff above is resolved by running the generator twice. Pass 1 starts from the cartoon at start index 12, which fixes the layout but leaves washed-out cells. Pass 2 then uses the pass-1 image as its start latent at start index 6, so the layout carries forward from a realistic image instead of a flat cartoon and the model has 14 steps to render proper tissue.
| Stage | Ring-with-lumen | Cells |
|---|---|---|
| Cartoon | 0.852 | schematic |
| Pass 1, start index 12 | 0.762 | washed out, weak nuclei |
| Pass 2, start index 9 | 0.85 | improved |
| Pass 2, start index 6 | 0.85 to 0.87 | crisp epithelial walls, goblet vacuoles, basal nuclei, fibrous stroma |
| Real held-out fields | 0.710 | - |
See pass2-compare.png. Locking the lumen during pass 2 (P2L) changes little, which is expected:
the geometry is already carried by the pass-1 image rather than by a flat white region.
Correction: what the copy screens do and do not show
An earlier version of this file claimed "0 of 48 tiles nearest their own conditioning field" and
concluded that no tile was nearest any source. That was wrong, and the error was in our own screen:
pixcell_embed_screen.py derived "own source" by parsing the output filename for a
hiesd-<slide>__<category>__<x>_<y> stem, which the two-pass filenames do not contain, so the count
was forced to zero for every candidate. The comparison figure quoted for the earlier cohort was also
wrong (71 of 80, not 63 of 80). The screen now takes the conditioning reference from the run's
records instead of the filename.
Recomputed honestly over the 20 two-pass images of the full set:
| Screen | Ten original candidates | Two-pass full set |
|---|---|---|
| phikon-v2 max cosine (copies 0.98, unrelated real fields 0.66) | 0.80 to 0.91 | 0.79 to 0.89 |
| Tiles whose nearest reference is the field that conditioned them | 71 of 80 (89%) | 140 of 160 (88%) |
| Pixel cross-correlation against the conditioning field (copies >0.99, threshold 0.92) | max 0.84 | max 0.53 to 0.76, nothing flagged |
So the appearance donor remains the nearest reference for most tiles, essentially unchanged. That is expected rather than alarming: each 1024 window is conditioned on the same-position window of the donor, so this measures appearance, which the donor is there to supply. It is not evidence about layout, and it does not by itself clear the finalist-stage concern.
The claim that survives is narrower and rests on two other pieces of evidence: three different
cartoons rendered against one donor produce three different tissue structures (layout-control.png),
and the pixel search finds no copied region at any offset. Layout is set by the procedural model;
appearance is borrowed from a public field. For the finalist stage that distinction still has to be
argued on the layout-control experiment, not on the embedding screen.
Recipe
render_cartoon.py --category {normal,hpylori_gastritis,intestinal_metaplasia,mixed} --cut {across,along,oblique} --seed N- Pass 1:
pixcell_generate.pyimg2img, reference = cartoon,token_reference= a real field of that category, start index 12. - Pass 2: img2img, reference = the pass-1 output, same
token_reference, start index 6, different seed. - For the two H. pylori categories, add organisms with
pixcell_hp_stage.py --renderer surface.
Still open: no pathologist has reviewed these; the ring metric measures topology and not realism; category presets for normal, gastritis and mixed are rendered but not yet generated through the two passes; and the rights position is unchanged.
Correction (8 September): the lock-release arm never ran
The release jobs (R_*_rel25, R_*_rel40, R_*_rel60) in retrieved/out/records.jsonl have output
SHA-256 values identical to the plain lock job at the same cut and start index (K_across_si3,
K_across_si0, K_along_si3, K_along_si0): four distinct images account for all twelve release
outputs. The lock_release parameter therefore never reached the sampler in the retrieved run, and any
number quoted for "releasing the lock for the last fraction of steps" (release-ring.json) describes the
plain lock, not a release schedule. Found by the morphometric-envelope package of the 8 September
programme (operations/research/sgh-program-20260908/C1_RESULT.md). The two-pass recipe does not depend on
the lock or its release, so the recipe's results stand.
Correction (8 September, evening): layout control does not survive pass 2
The layout-control result above (layout-control.png) was measured on light-repaint outputs (start
index 12), where it holds. The 8 September sweep measured cartoon retention directly, as the IoU between
each output's lumens and its own cartoon's lumen label map (ceiling about 0.60 for a perfect render):
pass 1 (start index 12) 0.54; pass 2 at start index 9: 0.13; at 6 (the recipe): 0.08; at 3: 0.06. In the
5-cartoon x 4-donor factorial, pass-2 outputs made from the same donor and different cartoons are
near-copies of each other (SSIM 0.87) while outputs from the same cartoon and different donors share
nothing (0.50); at pass 1 the relationship is reversed (0.87 vs 0.30). The two-pass recipe therefore
does NOT deliver layout independence: the donor's token grid re-imposes the donor's layout during pass 2,
and the pass-1 image only anchors it while the repaint is light. The high ring fractions of the two-pass
IM outputs are real, but the rings are the donor's, not the cartoon's. Evidence:
operations/research/sgh-program-20260908/EVAL_RESULT.md section (c) and
packages/sweep-v1/eval/headline.json (cartoon_layout_iou_by_arm, d1).