Load, open and display 2dseq file (MRI, bruker)

29 ビュー (過去 30 日間)
viet le
viet le 2017 年 6 月 27 日
コメント済み: Maqbool 2024 年 1 月 16 日
Hello,
I have an MR image data which acquired at Bruker 4.7 T MRI scanner. (Bruker file attached). This code by Matlab can not run and I did not know how to fix? really appreciate your help.
Thank you.
num_dif = 1;
dimension = [128 128 100]; % [x y z] the dimension of the 2dseq file, suppose average=1
voxel_size = [0.1 0.1 0.1]; % [x y z] pixel spacing in mm
f1 = fopen('2dseq','r');
A=fread(f1,'int16');
A=reshape(A,dimension(1),dimension(2),dimension(3),num_dif);
% slope is a dimension(3) x num_dif matrix that defines the scaling parameters
% input the slope here
slope=[81.3139111191806 81.3139111191806 81.3139111191806 81.3139111191806
...
]
slope = slope./min(min(slope));
slope = reshape(slope',dimension(3),num_dif);
for i = 1:dimension(3)
for j = 1:num_dif
A(:,:,i,j) = A(:,:,i,j)/slope(i,j);
end
end
% image0 ~ imageN, where N is the number of diffusion gradient encoding
image0 = reshape(A(:,:,:,1),prod(dimension),1);
  1 件のコメント
Oscar Jalnefjord
Oscar Jalnefjord 2017 年 6 月 28 日
There is only data from a single slice in the attached file 2dseq. if you set
dimension = [128 128 100]
and set slope to a scalar value your code runs

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

回答 (2 件)

Khieu
Khieu 2018 年 4 月 16 日
編集済み: Khieu 2018 年 4 月 16 日

1. You should take a look at parameters files: acqp, method. (text file) these files contain all image parameters that suitable for you. 2. I found that your image is 2D based on: - method file: ##$PVM_Matrix=( 2 ) 128 128 So your image data size should be: 128x128 (complex or real you should check on method file or reco file)

A=fread(f1,'int16');
% if complex data, do three following lines 
RealI = A(1:2:end);
ImgI = A(2:2:end);
cmplxImage = complex(RealI, ImgI);

Then you just reshape that variable to correct image dimension...

Good luck

ps: your image is T1-weighted image, not diffusion image, so you do not need a variable like num_dif (number of diffusions)

  1 件のコメント
Maqbool
Maqbool 2024 年 1 月 16 日
This only for one real and imaginary lines, what about I needs all of them and to do FFT

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


Cecil Yen
Cecil Yen 2018 年 10 月 29 日
I wrote a Matlab function to read Bruker's 2dseq file for my own purposes years ago. It will phrase the header file and load the binary image for you. I use some tricks to speed up the reading, which shall be the fastest Matlab implementation this far. I uploaded it to Matlab Central such that everyone can use it.
https://www.mathworks.com/matlabcentral/fileexchange/69177-read_2dseq-quickly-reads-bruker-s-2dseq-mri-images
  2 件のコメント
Avigdor
Avigdor 2018 年 10 月 29 日
Hi,
There seems to be an issue with the find_newline function and the read_2dseq does not run.
Amaan Khan
Amaan Khan 2023 年 7 月 25 日
Hi, is there any documentation for this by any chance?

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!