- Timestamp:
- Jul 15, 2012, 10:30:28 AM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r487 r492 24 24 %TODO: search range 25 25 26 % Last Modified by GUIDE v2.5 21-Jun-2012 23:37:4726 % Last Modified by GUIDE v2.5 13-Jul-2012 15:11:00 27 27 % Begin initialization code - DO NOT EDIT 28 28 gui_Singleton = 1; … … 533 533 end 534 534 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 535 set(handles.ListPairMode,'Value',1); 536 set(handles.ListPairMode,'String',{'series(Di)'}) 535 set(handles.ListPairMode,'Value',1); 537 536 dt=1/get(MovieObject,'FrameRate');%time interval between successive frames 538 MaxIndex_i=get(MovieObject,'NumberOfFrames'); 539 time=(dt*(0:MaxIndex_i-1))';%list of image times 537 if strcmp(NomTypeIma,'*') 538 set(handles.ListPairMode,'String',{'series(Di)'}) 539 MaxIndex_i=get(MovieObject,'NumberOfFrames'); 540 time=(dt*(0:MaxIndex_i-1))';%list of image times 541 else 542 set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}]) 543 MaxIndex_i=max(i1_series(i1_series>0)); 544 MaxIndex_j=get(MovieObject,'NumberOfFrames'); 545 time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times 546 enable_j(handles,'on') 547 end 540 548 TimeUnit='s'; 541 549 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter … … 614 622 set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large 615 623 end 616 else 624 elseif ~(strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 617 625 set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice 618 626 if strcmp(NomTypeNc,'_1-2_1') … … 2549 2557 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default 2550 2558 end 2551 % if strcmp(option,'stereo PIV') && get(handles.CheckPatch1,'Value')2552 % set(handles.CheckStereo,'Visible','on')2553 % else2554 % set(handles.CheckStereo,'Visible','off')2555 % end2556 % if strcmp(option,'stereo PIV') && get(handles.CheckPatch2,'Value')2557 % set(handles.CheckStereo,'Visible','on')2558 % else2559 % set(handles.CheckStereo,'Visible','off')2560 % end2561 2559 ListPairMode_Callback(hObject, eventdata, handles) 2562 2560 … … 3855 3853 end 3856 3854 case 'series(Dj)' 3857 r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names');3858 if ~isempty(r)3855 % r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); 3856 % if ~isempty(r) 3859 3857 NomTypeNc='_1_1-2'; 3860 end3858 % end 3861 3859 case 'series(Di)' 3862 3860 r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); … … 4375 4373 case {'PCWIN','PCWIN64'} 4376 4374 filename=regexprep(filename,'\\','\\\\');% add '\' so that '\' are left as characters 4375 cmd=['civ_matlab(''' regexprep(filename,'(.+)([/\\])(.+$)','$1$20_XML\\$2$3.xml') ''','''... 4376 filename '.nc'');']; 4377 4377 case {'GLNX86','GLNXA64','MACI64'} 4378 cmd=['civ_matlab(''' regexprep(filename,'(.+)([/\\])(.+$)','$1$20_XML$2$3.xml') ''','''... 4379 filename '.nc'');']; 4378 4380 end 4379 cmd=['civ_matlab(''' regexprep(filename,'(.+)([/\\])(.+$)','$1$20_XML$2$3.xml') ''','''... 4380 filename '.nc'');'];4381 4382 4381 4383 case 'civ_matlab.sh' 4382 4384 switch computer … … 4553 4555 % --- Executes on selection change in RunMode. 4554 4556 function RunMode_Callback(hObject, eventdata, handles) 4557 4558 4559 4560 function nb_field2_Callback(hObject, eventdata, handles) 4561 % hObject handle to nb_field2 (see GCBO) 4562 % eventdata reserved - to be defined in a future version of MATLAB 4563 % handles structure with handles and user data (see GUIDATA) 4564 4565 % Hints: get(hObject,'String') returns contents of nb_field2 as text 4566 % str2double(get(hObject,'String')) returns contents of nb_field2 as a double 4567 4568 4569 4570 function last_j_Callback(hObject, eventdata, handles) 4571 % hObject handle to last_j (see GCBO) 4572 % eventdata reserved - to be defined in a future version of MATLAB 4573 % handles structure with handles and user data (see GUIDATA) 4574 4575 % Hints: get(hObject,'String') returns contents of last_j as text 4576 % str2double(get(hObject,'String')) returns contents of last_j as a double 4577 4578 4579 4580 function last_i_Callback(hObject, eventdata, handles) 4581 % hObject handle to last_i (see GCBO) 4582 % eventdata reserved - to be defined in a future version of MATLAB 4583 % handles structure with handles and user data (see GUIDATA) 4584 4585 % Hints: get(hObject,'String') returns contents of last_i as text 4586 % str2double(get(hObject,'String')) returns contents of last_i as a double -
trunk/src/civ_matlab.m
r466 r492 223 223 Data.VarAttribute{nbvar+2}.Role='vector_y'; 224 224 Data.VarAttribute{nbvar+5}.Role='coord_tps'; 225 Data.VarAttribute{nbvar+6}.Role='vector_x _tps';226 Data.VarAttribute{nbvar+7}.Role='vector_y _tps';225 Data.VarAttribute{nbvar+6}.Role='vector_x'; 226 Data.VarAttribute{nbvar+7}.Role='vector_y'; 227 227 Data.Civ1_U_smooth=zeros(size(Data.Civ1_X)); 228 228 Data.Civ1_V_smooth=zeros(size(Data.Civ1_X)); … … 407 407 Data.VarAttribute{nbvar+2}.Role='vector_y'; 408 408 Data.VarAttribute{nbvar+5}.Role='coord_tps'; 409 Data.VarAttribute{nbvar+6}.Role='vector_x _tps';410 Data.VarAttribute{nbvar+7}.Role='vector_y _tps';409 Data.VarAttribute{nbvar+6}.Role='vector_x'; 410 Data.VarAttribute{nbvar+7}.Role='vector_y'; 411 411 Data.Civ2_U_smooth=zeros(size(Data.Civ2_X)); 412 412 Data.Civ2_V_smooth=zeros(size(Data.Civ2_X)); -
trunk/src/proj_field.m
r491 r492 536 536 %project on a line 537 537 % AJOUTER flux,circul,error 538 % OUTPUT: 539 % ProjData: projected field 540 % 538 541 function [ProjData,errormsg] = proj_line(FieldData, ObjectData) 539 542 %----------------------------------------------------------------- … … 547 550 if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end; 548 551 % ProjAngle=90; %90 degrees projection by default 549 % if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end; 552 550 553 width=0;%default width of the projection band 551 554 if isfield(ObjectData,'Range')&&size(ObjectData.Range,2)>=2 … … 569 572 ListIndex={}; 570 573 571 % angles of the polyline and boundaries of action574 %% angles of the polyline and boundaries of action 572 575 dlinx=diff(ObjectData.Coord(:,1)); 573 576 dliny=diff(ObjectData.Coord(:,2)); 574 theta=angle(dlinx+ i*dliny);%angle of each segment577 theta=angle(dlinx+1i*dliny);%angle of each segment 575 578 theta(siz_line(1))=theta(siz_line(1)-1); 576 579 % determine a rectangles at +-width from the line (only used for the ProjMode='projection or 'filter') 580 xsup=zeros(1,siz_line(1)); xinf=zeros(1,siz_line(1)); ysup=zeros(1,siz_line(1)); yinf=zeros(1,siz_line(1)); 577 581 if isequal(ProjMode,'projection') || isequal(ProjMode,'filter') 578 582 xsup(1)=ObjectData.Coord(1,1)-width*sin(theta(1)); … … 588 592 end 589 593 590 % group the variables (fields of 'FieldData') in cells of variables with the same dimensions594 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions 591 595 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(FieldData); 592 596 if ~isempty(errormsg) … … 595 599 end 596 600 597 % loop on variable cells with the same space dimension601 %% loop on variable cells with the same space dimension 598 602 ProjData.ListVarName={}; 599 603 ProjData.VarDimName={}; 604 testproj=zeros(size(FieldData.ListVarName)); 600 605 for icell=1:length(CellVarIndex) 601 606 VarIndex=CellVarIndex{icell};% indices of the selected variables in the list FieldData.ListVarName … … 605 610 end 606 611 testX=~isempty(VarType.coord_x) && ~isempty(VarType.coord_y);% test for unstructured coordinates 612 test_tps=~isempty(VarType.coord_tps); 607 613 testU=~isempty(VarType.vector_x) && ~isempty(VarType.vector_y);% test for vectors 608 614 testfalse=~isempty(VarType.errorflag);% test for error flag 609 615 testproj(VarIndex)=zeros(size(VarIndex));% test =1 for simply projected variables, default =0 610 616 %=0 for vector components, treated separately 611 testproj(VarType.scalar)=1; 612 testproj(VarType.image)=1; 613 testproj(VarType.color)=1; 617 testproj([VarType.scalar VarType.image VarType.color VarType.vector_x VarType.vector_y])=1; 614 618 VarIndex=VarIndex(find(testproj(VarIndex)));%select only the projected variables 615 if testU 616 VarIndex=[VarIndex VarType.vector_x VarType.vector_y];%append u and v at the end of the list of variables 617 end 619 618 620 %identify vector components 619 621 if testU 620 622 UName=FieldData.ListVarName{VarType.vector_x}; 621 623 VName=FieldData.ListVarName{VarType.vector_y}; 622 eval(['vector_x=FieldData.' UName ';'])623 eval(['vector_y=FieldData.' VName ';'])624 vector_x=FieldData.(UName); 625 vector_y=FieldData.(VName); 624 626 end 625 627 %identify error flag 626 628 if testfalse 627 629 FFName=FieldData.ListVarName{VarType.errorflag}; 628 e val(['errorflag=FieldData.' FFName ';'])630 errorflag=FieldData.(FFName); 629 631 end 630 632 % check needed object properties for unstructured positions (position given by the variables with role coord_x, coord_y … … 648 650 XName= FieldData.ListVarName{VarType.coord_x}; 649 651 YName= FieldData.ListVarName{VarType.coord_y}; 650 eval(['coord_x=FieldData.' XName ';'])651 eval(['coord_y=FieldData.' YName ';'])652 coord_x=FieldData.(XName); 653 coord_y=FieldData.(YName); 652 654 end 653 655 %initiate projection … … 737 739 end 738 740 ProjData.X=XLine'; 739 cur_index=1;740 741 ProjData.ListVarName=[ProjData.ListVarName {XName}]; 741 742 ProjData.VarDimName=[ProjData.VarDimName {XName}]; … … 871 872 ProjData.VarDimName{end}={AXName,'rgb'}; 872 873 end 873 end 874 end 875 elseif test_tps 876 if isfield(ObjectData,'DX')&~isempty(ObjectData.DX) 877 DX=abs(ObjectData.DX);%mesh of interpolation points along the line 878 Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint); 879 xreg=cos(theta(ip))*Xproj+ObjectData.Coord(ip,1) 880 yreg=sin(theta(ip))*Xproj+ObjectData.Coord(ip,2) 881 % coord_x_proj=XMin:DX:XMax; 882 % coord_y_proj=YMin:DY:YMax; 883 DataOut=calc_field(FieldData.FieldList,FieldData,cat(3,xreg,yreg)); 884 ProjData.ListVarName=[ProjData.ListVarName DataOut.ListVarName]; 885 ProjData.VarDimName=[ProjData.VarDimName DataOut.VarDimName]; 886 ProjData.VarAttribute=[ProjData.VarAttribute DataOut.VarAttribute]; 887 DataOut.ListVarName(1)=[]; 888 DataOut.VarDimName(1)=[]; 889 DataOut.VarAttribute(1)=[]; 890 for ilist=2:length(DataOut.ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise 891 VarName=DataOut.ListVarName{ilist}; 892 ProjData.(VarName)=DataOut.(VarName); 893 end 894 ProjData.coord_x=Xproj; 895 end 874 896 end 875 897 end -
trunk/src/read_civdata.m
r406 r492 134 134 end 135 135 end 136 if isempty(vel_type)||strcmp(vel_type,'*')137 switch CivStage138 case {6} %filter2 available139 vel_type='civ2';140 case {4,5}% civ2 available but not filter2141 if testder% derivatives needed142 vel_type='civ1';143 else144 vel_type='civ2';145 end146 case {1,2,3}% civ1 available but not civ2147 vel_type='civ1';148 end149 end150 136 if strcmp(vel_type,'civ2') && testder 151 137 vel_type='filter2'; … … 153 139 vel_type='filter1'; 154 140 end 141 if isempty(vel_type)||strcmp(vel_type,'*') 142 switch CivStage 143 case {6} %filter2 available 144 vel_type='filter2'; 145 case {4,5}% civ2 available but not filter2 146 if testder% derivatives needed 147 vel_type='filter1'; 148 else 149 vel_type='civ2'; 150 end 151 case 3 152 vel_type='filter1'; 153 case {1,2}% civ1 available but not filter1 154 vel_type='civ1'; 155 end 156 end 157 155 158 var={}; 156 159 switch vel_type 157 160 case 'civ1' 158 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 159 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 160 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 161 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 162 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 163 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 161 var={'X','Y','Z','U','V','W','C','F','FF';... 162 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'}; 163 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 164 units={'pixel','pixel','pixel','pixel','pixel','pixel','','',''}; 164 165 case 'filter1' 165 166 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 166 167 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 167 168 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 168 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x _tps',...169 'vector_y _tps','vector_z_tps','ancillary','ancillary'};169 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x',... 170 'vector_y','vector_z','ancillary','ancillary'}; 170 171 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 171 172 case 'civ2' 172 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 173 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 174 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 176 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 177 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 173 var={'X','Y','Z','U','V','W','C','F','FF';... 174 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 176 units={'pixel','pixel','pixel','pixel','pixel','pixel','','',''}; 178 177 case 'filter2' 179 178 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 180 179 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 181 180 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 182 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x _tps',...183 'vector_y _tps','vector_z_tps','ancillary','ancillary'};181 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x',... 182 'vector_y','vector_z','ancillary','ancillary'}; 184 183 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 185 184 end
Note: See TracChangeset
for help on using the changeset viewer.