"""Paths and split-manifest helpers. Each manifest in experiments/splits/ lists one sample per row.""" import csv import os S2F_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEFAULT_DATASET_ROOT = os.environ.get("S2F_DATASET_ROOT", os.path.join(S2F_ROOT, "dataset")) SPLITS_DIR = os.environ.get("S2F_SPLITS_DIR", os.path.join(S2F_ROOT, "experiments", "splits")) RUNS_DIR = os.environ.get("S2F_RUNS_DIR", os.path.join(S2F_ROOT, "experiments", "runs")) RESULTS_DIR = os.environ.get("S2F_RESULTS_DIR", os.path.join(S2F_ROOT, "experiments", "results")) MASK_NAMES = ("cell_mask.tif", "cell_mask.png", "mask.tif", "mask.png") def read_manifest(path): with open(path, newline="") as f: return list(csv.DictReader(f)) def manifest_path(name): return os.path.join(SPLITS_DIR, f"{name}.csv") def list_manifests(): if not os.path.isdir(SPLITS_DIR): return [] return sorted(os.path.splitext(f)[0] for f in os.listdir(SPLITS_DIR) if f.endswith(".csv"))