Changeset 1153 for trunk/src/series/civ_input.m
- Timestamp:
- Jul 5, 2024, 9:00:14 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.