如果我正确理解你的问题,听起来你想用给定大小的体素插入一个图像堆栈,以便你定义一个新的坐标系,其中每个体素都是各向同性的(即具有相等的高度宽度和深度,即立方体素)。如果是这样,可能会有所帮助:
(我以 matlabs 提供的 mri 数据为例)
load mri D
D=double(squeeze(D)); % remove singleton dimension, convert to double
szD_a=size(D); % get size of original image stack
vox_a = [.4, .4, .45]; % define size of voxel in original image stack
vox_b = [.25, .25, .25];% define size of voxel in target image stack
szD_b = ceil((size(D)-1).*vox_a./vox_b)+1; % set size of target image stack
% define coordinates of voxels in original image stack
[Xa,Ya,Za]=meshgrid(...
[0:szD_a(1)-1]*vox_a(1),...
[0:szD_a(2)-1].*vox_a(2),...
[0:szD_a(3)-1].*vox_a(3));
% define coordinates of voxels in original image stack
[Xb,Yb,Zb]=meshgrid(...
[0:szD_b(1)-1]*vox_b(1),...
[0:szD_b(2)-1].*vox_b(2),...
[0:szD_b(3)-1].*vox_b(3));
D_target = interp3(Xa,Ya,Za,D,Xb,Yb,Zb);
figure
for t=0:vox_b(3):max(Zb(:))
subplot(1,2,1)
imagesc(D(:,:,floor(t/vox_a(3))+1))
subplot(1,2,2)
imagesc(D_target(:,:,floor(t/vox_b(3))+1))
drawnow
pause(0.1)
end