필터 지우기
필터 지우기

Change the voxel size from a 3D matrix

조회 수: 3 (최근 30일)
Katharina Hecker
Katharina Hecker 2018년 6월 18일
댓글: Katharina Hecker 2018년 6월 18일
Hi everyone,
I wanted to change the voxel size of an image stack in 50x50x50 Right now I loaded the image stack into a matrix inside a .mat file It has the dimensions: 1186x1834x121 Initially I just wanted to change the dimensions of the z axis in mm to 6.05 mm so that I have a the right relation (one image was 0.05mm thick; all dimensions: x = 13 mm y = 10 mm z = 6.05 mm), but I wasn´t able to find the right code, since I´m new to Matlab I need more time to look into every code. I would be really happy about any suggestions!!! Thanks in advance.
  댓글 수: 1
Katharina Hecker
Katharina Hecker 2018년 6월 18일
PS: I forgot to add double: 1186x1834x121 double

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2018년 6월 18일
Read about interpn
A = rand(1186,1834,121) ;
[m1,n1,p1]= size(A) ;
x0 = 13 ; y0 = 10 ; z0 = 6.05 ;
x1 = x0+(m1-1)*x0 ;
y1 = y0+(n1-1)*y0 ;
z1 = z0+(p1-1)*z0 ;
x = linspace(x0,x1,m1) ;
y = linspace(y0,y1,n1) ;
z = linspace(z0,z1,p1) ;
[X1,Y1,Z1] = ndgrid(x,y,z) ;
xi = linspace(x0,x1,50) ;
yi = linspace(y0,y1,50) ;
zi = linspace(z0,z1,50) ;
[Xi,Yi,Zi] = ndgrid(xi,yi,zi) ;
Ai = interpn(X1,Y1,Z1,A,Xi,Yi,Zi) ;
  댓글 수: 1
Katharina Hecker
Katharina Hecker 2018년 6월 18일
Thank you very much! It is working.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by