loadsave

Utilities to load and save image objects

guessed_image_type(filename)

Guess image type from file filename

load(filename, **kwargs)

Load file given filename, guessing at file type

read_img_data(img[, prefer])

Read data from image associated with files

save(img, filename, **kwargs)

Save an image to file adapting format to filename

guessed_image_type

nibabel.loadsave.guessed_image_type(filename)

Guess image type from file filename

guessed_image_type deprecated.

  • deprecated from version: 3.2

  • Raises <class ‘nibabel.deprecator.ExpiredDeprecationError’> as of version: 5.0

load

nibabel.loadsave.load(filename: FileSpec, **kwargs) FileBasedImage

Load file given filename, guessing at file type

Parameters:
filenamestr or os.PathLike

specification of file to load

**kwargskeyword arguments

Keyword arguments to format-specific load

Returns:
imgSpatialImage

Image of guessed type

read_img_data

nibabel.loadsave.read_img_data(img, prefer='scaled')

Read data from image associated with files

read_img_data deprecated. Please use img.dataobj.get_unscaled() instead.

  • deprecated from version: 3.2

  • Raises <class ‘nibabel.deprecator.ExpiredDeprecationError’> as of version: 5.0

save

nibabel.loadsave.save(img: FileBasedImage, filename: FileSpec, **kwargs) None

Save an image to file adapting format to filename

Parameters:
imgSpatialImage

image to save

filenamestr or os.PathLike

filename (often implying filenames) to which to save img.

**kwargskeyword arguments

Keyword arguments to format-specific save

Returns:
None