简体   繁体   English

在Matlab中读取没有标题的img医学图像

[英]Read img medical image without header in matlab

I have a radiograph .img file without the header file. 我有一个没有头文件的X射线照片.img文件。 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)

Using this information, I tried fread command in Matlab to read the image into Matlab. 使用此信息,我尝试在Matlab中使用fread命令将图像读入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 ? 有人可以建议任何其他方法来读取此图像文件吗?

The lung x-rays of the JSRT database (www.jsrt.or.jp/jsrt-db/eng.php), have that format. JSRT数据库(www.jsrt.or.jp/jsrt-db/eng.php)的肺部X射线具有这种格式。 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);
%%% Read image
    fid = fopen('image.img','r','b');
    oneSlice = fread(fid, [2048 2048], '*uint16','b');
    img = mat2gray(oneSlice, [0,4096]);
    fclose(fid);

%%%rotate image

    imgR = imrotate(img,270);

%%%horizontal flip image

    imgRF = flipdim(TestImgR ,2);  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM