Changeset 362
- Timestamp:
- Jan 9, 2012, 5:21:57 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r360 r362 423 423 set(handles.RootName,'String',RootName) 424 424 browse=get(handles.RootName,'UserData'); 425 browse.nom_type_nc=NomTypeNc;425 % browse.nom_type_nc=NomTypeNc; 426 426 browse.incr_pair=[0 0];%default 427 427 … … 433 433 num_ref_j=j1; 434 434 if ~isempty(j2) 435 num_ref_ i=floor((num_ref_j+j2)/2);435 num_ref_j=floor((num_ref_j+j2)/2); 436 436 end 437 437 … … 581 581 582 582 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% 583 check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter584 if ~check_letter||isequal(NomTypeNc,'_1-2')|| (MaxIndex_j==1)583 %check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter 584 if isequal(NomTypeNc,'_1-2')|| (MaxIndex_j==1) 585 585 set(handles.ListPairMode,'Value',1) 586 586 set(handles.ListPairMode,'String',{'series(Di)'}) … … 679 679 set(handles.ListSubdirCiv2,'Value',ilist) 680 680 else % if Civ1 data already exist 681 find_netcpair_civ(handles,1); %update the list of available pairs from netcdf files in the new directory 681 errormsg=find_netcpair_civ(handles,1); %update the list of available pairs from netcdf files in the new directory 682 if ~isempty(errormsg) 683 msgbox_uvmat('ERROR',errormsg) 684 end 682 685 end 683 686 … … 697 700 %update the list of available pairs from netcdf files in the new directory 698 701 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 699 find_netcpair_civ(handles,2); 702 errormsg=find_netcpair_civ(handles,2); 703 if ~isempty(errormsg) 704 msgbox_uvmat('ERROR',errormsg) 705 end 700 706 end 701 707 … … 749 755 ind_selected=find(checkbox,1); 750 756 if ~isempty(ind_selected) 751 RootName=get(handles.RootName,'String');757 RootName=get(handles.RootName,'String'); 752 758 if isempty(RootName) 753 754 return opening759 msgbox_uvmat('ERROR','Please open an image or PIV .nc file with the upper bar menu Open/Browse...') 760 return 755 761 end 756 762 end … … 759 765 set(handles.ListSubdirCiv1,'Visible','on') 760 766 if ~opening 761 find_netcpair_civ(handles,1) % select the available netcdf files 767 errormsg=find_netcpair_civ(handles,1); % select the available netcdf files 768 if ~isempty(errormsg) 769 msgbox_uvmat('ERROR',errormsg) 770 end 762 771 end 763 772 if max(checkbox(4:6))% case of civ2 pair choice needed … … 768 777 set(handles.ListPairCiv2,'Visible','on') 769 778 if ~opening 770 find_netcpair_civ(handles,2) % select the available netcdf files 779 errormsg=find_netcpair_civ(handles,2); % select the available netcdf files 780 if ~isempty(errormsg) 781 msgbox_uvmat('ERROR',errormsg) 782 end 771 783 end 772 784 else … … 2771 2783 end 2772 2784 set(handles.ListPairCiv1,'UserData',displ_num); 2773 find_netcpair_civ( handles,1) 2785 errormsg=find_netcpair_civ( handles,1); 2786 if ~isempty(errormsg) 2787 msgbox_uvmat('ERROR',errormsg) 2788 end 2774 2789 % find_netcpair_civ2(handles) 2775 2790 … … 2882 2897 mode_value=get(handles.ListPairMode,'Value'); 2883 2898 mode=mode_list{mode_value}; 2884 find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files2899 errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 2885 2900 if isequal(mode,'series(Di)') || ...% we do patch2 only 2886 2901 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 2887 find_netcpair_civ( handles,2); 2888 end 2902 errormsg=find_netcpair_civ( handles,2); 2903 end 2904 if ~isempty(errormsg) 2905 msgbox_uvmat('ERROR',errormsg) 2906 end 2889 2907 2890 2908 %------------------------------------------------------------------------ … … 2895 2913 mode=mode_list{mode_value}; 2896 2914 if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') 2897 find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files2915 errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 2898 2916 end 2899 2917 if isequal(mode,'series(Dj)') || ... 2900 2918 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 2901 find_netcpair_civ(handles,2); 2902 end 2903 % 2919 errormsg=find_netcpair_civ(handles,2); 2920 end 2921 if ~isempty(errormsg) 2922 msgbox_uvmat('ERROR',errormsg) 2923 end 2904 2924 2905 2925 %------------------------------------------------------------------------ 2906 2926 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of 2907 2927 % the field series set by first_i, incr, last_i 2908 function find_netcpair_civ(handles,index) 2909 %------------------------------------------------------------------------ 2910 set(gcf,'Pointer','watch') 2928 function errormsg=find_netcpair_civ(handles,index) 2929 %------------------------------------------------------------------------ 2930 set(gcf,'Pointer','watch')% set the mouse pointer to 'watch' (clock) 2931 2932 %% initialisation 2933 errormsg=''; 2911 2934 filebase=get(handles.RootName,'String'); 2912 2935 [filepath,Nme,ext_dir]=fileparts(filebase); … … 2928 2951 2929 2952 %% determine nom_type_nc, nomenclature type of the .nc files: 2930 nom_type_nc='';%default2931 if isfield(browse,'nom_type_nc')2932 nom_type_nc=browse.nom_type_nc;2933 end2934 if isempty(nom_type_nc)2953 % nom_type_nc='';%default 2954 % if isfield(browse,'nom_type_nc') 2955 % nom_type_nc=browse.nom_type_nc; 2956 % end 2957 % if isempty(nom_type_nc) 2935 2958 [nom_type_nc]=nomtype2pair(nom_type_ima,mode); 2936 end2937 browse.nom_type_nc=nom_type_nc;2938 set(handles.RootName,'UserData',browse)2939 2940 % reads .nc subdirectoy and image numbers from the interface2959 % end 2960 % browse.nom_type_nc=nom_type_nc; 2961 % set(handles.RootName,'UserData',browse) 2962 2963 %% reads .nc subdirectoy and image numbers from the interface 2941 2964 subdir_civ1=get(handles.txt_SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data 2942 2965 subdir_civ2=get(handles.txt_SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data … … 2952 2975 displ_num=get(handles.ListPairCiv1,'UserData'); 2953 2976 2954 % eliminate the first pairs inconsistent with the position2977 %% eliminate the first pairs inconsistent with the position 2955 2978 if isempty(displ_num) 2956 2979 nbpair=0; … … 2965 2988 nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 2966 2989 2967 % look for existing processed pairs involving the field at the middle of the series if checkciv1 will not2990 %% case with no Civ1 operation, netcdf files need to exist for reading 2968 2991 % be performed, while the result is needed for next steps. 2969 2992 displ_pair={''}; 2970 2993 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display 2971 2994 testpair=0; 2972 2973 %% case with no Civ1 operation, netcdf files need to exist for reading2974 2995 [RootPath,RootFile]=fileparts(filebase); 2975 2996 if index==1 % case civ1 2976 if ~get(handles.CheckCiv1,'Value') % 2977 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') 2978 msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); 2979 set(handles.ListPairCiv1,'String',{}); 2980 return 2981 end 2982 for ipair=1:nbpair 2983 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 2984 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 2985 select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist 2986 end 2987 % case of no displayed pair 2988 if isequal(select,zeros(size(1:nbpair))) 2989 if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0]) 2990 num_i1=ref_i-floor(browse.incr_pair(1)/2); 2991 num_i2=ref_i+ceil(browse.incr_pair(1)/2); 2992 num_j1=ref_j-floor(browse.incr_pair(2)/2); 2993 num_j2=ref_j+ceil(browse.incr_pair(2)/2); 2994 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 2995 select(1)=exist(filename,'file')==2; 2996 testpair=1; 2997 else 2998 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 2999 msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]); 2997 if ~get(handles.CheckCiv1,'Value') % 2998 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') 2999 errormsg=['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']; 3000 set(handles.ListPairCiv1,'String',{}); 3001 return 3002 end 3003 for ipair=1:nbpair 3004 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3005 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3006 select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist 3007 end 3008 % case of no displayed pair 3009 if isequal(select,zeros(size(1:nbpair))) 3010 if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0]) 3011 num_i1=ref_i-floor(browse.incr_pair(1)/2); 3012 num_i2=ref_i+ceil(browse.incr_pair(1)/2); 3013 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3014 num_j2=ref_j+ceil(browse.incr_pair(2)/2); 3015 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3016 select(1)=exist(filename,'file')==2; 3017 testpair=1; 3000 3018 else 3001 msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]); 3002 end 3003 set(handles.ListPairCiv1,'String',{''}); 3004 %COMPLETER CAS STEREO 3005 return 3006 end 3007 end 3008 end 3009 else %case civ2 3010 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3011 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 3012 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3013 set(handles.ListPairCiv2,'Value',1); 3014 set(handles.ListPairCiv2,'String',{''}); 3015 return 3016 end 3017 for ipair=1:nbpair 3018 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3019 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3020 select(ipair)=exist(filename,'file')==2; 3021 end 3022 if isequal(select,zeros(size(1:nbpair))) 3023 if isfield(browse,'incr_pair') 3024 num_i1=ref_i-floor(browse.incr_pair(1)/2); 3025 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); 3026 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3027 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3028 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3029 select(1)=exist(filename,'file')==2; 3030 else 3031 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3032 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 3033 else 3034 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 3035 end 3019 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3020 errormsg=['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]; 3021 else 3022 errormsg=['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]; 3023 end 3024 set(handles.ListPairCiv1,'String',{''}); 3025 %COMPLETER CAS STEREO 3026 return 3027 end 3028 end 3029 end 3030 else %case civ2 alone 3031 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3032 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 3033 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3036 3034 set(handles.ListPairCiv2,'Value',1); 3037 3035 set(handles.ListPairCiv2,'String',{''}); 3038 3036 return 3039 3037 end 3040 end 3041 end 3038 for ipair=1:nbpair 3039 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3040 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3041 select(ipair)=exist(filename,'file')==2; 3042 end 3043 if isequal(select,zeros(size(1:nbpair))) 3044 if isfield(browse,'incr_pair') 3045 num_i1=ref_i-floor(browse.incr_pair(1)/2); 3046 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); 3047 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3048 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3049 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3050 select(1)=exist(filename,'file')==2; 3051 else 3052 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3053 errormsg=['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]; 3054 else 3055 errormsg=['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]; 3056 end 3057 set(handles.ListPairCiv2,'Value',1); 3058 set(handles.ListPairCiv2,'String',{''}); 3059 return 3060 end 3061 end 3062 end 3042 3063 end 3043 3064 … … 3101 3122 displ_pair={'Di=Dj=0'}; 3102 3123 end 3124 if index==1 3103 3125 set(handles.ListPairCiv1,'String',displ_pair'); 3126 end 3104 3127 3105 3128 %% determine the default selection in the pair menu … … 3685 3708 end 3686 3709 set(handles.txt_SubdirCiv1,'String',SubDir); 3687 find_netcpair_civ(handles,1) 3688 3710 errormsg=find_netcpair_civ(handles,1); 3711 if ~isempty(errormsg) 3712 msgbox_uvmat('ERROR',errormsg) 3713 end 3714 3689 3715 %------------------------------------------------------------------------ 3690 3716 % --- Executes on button press in ListSubdirCiv2. … … 4482 4508 Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0); 4483 4509 DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff)) 4484 NbSites(irho )=Data.Civ1_NbSites/numel(Data.Civ1_U_Diff);4510 NbSites(irho,:)=Data.Civ1_NbSites*numel(Data.Civ1_NbSites)/numel(Data.Civ1_U_Diff); 4485 4511 Param.Patch1.SmoothingParam=2*Param.Patch1.SmoothingParam; 4486 4512 end -
trunk/src/find_file_series.m
r360 r362 181 181 for ifile=1:nbpair 182 182 rr=regexp(dirpair(ifile).name,detect_string,'names'); 183 if ~isempty(rr) 183 184 i1=str2num(rr.i1); 184 185 i2=str2num(rr.i2); … … 232 233 j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2; 233 234 end 235 end 234 236 end 235 237 % look for the numerical string of the first files to update the NomType (take into account the 0 before the number) -
trunk/src/tps_coeff.m
r356 r362 26 26 % X=reshape(X,[],1); 27 27 % Y=reshape(Y,[],1); 28 % N=numel(X);28 N=size(ctrs,1); 29 29 % rhs = reshape(U,[],1); 30 30 U = [U; zeros(3,1)];
Note: See TracChangeset
for help on using the changeset viewer.