Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fahsuanlin authored Feb 10, 2024
1 parent 8b517d4 commit 0356e12
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions scripts/show_bem_fhlin.m
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0356e12

Please sign in to comment.