|
EIDORS: Electrical Impedance Tomography and Diffuse Optical Tomography Reconstruction Software |
|
EIDORS
(mirror) Main Documentation Tutorials − Image Reconst − Data Structures − Applications − FEM Modelling − GREIT − Old tutorials Download Contrib Data GREIT Browse Docs Browse SVN News Mailing list (archive) FAQ Developer
|
EIDORS fwd_modelsCreating an FEM and solving the forward problemEIDORS has functions to create common FEM models.
% Forward solvers $Id: forward_solvers01.m 2157 2010-04-04 11:22:54Z aadler $
% 2D Model
imdl= mk_common_model('d2d1c',19);
% Create an homogeneous image
img_1 = mk_image(imdl);
subplot(221); show_fem(img_1);
% Add a circular object at 0.2, 0.5
% Calculate element membership in object
img_2 = img_1;
select_fcn = inline('(x-0.2).^2+(y-0.5).^2<0.1^2','x','y','z');
img_2.elem_data = 1 + elem_select(img_2.fwd_model, select_fcn);
img_2.calc_colours.cb_shrink_move = [0.3,0.6,+0.03];
subplot(222); show_fem(img_2,1);
print_convert forward_solvers01a.png
Figure: A 2D finite element model (left) and an conductivity contrasting inclusion (right)
% Forward solvers $Id: forward_solvers02.m 2157 2010-04-04 11:22:54Z aadler $
% Calculate a stimulation pattern
stim = mk_stim_patterns(19,1,[0,1],[0,1],{},1);
% Solve all voltage patterns
img_2.fwd_model.stimulation = stim;
img_2.fwd_solve.get_all_meas = 1;
vh = fwd_solve(img_2);
% Show first stim pattern
subplot(221);
img_v = rmfield(img_2, 'elem_data');
img_v.node_data = vh.volt(:,1);
show_fem(img_v);
% Show 7th stim pattern
subplot(222);
img_v = rmfield(img_2, 'elem_data');
img_v.node_data = vh.volt(:,7);
img_v.calc_colours.cb_shrink_move = [0.3,0.6,+0.03];
show_fem(img_v,1);
print_convert forward_solvers02a.png
Figure: The voltage pattern from adjacent stimulation
% Forward solvers $Id: forward_solvers03.m 2157 2010-04-04 11:22:54Z aadler $
% Calculate a stimulation pattern
stim = mk_stim_patterns(19,1,[0,9],[0,1],{},1);
% Solve all voltage patterns
img_2.fwd_model.stimulation = stim;
img_2.fwd_solve.get_all_meas = 1;
vh = fwd_solve(img_2);
% Show first stim pattern
subplot(221);
img_v = rmfield(img_2, 'elem_data');
img_v.node_data = vh.volt(:,1);
show_fem(img_v);
% Show 7th stim pattern
subplot(222);
img_v = rmfield(img_2, 'elem_data');
img_v.node_data = vh.volt(:,7);
img_v.calc_colours.cb_shrink_move = [0.3,0.6,+0.03];
show_fem(img_v,1);
print_convert forward_solvers03a.png
Figure: The voltage pattern from opposite (nearly) stimulation
% Forward solvers $Id: forward_solvers04.m 2157 2010-04-04 11:22:54Z aadler $
% Calculate a stimulation pattern
stim = mk_stim_patterns(19,1,[0,1],[0,1],{},1);
% Solve all voltage patterns
img_1.fwd_model.stimulation = stim;
img_1.fwd_solve.get_all_meas = 1;
vh1= fwd_solve(img_1);
img_2.fwd_model.stimulation = stim;
img_2.fwd_solve.get_all_meas = 1;
vh2= fwd_solve(img_2);
img_v = rmfield(img_2, 'elem_data');
% Show homoeneous image
subplot(231);
img_v.node_data = vh1.volt(:,1);
show_fem(img_v);
% Show inhomoeneous image
subplot(232);
img_v.node_data = vh2.volt(:,1);
show_fem(img_v);
% Show difference image
subplot(233);
img_v.node_data = vh1.volt(:,1) - vh2.volt(:,1);
img_v.calc_colours.cb_shrink_move = [0.3,0.6,+0.03];
show_fem(img_v,1);
print_convert forward_solvers04a.png
Figure: The voltage pattern from a change in conductivity
% Forward solvers $Id: forward_solvers05.m 2157 2010-04-04 11:22:54Z aadler $
% Solve all voltage patterns
img_2.fwd_solve.get_all_meas = 1;
img_2.fwd_model.mdl_slice_mapper.npx = 64;
img_2.fwd_model.mdl_slice_mapper.npy = 64;
% Show [0-3] stim pattern
subplot(221);
stim = mk_stim_patterns(19,1,[0,3],[0,1],{},1);
img_2.fwd_model.stimulation = stim;
vh = fwd_solve(img_2);
show_current(img_2,vh.volt(:,1));
axis([-1,1,-1,1]);
% Show [2-9] stim pattern
subplot(222);
stim = mk_stim_patterns(19,1,[0,7],[0,1],{},1);
img_2.fwd_model.stimulation = stim;
vh = fwd_solve(img_2);
show_current(img_2,vh.volt(:,3));
axis([-1,1,-1,1]);
print_convert forward_solvers05a.png
Figure: The current pattern for various stimulation patterns |
Last Modified: $Date: 2011-07-15 06:48:46 -0400 (Fri, 15 Jul 2011) $ by $Author: aadler $