Download load_example.py from SharpMeow/pherc0490b-lasagna: direct link, hf CLI and curl.
- Browser
- Download file 731 Bytes
-
https://huggingface.co/datasets/SharpMeow/pherc0490b-lasagna/resolve/main/load_example.py
- Command line
-
hf download hf://datasets/SharpMeow/pherc0490b-lasagna/load_example.py
-
curl -L -o load_example.py https://huggingface.co/datasets/SharpMeow/pherc0490b-lasagna/resolve/main/load_example.py
731 Bytes
| import numpy as np | |
| import zarr | |
| cos = zarr.open("PHerc0490B_cos.ome.zarr/1", mode="r") # every 2nd scan voxel | |
| nx = zarr.open("PHerc0490B_nx.ome.zarr/2", mode="r") # every 4th scan voxel | |
| ny = zarr.open("PHerc0490B_ny.ome.zarr/2", mode="r") | |
| print("cos", cos.shape, "normals", nx.shape) | |
| z, y, x = 1536, 4171, 4171 # 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)) | |