问题描述
我有一个射线照片.img文件,没有头文件.但是,已发布文件的研究人员已经提供了有关此文件的信息
I have a radiograph .img file without the header file. However, the researchers who have published the file have given this information about it
High resolution (2048 x 2048 matrix size, 0.175mm pixel size)
Wide density range (12bit, 4096 gray scale)
Universal image format (no header, big-endian raw data)
使用这些信息,我尝试在Matlab中使用fread命令将图像读取到Matlab中.
Using this information, I tried fread command in Matlab to read the image into Matlab.
fid = fopen('image.img','r','B');
oneSlice = fread(fid, [2048 2048], '*uint8','B');
imshow(oneSlice)
但是,生成的图像显示为不正确.我做错什么了吗?有人可以建议任何其他方法来读取此图像文件吗?
However the resulting image is coming up as incorrect. Is there something that I am doing wrong ? Could someone suggest any different method to read this image file ?
推荐答案
JSRT数据库(www.jsrt.or.jp/jsrt-db/eng.php)的肺部X射线具有这种格式.我与他们一起测试了此代码,它的工作原理是:
The lung x-rays of the JSRT database (www.jsrt.or.jp/jsrt-db/eng.php), have that format. I tested this code with them and it works:
fid = fopen('image.img','r','b');
oneSlice = fread(fid, [2048 2048], '*uint16','b');
img = mat2gray(oneSlice, [0,4096]);
fclose(fid);
这篇关于在Matlab中读取没有标题的img医学图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!