Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
7.5.10. nilearn.image.load_img¶
-
nilearn.image.
load_img
(img, wildcards=True, dtype=None)¶ Load a Niimg-like object from filenames or list of filenames.
New in version 0.2.5.
Parameters: img: Niimg-like object
See http://nilearn.github.io/manipulating_images/input_output.html If niimg is a string, consider it as a path to Nifti image and call nibabel.load on it. The ‘~’ symbol is expanded to the user home folder. If it is an object, check if get_data() and affine attributes are present, raise TypeError otherwise.
wildcards: bool, optional
Use niimg as a regular expression to get a list of matching input filenames. If multiple files match, the returned list is sorted using an ascending order. If no file matches the regular expression, a ValueError exception is raised.
dtype: {dtype, “auto”}
Data type toward which the data should be converted. If “auto”, the data will be converted to int32 if dtype is discrete and float32 if it is continuous.
Returns: result: 3D/4D Niimg-like object
Result can be nibabel.Nifti1Image or the input, as-is. It is guaranteed that the returned object has get_data() and affine attributes.