modelarrayio.utils.s3_utils.load_nibabel

modelarrayio.utils.s3_utils.load_nibabel(path: str | PathLike[str], *, cifti: bool = False)[source]

Load a nibabel image from a local path or an s3:// URI.

For s3:// paths the object is downloaded directly into memory via get_object; no temporary file is written to disk. The bytes are decompressed in-memory if the key ends with .gz, then handed to nibabel through its FileHolder / from_file_map API.

Parameters:
  • path (str) – Local file path or s3:// URI.

  • cifti (bool) – Pass True for CIFTI-2 files (.dscalar.nii etc.) so that nibabel returns a Cifti2Image with proper axes. False (default) returns a Nifti1Image.

Return type:

nibabel.FileBasedImage