Main Content


Read NRRD image



V = nrrdread(filename) reads the nearly raw raster data (NRRD) image file specified by filename, and returns the volumetric image data V.


collapse all

Read the image data from an NRRD format file. The file is part of a data set containing the 3-D CT and MRI scans from The Retrospective Image Registration Evaluation (RIRE) Dataset, converted to the NRRD file format. The original data set was provided by Dr. Michael Fitzpatrick. For more information, see the RIRE Project homepage. The size of the entire data set is approximately 35 MB. Download the data set from the MathWorks® website, then unzip the folder.

zipFile = matlab.internal.examples.downloadSupportFile("medical","");
filepath = fileparts(zipFile);

Specify the name of the NRRD file to read.

filename = fullfile(filepath,"supportfilesNRRD","Patient007CT.nrrd");

Read the image data from filename. The image data, V, is a 3-D array of intensity values.

V = nrrdread(filename);
whos V
  Name        Size                   Bytes  Class     Attributes

  V         512x512x28            29360128  single              

Display the image data stored in the array V.


Input Arguments

collapse all

Name of the NRRD file, specified as a string scalar or a character vector. The file must be a valid NRRD file (.nrrd) that contains header information and image data. Specify filename as the absolute path to the file, a relative path from the current directory, or a relative path from a directory on the MATLAB® path.

Data Types: char | string

Output Arguments

collapse all

Volumetric image data, returned as a numeric array.

Version History

Introduced in R2022b

See Also