0001 function img = mk_thorax_model_grychtol2016a(stimpat)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 citeme(mfilename);
0021
0022 if nargin<1 || isempty(stimpat)
0023 stimpat = '1x32_ring';
0024 end
0025
0026
0027 eth16 = 360*cumsum([0.2 0.4*ones(1,7) 0.5 0.4*ones(1,7)])/6.5 - 90; eth16 = eth16';
0028 eth32 = 360*cumsum([0.1 0.2*ones(1,15) 0.25 0.2*ones(1,15)])/6.45 - 90; eth32 = eth32';
0029 ep = eth16; ep(:,2) = 150;
0030 ep(17:48,1) = eth32; ep(17:48,2) = 175;
0031 ep(49:64,1) = eth16; ep(49:64,2) = 200;
0032 mdl = mk_thorax_model('male',ep,[5 0 .5],10);
0033 mdl.name = sprintf(['Thorax mesh from Grychtol, Müller and Adler (2016) '...
0034 '- %s electrode config'],stimpat);
0035
0036 emap = get_elec_map(stimpat);
0037 mdl.electrode = mdl.electrode(emap);
0038 mdl.stimulation = get_stim_pattern(stimpat);
0039
0040
0041 opt = organ_options;
0042 img = mk_lung_image(mdl,opt);
0043 img.fwd_model.normalize_measurements = false;
0044
0045 img.name = sprintf(['Thorax model from Grychtol, Müller and Adler (2016) '...
0046 '- %s electrode config'],stimpat);
0047
0048 end
0049
0050
0051 function opt = organ_options
0052 opt.bkgnd_val = 1 ;
0053 opt.lung_val = .2;
0054 opt.heart_val = 1.5;
0055 opt.left_lung_center = [ 75 25 100];
0056 opt.right_lung_center = [-75 25 100];
0057 opt.left_lung_axes = [80 100 250];
0058 opt.right_lung_axes = [80 100 250];
0059 opt.heart_center = [20 -25 200];
0060 opt.heart_axes = [50 60 75];
0061 opt.diaphragm_center = [0 -50 0];
0062 opt.diaphragm_axes = [220 190 120];
0063 end
0064
0065 function stim = get_stim_pattern(str)
0066 switch(str)
0067 case '2x16_planar'
0068 stim = mk_stim_patterns(32,1,[0 6],[0 6],{'no_meas_current','no_rotate_meas'},1);
0069 case {'2x16_odd-even', '2x16_square', '1x32_ring'}
0070 stim = mk_stim_patterns(32,1,[0 5],[0 5],{'no_meas_current','no_rotate_meas'},1);
0071 case '2x16_adjacent'
0072 stim = mk_stim_patterns(32,1,[0 1],[0 1],{'no_meas_current','no_rotate_meas'},1);
0073 otherwise
0074 error('Stim pattern string not understood. Available strings are: \n%s', ...
0075 sprintf('%s\n', pattern_list));
0076 end
0077 end
0078
0079 function ls = pattern_list
0080 ls = {
0081 '2x16_planar'
0082 '2x16_odd-even'
0083 '2x16_square'
0084 '2x16_adjacent'
0085 '1x32_ring'
0086 };
0087 end
0088
0089 function map = get_elec_map(str)
0090
0091 switch str
0092 case {'2x16_odd-even', '2x16_planar'}
0093 map = oddeven32;
0094 case {'2x16_square', '2x16_adjacent'}
0095 map = square32;
0096 case '1x32_ring'
0097 map = ring32;
0098 otherwise
0099 error('No such electrode map');
0100 end
0101 end
0102
0103 function m = square32
0104 o = [48 1 -48 1];
0105 o = repmat(o,1,8);
0106 m = zeros(1,32);
0107 m(1) = 1;
0108 for i = 2:32
0109 m(i) = m(i-1) + o(i-1);
0110 end
0111 end
0112
0113
0114 function m = oddeven32
0115 odd = 49:64;
0116 even = 1:16;
0117 m = [odd; even];
0118 m = m(:)';
0119 end
0120
0121 function m = ring32
0122 m = 17:48;
0123 end