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

조회 수: 52 (최근 30일)
David Paik
David Paik 2022년 1월 19일
댓글: David Paik 2022년 1월 19일
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!

채택된 답변

Konrad
Konrad 2022년 1월 19일
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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by