How to open .hdr files (paired with zipped .img files)

52 vues (au cours des 30 derniers jours)
David Paik
David Paik le 19 Jan 2022
Commenté : David Paik le 19 Jan 2022
I have been trying to open several CT images in .hdr format by using the "hdrread" function, but it doesn't seem to work.
These are what the files look like:
Here's the error message that shows up when I use "hdrread":
>> hdr = hdrread('27M01022184.hdr');
Error using hdrread>readHeader (line 65)
Not a Radiance file.
Error in hdrread (line 31)
fileinfo = readHeader(fid);
These are lines from 58 to 66 in the "hdrread" function code:
while (isempty(strfind(header, '#?')) && ~feof(fid))
header = fgetl(fid);
continue;
end
radianceMarker = strfind(header, '#?');
if (isempty(radianceMarker))
error(message('images:hdrread:notRadiance'))
end
I tried using "hdrread" with sample HDR images that I found online and it worked fine. So could it be the file format problem...? If so, can anyone tell me what the problem is? Would appreciate any form of help!

Réponse acceptée

Konrad
Konrad le 19 Jan 2022
Hi David,
hdrread is not for radiological images but for high dynamic range images.
You are dealing with the nifti file format. You can display the images with e.g. mricron or read the data using e.g. spm:
V = spm_vol('27M01022184.hdr')
[Y,XYZ] = spm_read_vols(V);
Best, Konrad

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by