我有一个解剖体积图像(B),它是一个索引图像i,j,k:
B(1,1,1)=0 %for example.
该文件仅包含0和1.
我可以用isosurface正确地想象它:
等值面(B);
我想在j的某个坐标处切割音量(每个音量都不同).
问题是体积垂直倾斜,可能有45%的度数,因此切口不会跟随解剖体积.
我想为数据获得一个新的正交坐标系,所以坐标j的平面将以更精确的方式切割解剖体积.
我被告知要用PCA做,但我不知道怎么做,阅读帮助页面没有帮助.欢迎任何方向!
编辑:
我一直在遵循这些建议,现在我得到了一个新的音量,以零为中心,但我认为轴不会像他们应该的那样遵循解剖图像.这些是前后图像:
这是我用来创建图像的代码(我从答案和评论中获取了一些代码):
clear all; close all; clc;
hippo3d = MRIread('lh_hippo.mgz');
vol = hippo3d.vol;
[I J K] = size(vol);
figure;
isosurface(vol);
% customize view and color-mapping of original volume
daspect([1,1,1])
axis tight vis3d;
camlight; lighting gouraud
camproj perspective
colormap(flipud(jet(16))); caxis([0 1]); colorbar
xlabel x; ylabel y; zlabel z
box on
% create the 2D data matrix
a = 0;
for i=1:K
for j=1:J
for k=1:I
a = a + 1;
x(a) = i;
y(a) = j;
z(a) = k;
v(a) = vol(k, j, i);
end
end
end
[COEFF SCORE] = princomp([x; y; z; v]');
% check that we get exactly the same image when going back
figure;
atzera = reshape(v, I, J, K);
isosurface(atzera);
% customize view and color-mapping for the check image
daspect([1,1,1])
axis tight vis3d;
camlight; lighting gouraud
camproj perspective
colormap(flipud(jet(16))); caxis([0 1]); colorbar
xlabel x; ylabel y; zlabel z
box on
% Convert all columns from SCORE
xx = reshape(SCORE(:,1), I, J, K);
yy = reshape(SCORE(:,2), I, J, K);
zz = reshape(SCORE(:,3), I, J, K);
vv = reshape(SCORE(:,4), I, J, K);
% prepare figure
%clf
figure;
set(gcf, 'Renderer','zbuffer')
% render isosurface at level=0.5 as a wire-frame
isoval = 0.5;
[pf,pv] = isosurface(xx, yy, zz, vv, isoval);
p = patch('Faces',pf, 'Vertices',pv, 'FaceColor','none', 'EdgeColor',[0.5 1 0.5]);
% customize view and color-mapping
daspect([1,1,1])
axis tight vis3d;view(-45,35);
camlight; lighting gouraud
camproj perspective
colormap(flipud(jet(16))); caxis([0 1]); colorbar
xlabel x; ylabel y; zlabel z
box on
任何人都可以暗示可能会发生什么吗?似乎问题可能是重塑命令,我有可能取消之前完成的工作吗?