diff --git a/scripts/show_bem_fhlin.m b/scripts/show_bem_fhlin.m new file mode 100644 index 0000000..c333aca --- /dev/null +++ b/scripts/show_bem_fhlin.m @@ -0,0 +1,43 @@ +close all; clear all; + +subjects_dir='/Users/fhlin/workspace/eegmri_wm/subjects'; +subject='s001'; + +file_surf={ +'outer_skin.surf' +'outer_skull.surf' +'inner_skull.surf' +}; + +output_file_surf={ +'outer_skin.surf' +'outer_skull.surf' +'inner_skull.surf' +}; + +for f_idx=1:length(file_surf) + + + [surf_vertex{f_idx},surf_face{f_idx}]=read_surf(sprintf('%s/%s/bem/%s',subjects_dir,subject, file_surf{f_idx})); + surf_face{f_idx}=surf_face{f_idx}+1; + + TR = triangulation(surf_face{f_idx},surf_vertex{f_idx}); + surf_center{f_idx}= incenter(TR); + surf_norm{f_idx} = faceNormal(TR); + + %save files for e-field modeling + P=surf_vertex{f_idx}; + t=surf_face{f_idx}; + normals=surf_norm{f_idx}; + save(sprintf('%s',output_file_surf{f_idx}),'P','t','normals'); + + hold on; + colors=get(gca,'colororder'); + h=patch('vertices',surf_vertex{f_idx},'faces',surf_face{f_idx},'edgecolor','none','facecolor',colors(f_idx,:),'facealpha',0.2); + %quiver3(surf_center{f_idx}(:,1),surf_center{f_idx}(:,2),surf_center{f_idx}(:,3),surf_norm{f_idx}(:,1),surf_norm{f_idx}(:,2),surf_norm{f_idx}(:,3),0.5,'color','r'); + +end; +view(-160,20); +lighting phong +camlight +axis off vis3d equal \ No newline at end of file