Giving credit

Table Of Contents

Previous topic

7.5.10. nilearn.image.mean_img

Next topic

7.5.12. nilearn.image.resample_img

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.11. nilearn.image.new_img_like

nilearn.image.new_img_like(ref_niimg, data, affine=None, copy_header=False)

Create a new image of the same class as the reference image

Parameters:

ref_niimg: image

Reference image. The new image will be of the same type.

data: numpy array

Data to be stored in the image

affine: 4x4 numpy array, optional

Transformation matrix

copy_header: boolean, optional

Indicated if the header of the reference image should be used to create the new image

Returns:

new_img: image

A loaded image with the same type (and header) as the reference image.