Nifti1Image 初始化nifti 图像数据

Nifti1Image

class nibabel.nifti1.Nifti1Image(dataobjaffineheader=Noneextra=Nonefile_map=None)

Bases: nibabel.nifti1.Nifti1Pairnibabel.filebasedimages.SerializableImage

Class for single file NIfTI1 format image

Initialize image

The image is a combination of (array-like, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.

Parameters

dataobjobject

Object containg image data. It should be some object that retuns an array from np.asanyarray. It should have a shape attribute or property

affineNone or (4,4) array-like

homogenous affine giving relationship between voxel coordinates and world coordinates. Affine can also be None. In this case, obj.affine also returns None, and the affine as written to disk will depend on the file format.

headerNone or mapping or header instance, optional

metadata for this image format

extraNone or mapping, optional

metadata to associate with image that cannot be stored in the metadata of this image type

file_mapmapping, optional

mapping giving file information for this image format

以上代码将image.nii文件读取到img中,imgnibabel.nifti1.Nifti1Image类型的。 一个nibabel.nifti1.Nifti1Image类型的数据包含三个主要的部分 - image data array 存放图像数据的矩阵 - an affine array 定义了图像数据在参考空间的位置 - image metadata 存放图像的一些属性信息,采集设备名称,体素的大小,扫描层数等等。 >image data array 虽然存储了每个体素的取值信息,但是并没有存储位置信息。也就是说我们并不知道某个体素来自由大脑哪个具体的位置 >affine数组定义了一个从image data array 到标准的参考空间的映射,每个体素经过这个数组映射后都会到一个标准的参考空间,在那个空间中,我们精确的知道每个体素所处的位置。 >结构像和功能像扫描的区域和方向均有所差异,所以都需要使用affine数组映射到参考空间,以确定体素在真实大脑中的位置 ### 显示数据

你可能感兴趣的:(Nifti1Image 初始化nifti 图像数据)