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.
8.5.15. nilearn.image.new_img_like¶
- nilearn.image.new_img_like(ref_niimg, data, affine=None, copy_header=False)[source]¶
Create a new image of the same class as the reference image
- Parameters
- ref_niimgNiimg-like object
Reference image. The new image will be of the same type.
- data
numpy.ndarray
Data to be stored in the image.
- affine4x4
numpy.ndarray
, optional Transformation matrix.
- copy_header
bool
, optional Indicated if the header of the reference image should be used to create the new image. Default=False.
- Returns
- Niimg-like object
A loaded image with the same file type (and, optionally, header) as the reference image.