Changeset 477 for trunk/src/series.m
- Timestamp:
- Jun 26, 2012, 8:40:09 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.