display_data

PURPOSE ^

DISPLAY_DATA show measurement structure in web browser

SYNOPSIS ^

function display_data( data, fwd_model )

DESCRIPTION ^

 DISPLAY_DATA show measurement structure in web browser

 Usage:
  display_data( data )

   where data is an eidors data object

 Usage:
  display_data( data, fwd_model )

   where data is a matrix M x F (Measurements x Frames)
   and fwd_model is an eidors fwd model structure

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function display_data( data, fwd_model )
0002 % DISPLAY_DATA show measurement structure in web browser
0003 %
0004 % Usage:
0005 %  display_data( data )
0006 %
0007 %   where data is an eidors data object
0008 %
0009 % Usage:
0010 %  display_data( data, fwd_model )
0011 %
0012 %   where data is a matrix M x F (Measurements x Frames)
0013 %   and fwd_model is an eidors fwd model structure
0014  
0015 % (C) 2005 Andy Adler.  License: GPL version 2 or version 3
0016 % $Id: display_data.m 1535 2008-07-26 15:36:27Z aadler $
0017 
0018 if nargin==1
0019     fwd_model= data.fwd_model;
0020 end
0021 
0022 d_name= 'Unknown';
0023 if isfield(data,'name');
0024     dname= data.name;
0025 end
0026 fm_name= fwd_model.name;
0027 
0028 fname= sprintf('%s.html', tempname );
0029 fid= fopen(fname,'wt');
0030 if fid==0; 
0031     error('can''t open file %s', fname );
0032 end
0033 
0034 %
0035 % Write out header
0036 %
0037 fprintf(fid, [ ...
0038 '<HTML><HEAD><TITLE>' ...
0039 'Data display %s. Model %s' ...
0040 '</TITLE></HEAD><BODY>' ...
0041 '<H1>Data display. <tt>data.name</tt>= %s' ...
0042                   '<tt>fwd_model.name</tt>= %s</H1>'], ...
0043   d_name, fm_name, d_name, fm_name );
0044 
0045 %
0046 % Write out electrodes
0047 %
0048 fprintf(fid, [...
0049 '<H2>Electrode information</H2>\n' ...
0050 '<Table border="1"><TR>\n' ...
0051 '<TH>Elec #<TH colspan=5>Posn<TH>Nodes<TH>Z<sub>c</sub>\n', ...
0052 '<TR>' ...
0053 '<TH><TH>x<TH>y<TH>z<TH>r<TH>&theta; (&deg;)<TH> <TH>(&Omega;)\n']);
0054 
0055 fme= fwd_model.electrode;
0056 n_elec= length(fme);
0057 xyctr= mean(fwd_model.nodes,1);
0058 for i=1:n_elec
0059     nodes= fme(i).nodes;
0060     posn= mean(fwd_model.nodes(nodes,:),1);
0061     posn= [posn, zeros(1,3-length(posn))]; % zero pad
0062     dxy= posn(1:2) - xyctr(1:2);
0063     radius= sqrt(norm(dxy));
0064     angle = 180/pi*atan2(dxy(2),dxy(1));
0065     nlist= sprintf('%d,', nodes);
0066     nlist= ['[', nlist(1:end-1),']'];
0067     fprintf( fid, ['\n<TR>' ...
0068     '<TD align="right">&nbsp;%d<TD align="right">&nbsp;%1.3f<TD align="right">&nbsp;%1.3f<TD align="right">&nbsp;%1.3f<TD align="right">&nbsp;%1.3f<TD align="right">&nbsp;%1.1f<TD>%s<TD align="right">&nbsp;%1.3f'], ...
0069     i,posn,radius,angle,nlist ,fme(i).z_contact);
0070 end
0071 fprintf( fid, '\n</Table>\n');
0072 
0073 %
0074 % Write out stimulation patterns
0075 %
0076 
0077 % Step 1: What are all the meas patterns used?
0078 % It is possible that two different patterns
0079 % use the same electrodes with different amplifications
0080 % we ignore that possibility here
0081 fms= fwd_model.stimulation;
0082 lfms= length(fms);
0083 
0084 elec_list = 2.^(0:n_elec-1)';
0085 meas_list = [];
0086 for i=1:lfms
0087     this_meas_list= (fms(i).meas_pattern~=0)*elec_list;
0088     meas_list = [meas_list, this_meas_list(:)'];
0089 end
0090 meas_list= unique(meas_list);
0091 lml= length(meas_list);
0092 
0093 fprintf(fid, [...
0094 '<H2>Stimulation pattern information</H2>\n' ...
0095 '<Table border="1"><TR>\n' ...
0096 '<TH>Stimulation<TH colspan="%d">Measurement Patterns\n', ...
0097 '<TR><TH>Patterns'],lml);
0098 ne2= floor(n_elec)/2;
0099 for i=1:lml
0100     d2b= dec2bin( meas_list(i),n_elec);
0101     for j=length(d2b):-4:1;
0102         d2b= [d2b(1:j),'<br>',d2b(j+1:end)];
0103     end
0104     fprintf(fid,'<TH aligh="center">%s', d2b );
0105 end
0106 fprintf( fid, '\n</Table>\n');
0107 
0108 
0109 fclose(fid);
0110 
0111 if isunix
0112     system(sprintf('mozilla file:///%s', fname));
0113 else
0114     system(sprintf('start file:///%s', fname));
0115 end
0116

Generated on Wed 21-Jun-2017 09:29:07 by m2html © 2005