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 itsFileHolder/from_file_mapAPI.- Parameters:
path (str) – Local file path or s3:// URI.
cifti (bool) – Pass
Truefor CIFTI-2 files (.dscalar.niietc.) so that nibabel returns aCifti2Imagewith proper axes.False(default) returns aNifti1Image.
- Return type:
nibabel.FileBasedImage