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!

Réponses (1)

Walter Roberson
Walter Roberson le 30 Avr 2016

0 votes

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

2 commentaires

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 le 1 Mai 2016
Which is the "first" image, and which is the "second" image?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by