Main Content

niftiwrite

Write volume to file using NIfTI format

描述

例子

niftiwrite(v,,,,文件名写入体积图像数据vto a file by using the Neuroimaging Informatics Technology Initiative (NIfTI) format. By default,niftiwrite创建一个包含元数据和体积数据的组合NIFTI文件。niftiwrite命名文件文件名,添加.nii文件扩展名。niftiwritepopulates the metadata using appropriate default values and volume properties, such as size and data type.

niftiwrite金宝app支持这两个nifti1andnifti2文件格式。nifti1是默认文件格式。在nifti2格式,使用语法与名称,价值pair arguments. Specify the版本论点为'nifti2'

例子

niftiwrite(v,,,,文件名,,,,信息writes the volumetric datav到一个文件,包括来自的文件元数据信息。如果元数据不匹配图像内容和大小,则niftiwrite返回错误。

niftiwrite(v,,,,文件名,,,,信息,,,,名称,价值使用指定的选项将体积数据写入文件名称,价值成对。

例子

全部收缩

Load a NIfTI image by using its.nii文件名。

v = niftiread('brain.nii');

使用3 x-3中值过滤器过滤3-D中的图像。

v = medfilt3(v);

将过滤的图像写入.nii文件,使用默认标题值。

niftiwrite(v,'outbrain.nii');

Read the metadata from a NIfTI file by using its.nii文件名。

info = niftiinfo('brain.nii');

使用文件元数据从文件中读取体积数据。

v = niftiread(info);

编辑描述文件的元数据字段。

信息。描述=“使用MATLAB R2017B修改”;

Write the volumetric data with the modified metadata to a new.niifile.

niftiwrite(v,'outbrain.nii',,,,信息);

输入参数

全部收缩

NIFTI文件的名称,,,,specified as a string scalar or character vector. By default,niftiwritecreates a combined format file that contains both metadata and image data and has the file extension.nii。如果指定“压缩”名称对,niftiwriteadds the file extension.nii。gz。如果您设置'Combined'name-value pair to错误的, 然后niftiwritecreates two files with the same name and different file extensions. One file contains the metadata associated with the volume and has the file extension.hdr。The other file contains image data and has the file extension.img

数据类型:char|细绳

volumetric data, specified as a numeric array.

数据类型:单身的|双倍的|int8|int16|int32|INT64|UINT8|UINT16|UINT32|Uint64|逻辑

File metadata, specified as a structure returned by theniftiinfo功能。

数据类型:结构

名称值参数

Specify optional pairs of arguments asname1 = value1,...,namen = valuen, 在哪里姓名是参数名称和value相应的价值。名称-值参数must appear after other arguments, but the order of the pairs does not matter.

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

例子:niftiwrite(v,'utbrain.nii',“压缩”,true)

nifti文件的类型要创建,指定为trueor错误的。如果true(默认),niftiwritecreates a single file with the file extension.nii。如果错误的,,,,niftiwrite创建具有相同名称的文件,但具有不同的文件扩展名:.hdr对于包含元数据的文件,.img对于包含体积数据的文件。

数据类型:单身的|双倍的|int8|int16|int32|INT64|UINT8|UINT16|UINT32|Uint64|逻辑

压缩图像数据,,,,specified astrueor错误的。如果“压缩”true, 然后niftiwrite使用GZIP生成压缩文件,并使用文件名扩展。gz

数据类型:单身的|双倍的|int8|int16|int32|INT64|UINT8|UINT16|UINT32|Uint64|逻辑

数据的端性,指定为'little',,,,to indicate little-endian format (default) or'big',指示大型格式。

数据类型:char|细绳

NIfTI数据格式,指定为'nifti1'or'nifti2'

  • 如果指定为'nifti1', 然后niftiwrite根据nifti1数据格式。

  • 如果指定为'nifti2', 然后niftiwrite根据nifti2数据格式。

  • 如果not specified, then the default value for'版本'根据输入体积数据的最大维度选择。

    • 如果输入的最大维度小于或等于32767,则默认值为nifti1

    • 如果输入的最大维度大于32767,则默认值为nifti2

数据类型:char|细绳

References

[1]Cox,R。W.,J。Ashburner,H。Breman,K。Fissell,C。Haselgrove,C。J. Holmes,J。L. Lancaster,D。E. Rex,S。M. Smith,J。B. Woodward和S. C. Strother。“一种(一种)新图像数据格式标准:NIFTI-1。”2004年6月,布达佩斯,布达佩斯,布达佩斯的第10届年度会议。

版本历史记录

在R2017b中引入

也可以看看

|