Changeset 85 for trunk/src/uvmat.m
- Timestamp:
- Apr 25, 2010, 9:46:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r84 r85 1622 1622 % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT' 1623 1623 %------------------------------------------------------------------- 1624 %------------------------------------------------------------------- 1625 1626 %Executes on button press in runplus: make one step forward and call 1627 %run0. The step forward is along the fields series 1 or 2 depending on 1628 %the scan_i and scan_j check box (exclusive each other) 1629 %------------------------------------------------------------------- 1624 1625 %------------------------------------------------------------------- 1626 % --- Executes on button press in runplus: make one step forward and call 1627 % --- run0. The step forward is along the fields series 1 or 2 depending on 1628 % --- the scan_i and scan_j check box (exclusive each other) 1630 1629 function runplus_Callback(hObject, eventdata, handles) 1630 %------------------------------------------------------------------- 1631 set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow 1632 drawnow 1631 1633 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 1632 1634 runpm(hObject,eventdata,handles,increment) 1633 1634 %------------------------------------------------------------------- 1635 % Executes on button press in runmin: make one step backward and call1636 % run0. The step backward is along the fields series 1 or 2 depending on1637 % the scan_i and scan_j check box (exclusive each other)1638 % -------------------------------------------------------------------1635 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button in yellow 1636 1637 %------------------------------------------------------------------- 1638 % --- Executes on button press in runmin: make one step backward and call 1639 % --- run0. The step backward is along the fields series 1 or 2 depending on 1640 % --- the scan_i and scan_j check box (exclusive each other) 1639 1641 function runmin_Callback(hObject, eventdata, handles) 1642 %------------------------------------------------------------------- 1643 set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow 1644 drawnow 1640 1645 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d 1641 1646 runpm(hObject,eventdata,handles,increment) 1647 set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button in yellow 1642 1648 1643 1649 %------------------------------------------------------------------- … … 1703 1709 set(handles.MovieBackward,'BusyAction','Cancel') 1704 1710 set(handles.MenuExportMovie,'BusyAction','Cancel') 1705 1711 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1712 set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1713 set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1706 1714 1707 1715 %------------------------------------------------------------------ … … 1836 1844 else 1837 1845 msgbox_uvmat('ERROR','an image or movie must be first introduced as input') 1846 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1838 1847 return 1839 1848 end … … 1847 1856 if isempty(num_i2) 1848 1857 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 1858 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1849 1859 return 1850 1860 else … … 1858 1868 if ~exist(imaname_1,'file') 1859 1869 msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']); 1870 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1860 1871 return 1861 1872 end 1862 % set(handles.i2,'String',''); % indicates that the second index i2 is not used1863 % set(handles.j2,'String',''); % indicates that the second index i2 is not used1864 1873 1865 1874 %read the second image … … 1949 1958 function run0_Callback(hObject, eventdata, handles) 1950 1959 %------------------------------------------------------------------------ 1960 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 1961 drawnow 1951 1962 filename=read_file_boxes(handles); 1952 1963 … … 1963 1974 msgbox_uvmat('ERROR',errormsg); 1964 1975 end 1965 1976 set(handles.run0,'BackgroundColor',[1 0 0]) 1966 1977 %------------------------------------------------------------------------ 1967 1978 % --- read the input files and refresh all the plots, including projection. … … 1978 1989 1979 1990 %initialisation 1980 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 1981 drawnow 1991 1982 1992 errormsg=[]; % default error message 1983 1993 abstime=[]; … … 2815 2825 end 2816 2826 end 2817 set(handles.run0,'BackgroundColor',[1 0 0]) 2827 2818 2828 2819 2829 … … 3051 3061 FileName=[FileName FileIndices FileExt]; 3052 3062 3053 %---------------------------------------------- 3054 %read the data displayed for the second input rootfile windows 3055 %------------------------------------------------- 3063 %------------------------------------------------------------------------ 3064 % ---- read the data displayed for the second input rootfile windows 3056 3065 function [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles) 3057 RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window 3058 if isequal(RootPath_1,'"'),RootPath_1=get(handles.RootPath,'String'); end; 3066 %------------------------------------------------------------------------ 3067 RootPath_1=get(handles.RootPath_1,'String') % read the data from the file1_input window 3068 if isequal(get(handles.RootPath_1,'Visible'),'off') || isequal(RootPath_1,'"') 3069 RootPath_1=get(handles.RootPath,'String'); 3070 end; 3059 3071 FileName_1=RootPath_1; %default 3060 3072 SubDir_1=get(handles.SubDir_1,'String'); 3061 if isequal( SubDir_1,'"')3073 if isequal(get(handles.SubDir_1,'Visible'),'off')|| isequal(SubDir_1,'"') 3062 3074 SubDir_1=get(handles.SubDir,'String'); 3063 3075 end 3064 if ~isempty(SubDir_1) && ~isequal(SubDir_1,'')3076 if numel(SubDir_1)>=1 3065 3077 if (isequal(SubDir_1(1),'/')|| isequal(SubDir_1(1),'\')) 3066 3078 SubDir_1(1)=[]; %suppress possible / or \ separator … … 3069 3081 end 3070 3082 RootFile_1=get(handles.RootFile_1,'String'); 3071 if isequal(RootFile_1,'"'),RootFile_1=get(handles.RootFile,'String'); end; 3072 if ~isempty(RootFile_1) && ~isequal(RootFile_1,'') 3083 if isequal(get(handles.RootFile_1,'Visible'),'off') || isequal(RootFile_1,'"') 3084 RootFile_1=get(handles.RootFile,'String'); 3085 end 3086 if numel(RootFile_1)>=1 3073 3087 if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\')) 3074 3088 RootFile_1(1)=[];%suppress possible / or \ separator … … 3077 3091 end 3078 3092 FileBase_1=fullfile(RootPath_1,RootFile_1); 3079 FileIndices_1=get(handles.FileIndex_1,'String'); 3093 if isequal(get(handles.FileIndex_1,'Visible'),'off') 3094 FileIndices_1=get(handles.FileIndex,'String'); 3095 else 3096 FileIndices_1=get(handles.FileIndex_1,'String'); 3097 end 3080 3098 FileExt_1=get(handles.FileExt_1,'String'); 3081 3099 if isequal(FileExt_1,'"'),FileExt_1=get(handles.FileExt,'String'); end; 3082 3100 FileName_1=[FileName_1 FileIndices_1 FileExt_1]; 3083 3101 3084 %--------------------------------------------------- 3102 %------------------------------------------------------------------------ 3085 3103 % --- Executes on menu selection Fields 3086 3104 function Fields_Callback(hObject, eventdata, handles) 3087 %------------------------------------------------- 3088 3105 %------------------------------------------------------------------------ 3089 3106 list_fields=get(handles.Fields,'String');% list menu fields 3090 3107 index_fields=get(handles.Fields,'Value');% selected string index … … 3112 3129 if isequal(field,'image') 3113 3130 % transform netc type to the corresponding image type 3114 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')3115 UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory3116 if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))3117 UvData.SubDir(1)=[];3118 end3119 set(handles.SubDir,'String','')3120 set(handles.FileExt,'String','.png');3131 % if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2') 3132 % UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory 3133 % if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/')) 3134 % UvData.SubDir(1)=[]; 3135 % end 3136 % set(handles.SubDir,'String','') 3137 % set(handles.FileExt,'String','.png'); 3121 3138 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2') 3122 3139 NomTypeNew='_i_j'; … … 3125 3142 elseif isequal(NomType,'_i1-i2') 3126 3143 NomTypeNew='_i'; 3127 % TODO: look for other types3128 3144 end 3129 end 3130 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3131 set_veltype_display(veltype_handles,0) % unvisible civ buttons 3145 imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'') 3146 if ~exist(imagename,'file') 3147 [FileName,PathName] = uigetfile( ... 3148 {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)'; 3149 '*.jpg',' jpeg image files'; ... 3150 '*.png','.png image files'; ... 3151 '*.tif','.tif image files'; ... 3152 '*.avi;*.AVI','.avi movie files'; ... 3153 '*.vol','.volume images (png)'; ... 3154 '*.*', 'All Files (*.*)'}, ... 3155 'Pick an image',imagename) 3156 % display the selected field and related information 3157 imagename=[PathName FileName]; 3158 end 3159 display_file_name(hObject, eventdata, handles,imagename)%display the image 3160 return 3161 % end 3162 % veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3163 % set_veltype_display(veltype_handles,0) % unvisible civ buttons 3132 3164 else 3133 3165 ext=get(handles.FileExt,'String'); 3134 3166 if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file 3135 MenuBrowse_Callback(hObject, eventdata, handles) 3167 [FileName,PathName] = uigetfile( ... 3168 {'*.nc', ' (*.nc)'; 3169 '*.nc',' netcdf files'; ... 3170 '*.*', 'All Files (*.*)'}, ... 3171 'Pick a netcdf file',FileBase) 3172 % display the selected field and related information 3173 filename=[PathName FileName]; 3174 display_file_name(hObject, eventdata, handles,filename) 3175 return 3176 % MenuBrowse_Callback(hObject, eventdata, handles) 3136 3177 end 3137 3178 if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain') … … 3163 3204 set(handles.npx,'Visible','on') 3164 3205 set(handles.npy,'Visible','on') 3165 % set(handles.fix_pair,'Value',0)3166 3206 else 3167 3207 set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons … … 3169 3209 set(handles.npx,'Visible','off') 3170 3210 set(handles.npy,'Visible','off') 3171 % set(handles.fix_pair,'Value',1)3172 3211 end 3173 3212 setfield(handles);% update the field structure ('civ1'....) … … 3195 3234 3196 3235 %read the rootfile input display 3197 FileExt_prev=get(handles.FileExt_1,'String'); 3236 [FileName,RootPath,FileBase,FileIndices,FileExt_prev]=read_file_boxes_1(handles); 3237 [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_prev]); 3198 3238 if isempty(FileExt_prev)|isequal(FileExt_prev,'') 3199 3239 FileExt_1=get(handles.FileExt,'String'); … … 3239 3279 if isequal(field_1,'image') 3240 3280 % transform netc type to the corresponding image type 3241 set(handles.FileExt_1,'String','.png');3281 % set(handles.FileExt_1,'String','.png'); 3242 3282 if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2') 3243 3283 UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory 3244 set(handles.SubDir_1,'String','')3284 % set(handles.SubDir_1,'String','') 3245 3285 % set(handles.FileExt_1,'String','.png'); 3246 3286 if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2') … … 3252 3292 end 3253 3293 end 3254 veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 3255 set_veltype_display(veltype_handles,0) % unvisible civ buttons 3294 imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),''); 3295 if ~exist(imagename,'file') 3296 [FileName,PathName] = uigetfile( ... 3297 {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)'; 3298 '*.jpg',' jpeg image files'; ... 3299 '*.png','.png image files'; ... 3300 '*.tif','.tif image files'; ... 3301 '*.avi;*.AVI','.avi movie files'; ... 3302 '*.vol','.volume images (png)'; ... 3303 '*.*', 'All Files (*.*)'}, ... 3304 'Pick an image',imagename) 3305 % display the selected field and related information 3306 imagename=[PathName FileName]; 3307 end 3308 display_file_name_1(hObject, eventdata, handles,imagename)%display the image 3309 return 3310 % veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 3311 % set_veltype_display(veltype_handles,0) % unvisible civ buttons 3256 3312 else 3257 3313 set(handles.SubDir_1,'Visible','on') … … 4717 4773 edit_vect_Callback(hObject, eventdata, handles) 4718 4774 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 4719 set(handles.edit_vect,'Value',0)4720 edit_vect_Callback(hObject, eventdata, handles)4721 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])4722 4775 set(handles.list_object_1,'Value',1) 4723 4776
Note: See TracChangeset
for help on using the changeset viewer.