Read volumetric data from the NRRD (.nrrd) medical imagery file format. This function returns the image volume and all of the metadata stored in the file.
Jeff Mather (2021). NRRD Format File Reader (https://www.mathworks.com/matlabcentral/fileexchange/34653-nrrd-format-file-reader), MATLAB Central File Exchange. Retrieved .
Inspired: NRRD Format File Reader, nrrdWriter(filename, matrix, pixelspacing, origin, encoding), addisonElliott/matnrrd, Microscopy Image Browser (MIB), Microscopy Image Browser 2 (MIB2), nrrdmeta2num(imgh), NRRD NHDR reader and writer
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
When reading a file exported through Slicer I get following error message:
"Error using nrrdread (line 76)
Missing required metadata fields."
I get the error: Unable to resolve the name Ref20131120pt14pl2.nrrd.
This is even though I copied and pasted the name and I've put the file into the same matlab path as the function. Do you know how to resolve this? Thanks!
I am having a difficult time unzipping this file with MATLAB or 7-zip.
I had this problem when attributes were embedded in the dim[0], dim[1], dim[2] field name value fields and the script didn't like it. The nrrd format was created using a standard ITK writer (in c3d toolbox).
So I added few lines
if (contains(field, '['))
field (strfind(field,'[')) = '';
end
if (contains(field, ']'))
field (strfind(field,']')) = '';
end
Is this part of the *.nrrd format?
clicked by accident, do not know how to delete it, sorry!
how to use this please tell me should i unzip and add folder where i have installed my matlab
Voxels values are not correct. Voxels values in Slicer3D and MITK are the same but in matlab are different.
very useful,
it would be nice if the numeric meta data extracted as numbers instead of characters.
Good job! One limitation I encountered is that some temporary files that are created during the code execution are not deleted at the end. It can be a serious problem in the case of medical images where each temporary file is about 200MB. To fix this, I commented out the following line of the code
cleaner = onCleanup(@() fclose(fidTmp));
and added the followings at the end of "case {'gzip', 'gz'}."
fclose(fidTmp);
system(['del ' tmpFile])
system(['del ' tmpBase])
you might have a problam in the fopen. fileID in the function readData point the nhdr and the data file