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.
nilearn.image.check_niimg_4d¶
- nilearn.image.check_niimg_4d(niimg, return_iterator=False, dtype=None)[source]¶
Check that niimg is a proper 4D niimg-like object and load it.
- Parameters:
- niimg4D Niimg-like object
See Input and output: neuroimaging data representation. If
niimgsis an iterable, checks if data is really 4D. Then, considering that it is a list of niimg and load them one by one. Ifniimgsis a string, consider it as a path to Nifti image and call nibabel.load on it. If it is an object, check if the affine attribute present and thatnilearn.image.get_datareturns a result, raiseTypeErrorotherwise.- return_iterator
bool, default=False If True, an iterator of 3D images is returned. This reduces the memory usage when
niimgscontains 3D images. If False, a single 4D image is returned. Whenniimgscontains 3D images they are concatenated together.- dtypedtype like, “auto” or None, default=None
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. If None, data will not be converted to a new data type..
- Returns:
- niimg: 4D nibabel.Nifti1Image or iterator of 3D nibabel.Nifti1Image
Notes
This function is the equivalent to
nilearn.image.check_niimg_3dfor Niimg-like objects with a run level.Its application is idempotent.