![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173020/image.png)
How to show different views on different axes ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
yogesh jain
el 26 de Feb. de 2016
Editada: yogesh jain
el 27 de Feb. de 2016
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 comentarios
Respuesta aceptada
Mike Garrity
el 26 de Feb. de 2016
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173020/image.png)
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.
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!