Spaces:
Sleeping
Sleeping
| """Bake a synthetic noisy image + clean ground-truth sidecar 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 add_noise, clean_image | |
| def main() -> int: | |
| clean = clean_image(H=256, W=256, seed=7) | |
| noisy = add_noise(clean, sigma=0.13, seed=7) | |
| out = APP_TMP_DIR / "example.tif" | |
| tifffile.imwrite(out, (noisy * 255).astype("uint8")) | |
| np.save(APP_TMP_DIR / "example_clean.npy", clean) # ground-truth sidecar | |
| register_protected(out) | |
| register_protected(APP_TMP_DIR / "example_clean.npy") | |
| print(f"wrote {out} shape={noisy.shape}") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |