Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

niftiinfo

Read metadata from NIfTI file

Syntax

info = niftiinfo(filename)

Description

example

info = niftiinfo(filename) reads metadata from the file specified by filename. The file must use the Neuroimaging Informatics Technology Initiative (NIfTI) format. niftiinfo returns the metadata in the structure info.

Examples

collapse all

Load metadata from the NIfTI file brain.nii.

info = niftiinfo('brain.nii');

Display the pixel dimensions of the file.

info.PixelDimensions
ans =

     1     1     1

Display the raw header content.

info.raw
ans = 

  struct with fields:

        sizeof_hdr: 348
          dim_info: ' '
               dim: [3 256 256 21 1 1 1 1]
         intent_p1: 0
         intent_p2: 0
         intent_p3: 0
       intent_code: 0
          datatype: 2
            bitpix: 8
       slice_start: 0
            pixdim: [1 1 1 1 0 0 0 0]
        vox_offset: 352
         scl_slope: 0
         scl_inter: 0
         slice_end: 0
        slice_code: 0
        xyzt_units: 0
           cal_max: 0
           cal_min: 0
    slice_duration: 0
           toffset: 0
           descrip: ''
          aux_file: ''
        qform_code: 0
        sform_code: 0
         quatern_b: 0
         quatern_c: 0
         quatern_d: 0
         qoffset_x: 0
         qoffset_y: 0
         qoffset_z: 0
            srow_x: [0 0 0 0]
            srow_y: [0 0 0 0]
            srow_z: [0 0 0 0]
       intent_name: ''
             magic: 'n+1 '

Display the intent code from the raw structure.

info.raw.intent_code
ans =

     0

Input Arguments

collapse all

Name of NIfTI file, specified as a string scalar or a character vector. If you do not specify a file extension, niftiinfo looks for a file with the extension .nii (or .nii.gz if the file is compressed). If niftiinfo cannot find a file with that name, it looks for a file with the file extension .hdr (or .hdr.gz if the file is compressed). In the dual-file NIfTI format, the .hdr file holds the metadata associated with the volume.

Data Types: char | string

Output Arguments

collapse all

Metadata associated with a NIfTI volume, returned as a structure.

niftiinfo returns the metadata from the header in simplified form---renaming, reordering, and packaging fields into easier to read MATLAB structures. For example, niftiinfo creates the DisplayIntensityRange field from the cal_max and cal_min fields of the file metadata. To view the metadata as it appears in the file, see the raw field of the structure returned.

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, and S.C. Strother. 'A (sort of) new image data format standard: Nifti-1. " Neuroimage, Vol. 22(Suppl 1):e1440, 2004.

Introduced in R2017b

Was this topic helpful?