"""Fetch a higher-resolution (1 mm) T1 sample for the viewer.

The bundled sample_data/mni152_t1_2mm.nii.gz is intentionally small (fast proof
figures), but at 2 mm the MPR slices look blocky. This writes a 1 mm MNI152
template you can open in the planner for a clinical-looking image:

    python scripts/make_hires_sample.py
    sulcora sample_data/mni152_t1_1mm.nii.gz

RESEARCH SOFTWARE — NOT FOR CLINICAL USE. Demonstration on public MNI152 data.
"""
import os


def main():
    import nibabel as nib
    from nilearn.datasets import load_mni152_template
    here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    out = os.path.join(here, "sample_data", "mni152_t1_1mm.nii.gz")
    os.makedirs(os.path.dirname(out), exist_ok=True)
    img = load_mni152_template(resolution=1)
    nib.save(img, out)
    print(f"wrote {out}  shape={img.shape}")
    print("open it with:  sulcora sample_data/mni152_t1_1mm.nii.gz")


if __name__ == "__main__":
    main()
