| |
| from __future__ import annotations |
| import argparse, json |
| from pathlib import Path |
| import nibabel as nib |
| import numpy as np |
|
|
|
|
| def main(): |
| ap = argparse.ArgumentParser() |
| ap.add_argument("--manifest", required=True) |
| args = ap.parse_args() |
| man = json.load(open(args.manifest)) |
| for split, items in man.items(): |
| if not isinstance(items, list): |
| continue |
| print(split, len(items)) |
| for it in items[:3]: |
| img = nib.load(it["image"]) |
| print(" ", it.get("id"), img.shape, img.header.get_zooms()[:3], "label", bool(it.get("label"))) |
| if it.get("label"): |
| lab = np.asanyarray(nib.load(it["label"]).dataobj) |
| print(" labels", np.unique(lab)[:20]) |
| if __name__ == "__main__": |
| main() |
|
|