How to show different views on different axes ?
1 次查看(过去 30 天)
显示 更早的评论
Hello all, I have code to generate 3D volume , which is -
load mri.mat;
K = squeeze(D);
K = padarray(K,[10 10 10],'both');
Ds = smooth3(K);
i_surface = isosurface(Ds,5);
hold all
hiso = patch('Vertices', i_surface.vertices,...
'Faces', i_surface.faces,...
'FaceColor', [.2,.8,.9],...
'FaceAlpha',0.5,'EdgeColor', 'none','EdgeAlpha',0.9);
axis tight
daspect([1,1,0.4])
lightangle(-40,30); lightangle(90,0); lightangle(-180,0);
set(gcf,'Renderer','zbuffer'); lighting phong
isonormals(Ds,hiso)
set(hiso, 'SpecularColorReflectance', 0, 'SpecularExponent', 50)
view(-16,90);
Now I want to show three views (axial,sagittal and coronal) on different axes in GUI, how should I program that according to "axes handle" (axes(handles.axes))? Thank you
0 个评论
采纳的回答
Mike Garrity
2016-2-26
The simplest is to just create 4 copies of the scene you've made:
set(gcf,'Renderer','zbuffer');
load mri.mat;
K = squeeze(D);
K = padarray(K,[10 10 10],'both');
Ds = smooth3(K);
a1 = subplot(2,2,1);
i_surface = isosurface(Ds,5);
hold all
hiso = patch('Vertices', i_surface.vertices,...
'Faces', i_surface.faces,...
'FaceColor', [.2,.8,.9],...
'FaceAlpha',0.5,'EdgeColor', 'none','EdgeAlpha',0.9);
isonormals(Ds,hiso)
set(hiso, 'SpecularColorReflectance', 0, 'SpecularExponent', 50)
lightangle(-40,30);
lightangle(90,0);
lightangle(-180,0);
axis tight
daspect([1,1,0.4])
lighting phong
set(a1,'CameraPosition',[0 0 10]+get(a1,'CameraTarget'))
a2 = subplot(2,2,2);
copyobj(get(a1,'Children'),a2)
axis tight
daspect([1,1,0.4])
lighting phong
set(a2,'CameraPosition',[0 10 0]+get(a2,'CameraTarget'))
a3 = subplot(2,2,3);
copyobj(get(a1,'Children'),a3)
axis tight
daspect([1,1,0.4])
lighting phong
set(a3,'CameraPosition',[10 0 0]+get(a3,'CameraTarget'))
a4 = subplot(2,2,4);
copyobj(a1.Children,a4)
axis tight
daspect([1,1,0.4])
lighting phong
view(3)
In addition to copying the contents of the first axes into the others, you also need to set the properties like DataAspectRatio on each of the axes.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!