How to show different views on different axes ?

1 回表示 (過去 30 日間)
yogesh jain
yogesh jain 2016 年 2 月 26 日
編集済み: yogesh jain 2016 年 2 月 27 日
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

採用された回答

Mike Garrity
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.
  1 件のコメント
yogesh jain
yogesh jain 2016 年 2 月 27 日
編集済み: yogesh jain 2016 年 2 月 27 日
Thank you very much Mr. Mike, it helped me completely . BTW is there any other way also ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScalar Volume Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by