"""Register Schaefer atlases in fMRIprep output MNI space."""

from junifer.data import register_parcellation, load_parcellation
from pathlib import Path

print(80 * "=")
print("REGISTERING MY OWN PARCELLATION")
n_networks = 17

for n_roi in [100, 200, 400]:
    # get the junifer parc to obtain same labels
    _, label_list, _ = load_parcellation(
        f"Schaefer{n_roi}x{n_networks}", resolution=2
    )

    # load the template flow file
    path_here = (
        Path("/data")
        / "project"
        / "identification_prediction"
        / "data"
        / "aomic-fc_junifer-release"
        / "code"
        / "junifer_extensions"
        / "parcellations"
        / "data"
    )
    path_mni_non_linear = path_here / (
        "tpl-MNI152NLin2009cAsym_res-02_atlas-Schaefer2018"
        f"_desc-{n_roi}Parcels{n_networks}Networks_dseg.nii.gz"
    )

    register_parcellation(
        name=f"Schaefer{n_roi}x{n_networks}_MNI152NLin2009cAsym",
        parcellation_path=path_mni_non_linear.resolve(),
        parcels_labels=label_list,
        overwrite=False,
    )
print(80 * "=")
