- Timestamp:
- Jun 26, 2012, 8:40:09 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_files.m
r476 r477 89 89 'read_GUI';... %read all parameters set by a GUI as a Matlab structure 90 90 'read_image';...%read .civ files (obsolete, but can be adapted to other text documentation files) 91 'read_multimadoc';... %read a set of Imadoc files and compare their timing of different file series 91 92 'read_xls';...%read excel files containing the list of the experiments 92 93 'reinit';...% suppress the personal parameter file 'uvmat_perso.mat' -
trunk/src/find_field_indices.m
r411 r477 140 140 for ilist=1:numel(ListRole) 141 141 eval(['VarType{icell}.' ListRole{ilist} '=ivar_' ListRole{ilist} ';']) 142 end 142 end 143 143 if numel(ivar_coord_x)>1 || numel(ivar_coord_y)>1 || numel(ivar_coord_z)>1 144 144 errormsg='multiply defined coordinates in the same cell'; -
trunk/src/plot_field.m
r434 r477 463 463 title_str=[title_str ext]; 464 464 end 465 if isfield(data,'Action') 465 if isfield(data,'Action')&&isfield(data.Action,'ActionName') 466 466 if ~isequal(title_str,'') 467 467 title_str=[title_str ', ']; 468 468 end 469 title_str=[title_str data.Action ];469 title_str=[title_str data.Action.ActionName]; 470 470 end 471 471 htitle=title(title_str); -
trunk/src/read_multimadoc.m
r469 r477 1 %'read_multimadoc': read a set of Imadoc files and compare their timing of different file series 2 %------------------------------------------------------------------------ 3 % [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series) 4 % 5 % OUTPUT: 6 % 7 % 8 % INPUT: 9 % 1 10 function [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series) 11 errormsg=''; 2 12 nbview=numel(RootPath); 13 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing) 3 14 NbSlice_calib=cell(1,nbview); 4 15 timecell=cell(1,nbview); 5 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing)6 16 for iview=1:nbview%Loop on views 7 17 XmlFileName=find_imadoc(RootPath{iview},SubDir{iview},RootFile{iview},FileExt{iview}); -
trunk/src/series.m
r476 r477 767 767 update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) 768 768 769 770 %% display the set of existing files as an image771 set(handles.waitbar_frame,'Units','pixels')772 pos=get(handles.waitbar_frame,'Position');773 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices774 yima=0.5:pos(4)-0.5;775 [XIma,YIma]=meshgrid(xima,yima);776 nb_i=size(i1_series,1);777 nb_j=size(i1_series,2);778 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i;779 ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j;780 [Ind_i,Ind_j]=meshgrid(ind_i,ind_j);781 CData=zeros([size(XIma) 3]);782 file_ima=double((i1_series(:,:,1)>0)');783 if numel(file_ima)>=2784 if size(file_ima,1)==1785 CLine=interp1(ind_i,file_ima,xima,'nearest');786 CData(:,:,2)=ones(size(yima'))*CLine;787 else788 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest');789 end790 set(handles.waitbar_frame,'CData',CData)791 end792 set(handles.waitbar_frame,'Units','normalized')793 794 795 769 %% update the series info in 'UserData' 796 770 SeriesData=get(handles.series,'UserData'); … … 812 786 end 813 787 788 %% display the set of existing files as an image 789 set(handles.FileStatus,'Units','pixels') 790 Position=get(handles.FileStatus,'Position'); 791 set(handles.FileStatus,'Units','normalized') 792 xI=0.5:Position(3)-0.5; 793 nbview=numel(SeriesData.i1_series); 794 for iview=1:nbview 795 index_min(iview)=min(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)); 796 index_max(iview)=max(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)); 797 end 798 index_min=min(index_min); 799 index_max=max(index_max); 800 range_index=index_max-index_min+1; 801 scale_y=Position(4)/nbview; 802 scale_x=Position(3)/range_index; 803 x=(0.5:range_index-0.5)*Position(3)/range_index; 804 % y=(0.5:nbview-0.5)*Position(4)/nbview; 805 range_y=max(1,floor(Position(4)/nbview)); 806 CData=zeros(nbview*range_y,Position(3)); 807 for iview=1:nbview 808 ind_y=1+(iview-1)*range_y:iview*range_y; 809 LineData=zeros(1,range_index); 810 x_index=find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)-index_min+1; 811 LineData(x_index)=1; 812 LineData=interp1(x,LineData,xI,'nearest'); 813 CData(ind_y,:)=ones(size(ind_y'))*LineData; 814 end 815 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); 816 set(handles.FileStatus,'CData',CData); 817 818 % 819 % 820 % xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 821 % yima=0.5:pos(4)-0.5; 822 % [XIma,YIma]=meshgrid(xima,yima); 823 % nb_i=size(i1_series,1); 824 % nb_j=size(i1_series,2); 825 % ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; 826 % ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; 827 % [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); 828 % CData=zeros([size(XIma) 3]);%black color 829 % file_ima=double((i1_series(:,:,1)>0)'); 830 % if numel(file_ima)>=2 831 % if size(file_ima,1)==1 832 % CLine=interp1(ind_i,file_ima,xima,'nearest'); 833 % CData(:,:,2)=ones(size(yima'))*CLine; 834 % else 835 % CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 836 % end 837 % set(handles.FileStatus,'CData',CData) 838 % end 839 % set(handles.FileStatus,'Units','normalized') 840 841 814 842 %% enable field and veltype menus, in accordance with the current action 815 843 ActionName_Callback([],[], handles) … … 829 857 set(handles.PairString,'Visible','off') 830 858 end 859 860 %% set length of waitbar 861 displ_time(handles) 862 831 863 832 864 % %% set default options in menu 'Fields'%% TODO: check VelType … … 987 1019 displ_time(handles); 988 1020 1021 989 1022 %------------------------------------------------------------------------ 990 1023 % ---- find the times corresponding to the first and last indices of a series … … 994 1027 ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))]; 995 1028 ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))]; 996 % last_i=str2num(get(handles.num_last_i,'String'));997 % last_j=str2num(get(handles.num_last_j,'String'));998 1029 TimeTable=get(handles.TimeTable,'Data'); 999 1030 Pairs=get(handles.PairString,'Data'); … … 1040 1071 set(handles.TimeTable,'Data',TimeTable) 1041 1072 1073 %% set the waitbar position with respect to the min and max in the series 1074 % for iview=1:numel(SeriesData.i1_series) 1075 % [tild,index_min(iview)]=min(SeriesData.i1_series{iview}(SeriesData.i1_series{iview}>0)); 1076 % [tild,index_max(iview)]=max(SeriesData.i1_series{iview}(SeriesData.i1_series{iview}>0)); 1077 % end 1078 for iview=1:numel(SeriesData.i1_series) 1079 index_min(iview)=min(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)); 1080 index_max(iview)=max(find(SeriesData.i1_series{iview}(2:end,2:end,1)>0)); 1081 end 1082 [index_min,iview_min]=min(index_min); 1083 [index_max,iview_max]=min(index_max); 1084 index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); 1085 index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); 1086 range=index_max-index_min+1; 1087 coeff_min=(index_first-index_min)/range; 1088 coeff_max=(index_last-index_min+1)/range; 1089 Position=get(handles.Waitbar,'Position'); 1090 Position_status=get(handles.FileStatus,'Position'); 1091 Position(1)=coeff_min*Position_status(3)+Position_status(1); 1092 Position(3)=Position_status(3)*(coeff_max-coeff_min); 1093 set(handles.Waitbar,'Position',Position) 1094 update_waitbar(handles.Waitbar,0) 1095 1042 1096 %------------------------------------------------------------------------ 1043 1097 % --- Executes when selected cell(s) is changed in PairString. … … 1335 1389 Series=h_fun(Series);% no background in the absence of output file 1336 1390 else 1337 % update the xml file after interactive input with the function 1338 Series.Specific='?'; 1339 Series=h_fun(Series); 1340 t=struct2xml(Series); 1341 t=set(t,1,'name','Series'); 1342 save(t,filexml); 1343 path_uvmat=fileparts(which('uvmat')); 1344 1345 filename_bat=regexprep(filexml,'.xml$','.bat'); 1346 [fid,message]=fopen(filename_bat,'w'); 1347 if isequal(fid,-1) 1348 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); 1349 return 1391 % update the xml file after interactive input with the function 1392 Series.Specific='?'; 1393 Series=h_fun(Series); 1394 t=struct2xml(Series); 1395 t=set(t,1,'name','Series'); 1396 save(t,filexml); 1397 path_uvmat=fileparts(which('uvmat')); 1398 1399 filename_bat=regexprep(filexml,'.xml$','.bat'); 1400 [fid,message]=fopen(filename_bat,'w'); 1401 if isequal(fid,-1) 1402 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); 1403 return 1404 end 1405 path_fct=get(handles.ActionPath,'String'); 1406 filelog=regexprep(filexml,'.xml$','.log'); 1407 text_matlabscript=[... 1408 '#!/bin/bash \n'... 1409 '. /etc/sysprofile \n'... 1410 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'... 1411 'addpath(''' path_uvmat '''); \n'... 1412 'addpath(''' Series.Action.ActionPath '''); \n'... 1413 '' Series.Action.ActionName '( ''' filexml '''); \n'... 1414 'exit \n'... 1415 'END_MATLAB \n']; 1416 fprintf(fid,text_matlabscript); 1417 fclose(fid); 1418 if isunix 1419 system(['chmod +x ' filename_bat]);% set the file to executable 1420 system(['. ' filename_bat ' &']);%execute fct 1421 else 1422 system(filename_bat); 1423 end 1350 1424 end 1351 path_fct=get(handles.ActionPath,'String'); 1352 filelog=regexprep(filexml,'.xml$','.log'); 1353 text_matlabscript=[... 1354 '#!/bin/bash \n'... 1355 '. /etc/sysprofile \n'... 1356 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'... 1357 'addpath(''' path_uvmat '''); \n'... 1358 'addpath(''' Series.Action.ActionPath '''); \n'... 1359 '' Series.Action.ActionName '( ''' filexml '''); \n'... 1360 'exit \n'... 1361 'END_MATLAB \n']; 1362 fprintf(fid,text_matlabscript); 1363 fclose(fid); 1364 if isunix 1365 system(['chmod +x ' filename_bat]);% set the file to executable 1366 system(['. ' filename_bat ' &']);%execute fct 1367 else 1368 system(filename_bat); 1369 end 1370 end 1425 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate lounching is finished 1371 1426 end 1372 1427 … … 1621 1676 PathName=list_path{index_ACTION};%current recorded path 1622 1677 set(handles.ActionPath,'String',PathName); %show the path to the senlected function 1678 1679 %reinitialise the waitbar 1680 update_waitbar(handles.Waitbar,0) 1623 1681 1624 1682 %default setting for the visibility of the GUI elements … … 2112 2170 2113 2171 %% display the set of existing files as an image 2114 set(handles. waitbar_frame,'Units','pixels')2115 pos=get(handles. waitbar_frame,'Position');2172 set(handles.Waitbar,'Units','pixels') 2173 pos=get(handles.Waitbar,'Position'); 2116 2174 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 2117 2175 yima=0.5:pos(4)-0.5; … … 2131 2189 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 2132 2190 end 2133 set(handles. waitbar_frame,'CData',CData)2134 end 2135 set(handles. waitbar_frame,'Units','normalized')2191 set(handles.Waitbar,'CData',CData) 2192 end 2193 set(handles.Waitbar,'Units','normalized') 2136 2194 2137 2195 %% enable field and veltype menus -
trunk/src/set_object.m
r445 r477 640 640 if ~isempty(answer) 641 641 t=struct2xml(Object); 642 t=set(t,1,'name','ProjObject'); 642 643 save(t,answer{1}) 643 644 end -
trunk/src/update_waitbar.m
r339 r477 3 3 %INPUT: 4 4 % hwaitbar: handles of the waitbar to update 5 % bar_size: vector with 4 elements, representing the abscissa, ordinate, width, height of the waitbar relative to the GUI6 5 % advance_ratio: number between 0 and 1 representing the advancement of the calculation (loop index relative to the total length) 7 6 8 function update_waitbar(hwaitbar,bar_size,advance_ratio) 9 % waitbarpos(1)=bar_size(1); 10 % waitbarpos(3)=bar_size(3); 11 % waitbarpos(4)=advance_ratio*bar_size(4); 12 % waitbarpos(2)=bar_size(4)+bar_size(2)-waitbarpos(4); 13 % set(hwaitbar,'Position',waitbarpos) 7 function update_waitbar(hwaitbar,advance_ratio) 8 14 9 set(hwaitbar,'Units','pixels') 15 pos=get(hwaitbar,'Position'); 16 CData=zeros([floor(pos(4)) floor(pos(3)) 3]); 17 set(hwaitbar,'Units','normalized') 18 CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1; 10 pos=get(hwaitbar,'Position');%read waitbar position in pixels 11 set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI) 12 CData=ones(floor(pos(4)),floor(pos(3)),3); 13 CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0]) 14 CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green) 19 15 set(hwaitbar,'CData',CData) 20 16 drawnow -
trunk/src/uvmat.m
r476 r477 4543 4543 4544 4544 %read the file 4545 data=xml2struct(fileinput); 4546 4545 [data,heading]=xml2struct(fileinput); 4546 if ~strcmp(heading,'ProjObject') 4547 msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects') 4548 end 4547 4549 [tild,data.Name]=fileparts(FileName);% object name set as file name 4548 4550 ListObject=get(handles.ListObject,'String'); … … 4551 4553 set(handles.ListObject,'String',ListObject) 4552 4554 end 4553 4554 4555 IndexObj=length(ListObject); 4555 4556 -
trunk/src/xml2struct.m
r472 r477 41 41 case 'cell' 42 42 out=[];%default 43 if isequal(cellfun(@isnumeric,ss),ones(size(ss)))% if the all the cell content is numeric 44 out=cell2mat(ss); 45 else 46 for ilist=1:numel(ss) 43 check_numeric=zeros(size(ss)); 44 for ilist=1:numel(ss) 45 if ~isempty(str2num(ss{ilist})) 46 out{ilist,1}=str2num(ss{ilist}); 47 check_numeric(ilist)=1; 48 else 47 49 sep_ind=regexp(ss{ilist},'\s&\s');% check for separator ' & ' which indicates column separation in tables 48 50 if ~isempty(sep_ind) … … 56 58 end 57 59 end 58 % for ilist=1:numel(ss) 59 % if ~isempty(str2num(ss{ilist})) 60 % out(ilist,:)=str2num(ss{ilist});% convert to numeric 61 % end 62 % end 60 if isequal(check_numeric,ones(size(ss))) 61 out=cell2mat(out); 62 end 63 63 otherwise 64 64 out=ss;
Note: See TracChangeset
for help on using the changeset viewer.