How to input data from a .bin file into a 3D array?
7 ビュー (過去 30 日間)
古いコメントを表示
I have a .bin file which signifies the positions of lungs from CT imaging, in 3D size [128 128 128]. I am trying to upload it using fopen and fread but it only gives a single 2D image size [128 128 1].
My code:
fid = fopen('filedirectoryandname.bin')
image = fread(fid, [128 128 128], '*uint16')
I don't think fread can work wth [128 128 128] images. Is there another way?
I have also tried the function interfileread but apparently my .bin file isn't a valid interfile file.
0 件のコメント
採用された回答
James Tursa
2016 年 2 月 2 日
You could read it into a vector and then reshape. E.g.,
image = fread(fid, 128*128*128, '*uint16');
image = reshape(image,128,128,128);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!