Changeset 1020
- Timestamp:
- Nov 18, 2017, 5:55:26 PM (7 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r1018 r1020 60 60 set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) 61 61 set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 62 %set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function63 62 set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 64 63 set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 65 %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function66 64 hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' 67 65 hhseries=guidata(hseries); %handles of the elements in 'series' … … 220 218 if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit) 221 219 TimeUnit=Param.IndexRange.TimeUnit; 222 end 223 % if isfield(SeriesData,'TimeSource') 224 % set(handles.TimeSource,'String',SeriesData.TimeSource) 225 % end 220 end 226 221 if isfield(SeriesData,'GeometryCalib') 227 222 tsai=SeriesData.GeometryCalib; … … 317 312 end 318 313 314 if strcmp(Param.ActionInput.ListCompareMode,'displacement') 315 set(handles.PairIndices,'Visible','off') 316 end 317 319 318 %% set the menu and default choice of civ pairs 320 319 if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs … … 668 667 OriginIndex='off'; 669 668 PairIndices='off'; 670 DoubleInputSeries='off';671 669 switch option 672 670 case 'PIV' 673 PairIndices='on';% needs to define index pairs for PIV 674 671 PairIndices='on';% needs to define index pairs for PIV 675 672 case 'PIV volume' 676 673 PairIndices='on';% needs to define index pairs for PIV … … 680 677 case 'displacement' 681 678 OriginIndex='on';%define a frame origin for displacement 682 % case 'shift'683 % if numel(ImageType)==1684 % fileinput=uigetfile_uvmat('pick a second file series for synchronous shift',InputTable{check_nc+1});685 % if ~isempty(fileinput)686 % series( 'display_file_name',hhseries,fileinput,'append')687 % end688 %689 %690 % end691 679 end 692 680 set(handles.num_OriginIndex,'Visible',OriginIndex) 693 681 set(handles.OriginIndex_title,'Visible',OriginIndex) 682 set(handles.CheckRefFile,'Visible',OriginIndex) 683 set(handles.RefFile,'Visible',OriginIndex) 694 684 set(handles.PairIndices,'Visible',PairIndices) 695 ListPairMode_Callback(hObject, eventdata, handles) 685 ListPairMode_Callback(hObject,eventdata,handles) 686 if strcmp(OriginIndex,'on') 687 set(handles.CheckRefFile,'Value',1) 688 CheckRefFile_Callback(hObject,eventdata,handles) 689 end 696 690 697 691 … … 708 702 compare=compare_list{val}; 709 703 if strcmp(compare,'displacement')||strcmp(compare,'shift') 710 mode ='displacement';704 mode_selected='displacement'; 711 705 else 712 706 mode_list=get(handles.ListPairMode,'String'); … … 718 712 mode_value=1; 719 713 end 720 mode =mode_list{mode_value};714 mode_selected=mode_list{mode_value}; 721 715 end 722 716 % displ_num=[];%default … … 734 728 % in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices 735 729 % are relative to the reference indices ref_i and ref_j respectively. 736 if isequal(mode ,'pair j1-j2')730 if isequal(mode_selected,'pair j1-j2') 737 731 dt=1; 738 732 displ=''; … … 764 758 displ_num(4,:)=0; 765 759 enable_j(handles, 'off') 766 elseif isequal(mode ,'series(Dj)') %| isequal(mode,'st_series(Dj)')760 elseif isequal(mode_selected,'series(Dj)') %| isequal(mode,'st_series(Dj)') 767 761 index=1:200; 768 762 displ_num(1,index)=-floor(index/2); … … 770 764 displ_num(3:4,index)=zeros(2,200); 771 765 enable_j(handles, 'on') 772 elseif isequal(mode ,'series(Di)') %| isequal(mode,'st_series(Di)')766 elseif isequal(mode_selected,'series(Di)') %| isequal(mode,'st_series(Di)') 773 767 % index=1:200; 774 768 % displ_num(1:2,index)=zeros(2,200); … … 781 775 enable_j(handles, 'off') 782 776 end 783 elseif isequal(mode ,'displacement')%the pairs have the same indices777 elseif isequal(mode_selected,'displacement')%the pairs have the same indices 784 778 displ_num(1,1)=0; 785 779 displ_num(2,1)=0; … … 855 849 mode_list=get(handles.ListPairMode,'String'); 856 850 mode_value=get(handles.ListPairMode,'Value'); 857 mode =mode_list{mode_value};851 mode_selected=mode_list{mode_value}; 858 852 errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 859 if isequal(mode ,'series(Di)') || ...% we do patch2 only853 if isequal(mode_selected,'series(Di)') || ...% we do patch2 only 860 854 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 861 855 errormsg=find_netcpair_civ( handles,2); … … 872 866 873 867 % %------------------------------------------------------------------------ 874 % function ref_j_Callback(hObject, eventdata, handles) 875 % %------------------------------------------------------------------------ 876 % mode_list=get(handles.ListPairMode,'String'); 877 % mode_value=get(handles.ListPairMode,'Value'); 878 % mode=mode_list{mode_value}; 879 % errormsg=''; 880 % if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') 881 % errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 882 % end 883 % if isequal(mode,'series(Dj)') || ... 884 % (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 885 % errormsg=find_netcpair_civ(handles,2); 886 % end 887 % if ~isempty(errormsg) 888 % msgbox_uvmat('ERROR',errormsg) 889 % end 890 % 891 % function ref_j_KeyPressFcn(hObject, eventdata, handles) 892 % set(handles.ref_j,'BackgroundColor',[1 0 1]) 893 %------------------------------------------------------------------------ 894 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of 895 % the field series set by MinIndex_i, incr, last_i 896 % index=1: look for pairs for civ1 897 % index=2: look for pairs for civ2 868 898 869 function errormsg=find_netcpair_civ(handles,index) 899 870 %------------------------------------------------------------------------ … … 907 878 val=get(handles.ListCompareMode,'Value'); 908 879 compare=compare_list{val}; 880 mode_selected='displacement'; 909 881 if ~strcmp(compare,'displacement')%||strcmp(compare,'shift') 910 882 … … 917 889 return 918 890 end 919 mode =mode_list{mode_value};891 mode_selected=mode_list{mode_value}; 920 892 end 921 893 nom_type_ima=CivInputData.NomTypeIma; … … 935 907 ref_i=str2double(get(handles.ref_i,'String')); 936 908 ref_j=[]; 937 if isequal(mode ,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')909 if isequal(mode_selected,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') 938 910 ref_j=0; 939 911 elseif strcmp(get(handles.ref_j,'Visible'),'on') … … 955 927 956 928 %% determine the menu display in .ListPairCiv1 957 switch mode 929 switch mode_selected 958 930 case 'series(Di)' 959 931 for ipair=1:nbpair … … 995 967 end 996 968 case 'pair j1-j2'%case of pairs 997 % MinIndex_j=CivInputData.MinIndex_j;998 % MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x10999 969 MinIndex_j=str2num(get(handles.MinIndex_j,'String')); 1000 970 MaxIndex_j=str2num(get(handles.MaxIndex_j,'String')); … … 1131 1101 end 1132 1102 if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax)) 1133 % list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs1134 % index=get(handles.ListPairCiv1,'Value');1135 % pair_string=list_pair{index};1136 % time=get(handles.TimeSource,'UserData'); %get the set of times1137 % pxcm=get(handles.SearchRange,'UserData');1138 % mode_list=get(handles.ListPairMode,'String');1139 % mode_value=get(handles.ListPairMode,'Value');1140 % mode=mode_list{mode_value};1141 % if isequal (mode, 'series(Di)' )1142 % ref_i=str2double(get(handles.ref_i,'String'));1143 % num1=ref_i-floor(index/2);% first image numbers1144 % num2=ref_i+ceil(index/2);1145 % num_a=1;1146 % num_b=1;1147 % elseif isequal (mode, 'series(Dj)')1148 % num1=1;1149 % num2=1;1150 % ref_j=str2double(get(handles.ref_j,'String'));1151 % num_a=ref_j-floor(index/2);% first image numbers1152 % num_b=ref_j+ceil(index/2);1153 % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)1154 % ref_i=str2double(get(handles.ref_i,'String'));1155 % num1=ref_i;1156 % num2=ref_i;1157 % r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');1158 % if isempty(r)1159 % r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');1160 % end1161 % num_a=str2num(r.num1);1162 % num_b=str2num(r.num2);1163 % end1164 % dt=time(num2+1,num_b+1)-time(num1+1,num_a+1);1165 % ibx=str2double(get(handles.num_CorrBoxSize_1,'String'));1166 % iby=str2double(get(handles.num_CorrBoxSize_2,'String'));1167 % umin=dt*pxcm*umin;1168 % umax=dt*pxcm*umax;1169 % vmin=dt*pxcm*vmin;1170 % vmax=dt*pxcm*vmax;1171 1103 shiftx=round((umin+umax)/2); 1172 1104 shifty=round((vmin+vmax)/2); … … 1555 1487 ind_A=2; 1556 1488 end 1557 % [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name 1558 % if isequal(flag_mask,1) 1559 % filemask=[num2str(nbslice) 'mask']; 1560 % testmask=1; 1561 % else % browse for a mask 1489 % browse for a mask 1562 1490 filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 1563 1491 [FilePath,FileName,Ext]=fileparts(filemask); … … 1570 1498 if ~isempty(filemask) 1571 1499 testmask=1; 1572 end 1573 % end 1500 end 1574 1501 end 1575 1502 if testmask … … 2194 2121 %'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature 2195 2122 %--------------------------------------------------------------------- 2196 function NomTypeNc=nomtype2pair(NomTypeIma,mode )2123 function NomTypeNc=nomtype2pair(NomTypeIma,mode_selected) 2197 2124 %--------------------------------------------------------------------- 2198 2125 % OUTPUT: … … 2203 2130 2204 2131 NomTypeNc=NomTypeIma;%default 2205 switch mode 2132 switch mode_selected 2206 2133 case 'pair j1-j2' 2207 2134 if ~isempty(regexp(NomTypeIma,'a$')) … … 2232 2159 %------------------------------------------------------------------------ 2233 2160 % --- determine the list of index pairs of processing file 2234 function [ind1,ind2,mode ]=...2161 function [ind1,ind2,mode_selected]=... 2235 2162 find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) 2236 2163 %------------------------------------------------------------------------ … … 2239 2166 r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names'); 2240 2167 if ~isempty(r) 2241 mode =['D' r.ind];2168 mode_selected=['D' r.ind]; 2242 2169 ind1=stra2num(r.num1); 2243 2170 ind2=stra2num(r.num2); 2244 2171 else 2245 mode ='burst';2172 mode_selected='burst'; 2246 2173 r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names'); 2247 2174 if ~isempty(r) … … 2402 2329 function CheckCiv3_Callback(hObject, eventdata, handles) 2403 2330 2331 % --- Executes on button press in CheckRefFile. 2332 function CheckRefFile_Callback(hObject, eventdata, handles) 2333 2334 hseries=findobj(allchild(0),'Tag','series'); 2335 hhseries=guidata(hseries); 2336 InputTable=get(hhseries.InputTable,'Data'); 2337 InputFile=fullfile(InputTable{1,1},InputTable{1,2},[InputTable{1,3} InputTable{1,5}]); 2338 % browse for a reference file for displacement 2339 fileref= uigetfile_uvmat('pick a reference image file:',InputFile); 2340 if ~isempty(fileref) 2341 set(handles.RefFile,'String',fileref) 2342 set(handles.ConfigSource,'String','NEW') 2343 set(handles.ConfigSource,'BackgroundColor',[1 0 1]) 2344 end 2404 2345 2405 2346 %------------------------------------------------------------------------ … … 2414 2355 drawnow 2415 2356 end 2416 2417 2418 2419 function num_NbSlice_Callback(hObject, eventdata, handles)2420 % hObject handle to num_NbSlice (see GCBO)2421 % eventdata reserved - to be defined in a future version of MATLAB2422 % handles structure with handles and user data (see GUIDATA)2423 2424 % Hints: get(hObject,'String') returns contents of num_NbSlice as text2425 % str2double(get(hObject,'String')) returns contents of num_NbSlice as a double2426 2427 2428 % --- Executes during object creation, after setting all properties.2429 function num_NbSlice_CreateFcn(hObject, eventdata, handles)2430 % hObject handle to num_NbSlice (see GCBO)2431 % eventdata reserved - to be defined in a future version of MATLAB2432 % handles empty - handles not created until after all CreateFcns called2433 2434 % Hint: edit controls usually have a white background on Windows.2435 % See ISPC and COMPUTER.2436 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2437 set(hObject,'BackgroundColor','white');2438 end -
trunk/src/series/civ_series.m
r1010 r1020 60 60 Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 61 61 Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 62 % if isfield(Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices')&& strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')63 % Data.Desable_j_index='on';% hide the j index in series (set by the pair choice in civ_input)64 % end65 62 Data.NbSlice='off'; %nbre of slices ('off' by default) 66 63 Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) … … 73 70 Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar) 74 71 Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 75 if is equal(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')72 if isfield(Data.ActionInput,'PairIndices') && strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2') 76 73 if isfield(Data.ActionInput.PairIndices,'ListPairCiv2') 77 74 str_civ=Data.ActionInput.PairIndices.ListPairCiv2; … … 133 130 iview_A=2;% the second line is used for the input images of Civ2 134 131 end 135 if strcmp(Param.ActionInput.ListCompareMode,'shift')136 iview_B=iview_A+1; % the second image series is on the next line of the input table137 end132 % if strcmp(Param.ActionInput.ListCompareMode,'shift') 133 % iview_B=iview_A+1; % the second image series is on the next line of the input table 134 % end 138 135 if iview_A~=0 139 136 RootPath_A=Param.InputTable{iview_A,1}; … … 180 177 case 'displacement' 181 178 i1_series_Civ1=Param.ActionInput.OriginIndex*ones(size(i1_series{1})); 182 i2_series_Civ1=i1_series{1};i2_series_Civ2=i1_series{1}; 183 j1_series_Civ1=ones(size(i1_series{1}));% first j index is 1 184 if isempty(j1_series_Civ1) 185 j2_series_Civ1=ones(size(i1_series{1})); 179 i1_series_Civ2=i1_series_Civ1; 180 i2_series_Civ1=i1_series{1}; 181 i2_series_Civ2=i1_series{1}; 182 j1_series_Civ1=[];% no j index variation for the ref image 183 j1_series_Civ2=[]; 184 if isempty(j1_series{1}) 185 j2_series_Civ1=ones(size(i1_series_Civ1)); 186 186 else 187 j2_series_Civ1=j1_series_Civ1; 188 end 189 i1_series_Civ2=i1_series_Civ1; 190 j1_series_Civ2=j1_series_Civ1; 187 j2_series_Civ1=j1_series{1};% if j index exist 188 end 191 189 j2_series_Civ2=j2_series_Civ1; 192 NomTypeNc= Param.InputTable{1,4};190 NomTypeNc='_1'; 193 191 case 'PIV volume' 194 192 % TODO, TODO 195 193 end 196 if isempty(j1_series_Civ1) 194 %determine frame indices for input with movie or other multiframe input file 195 if isempty(j1_series_Civ1)% simple movie with index i 197 196 FrameIndex_A_Civ1=i1_series_Civ1; 198 197 FrameIndex_B_Civ1=i2_series_Civ1; 199 198 j1_series_Civ1=ones(size(i1_series_Civ1)); 199 if strcmp(Param.ActionInput.ListCompareMode,'PIV') 200 200 j2_series_Civ1=ones(size(i1_series_Civ1)); 201 else 201 end 202 else % movie for each burst or volume (index j) 202 203 FrameIndex_A_Civ1=j1_series_Civ1; 203 204 FrameIndex_B_Civ1=j2_series_Civ1; … … 211 212 FrameIndex_B_Civ2=i2_series_Civ2; 212 213 j1_series_Civ2=ones(size(i1_series_Civ2)); 214 if strcmp(Param.ActionInput.ListCompareMode,'PIV') 213 215 j2_series_Civ2=ones(size(i1_series_Civ2)); 216 end 214 217 else 215 218 FrameIndex_A_Civ2=j1_series_Civ2; … … 227 230 NbField=numel(i1_series_Civ1); 228 231 elseif Param.ActionInput.CheckCiv2 % Civ2 is performed without Civ1 229 230 232 NbField=numel(i1_series_Civ2); 231 233 else … … 233 235 end 234 236 235 236 237 237 %% Output directory 238 238 OutputDir=''; … … 257 257 if isfield(XmlData,'Time') 258 258 Time=XmlData.Time; 259 TimeSource='xml';260 259 end 261 260 if isfield(XmlData,'Camera') … … 271 270 end 272 271 end 273 274 275 272 end 276 273 … … 342 339 disp('civ1 started') 343 340 end 344 par_civ1=Param.ActionInput.Civ1; 341 par_civ1=Param.ActionInput.Civ1;% parameters for civ1 345 342 if CheckInputFile % read input images (except in mode Test where it is introduced directly in Param.ActionInput.Civ1.ImageNameA and B) 346 343 try 344 if strcmp(Param.ActionInput.ListCompareMode,'displacement') 345 ImageName_A=Param.ActionInput.RefFile; 346 else 347 347 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); 348 end 348 349 if strcmp(FileExt_A,'.nc')% case of input images in format netcdf 349 350 FieldName_A=Param.InputFields.FieldName; … … 351 352 par_civ1.ImageA=DataIn.(FieldName_A); 352 353 else % usual image formats for image A 353 if isempty(FileType_A) 354 if isempty(FileType_A)% open the image object if not already done in case of movie input 354 355 [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A); 355 356 FileType_A=FileInfo_A.FileType; … … 357 358 Time=zeros(FileInfo_A.NumberOfFrames+1,2); 358 359 Time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)'; 359 TimeSource='video';360 ColorType='truecolor';361 360 end 362 361 if ~isempty(FileType_A) && isempty(Time)% Time = index i +0.001 index j by default … … 596 595 par_civ2.ImageA=[]; 597 596 par_civ2.ImageB=[]; 598 % i1_civ2=i1_series_Civ2(ifield); 599 % i2_civ2=i1_civ2; 600 % if ~isempty(i2_series_Civ2) 601 % i2_civ2=i2_series_Civ2(ifield); 602 % end 603 % j1_civ2=1; 604 % if ~isempty(j1_series_Civ2) 605 % j1_civ2=j1_series_Civ2(ifield); 606 % end 607 % j2_civ2=i1_civ2; 608 % if ~isempty(j2_series_Civ2) 609 % j2_civ2=j2_series_Civ2(ifield); 610 % end 597 if strcmp(Param.ActionInput.ListCompareMode,'displacement') 598 ImageName_A_Civ2=Param.ActionInput.RefFile; 599 else 611 600 ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2); 612 601 end 613 602 if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield)) 614 603 par_civ2.ImageA=par_civ1.ImageA; … … 622 611 [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield)); 623 612 end 624 % if strcmp(Param.ActionInput.ListCompareMode,'PIV')625 % ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,j1,j2);626 % else % displacement627 % ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i2,[],j2);628 % end629 613 par_civ2.ImageWidth=FileInfo_A.Width; 630 614 par_civ2.ImageHeight=FileInfo_A.Height;
Note: See TracChangeset
for help on using the changeset viewer.