Changeset 1153
- Timestamp:
- Jul 5, 2024, 9:00:14 AM (3 months ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_civdata.m
r1135 r1153 191 191 if iscell(vel_type),vel_type=vel_type{1}; end%transform cell to string if needed 192 192 errormsg=''; 193 if CivStage>=6 194 CivStage=6; 195 end 193 196 194 197 %% select the priority order for automatic vel_type selection 195 if strcmp(vel_type,'civ2') && strcmp(ProjModeRequest,'derivatives') 196 vel_type='filter2'; 197 elseif strcmp(vel_type,'civ1') && strcmp(ProjModeRequest,'derivatives') 198 vel_type='filter1'; 198 if strcmp(ProjModeRequest,'derivatives')&& numel(vel_type)>=3 && strcmp(vel_type(1:3),'civ') 199 vel_type=['filter' vel_type(4:end)]; 199 200 end 200 201 if isempty(vel_type)||strcmp(vel_type,'*') 201 202 vel_type='filter2';% case CivStage >=6 202 203 switch CivStage 204 case {1,2}% civ1 available but not filter1 205 vel_type='civ1'; 206 case 3 207 vel_type='filter1'; 208 203 209 case {4,5}% civ2 available but not filter2 204 210 if strcmp(ProjModeRequest,'derivatives')% derivatives needed … … 207 213 vel_type='civ2'; 208 214 end 209 case 3210 vel_type='filter1';211 case {1,2}% civ1 available but not filter1212 vel_type='civ1';213 215 end 214 216 end -
trunk/src/series/civ_input.m
r1152 r1153 140 140 141 141 iview_image=2;%line # for the input images 142 case 'civxdata'% case of civx data,143 msgbox_uvmat('ERROR','old civX convention, use the GUI civ')144 return145 142 otherwise 146 143 if ~strcmp(FieldType,'image') … … 216 213 %show the reference image edit box if relevant (not needed for movies or in the absence of time information 217 214 if numel(time)>=2 % if there are at least two time values to define dt 218 if size(time,1)<MaxIndex_i ;215 if size(time,1)<MaxIndex_i 219 216 msgbox_uvmat('WARNING','maximum i index restricted by the timing of the xml file'); 220 217 elseif size(time,2)<MaxIndex_j … … 252 249 end 253 250 else %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed 254 % if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) &&... 255 % ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) 256 for index = 1:min(ind_opening,5) 257 set(handles.(ListOptions{index}),'value',0) 258 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file 259 end 260 if isempty(FileInfo) 261 FileInfo.FileName=''; 262 end 263 set(handles.ConfigSource,'String',FileInfo.FileName); 264 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) 265 for index = ind_opening+2:6 266 set(handles.(ListOptions{index}),'value',0) 267 end 268 checkrefresh=1; 269 % end 270 if ind_opening>=3 251 % if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) &&... 252 % ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) 253 for index = 1:min(ind_opening,5) 254 set(handles.(ListOptions{index}),'value',0) 255 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file 256 end 257 if isempty(FileInfo) 258 FileInfo.FileName=''; 259 end 260 set(handles.ConfigSource,'String',FileInfo.FileName); 261 if ind_opening<6 262 for index = 1:ind_opening 263 set(handles.(ListOptions{index}),'value',0) 264 end 265 for index = ind_opening+1:6 266 set(handles.(ListOptions{index}),'value',1) 267 end 268 set(handles.CheckCiv3,'Visible','off')% make visible the switch 'iterate/repet' for Civ2. 269 set(handles.CheckCiv3,'Value',0)% select'iterate/repet' by default 270 else 271 for index = 1:3 272 set(handles.(ListOptions{index}),'value',0) 273 end 274 for index = 4:6 275 set(handles.(ListOptions{index}),'value',1) 276 end 271 277 set(handles.CheckCiv3,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. 272 else 273 set(handles.CheckCiv3,'Visible','off') 274 end 278 set(handles.CheckCiv3,'Value',1)% select'iterate/repet' by default 279 end 280 checkrefresh=1; 281 % end 282 % if ind_opening==6 283 % set(handles.CheckCiv3,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. 284 % else 285 % set(handles.CheckCiv3,'Visible','off') 286 % end 275 287 end 276 288 … … 1078 1090 end 1079 1091 1080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1081 % Callbacks in the uipanel Fix11082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1083 %------------------------------------------------------------------------1084 % % --- Executes on button press in CheckMask.1085 % function get_mask_fix1_Callback(hObject, eventdata, handles)1086 % %------------------------------------------------------------------------1087 % maskval=get(handles.CheckMask,'Value');1088 % if isequal(maskval,0)1089 % set(handles.Mask,'String','')1090 % else1091 % mask_displ='no mask'; %default1092 % filebase=get(handles.RootPath,'String');1093 % [nbslice, flag_mask]=get_mask(filebase,handles);1094 % if isequal(flag_mask,1)1095 % mask_displ=[num2str(nbslice) 'mask'];1096 % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series1097 % filebase_a=get(handles.RootFile_1,'String');1098 % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);1099 % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)1100 % mask_displ='no mask';1101 % end1102 % end1103 % if isequal(mask_displ,'no mask')1104 % [FileName, PathName, filterindex] = uigetfile( ...1105 % {'*.png', ' (*.png)';1106 % '*.png', '.png files '; ...1107 % '*.*', 'All Files (*.*)'}, ...1108 % 'Pick a mask file *.png',filebase);1109 % mask_displ=fullfile(PathName,FileName);1110 % if ~exist(mask_displ,'file')1111 % mask_displ='no mask';1112 % end1113 % end1114 % if isequal(mask_displ,'no mask')1115 % set(handles.CheckMask,'Value',0)1116 % set(handles.CheckMask,'Value',0)1117 % set(handles.CheckMask,'Value',0)1118 % else1119 % %set(handles.CheckMask,'Value',1)1120 % set(handles.CheckMask,'Value',1)1121 % end1122 % set(handles.Mask,'String',mask_displ)1123 % set(handles.Mask,'String',mask_displ)1124 % set(handles.Mask,'String',mask_displ)1125 % end1126 1127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1128 % Callbacks in the uipanel Civ21129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1130 %------------------------------------------------------------------------1131 % --- Executes on button press in CheckMask: select box for mask option1132 function get_mask_civ2_Callback(hObject, eventdata, handles)1133 %------------------------------------------------------------------------1134 maskval=get(handles.CheckMask,'Value');1135 if isequal(maskval,0)1136 set(handles.Mask,'String','')1137 else1138 mask_displ='no mask'; %default1139 filebase=get(handles.RootPath,'String');1140 [nbslice, flag_mask]=get_mask(filebase,handles);1141 if isequal(flag_mask,1)1142 mask_displ=[num2str(nbslice) 'mask'];1143 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series1144 filebase_a=get(handles.RootFile_1,'String');1145 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);1146 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)1147 mask_displ='no mask';1148 end1149 end1150 if isequal(mask_displ,'no mask')1151 [FileName, PathName, filterindex] = uigetfile( ...1152 {'*.png', ' (*.png)';1153 '*.png', '.png files '; ...1154 '*.*', 'All Files (*.*)'}, ...1155 'Pick a mask file *.png',filebase);1156 mask_displ=fullfile(PathName,FileName);1157 if ~exist(mask_displ,'file')1158 mask_displ='no mask';1159 end1160 end1161 if isequal(mask_displ,'no mask')1162 set(handles.CheckMask,'Value',0)1163 set(handles.CheckMask,'Value',0)1164 else1165 set(handles.CheckMask,'Value',1)1166 end1167 set(handles.Mask,'String',mask_displ)1168 end1169 1170 % %------------------------------------------------------------------------1171 % % --- Executes on button press in CheckMask.1172 % function get_mask_fix2_Callback(hObject, eventdata, handles)1173 % %------------------------------------------------------------------------1174 % maskval=get(handles.CheckMask,'Value');1175 % if isequal(maskval,0)1176 % set(handles.Mask,'String','')1177 % else1178 % mask_displ='no mask'; %default1179 % filebase=get(handles.RootPath,'String');1180 % [nbslice, flag_mask]=get_mask(filebase,handles);1181 % if isequal(flag_mask,1)1182 % mask_displ=[num2str(nbslice) 'mask'];1183 % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series1184 % filebase_a=get(handles.RootFile_1,'String');1185 % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);1186 % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)1187 % mask_displ='no mask';1188 % end1189 % end1190 % if isequal(mask_displ,'no mask')1191 % [FileName, PathName, filterindex] = uigetfile( ...1192 % {'*.png', ' (*.png)';1193 % '*.png', '.png files '; ...1194 % '*.*', 'All Files (*.*)'}, ...1195 % 'Pick a mask file *.png',filebase);1196 % mask_displ=fullfile(PathName,FileName);1197 % if ~exist(mask_displ,'file')1198 % mask_displ='no mask';1199 % end1200 % end1201 % if isequal(mask_displ,'no mask')1202 % set(handles.CheckMask,'Value',0)1203 % end1204 % set(handles.Mask,'String',mask_displ)1205 % end1206 1207 %------------------------------------------------------------------------1208 % --- function called to look for mask files1209 function [nbslice, flag_mask]=get_mask(filebase,handles)1210 %------------------------------------------------------------------------1211 %detect mask files, images with appropriate file base1212 %[filebase '_' xx 'mask'], xx=nbslice1213 %flag_mask=1 indicates detection1214 1215 flag_mask=0;%default1216 nbslice=1;1217 1218 % subdir=get(handles.Civ1_ImageB,'String');1219 [Path,Name]=fileparts(filebase);1220 if ~isdir(Path)1221 msgbox_uvmat('ERROR','no path for input files')1222 return1223 end1224 % currentdir=pwd;1225 % cd(Path);%move in the dir of the root name filebase1226 maskfiles=dir(fullfile(Path,[Name '_*mask_*.png']));%look for mask files1227 % cd(currentdir);%come back to the current working directory1228 if ~isempty(maskfiles)1229 % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat')1230 % else1231 flag_mask=1;1232 maskname=maskfiles(1).name;% take the first mask file in the list1233 [Path2,Name,ext]=fileparts(maskname);1234 Namedouble=double(Name);1235 val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters1236 ind_mask=findstr('mask',Name);1237 i=ind_mask-1;1238 while val(i)==0 && i>01239 i=i-1;1240 end1241 nbslice=str2double(Name(i+1:ind_mask-1));1242 if ~isnan(nbslice) && Name(i)=='_'1243 flag_mask=1;1244 else1245 msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2])1246 return1247 nbslice=1;1248 end1249 end1250 1251 1092 %------------------------------------------------------------------------ 1252 1093 % --- function called to look for grid files … … 1419 1260 function CheckMask_Callback(hObject, eventdata, handles) 1420 1261 %------------------------------------------------------------------------ 1421 value=get(hObject,'Value');1422 1262 hparent=get(hObject,'parent'); 1423 parent_tag=get(hparent,'Tag');1424 1263 hchildren=get(hparent,'children'); 1425 1264 handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel 1426 handle_NbSlice=findobj(hchildren,'tag','num_NbSlice');% look for the mask name box in the same panel1265 % handle_NbSlice=findobj(hchildren,'tag','num_NbSlice');% look for the mask name box in the same panel 1427 1266 testmask=0; 1428 if value1267 if get(hObject,'Value')% if the checkbox is activated 1429 1268 hseries=findobj(allchild(0),'Tag','series'); 1430 1269 hhseries=guidata(hseries); 1431 1270 InputTable=get(hhseries.InputTable,'Data'); 1432 ind_A=1;% line index of the (first) image series 1433 if strcmp(InputTable{1,5},'.nc'); 1434 ind_A=2; 1435 end 1436 % browse for a mask 1437 filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 1438 [FilePath,FileName,Ext]=fileparts(filemask); 1439 [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName,Ext]); 1271 if strcmp(InputTable{1,5},'.nc') 1272 ind_A=2;%case of nc file as input (for civ3), image in second line 1273 else 1274 ind_A=1;% line index of the (first) image series 1275 end 1276 % browse for a mask 1277 filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 1278 if ~isempty(filemask) 1279 [FilePath,FileName,FileExt]=fileparts(filemask); 1280 [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName FileExt]); 1440 1281 if strcmp(NomType,'_1') 1441 NbSlice=i1_series(1,2,end); 1442 set(handles.num_NbSlice,'String',num2str(NbSlice)) 1282 NbSlice=i1_series(1,2,end); 1283 set(handles.num_NbSlice,'String',num2str(NbSlice)) 1284 elseif ~strcmp(NomType,'*') 1285 msgbox_uvmat('ERROR','multilevel masks must be labeled with a single index as _1,_2,...'); 1286 return 1443 1287 end 1444 1288 set(hObject,'UserData',filemask);%store for future use 1445 if ~isempty(filemask) 1446 testmask=1; 1447 end 1289 testmask=1; 1290 end 1448 1291 end 1449 1292 if testmask -
trunk/src/series/civ_series.m
r1152 r1153 903 903 time_total=toc(tstart); 904 904 disp(['ellapsed time ' num2str(time_total/60,2) ' minutes']) 905 disp(['time image reading ' num2str(time_input,2) ' s']) 905 if exist('time_input','var') 906 disp(['time image reading ' num2str(time_input,2) ' s']) 907 end 906 908 disp(['time civ1 ' num2str(time_civ1,2) ' s']) 907 909 disp(['time patch1 ' num2str(time_patch1,2) ' s']) -
trunk/src/uvmat.m
r1152 r1153 2878 2878 set(handles.CheckMask,'Value',0) 2879 2879 end 2880 2880 2881 [MaskPath,MaskName,MaskExt]=fileparts(MaskFullName); 2881 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt],0); 2882 if ~(isempty(i2_series) && isempty(j2_series)) 2883 MaskNomType='*'; 2884 end 2885 end 2886 Mask.Path=MaskPath; 2887 if isempty(MaskFile) 2888 Mask.File=''; 2889 elseif ischar(MaskFile) 2890 Mask.File=MaskFile; 2891 else 2892 Mask.File=MaskFile{1}; 2893 end 2894 Mask.NbSlice_i=1; 2895 Mask.NbSlice_j=1; 2896 if isempty(j1_series) 2897 if isempty(i1_series) 2898 MaskNomType='*'; 2899 else 2900 Mask.NbSlice_i=i1_series(1,2,end); 2901 end 2902 else 2903 Mask.NbSlice_j=j1_series(1,end,2); 2904 end 2905 Mask.Ext=MaskExt; 2906 Mask.NomType=MaskNomType; 2882 [tild,tild,MaskFile,i1_series,i2,j1,j2,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt],0); 2883 if strcmp(NomType,'_1') 2884 NbSlice=i1_series(1,2,end); 2885 set(handles.num_NbSlice,'String',num2str(NbSlice)) 2886 end 2887 end 2888 % Mask.Path=MaskPath; 2889 % if isempty(MaskFile) 2890 % Mask.File=''; 2891 % elseif ischar(MaskFile) 2892 % Mask.File=MaskFile; 2893 % else 2894 % Mask.File=MaskFile{1}; 2895 % end 2896 % Mask.NbSlice_i=1; 2897 % Mask.NbSlice_j=1; 2898 % if isempty(j1_series) 2899 % if isempty(i1_series) 2900 % MaskNomType='*'; 2901 % else 2902 % Mask.NbSlice_i=i1_series(1,2,end); 2903 % end 2904 % else 2905 % Mask.NbSlice_j=j1_series(1,end,2); 2906 % end 2907 % Mask.Ext=MaskExt; 2908 % Mask.NomType=MaskNomType; 2907 2909 set(handles.CheckMask,'UserData',Mask); 2908 2910 errormsg=update_mask(handles); … … 4946 4948 %------------------------------------------------------------------------ 4947 4949 % --- set the visibility of relevant velocity type menus: 4948 function menu=set_veltype_display(Civ ,FileType)4950 function menu=set_veltype_display(CivStage,FileType) 4949 4951 %------------------------------------------------------------------------ 4950 4952 if ~exist('FileType','var') … … 4952 4954 end 4953 4955 imin=1; 4956 if CivStage>=6 4957 CivStage=6; 4958 end 4954 4959 switch FileType 4955 4960 case 'civx' 4956 4961 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 4957 if isequal(Civ ,0)4962 if isequal(CivStage,0) 4958 4963 imax=0; 4959 elseif isequal(Civ ,1) || isequal(Civ,2)4964 elseif isequal(CivStage,1) || isequal(CivStage,2) 4960 4965 imax=1; 4961 elseif isequal(Civ ,3)4966 elseif isequal(CivStage,3) 4962 4967 imax=3; 4963 elseif isequal(Civ ,4) || isequal(Civ,5)4968 elseif isequal(CivStage,4) || isequal(CivStage,5) 4964 4969 imax=4; 4965 elseif isequal(Civ ,6) %patch24970 elseif isequal(CivStage,6) %patch2 4966 4971 imax=6; 4967 4972 end 4968 4973 case {'civdata','pivdata_fluidimage'} 4969 menu={'civ1';'filter1';'civ2';'filter2' ;'civ3';'filter3'};4974 menu={'civ1';'filter1';'civ2';'filter2'}; 4970 4975 imax=[0 1 1 2 3 3 4 5 5 6]; 4971 imax=imax(min(Civ+1,10)); 4972 % if isequal(Civ,0) 4973 % imax=0; 4974 % elseif isequal(Civ,1) || isequal(Civ,2) 4975 % imax=1; 4976 % elseif isequal(Civ,3) 4977 % imax=2; 4978 % elseif isequal(Civ,4) || isequal(Civ,5) 4979 % imax=3; 4980 % elseif Civ==6 %patch2 4981 % imax=4; 4982 % else 4983 % imax=4;imin=3; 4984 % end 4976 imax=imax(min(CivStage+1,10)); 4985 4977 end 4986 4978 menu=menu(imin:imax);
Note: See TracChangeset
for help on using the changeset viewer.