pherc0175a-lasagna / README.md
SharpMeow's picture
Card: stream the field by URL from the public bucket
468ec0a verified
|
Raw History Blame Contribute Delete
4.68 kB
---
license: cc-by-nc-4.0
tags: [vesuvius-challenge, herculaneum, ct, lasagna, ome-zarr]
pretty_name: PHerc0175A lasagna field (villa predict3d)
---
# PHerc0175A lasagna field
villa's lasagna `predict3d` output for the whole PHerc0175A scan, in villa's own layout, so you can point
lasagna or the spiral fit at it without running the model yourself.
[![cos and surface normals, a slice through the middle of the scroll](preview-xy.png)](https://huggingface.co/spaces/SharpMeow/umbilici?mode=lasagna&scan=PHerc0175A&z=6400)
See the same height in 3D, with the center line and the normals, in the [Umbilici Space](https://huggingface.co/spaces/SharpMeow/umbilici?mode=lasagna&scan=PHerc0175A&z=6400) (its sheet
at z 6,400; this preview is at z 6,372).
## Get it
```bash
hf download SharpMeow/pherc0175a-lasagna --repo-type dataset --local-dir pherc0175a-lasagna
cd pherc0175a-lasagna && sha256sum -c SHA256SUMS
for f in parts/*.tar; do tar -xf "$f"; done
tar -xf PHerc0175A-lasagna-pyramid-fix.tar # last: joins the level-4 pyramid across tiles
```
You end up with `PHerc0175A.lasagna.json` and `PHerc0175A_{cos,grad_mag,nx,ny}.ome.zarr`.
## Load it
```python
import numpy as np
import zarr
cos = zarr.open("PHerc0175A_cos.ome.zarr/1", mode="r") # every 2nd scan voxel
nx = zarr.open("PHerc0175A_nx.ome.zarr/2", mode="r") # every 4th scan voxel
ny = zarr.open("PHerc0175A_ny.ome.zarr/2", mode="r")
z, y, x = 1536, 6000, 4608 # full-resolution scan voxels
patch = cos[z // 2, y // 2 - 256:y // 2 + 256, x // 2 - 256:x // 2 + 256]
a = (float(nx[z // 4, y // 4, x // 4]) - 128) / 127 # normals are stored as uint8, v * 127 + 128
b = (float(ny[z // 4, y // 4, x // 4]) - 128) / 127
c = np.sqrt(max(0.0, 1 - a * a - b * b)) # nz is not stored
```
`load_example.py` is a runnable version of this snippet; it was run on the real parts before upload.
## Stream it, no download
The same field, unpacked, is in the public bucket
[SharpMeow/lasagna-fields](https://huggingface.co/buckets/SharpMeow/lasagna-fields) under `PHerc0175A/representations/predictions/lasagna/20250521115057-lasagna-de45f011/`, so any zarr reader
can open it by URL:
```python
import zarr # zarr 3, with fsspec and aiohttp
base = "https://huggingface.co/buckets/SharpMeow/lasagna-fields/resolve/PHerc0175A/representations/predictions/lasagna/20250521115057-lasagna-de45f011"
cos = zarr.open_array(base + "/PHerc0175A_cos.ome.zarr/1", mode="r", zarr_format=2)
```
Region downloads, a Neuroglancer link and the methods for all ten fields are on the
[Lasagna Fields](https://huggingface.co/spaces/SharpMeow/lasagna-fields) page.
## What it is
- Scan: PHerc0175A, `20250521115057-8.640um-1.2m-116keV-masked.zarr`, level 0, Vesuvius Challenge open data
- Model: `scrollprize/lasagna` `model_current.pt` at revision de45f011 (sha256 4cc0c40a...)
- Code: ScrollPrize/villa lasagna at db3dbea2, `lasagna-preprocess predict3d --tile-size 192`, default chunks and levels
- Channels: cos at OME-Zarr level 1 (2x down); grad_mag, nx, ny at level 2 (4x down); each with its pyramid
- Run: 64 parts on Hugging Face Jobs (RTX PRO 6000). Every part edge sits on a chunk line for levels 1 to 3. Level 4
chunks that straddle a tile edge were rebuilt from the joined level 3 with villa's own `omezarr_pyramid`, and a seam
check found no step at any tile edge (worst ratio 1.26 against a 1.5 limit). In grad_mag the rebuilt level 4 differs
from what the parts wrote in 15,978 of 57.7 million voxels (0.03%), every one a 0 against a small value at the edge
of the masked region; nx and ny differ in one voxel each. Finer levels are exactly as the parts wrote them.
## Notes
Raw model output; nobody has checked it by eye. Regions the masked scan leaves empty are absent (fill 0). The model
ran on the scan at its native 8.64 um with no resampling; we have not tested whether another input scale works better.
## Related
A center line (umbilicus) for PHerc0175A, and for every other scan on the prize page, is in
[SharpMeow/vesuvius-center-lines](https://huggingface.co/datasets/SharpMeow/vesuvius-center-lines).
The Lasagna tab of the [Umbilici Space](https://huggingface.co/spaces/SharpMeow/umbilici?mode=lasagna&scan=PHerc0175A&z=6400) shows a small sample of
this field in your browser: cos at nine heights and the surface normals as needles, with the center line through
them. Its X-ray tab streams the PHerc0175A CT itself.
## Credit and terms
The scan is Vesuvius Challenge open data, CC BY-NC 4.0; this derived field is shared under the same terms. Model and
code are ScrollPrize/villa's lasagna, credit to its authors. Shared by Chase Hendrick.