pherc0841-lasagna / README.md
SharpMeow's picture
American English in the card and example
8f1645b verified
|
Raw History Blame Contribute Delete
4.18 kB
---
license: cc-by-nc-4.0
tags: [vesuvius-challenge, herculaneum, ct, lasagna, ome-zarr]
pretty_name: PHerc0841 lasagna field (villa predict3d)
---
# PHerc0841 lasagna field
villa's lasagna `predict3d` output for the whole PHerc0841 scan, in villa's own layout, so you can point lasagna or the
spiral fit at it without running the model yourself. The open data has no lasagna field for this scan.
![cos and surface normals, a slice through the middle of the scroll](preview-xy.png)
## Get it
```bash
hf download SharpMeow/pherc0841-lasagna --repo-type dataset --local-dir pherc0841-lasagna
cd pherc0841-lasagna && sha256sum -c SHA256SUMS
for f in parts/*.tar; do tar -xf "$f"; done
tar -xf PHerc0841-lasagna-pyramid-fix.tar # last: the joined PHerc0841.lasagna.json
```
You end up with `PHerc0841.lasagna.json` and `PHerc0841_{cos,grad_mag,nx,ny}.ome.zarr`.
## Load it
```python
import numpy as np
import zarr
cos = zarr.open("PHerc0841_cos.ome.zarr/1", mode="r") # every 2nd scan voxel
nx = zarr.open("PHerc0841_nx.ome.zarr/2", mode="r") # every 4th scan voxel
ny = zarr.open("PHerc0841_ny.ome.zarr/2", mode="r")
print("cos", cos.shape, "normals", nx.shape)
z, y, x = 1536, 3851, 3851 # a point in 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
b = (float(ny[z // 4, y // 4, x // 4]) - 128) / 127
print("cos patch", patch.shape, "mean", round(float(patch.mean()), 1))
print("normal", round(a, 3), round(b, 3), round(float(np.sqrt(max(0.0, 1 - a * a - b * b))), 3))
```
`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 `PHerc0841/representations/predictions/lasagna/20250821151531-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/PHerc0841/representations/predictions/lasagna/20250821151531-lasagna-de45f011"
cos = zarr.open_array(base + "/PHerc0841_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: PHerc0841, `20250821151531-9.366um-1.2m-113keV-masked.zarr`, level 0, Vesuvius Challenge open data (9.366 um)
- 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: 22 parts on Hugging Face Jobs (RTX PRO 6000), one x, y, z box each. Every part edge sits on a multiple of
1,024 scan voxels, so every chunk of every level, level 4 included, was written by exactly one part, and the parts
together are the whole field. A seam check on level 2 flagged 1 part edge (cos at z 1,024; worst step 1.62
times its neighbors against a 1.5 limit). One run straight across it gave the same field, chunk for chunk, so
the step is in the scan there, not a seam. Every other edge passed.
- Settings check: the same code and settings reproduce villa's published PHerc0343 lasagna field on a test crop
(cos within 2 of 255 at every voxel compared).
## 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 resolution with no resampling.
## Related
The same kind of field for PHerc0175A is in
[SharpMeow/pherc0175a-lasagna](https://huggingface.co/datasets/SharpMeow/pherc0175a-lasagna).
## 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.