nispace.utils.utils.mirror_gifti

nispace.utils.utils.mirror_gifti(img, direction='left_to_right', match_r=False, mask=None)[source]

Mirror/flip a bilateral surface image pair across hemispheres.

Plain numpy/nibabel (no numba). Surface counterpart of mirror_nifti(), with fewer supported modes (no per-hemisphere drop/switch). Not currently called anywhere in NiSpace (dead code) — kept as a public utility. match_r/mask parameters are accepted but currently unused.

Parameters:
  • img (tuple of (nib.GiftiImage, nib.GiftiImage) or (np.ndarray, np.ndarray)) – (left, right) hemisphere data.

  • direction (str, default="left_to_right") – "left_to_right": copy LH data to RH. "right_to_left": copy RH data to LH. "average"/"bilateral": average both hemispheres, assigned to both outputs.

  • match_r (bool, optional) – Currently unused.

  • mask (optional) – Currently unused.

Returns:

(left, right) mirrored pair, same type as the input (arrays in, arrays out; GiftiImages in, GiftiImages out).

Return type:

tuple

Raises:

ValueError – If img is not a tuple, or its elements are neither ndarrays nor GiftiImages.