Problems with interp3
古いコメントを表示
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
2016 年 4 月 30 日
0 投票
I recommend you use linspace() instead of the colon operator to build the xx, yy, zz
2 件のコメント
Francisco Javier Vilchez Torralba
2016 年 4 月 30 日
Walter Roberson
2016 年 5 月 1 日
Which is the "first" image, and which is the "second" image?
カテゴリ
ヘルプ センター および File Exchange で Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!