試試這個:的解釋是在評論
V = [195.1126 169.3114 62.4193,28.2725 23.0191 9.3104,52.9536 -5.7639 1.7606];
c = V(1:3); % The centroid
l = V(4:6); % Axis Length
phi = -V(7:9); % Angles
E = zeros(512,512,85); % initialize Elipse matrix
R = rotx(phi(1))*roty(phi(2))*rotz(phi(3)); % Create rotation matrix around phi
%%
[X,Y,Z] = meshgrid(1:size(E,2),1:size(E,1),1:size(E,3)); % Create a Grid
XYZr = ([X(:)-c(1),Y(:)-c(2),Z(:)-c(3)])*R; % rotate Grid and centralize around centroid
%% Calculate the elipse equation
inx = (((XYZr(:,1)))./l(1)); %
iny = (((XYZr(:,2)))./l(2));
inz = (((XYZr(:,3)))./l(3));
ind = [inx,iny,inz];
E(:) = sum(ind.^2,2)<1;
%% Display
figure; imagesc(E(:,:,62));
figure; imagesc(squeeze(E(:,195,:)));
figure; imagesc(squeeze(E(170,:,:)));
大家好,我試過,但它不工作...它給了我錯誤的結果...橢球是完全錯誤的,未經審查並以錯誤的半徑出現。只是一個解釋:我初始化E爲512x512x85矩陣,因爲我的音量是512x512x85。如果你嘗試這個,它將無法工作。你對如何解決這個問題有任何想法嗎? – David
我編輯了回覆 – aarbelle
謝謝。有用 – David