Spaces:
Paused
Paused
| """Bake a synthetic nuclei image + ground-truth labels into APP_TMP_DIR.""" | |
| from __future__ import annotations | |
| import sys | |
| import numpy as np | |
| import tifffile | |
| from core.io import APP_TMP_DIR, register_protected | |
| from core.synth import nuclei_image | |
| def main() -> int: | |
| img, labels, meta = nuclei_image(H=256, W=256, n=30, seed=0) | |
| out = APP_TMP_DIR / "example.tif" | |
| tifffile.imwrite(out, img) | |
| np.save(APP_TMP_DIR / "example_labels.npy", labels) # ground-truth sidecar | |
| register_protected(out) | |
| register_protected(APP_TMP_DIR / "example_labels.npy") | |
| print(f"wrote {out} shape={img.shape} nuclei={meta['n_nuclei']}") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |