fig = figure;
axes1 = axes('Parent',fig,'Position',[0.13 0.4 0.37 0.5]);
surf(x,y,z,B,'EdgeColor','None','HandleVisibility','off','Parent',axes1);
grid on
view([-62.6 13.8])
colormap(gray)
xlabel('x-axis')
ylabel('y-axis');
zlabel('z-axis');
title('Position of Slice in 3-D Coordinate Space')
点と法線ベクトルをプロットします。
hold on
plot3(point(1),point(2),point(3),'or','MarkerFaceColor','r');
plot3(normal(1),normal(2),normal(3),'ob','MarkerFaceColor','b');
hold off
legend('Point in the volume','Normal vector','Position',[0.15 0.2 0.3 0.08])
figure
for slice = 1:size(B,3)
subplot('Position',[0.11 0.36 0.38 0.5])
surf(x(:,:,slice),y(:,:,slice),z(:,:,slice),B(:,:,slice), ...'EdgeColor','None','HandleVisibility','off');
grid on
view([-24 12])
colormap(gray)
xlabel('x-axis')
ylabel('y-axis');
zlabel('z-axis');
zlim([0 155]);
ylim([0 250]);
xlim([0 250]);
title('Position of Slice in 3-D Coordinate Space')
% Plot the point and the normal vector.
hold on
plot3(point{slice}(1),point{slice}(2),point{slice}(3),'or','MarkerFaceColor','r');
plot3(normal(1),normal(2),normal(3),'ob','MarkerFaceColor','b');
legend('Point in the volume','Normal vector','Position',[0.1 0.12 0.3 0.08])
hold off% Display the extracted slice.
subplot('Position',[0.6 0.37 0.34 0.49])
imshow(B(:,:,slice),[])
title('Output Slice in Image Plane')
pause(0.5);
end
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.