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 − Workshop Download Contrib Data GREIT Browse Docs Browse SVN News Mailing list (archive) FAQ Developer
|
Using Netgen to simulate fwd and inverse solutionsEIDORS can use Netgen to create sophisticated 2D and 3D modelsModel a 2D tank with 8 electrodes% Netgen simulation $Id: netgen_sims01.m 3273 2012-06-30 18:00:35Z aadler $ extra={'ball','solid ball = cylinder(0.2,0.2,0;0.2,0.2,1;0.2) and orthobrick(-1,-1,0;1,1,0.05);'}; fmdl= ng_mk_cyl_models(0,[9],[0.2,0,0.05],extra); ctr = interp_mesh(fmdl); ctr=(ctr(:,1)-0.2).^2 + (ctr(:,2)-0.2).^2; img= mk_image(fmdl, 1 + 0.1*(ctr < 0.2^2)); subplot(221) show_fem(img); print_convert netgen_sims01a.png '-density 100' Simulate a 2D tank with 8 electrodes with adjacent patterns% Netgen simulation $Id: netgen_sims02.m 3791 2013-04-04 15:48:25Z aadler $ % Calculate stimulation pattern adjacent stim = mk_stim_patterns(9,1,[0,1],[0,1],{},1); img.fwd_model.stimulation = stim; % Get all voltages so we can plot it img.fwd_solve.get_all_meas = 1; % Homogeneous model img.elem_data(:) = 1; vh = fwd_solve(img); % Show Voltage for stim pattern #1 imgn = rmfield(img,'elem_data'); imgn.node_data = vh.volt(:,1); h1= subplot(221); show_fem(imgn); % Show Voltage for stim pattern #2 imgn = rmfield(img,'elem_data'); imgn.node_data = vh.volt(:,2); h2= subplot(222); show_fem(imgn); imgn.calc_colours.cb_shrink_move = [0.5,0.8,-.02]; common_colourbar([h1,h2],imgn); print_convert netgen_sims02a.png '-density 100' Figure: Voltage pattens for two adjacent simulation patterns Simulate a 2D tank with 8 electrodes with different current patterns% Netgen simulation $Id: netgen_sims03.m 3792 2013-04-04 16:01:34Z aadler $ clf;subplot(221); % Calculate stimulation pattern adjacent img.fwd_model.stimulation = mk_stim_patterns(9,1,[0,1],[0,1],{},1); vh = fwd_solve(img); imgn.node_data = vh.volt(:,1); show_fem(imgn); axis equal; axis tight; print_convert netgen_sims03a.png '-density 100' % Calculate stimulation pattern offset-2 img.fwd_model.stimulation = mk_stim_patterns(9,1,[0,2],[0,1],{},1); vh = fwd_solve(img); imgn.node_data = vh.volt(:,1); show_fem(imgn); axis equal; axis tight; print_convert netgen_sims03b.png '-density 100' % Calculate stimulation pattern offset-3 img.fwd_model.stimulation = mk_stim_patterns(9,1,[0,3],[0,1],{},1); vh = fwd_solve(img); imgn.node_data = vh.volt(:,1); show_fem(imgn); axis equal; axis tight; print_convert netgen_sims03c.png '-density 100' % Calculate stimulation pattern offset-4 img.fwd_model.stimulation = mk_stim_patterns(9,1,[0,4],[0,1],{},1); vh = fwd_solve(img); imgn.node_data = vh.volt(:,1); show_fem(imgn); axis equal; axis tight; print_convert netgen_sims03d.png '-density 100' Figure: Voltage pattens for two adjacent simulation patterns Simulate a voltages for a change in conductivity% Netgen simulation $Id: netgen_sims04.m 3792 2013-04-04 16:01:34Z aadler $ % Calculate stimulation pattern offset-4 img.fwd_model.stimulation = mk_stim_patterns(9,1,[0,4],[0,1],{},1); % Set homogeneous phantom img.elem_data(:) = 1; vh = fwd_solve(img); imgn.node_data = vh.volt(:,1); imgn.calc_colours.cb_shrink_move = [0.3,0.7,0.02]; imgn.calc_colours.ref_level = 0; clf; subplot(221); show_fem(imgn,1); axis equal; axis tight; print_convert netgen_sims04a.png '-density 100' % Set inhomogeneity very insulating img.elem_data = 1 - 0.99*(ctr < 0.2^2); vi = fwd_solve(img); imgn.node_data = vi.volt(:,1); clf; subplot(221); show_fem(imgn,1); axis equal; axis tight; print_convert netgen_sims04b.png '-density 100' % Difference in voltages imgn.node_data = vh.volt(:,1) - vi.volt(:,1); clf; subplot(221); show_fem(imgn,1); axis equal; axis tight; print_convert netgen_sims04c.png '-density 100' Figure: Voltage pattens without (left) and with (middle) non-conductive target. Right is the difference in voltage pattern. Voltage patterns for a change in conductivity% Netgen simulation $Id: netgen_sims05.m 2787 2011-07-14 21:52:22Z bgrychtol $ subplot(211) plot([vh.meas, vi.meas, vi.meas-vh.meas]); print_convert netgen_sims05a.png '-density 100' Figure: Voltage pattens without (green) and with (blue) non-conductive target. Red is the difference in voltage pattern. Simple image reconstruction% Netgen simulation $Id: netgen_sims06.m 4839 2015-03-30 07:44:50Z aadler $ subplot(221) % Get a basic inverse model - replace the fwd model part imdl = mk_common_model('a2c2',16); % the parameters aren't important because we replace it imdl.fwd_model = img.fwd_model; imgr = inv_solve(imdl, vh, vi); show_fem(imgr); axis equal; axis tight; print_convert netgen_sims06a.png '-density 100' % Change the hyperparameter imdl.hyperparameter.value = .05; imgr = inv_solve(imdl, vh, vi); show_fem(imgr); axis equal; axis tight; print_convert netgen_sims06b.png '-density 100' Figure: Image reconstructed with large (left) and smaller (right) hyperparameter value. Note that the expected resolution with nine electrodes isn't particularly good. |
Last Modified: $Date: 2017-02-28 13:12:08 -0500 (Tue, 28 Feb 2017) $ by $Author: aadler $