Problems with interp3
Mostrar comentarios más antiguos
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!
Respuestas (1)
Walter Roberson
el 30 de Abr. de 2016
0 votos
I recommend you use linspace() instead of the colon operator to build the xx, yy, zz
2 comentarios
Francisco Javier Vilchez Torralba
el 30 de Abr. de 2016
Walter Roberson
el 1 de Mayo de 2016
Which is the "first" image, and which is the "second" image?
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!