Hi everybody!:
I have a matrix whose dimensions are 512x512x56(Cube_CT), every image have a voxel whose dimensions are 0.97x0.97 (mm) and the SliceThickness is 3mm, and I need that every image has a voxel with dimensions: 0.97x0.97(mm) and the SliceThickness 1mm. My code is the following:
[m,n,p]=size(Cube_CT);
[X,Y,Z]=meshgrid(1:m,1:n,1:p);
voxel_x_in=InfoCT_ord{1,1}.PixelSpacing(1);
voxel_y_in=InfoCT_ord{1,1}.PixelSpacing(2);
voxel_z_in=InfoCT_ord{1,1}.SliceThickness;
voxel_x_out=InfoCT_ord{1,1}.PixelSpacing(1);
voxel_y_out=InfoCT_ord{1,1}.PixelSpacing(2);
voxel_z_out=1;
xx=(voxel_x_out/voxel_x_in:voxel_x_out/voxel_x_in:m);
yy=(voxel_y_out/voxel_y_in:voxel_y_out/voxel_y_in:n);
zz=(voxel_z_out/voxel_z_in:voxel_z_out/voxel_z_in:p);
[Xq,Yq,Zq]=meshgrid(xx,yy,zz);
CubeCT_inter=interp3(X,Y,Z,Cube_CT,Xq,Yq,Zq,'cubic');
But when I execute this code, all components of the first image and second image are NaN. I don't understand where is the problem.
Thanks!

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 30일

0 개 추천

I recommend you use linspace() instead of the colon operator to build the xx, yy, zz

댓글 수: 2

Hi Walter, thanks for your answer but I still have the same problem using linspace:
[m,n,p]=size(Cubo_CT);
[X,Y,Z]=meshgrid(1:m,1:n,1:p);
voxel_x_in=InfoCT_ord{1,1}.PixelSpacing(1);
voxel_y_in=InfoCT_ord{1,1}.PixelSpacing(2);
voxel_z_in=InfoCT_ord{1,1}.SliceThickness;
voxel_x_out=InfoCT_ord{1,1}.PixelSpacing(1);
voxel_y_out=InfoCT_ord{1,1}.PixelSpacing(2);
voxel_z_out=1;
xx=linspace(voxel_x_out/voxel_x_in,m,m);
yy=linspace(voxel_y_out/voxel_y_in,n,n);
zz=linspace(voxel_z_out/voxel_z_in,p,p/(voxel_z_out/voxel_z_in));
[Xq,Yq,Zq]=meshgrid(xx,yy,zz);
CuboCT_inter=interp3(X,Y,Z,Cubo_CT,Xq,Yq,Zq,'cubic');
Walter Roberson
Walter Roberson 2016년 5월 1일
Which is the "first" image, and which is the "second" image?

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

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

태그

댓글:

2016년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by