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

49 ビュー (過去 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
  1 件のコメント
David Paik
David Paik 2022 年 1 月 19 日
Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by