Create a .mat file similar to MRI
이전 댓글 표시
Hello,
Does anyone know how to place 12 mri images into the same matrix size and shape as D in the .mat file MRI?
Any help is greatly appreciated.
-Thanks
답변 (2개)
Youssef Khmou
2013년 5월 6일
편집: Youssef Khmou
2013년 5월 6일
hi,
The default MRI sample has singleton dimension right?
try :
% given I1,.............,I12
[m n]=size(I1);
M=zeros(m,n,12);
M(:,:,1)=I1;
%....
M(:,:,12)=I12;
D=zeros(m,n,1,12);
for n=1:12
D(:,:,:,n)=M(:,:,n);
end
save Neoplasm_MRI D
댓글 수: 10
Christopher P.
2013년 5월 6일
Youssef Khmou
2013년 5월 6일
try the edited code...
Christopher P.
2013년 5월 6일
Youssef Khmou
2013년 5월 6일
hi Christopher,
No 'M' was only a bypass, now D contains the 12 slices and has same m-n-1-12 as dimensions, it can also contains double valued images , what is the problem
Youssef Khmou
2013년 5월 6일
here is simple example : ( use : operator instead of 1 ok? )
I1=rand(10); % my first image {double}
I2=rand(10); % my second image {double}
M=zeros(10,10,1,2); % container
M(:,:,:,1)=I1; % transfer 1
M(:,:,:,2)=I1; % transfer 2
This should work in your case too
Christopher P.
2013년 5월 6일
Youssef Khmou
2013년 5월 6일
편집: Youssef Khmou
2013년 5월 6일
the images are RGB , or grayscale ?because that error is not in what we are discussing now its in the size of image(s) : try
size(I1)
Christopher P.
2013년 5월 6일
Youssef Khmou
2013년 5월 6일
well thats where the problem then, you have to solutions : 1) transform them into grayscale images using
rgb2gray
2)or add a 4th/5th dimention in M/D:
M=zeros(m,n,3,1,12) ;
% in the code use M(:,:,:,:,n)
Christopher P.
2013년 5월 6일
bintoro adi
2014년 12월 2일
0 개 추천
Hi Christoper, Can u write the final code, because i still have the the same error (Subscripted assignment dimension mismatch). thank u...
카테고리
도움말 센터 및 File Exchange에서 Neuroimaging에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!